Properly handle error conditions from dunstctl
This commit is contained in:
parent
9049bf15b2
commit
ec421f1ea1
12
src/dbus.c
12
src/dbus.c
@ -583,11 +583,13 @@ GVariant *dbus_cb_dunst_Properties_Get(GDBusConnection *connection,
|
||||
{
|
||||
struct dunst_status status = dunst_status_get();
|
||||
|
||||
if (STR_EQ(property_name, "running"))
|
||||
if (STR_EQ(property_name, "running")) {
|
||||
return g_variant_new_boolean(status.running);
|
||||
else
|
||||
//TODO: is NULL as return value allowed?
|
||||
} else {
|
||||
LOG_W("Unknown property!\n");
|
||||
*error = g_error_new(G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_PROPERTY, "Unknown property");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
gboolean dbus_cb_dunst_Properties_Set(GDBusConnection *connection,
|
||||
@ -605,10 +607,8 @@ gboolean dbus_cb_dunst_Properties_Set(GDBusConnection *connection,
|
||||
return true;
|
||||
}
|
||||
|
||||
*error = g_error_new(G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_PROPERTY, "Unknown property");
|
||||
|
||||
//FIXME: don't we have to return true on successful setting, but return false, if e.g. the parameter name is wrong?
|
||||
//return true;
|
||||
// so like this?
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user