feat(Watcher): define watcher_id

This commit is contained in:
Alex 2019-05-20 11:47:45 +02:00
parent 7b11283b73
commit f2edc8f965
3 changed files with 4 additions and 2 deletions

View File

@ -8,7 +8,7 @@ namespace waybar::modules::SNI {
class Watcher {
public:
Watcher();
Watcher(std::size_t id);
~Watcher();
private:

View File

@ -6,6 +6,7 @@ namespace waybar::modules::SNI {
Tray::Tray(const std::string& id, const Bar& bar, const Json::Value& config)
: config_(config),
box_(bar.vertical ? Gtk::ORIENTATION_VERTICAL : Gtk::ORIENTATION_HORIZONTAL, 0),
watcher_(nb_hosts_),
host_(nb_hosts_, config, std::bind(&Tray::onAdd, this, std::placeholders::_1),
std::bind(&Tray::onRemove, this, std::placeholders::_1)) {
box_.set_name("tray");

View File

@ -4,13 +4,14 @@
using namespace waybar::modules::SNI;
Watcher::Watcher()
Watcher::Watcher(std::size_t id)
: bus_name_id_(Gio::DBus::own_name(Gio::DBus::BusType::BUS_TYPE_SESSION,
"org.kde.StatusNotifierWatcher",
sigc::mem_fun(*this, &Watcher::busAcquired),
Gio::DBus::SlotNameAcquired(), Gio::DBus::SlotNameLost(),
Gio::DBus::BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT |
Gio::DBus::BUS_NAME_OWNER_FLAGS_REPLACE)),
watcher_id_(id),
watcher_(sn_watcher_skeleton_new()) {}
Watcher::~Watcher() {