Add dbus properties for number of displayed, waiting and shown notifications
This commit is contained in:
parent
a89287cb3e
commit
313731f0f2
13
src/dbus.c
13
src/dbus.c
@ -85,6 +85,10 @@ static const char *introspection_xml =
|
||||
" <annotation name=\"org.freedesktop.DBus.Property.EmitsChangedSignal\" value=\"true\"/>"
|
||||
" </property>"
|
||||
|
||||
" <property name=\"displayed\" type=\"u\" access=\"read\" />"
|
||||
" <property name=\"history\" type=\"u\" access=\"read\" />"
|
||||
" <property name=\"waiting\" type=\"u\" access=\"read\" />"
|
||||
|
||||
" </interface>"
|
||||
"</node>";
|
||||
|
||||
@ -597,6 +601,15 @@ GVariant *dbus_cb_dunst_Properties_Get(GDBusConnection *connection,
|
||||
|
||||
if (STR_EQ(property_name, "paused")) {
|
||||
return g_variant_new_boolean(!status.running);
|
||||
} else if (STR_EQ(property_name, "displayed")) {
|
||||
unsigned int displayed = queues_length_displayed();
|
||||
return g_variant_new_uint32(displayed);
|
||||
} else if (STR_EQ(property_name, "history")) {
|
||||
unsigned int history = queues_length_history();
|
||||
return g_variant_new_uint32(history);
|
||||
} else if (STR_EQ(property_name, "waiting")) {
|
||||
unsigned int waiting = queues_length_waiting();
|
||||
return g_variant_new_uint32(waiting);
|
||||
} else {
|
||||
LOG_W("Unknown property!\n");
|
||||
*error = g_error_new(G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_PROPERTY, "Unknown property");
|
||||
|
Loading…
x
Reference in New Issue
Block a user