aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-02-16 08:20:01 -0600
committerTed Gould <ted@gould.cx>2010-02-16 08:20:01 -0600
commit8b8c3f426b96071e3cf92b1236c6507586805647 (patch)
tree6c351b0590259352fc02825dc97d3b6738b14cbe
parentae0b7bc73ee056f893c739e5dec1311f5bcd630f (diff)
downloadlibayatana-indicator-8b8c3f426b96071e3cf92b1236c6507586805647.tar.gz
libayatana-indicator-8b8c3f426b96071e3cf92b1236c6507586805647.tar.bz2
libayatana-indicator-8b8c3f426b96071e3cf92b1236c6507586805647.zip
Some error handling.
-rw-r--r--libindicator/indicator-desktop-shortcuts.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/libindicator/indicator-desktop-shortcuts.c b/libindicator/indicator-desktop-shortcuts.c
index eceec51..bfd8719 100644
--- a/libindicator/indicator-desktop-shortcuts.c
+++ b/libindicator/indicator-desktop-shortcuts.c
@@ -304,6 +304,8 @@ indicator_desktop_shortcuts_nick_get_name (IndicatorDesktopShortcuts * ids, cons
gboolean
indicator_desktop_shortcuts_nick_exec (IndicatorDesktopShortcuts * ids, const gchar * nick)
{
+ GError * error = NULL;
+
g_return_val_if_fail(INDICATOR_IS_DESKTOP_SHORTCUTS(ids), FALSE);
IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(ids);
@@ -354,11 +356,24 @@ indicator_desktop_shortcuts_nick_exec (IndicatorDesktopShortcuts * ids, const gc
g_free(name); g_free(exec);
GKeyFile * launcher = g_key_file_new();
- g_key_file_load_from_data(launcher, desktopdata, -1, G_KEY_FILE_NONE, NULL);
+ g_key_file_load_from_data(launcher, desktopdata, -1, G_KEY_FILE_NONE, &error);
g_free(desktopdata);
+ if (error != NULL) {
+ g_warning("Unable to build desktop keyfile for executing shortcut '%s': %s", nick, error->message);
+ g_error_free(error);
+ return FALSE;
+ }
+
GDesktopAppInfo * appinfo = g_desktop_app_info_new_from_keyfile(launcher);
- gboolean launched = g_app_info_launch(G_APP_INFO(appinfo), NULL, NULL, NULL);
+ gboolean launched = g_app_info_launch(G_APP_INFO(appinfo), NULL, NULL, &error);
+
+ if (error != NULL) {
+ g_warning("Unable to launch file from nick '%s': %s", nick, error->message);
+ g_error_free(error);
+ g_key_file_free(launcher);
+ return FALSE;
+ }
g_object_unref(appinfo);
g_key_file_free(launcher);