Added minimum viable swaybar tray SNI protocol support using sd-bus

This commit is contained in:
David McKinney 2018-09-16 15:44:53 -04:00
parent 456b91600d
commit 854c0d3b6d
13 changed files with 392 additions and 17 deletions

View file

@ -1,10 +1,41 @@
#ifndef _SWAYBAR_SNI_WATCHER_H
#define _SWAYBAR_SNI_WATCHER_H
#include <stdbool.h>
#include <systemd/sd-bus.h>
#include "list.h"
struct sni_watcher {
sd_bus *bus;
const char *iface;
const char *path;
list_t *hosts;
list_t *items;
int version;
};
/**
* Starts the sni_watcher, the watcher is practically a black box and should
* only be accessed though functions described in its spec
*/
int init_sni_watcher();
static int method_register_sni(sd_bus_message *msg, void *userdata,
sd_bus_error *ret_error);
static int property_registered_sni(sd_bus *bus, const char *path,
const char *interface, const char *property, sd_bus_message *reply,
void *userdata, sd_bus_error *error);
bool sni_watcher_vtable_init(struct sni_watcher *watcher, sd_bus_slot *slot);
bool sni_watcher_init(struct sni_watcher *watcher);
static int handle_new_icon(sd_bus_message *msg, void *userdata,
sd_bus_error *ret_error);
int add_sni_signal_matches(struct sni_watcher *watcher);
int sni_item_cmp(const void *item, const void *data);
#endif /* _SWAYBAR_SNI_WATCHER_H */