diff options
author | Ted Gould <ted@gould.cx> | 2013-08-19 11:24:47 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2013-08-19 11:24:47 -0500 |
commit | f96b5cf389899d0cc4b7f389d8dd8ec3e9e89489 (patch) | |
tree | 2482a78411cb93f14b045255180add8e98cfb3e0 /src/messages-service.c | |
parent | 3c8052130a82f0f05d2ad875f3d24fd7367321c8 (diff) | |
download | ayatana-indicator-messages-f96b5cf389899d0cc4b7f389d8dd8ec3e9e89489.tar.gz ayatana-indicator-messages-f96b5cf389899d0cc4b7f389d8dd8ec3e9e89489.tar.bz2 ayatana-indicator-messages-f96b5cf389899d0cc4b7f389d8dd8ec3e9e89489.zip |
Pass the error back up through DBus
Diffstat (limited to 'src/messages-service.c')
-rw-r--r-- | src/messages-service.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/messages-service.c b/src/messages-service.c index 71fa09b..5054ebc 100644 --- a/src/messages-service.c +++ b/src/messages-service.c @@ -43,6 +43,12 @@ static IndicatorMessagesService *messages_service; static GHashTable *menus; static GSettings *settings; +enum { + DBUS_ERROR_BAD_DESKTOP_FILE, +}; + +G_DEFINE_QUARK(indicator_messages_dbus_error, dbus_error); + static void register_application (IndicatorMessagesService *service, GDBusMethodInvocation *invocation, @@ -53,7 +59,10 @@ register_application (IndicatorMessagesService *service, GDBusConnection *bus; const gchar *sender; - im_application_list_add (applications, desktop_id); + if (!im_application_list_add (applications, desktop_id)) { + g_dbus_method_invocation_return_error(invocation, dbus_error_quark(), DBUS_ERROR_BAD_DESKTOP_FILE, "Unable to find or parse desktop file for application '%s'", desktop_id); + return; + } bus = g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (service)); sender = g_dbus_method_invocation_get_sender (invocation); @@ -125,6 +134,9 @@ on_bus_acquired (GDBusConnection *bus, const gchar *profile; ImMenu *menu; + /* Register some errors */ + g_dbus_error_register_error (dbus_error_quark(), DBUS_ERROR_BAD_DESKTOP_FILE, "BadDesktopFile"); + g_dbus_connection_export_action_group (bus, INDICATOR_MESSAGES_DBUS_OBJECT, im_application_list_get_action_group (applications), &error); |