From 980a6d9cc12831aab085c18363fe6c4785d31e0c Mon Sep 17 00:00:00 2001 From: Eric Koegel Date: Sat, 28 Apr 2012 14:05:12 +0300 Subject: [PATCH] Use the Path key of desktop files if a path is not set (Bug #8741) --- src/xfdesktop-file-utils.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/xfdesktop-file-utils.c b/src/xfdesktop-file-utils.c index 2670bbd..a99417c 100644 --- a/src/xfdesktop-file-utils.c +++ b/src/xfdesktop-file-utils.c @@ -1171,6 +1171,31 @@ xfdesktop_file_utils_execute(GFile *working_directory, uris[n] = g_file_get_uri(lp->data); uris[n] = NULL; + /* If the working_dir wasn't set check if this is a .desktop file + * we can parse a working dir from */ + if(working_dir == NULL) { + GFileInfo *info = g_file_query_info(file, + XFDESKTOP_FILE_INFO_NAMESPACE, + G_FILE_QUERY_INFO_NONE, + NULL, NULL); + + if(xfdesktop_file_utils_is_desktop_file(info)) { + XfceRc *rc; + gchar *path = g_file_get_path(file); + if(path != NULL) { + rc = xfce_rc_simple_open(path, TRUE); + if(rc != NULL) { + working_dir = g_strdup(xfce_rc_read_entry(rc, "Path", NULL)); + xfce_rc_close(rc); + } + g_free(path); + } + } + + if(info) + g_object_unref(info); + } + if(!xfdesktop_file_manager_proxy_execute(fileman_proxy, working_dir, uri, (const gchar **)uris, -- 1.7.9.5