samuel verstraete wrote:
> Benny, 
> 
> while thunar is shaping up very nicely these days... i still have
> another remaining question...
> 
> it concerns the "Configure custom actions" (again)
> 
> if i throw in entry there for f.e. xfrun it always goes to one
> directory below the one i'm actually in in thunar... 
> 
> f.e. : i'm in /home/samuel/Desktop it would open the xfrun dialog
> in /home/samuel .... 
> the same for gnumeric... etc etc... only Terminal seems to work like
> expected...

The attached patch should fix the problem.

> gr,S.

Benedikt
Index: thunar-uca-provider.c
===================================================================
--- thunar-uca-provider.c	(revision 20276)
+++ thunar-uca-provider.c	(working copy)
@@ -241,7 +241,9 @@
                                         GtkWidget           *window,
                                         ThunarxFileInfo     *folder)
 {
-  GList files;
+  GList *actions;
+  GList  files;
+  GList *lp;
 
   /* fake a file list... */
   files.data = folder;
@@ -249,7 +251,13 @@
   files.prev = NULL;
 
   /* ...and use the get_file_actions() method */
-  return thunarx_menu_provider_get_file_actions (menu_provider, window, &files);
+  actions = thunarx_menu_provider_get_file_actions (menu_provider, window, &files);
+
+  /* make the actions, so we can properly detect the working directory */
+  for (lp = actions; lp != NULL; lp = lp->next)
+    g_object_set_data (G_OBJECT (lp->data), "thunar-uca-folder-action", GUINT_TO_POINTER (TRUE));
+
+  return actions;
 }
 
 
@@ -299,10 +307,22 @@
       /* determine the working from the first file */
       if (G_LIKELY (files != NULL))
         {
+          /* determine the filename of the first selected file */
           uri = thunarx_file_info_get_uri (files->data);
           filename = g_filename_from_uri (uri, NULL, NULL);
           if (G_LIKELY (filename != NULL))
-            working_directory = g_path_get_dirname (filename);
+            {
+              /* if this is a folder action, we just use the filename as working directory */
+              if (g_object_get_data (G_OBJECT (action), "thunar-uca-folder-action") != NULL)
+                {
+                  working_directory = filename;
+                  filename = NULL;
+                }
+              else
+                {
+                  working_directory = g_path_get_dirname (filename);
+                }
+            }
           g_free (filename);
           g_free (uri);
         }
_______________________________________________
Thunar-dev mailing list
Thunar-dev@xfce.org
http://foo-projects.org/mailman/listinfo/thunar-dev

Reply via email to