aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2013-08-08 12:18:47 +0200
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2013-08-08 12:18:47 +0200
commitc0bb2944764b0d60b7c9e8ed3b133eb3e24a7261 (patch)
tree765c8b43db10e315b679f7e818a1c27e2ea1825e
parentf695712245cd410c192e4f74dce773c5d05d3175 (diff)
downloadlibayatana-indicator-c0bb2944764b0d60b7c9e8ed3b133eb3e24a7261.tar.gz
libayatana-indicator-c0bb2944764b0d60b7c9e8ed3b133eb3e24a7261.tar.bz2
libayatana-indicator-c0bb2944764b0d60b7c9e8ed3b133eb3e24a7261.zip
IndicatorDesktopShortcuts: add support to Path key for shortcut items
-rw-r--r--libindicator/indicator-desktop-shortcuts.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/libindicator/indicator-desktop-shortcuts.c b/libindicator/indicator-desktop-shortcuts.c
index 7b43630..6148aec 100644
--- a/libindicator/indicator-desktop-shortcuts.c
+++ b/libindicator/indicator-desktop-shortcuts.c
@@ -612,6 +612,20 @@ indicator_desktop_shortcuts_nick_exec_with_context (IndicatorDesktopShortcuts *
return FALSE;
}
+ /* If possible move to the proper launch path */
+ gchar * path = g_key_file_get_locale_string(priv->keyfile,
+ groupheader,
+ G_KEY_FILE_DESKTOP_KEY_PATH,
+ NULL,
+ NULL);
+
+ if (path && *path != '\0' && chdir(path) < 0) {
+ g_warning ("Impossible to run action '%s' from path '%s'", nick, path);
+ g_free(groupheader);
+ g_free(path);
+ return FALSE;
+ }
+
/* Grab the name and the exec entries out of our current group */
gchar * name = g_key_file_get_locale_string(priv->keyfile,
groupheader,
@@ -625,8 +639,6 @@ indicator_desktop_shortcuts_nick_exec_with_context (IndicatorDesktopShortcuts *
NULL,
NULL);
- g_free(groupheader);
-
GAppInfoCreateFlags flags = G_APP_INFO_CREATE_NONE;
if (launch_context) {
@@ -634,7 +646,7 @@ indicator_desktop_shortcuts_nick_exec_with_context (IndicatorDesktopShortcuts *
}
GAppInfo * appinfo = g_app_info_create_from_commandline(exec, name, flags, &error);
- g_free(name); g_free(exec);
+ g_free(groupheader); g_free(path); g_free(name); g_free(exec);
if (error != NULL) {
g_warning("Unable to build Command line App info: %s", error->message);