2018-08-29 18:36:39 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <gtkmm.h>
|
2018-09-04 21:50:08 +00:00
|
|
|
#include <tuple>
|
2018-08-29 18:36:39 +00:00
|
|
|
#include <dbus-status-notifier-watcher.h>
|
|
|
|
#include "modules/sni/sni.hpp"
|
|
|
|
|
|
|
|
namespace waybar::modules::SNI {
|
|
|
|
|
|
|
|
class Host {
|
|
|
|
public:
|
2018-09-04 21:50:08 +00:00
|
|
|
Host(Glib::Dispatcher*);
|
2018-08-29 18:36:39 +00:00
|
|
|
std::vector<Item> items;
|
|
|
|
private:
|
|
|
|
static void busAcquired(GDBusConnection*, const gchar*, gpointer);
|
|
|
|
static void nameAppeared(GDBusConnection*, const gchar*, const gchar*,
|
|
|
|
gpointer);
|
|
|
|
static void nameVanished(GDBusConnection*, const gchar*, gpointer);
|
|
|
|
static void proxyReady(GObject*, GAsyncResult*, gpointer);
|
|
|
|
static void registerHost(GObject*, GAsyncResult*, gpointer);
|
|
|
|
static void itemRegistered(SnOrgKdeStatusNotifierWatcher*, const gchar*,
|
|
|
|
gpointer);
|
|
|
|
static void itemUnregistered(SnOrgKdeStatusNotifierWatcher*, const gchar*,
|
|
|
|
gpointer);
|
|
|
|
|
2018-09-04 21:50:08 +00:00
|
|
|
std::tuple<std::string, std::string> getBusNameAndObjectPath(const gchar*);
|
2018-08-29 18:36:39 +00:00
|
|
|
void addRegisteredItem(const gchar* service);
|
|
|
|
|
|
|
|
uint32_t bus_name_id_;
|
|
|
|
uint32_t watcher_id_;
|
|
|
|
std::string bus_name_;
|
|
|
|
std::string object_path_;
|
2018-09-04 21:50:08 +00:00
|
|
|
Glib::Dispatcher* dp_;
|
2018-08-29 18:36:39 +00:00
|
|
|
GCancellable* cancellable_ = nullptr;
|
|
|
|
SnOrgKdeStatusNotifierWatcher* watcher_ = nullptr;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|