summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorFurkan Sahin <furkan-dev@proton.me>2017-11-15 13:16:21 -0700
committerFurkan Sahin <furkan-dev@proton.me>2017-11-15 13:16:21 -0700
commit624f644e3adbe3d45163794e18e4b5e385d7c445 (patch)
tree675e1fbd1e6500633c01e418a0b055cb3fe8d1db /include
parent8ce461316a276a6fe13e2219051e492a21c575e0 (diff)
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')
-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 @@
#include <dbus/dbus.h>
extern DBusConnection *conn;
+enum property_status {
+ PROP_EXISTS, /* Will give iter */
+ PROP_ERROR, /* Will not give iter */
+ PROP_BAD_DATA, /* Will not give iter */
+ PROP_WRONG_SIG, /* Will give iter, please be careful */
+};
+
/**
* Checks the signature of the given iter against `sig`. Prefer to
* `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);
* Fetches the property and calls `callback` with a message iter pointing it.
* Performs error handling and signature checking.
*
- * Returns: true if message is successfully sent (will not necessarily arrive)
- * and false otherwise
+ * Returns: true if message is successfully sent and false otherwise. If there
+ * is an error getting a property, `callback` will still be run, but with
+ * `status` set to the error.
*
* NOTE: `expected_signature` must remain valid until the message reply is
* received, please only use 'static signatures.
@@ -26,7 +34,7 @@ bool dbus_get_prop_async(const char *destination,
const char *iface,
const char *prop,
const char *expected_signature,
- void(*callback)(DBusMessageIter *iter, void *data),
+ void(*callback)(DBusMessageIter *iter, void *data, enum property_status status),
void *data);
/**
* Should be called in main loop to dispatch events