summaryrefslogtreecommitdiffstats
path: root/include/swaybar/tray
diff options
context:
space:
mode:
authorLibravatar Calvin Lee <cyrus296@gmail.com>2017-11-15 13:16:21 -0700
committerLibravatar Calvin Lee <cyrus296@gmail.com>2017-12-29 12:11:51 -0700
commit13b81f9fb91ee20a41ccdd955c2539d46ef6b6e1 (patch)
tree675e1fbd1e6500633c01e418a0b055cb3fe8d1db /include/swaybar/tray
parentAdd `dbus_get_prop_async` utility (diff)
downloadsway-13b81f9fb91ee20a41ccdd955c2539d46ef6b6e1.tar.gz
sway-13b81f9fb91ee20a41ccdd955c2539d46ef6b6e1.tar.zst
sway-13b81f9fb91ee20a41ccdd955c2539d46ef6b6e1.zip
Fix `get_icon`
Property reply functions are now notified if there was an error with the property instead of silent failure. Also issues in `get_item` were resolved.
Diffstat (limited to 'include/swaybar/tray')
-rw-r--r--include/swaybar/tray/dbus.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/include/swaybar/tray/dbus.h b/include/swaybar/tray/dbus.h
index 125ce96f..c693e6f7 100644
--- a/include/swaybar/tray/dbus.h
+++ b/include/swaybar/tray/dbus.h
@@ -5,6 +5,13 @@
5#include <dbus/dbus.h> 5#include <dbus/dbus.h>
6extern DBusConnection *conn; 6extern DBusConnection *conn;
7 7
8enum property_status {
9 PROP_EXISTS, /* Will give iter */
10 PROP_ERROR, /* Will not give iter */
11 PROP_BAD_DATA, /* Will not give iter */
12 PROP_WRONG_SIG, /* Will give iter, please be careful */
13};
14
8/** 15/**
9 * Checks the signature of the given iter against `sig`. Prefer to 16 * Checks the signature of the given iter against `sig`. Prefer to
10 * `dbus_message_iter_get_signature` as this one frees the intermediate string. 17 * `dbus_message_iter_get_signature` as this one frees the intermediate string.
@@ -15,8 +22,9 @@ bool dbus_message_iter_check_signature(DBusMessageIter *iter, const char *sig);
15 * Fetches the property and calls `callback` with a message iter pointing it. 22 * Fetches the property and calls `callback` with a message iter pointing it.
16 * Performs error handling and signature checking. 23 * Performs error handling and signature checking.
17 * 24 *
18 * Returns: true if message is successfully sent (will not necessarily arrive) 25 * Returns: true if message is successfully sent and false otherwise. If there
19 * and false otherwise 26 * is an error getting a property, `callback` will still be run, but with
27 * `status` set to the error.
20 * 28 *
21 * NOTE: `expected_signature` must remain valid until the message reply is 29 * NOTE: `expected_signature` must remain valid until the message reply is
22 * received, please only use 'static signatures. 30 * received, please only use 'static signatures.
@@ -26,7 +34,7 @@ bool dbus_get_prop_async(const char *destination,
26 const char *iface, 34 const char *iface,
27 const char *prop, 35 const char *prop,
28 const char *expected_signature, 36 const char *expected_signature,
29 void(*callback)(DBusMessageIter *iter, void *data), 37 void(*callback)(DBusMessageIter *iter, void *data, enum property_status status),
30 void *data); 38 void *data);
31/** 39/**
32 * Should be called in main loop to dispatch events 40 * Should be called in main loop to dispatch events