[Xfce4-commits] <xfdesktop:master> Use the Path key of desktop files if a path is not set (Bug #8741)

Eric Koegel noreply at xfce.org
Mon Oct 28 11:36:01 CET 2013


Updating branch refs/heads/master
         to 8f89ae4bb60fe6b15e0a8eb5b31135fbdd6ca182 (commit)
       from 3deb28c2b6f26951a556b1e46d69591c8f6c6299 (commit)

commit 8f89ae4bb60fe6b15e0a8eb5b31135fbdd6ca182
Author: Eric Koegel <eric.koegel at gmail.com>
Date:   Sat Apr 28 14:05:12 2012 +0300

    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 4f53c57..94df3a2 100644
--- a/src/xfdesktop-file-utils.c
+++ b/src/xfdesktop-file-utils.c
@@ -1117,6 +1117,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,


More information about the Xfce4-commits mailing list