aboutsummaryrefslogtreecommitdiff
path: root/swaybar/tray/tray.c
diff options
context:
space:
mode:
authorIan Fan <ianfan0@gmail.com>2018-12-07 12:33:45 +0000
committerIan Fan <ianfan0@gmail.com>2018-12-31 20:40:18 +0000
commite6cb55e2f8176b0ea8a6dbf15c728c56d8b74056 (patch)
tree5de223965d04be7bf2835e0ca391426185494261 /swaybar/tray/tray.c
parent746600e6ed562db9395ac790b7749624006d80ad (diff)
swaybar: add StatusNotifierHost to tray
Diffstat (limited to 'swaybar/tray/tray.c')
-rw-r--r--swaybar/tray/tray.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/swaybar/tray/tray.c b/swaybar/tray/tray.c
index c1d3b50b..e760812c 100644
--- a/swaybar/tray/tray.c
+++ b/swaybar/tray/tray.c
@@ -4,8 +4,10 @@
#include <string.h>
#include "swaybar/bar.h"
#include "swaybar/tray/icon.h"
+#include "swaybar/tray/host.h"
#include "swaybar/tray/tray.h"
#include "swaybar/tray/watcher.h"
+#include "list.h"
#include "log.h"
struct swaybar_tray *create_tray(struct swaybar *bar) {
@@ -29,6 +31,11 @@ struct swaybar_tray *create_tray(struct swaybar *bar) {
tray->watcher_xdg = create_watcher("freedesktop", tray->bus);
tray->watcher_kde = create_watcher("kde", tray->bus);
+ tray->items = create_list();
+
+ init_host(&tray->host_xdg, "freedesktop", tray);
+ init_host(&tray->host_kde, "kde", tray);
+
init_themes(&tray->themes, &tray->basedirs);
return tray;
@@ -38,6 +45,12 @@ void destroy_tray(struct swaybar_tray *tray) {
if (!tray) {
return;
}
+ finish_host(&tray->host_xdg);
+ finish_host(&tray->host_kde);
+ for (int i = 0; i < tray->items->length; ++i) {
+ free(tray->items->items[0]);
+ }
+ list_free(tray->items);
destroy_watcher(tray->watcher_xdg);
destroy_watcher(tray->watcher_kde);
sd_bus_flush_close_unref(tray->bus);