summaryrefslogtreecommitdiff
path: root/swaybar/tray/host.c
diff options
context:
space:
mode:
authorIan Fan <[email protected]>2018-12-07 12:33:45 +0000
committerIan Fan <[email protected]>2018-12-31 20:40:18 +0000
commit74655f835aa9fe0e976473d443f62d253602696c (patch)
tree238835505b049fc4b0479f0fa25e2c30deb0adb6 /swaybar/tray/host.c
parente6cb55e2f8176b0ea8a6dbf15c728c56d8b74056 (diff)
swaybar: add StatusNotifierItem to tray
Diffstat (limited to 'swaybar/tray/host.c')
-rw-r--r--swaybar/tray/host.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/swaybar/tray/host.c b/swaybar/tray/host.c
index 3cc90254..8ab896d4 100644
--- a/swaybar/tray/host.c
+++ b/swaybar/tray/host.c
@@ -5,6 +5,7 @@
#include <string.h>
#include <unistd.h>
#include "swaybar/tray/host.h"
+#include "swaybar/tray/item.h"
#include "swaybar/tray/tray.h"
#include "list.h"
#include "log.h"
@@ -12,15 +13,15 @@
static const char *watcher_path = "/StatusNotifierWatcher";
static int cmp_sni_id(const void *item, const void *cmp_to) {
- const char *sni = item;
- return strcmp(sni, cmp_to);
+ const struct swaybar_sni *sni = item;
+ return strcmp(sni->watcher_id, cmp_to);
}
static void add_sni(struct swaybar_tray *tray, char *id) {
int idx = list_seq_find(tray->items, cmp_sni_id, id);
if (idx == -1) {
wlr_log(WLR_DEBUG, "Registering Status Notifier Item '%s'", id);
- char *sni = strdup(id);
+ struct swaybar_sni *sni = create_sni(id, tray);
if (sni) {
list_add(tray->items, sni);
}
@@ -53,7 +54,7 @@ static int handle_sni_unregistered(sd_bus_message *msg, void *data,
int idx = list_seq_find(tray->items, cmp_sni_id, id);
if (idx != -1) {
wlr_log(WLR_DEBUG, "Unregistering Status Notifier Item '%s'", id);
- free(tray->items->items[idx]);
+ destroy_sni(tray->items->items[idx]);
list_del(tray->items, idx);
}
return ret;