From f96b5cf389899d0cc4b7f389d8dd8ec3e9e89489 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 19 Aug 2013 11:24:47 -0500 Subject: Pass the error back up through DBus --- src/messages-service.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/messages-service.c') 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); -- cgit v1.2.3