Added GeoClue2 privacy item
Rebased onto current master and fixed the privacy module build: - privacy_item.hpp no longer includes privacy.hpp (it does not use the Privacy class); this broke the circular include that left PrivacyItem undeclared when privacy.hpp was reached first from privacy_item.cpp. - privacy_item.cpp now includes gtkmm/label.h explicitly, since Gtk::Label was previously only pulled in transitively via privacy.hpp.
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
|
||||
#include <giomm/dbusconnection.h>
|
||||
|
||||
#include <atomic>
|
||||
|
||||
#include "giomm/dbusproxy.h"
|
||||
|
||||
namespace waybar::util::GeoClueBackend {
|
||||
|
||||
class GeoClueBackend {
|
||||
private:
|
||||
guint watcherID_;
|
||||
sigc::connection signal_conn;
|
||||
Glib::RefPtr<Gio::DBus::Proxy> proxy;
|
||||
bool connected;
|
||||
|
||||
/* Hack to keep constructor inaccessible but still public.
|
||||
* This is required to be able to use std::make_shared.
|
||||
* It is important to keep this class only accessible via a reference-counted
|
||||
* pointer because the destructor will manually free memory, and this could be
|
||||
* a problem with C++20's copy and move semantics.
|
||||
*/
|
||||
struct PrivateConstructorTag {};
|
||||
|
||||
public:
|
||||
sigc::signal<void> in_use_changed_signal_event;
|
||||
|
||||
std::atomic<bool> location_in_use; // GeoClue is being used
|
||||
|
||||
static std::shared_ptr<GeoClueBackend> getInstance();
|
||||
|
||||
// DBus callbacks
|
||||
void onAppear(const Glib::RefPtr<Gio::DBus::Connection>&, const Glib::ustring&,
|
||||
const Glib::ustring&);
|
||||
void onVanished(const Glib::RefPtr<Gio::DBus::Connection>&, const Glib::ustring&);
|
||||
void propertyChanged(const Gio::DBus::Proxy::MapChangedProperties& changedProperties,
|
||||
const std::vector<Glib::ustring>& invalidatedProperties);
|
||||
|
||||
GeoClueBackend(PrivateConstructorTag tag);
|
||||
~GeoClueBackend();
|
||||
};
|
||||
} // namespace waybar::util::GeoClueBackend
|
||||
@@ -29,7 +29,7 @@ class PipewireBackend {
|
||||
public:
|
||||
sigc::signal<void> privacy_nodes_changed_signal_event;
|
||||
|
||||
std::unordered_map<uint32_t, PrivacyNodeInfo*> privacy_nodes;
|
||||
std::unordered_map<uint32_t, PWPrivacyNodeInfo*> privacy_nodes;
|
||||
std::mutex mutex_;
|
||||
|
||||
static std::shared_ptr<PipewireBackend> getInstance();
|
||||
|
||||
@@ -12,10 +12,11 @@ enum PrivacyNodeType {
|
||||
PRIVACY_NODE_TYPE_NONE,
|
||||
PRIVACY_NODE_TYPE_VIDEO_INPUT,
|
||||
PRIVACY_NODE_TYPE_AUDIO_INPUT,
|
||||
PRIVACY_NODE_TYPE_AUDIO_OUTPUT
|
||||
PRIVACY_NODE_TYPE_AUDIO_OUTPUT,
|
||||
PRIVACY_NODE_TYPE_LOCATION
|
||||
};
|
||||
|
||||
class PrivacyNodeInfo {
|
||||
class PWPrivacyNodeInfo {
|
||||
public:
|
||||
PrivacyNodeType type = PRIVACY_NODE_TYPE_NONE;
|
||||
uint32_t id;
|
||||
|
||||
Reference in New Issue
Block a user