[Xfce4-commits] <thunar:master> Use ThunarBrowser to resolve locations in launcher.

Nick Schermer noreply at xfce.org
Sun Dec 9 18:22:02 CET 2012


Updating branch refs/heads/master
         to 3d8fb7d82d5a76565ff37338db72ad3e0323f5a9 (commit)
       from 6137b711dab10e2e8223e09e5d420e3cfeda5923 (commit)

commit 3d8fb7d82d5a76565ff37338db72ad3e0323f5a9
Author: Nick Schermer <nick at xfce.org>
Date:   Sun Dec 9 18:19:09 2012 +0100

    Use ThunarBrowser to resolve locations in launcher.
    
    This makes it possible to open new tabs and windows of
    remote locations from locations like computer:// and
    unmounted targets.

 thunar/thunar-launcher.c |   34 +++++++++++++++++++++-------------
 1 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/thunar/thunar-launcher.c b/thunar/thunar-launcher.c
index 10b5c46..6bede6a 100644
--- a/thunar/thunar-launcher.c
+++ b/thunar/thunar-launcher.c
@@ -167,6 +167,7 @@ struct _ThunarLauncherPokeData
 {
   GList *files;
   GList *resolved_files;
+  guint  directories_in_tabs : 1;
 };
 
 
@@ -1287,8 +1288,17 @@ thunar_launcher_poke_files_finish (ThunarBrowser *browser,
       /* check if we have any directories to process */
       if (G_LIKELY (directories != NULL))
         {
-          /* open new windows for all directories */
-          thunar_launcher_open_windows (THUNAR_LAUNCHER (browser), directories);
+          if (poke_data->directories_in_tabs)
+            {
+              /* open new tabs */
+              for (lp = directories; lp != NULL; lp = lp->next)
+                thunar_navigator_open_new_tab (THUNAR_NAVIGATOR (browser), lp->data);
+            }
+          else
+            {
+              /* open new windows for all directories */
+              thunar_launcher_open_windows (THUNAR_LAUNCHER (browser), directories);
+            }
           g_list_free (directories);
         }
 
@@ -1395,6 +1405,8 @@ static void
 thunar_launcher_action_open_in_new_window (GtkAction      *action,
                                            ThunarLauncher *launcher)
 {
+  ThunarLauncherPokeData *poke_data;
+
   _thunar_return_if_fail (GTK_IS_ACTION (action));
   _thunar_return_if_fail (THUNAR_IS_LAUNCHER (launcher));
 
@@ -1404,7 +1416,8 @@ thunar_launcher_action_open_in_new_window (GtkAction      *action,
     return;
 
   /* open the selected directories in new windows */
-  thunar_launcher_open_windows (launcher, launcher->selected_files);
+  poke_data = thunar_launcher_poke_data_new (launcher->selected_files);
+  thunar_launcher_poke_files (launcher, poke_data);
 }
 
 
@@ -1413,8 +1426,7 @@ static void
 thunar_launcher_action_open_in_new_tab (GtkAction      *action,
                                         ThunarLauncher *launcher)
 {
-  GList *lp;
-  GList *selected_files;
+  ThunarLauncherPokeData *poke_data;
 
   _thunar_return_if_fail (GTK_IS_ACTION (action));
   _thunar_return_if_fail (THUNAR_IS_LAUNCHER (launcher));
@@ -1425,14 +1437,9 @@ thunar_launcher_action_open_in_new_tab (GtkAction      *action,
     return;
 
   /* open all selected directories in a new tab */
-  selected_files = thunar_g_file_list_copy (launcher->selected_files);
-  for (lp = selected_files; lp != NULL; lp = lp->next)
-    {
-      if (thunar_file_is_directory (lp->data))
-        thunar_navigator_open_new_tab (THUNAR_NAVIGATOR (launcher), lp->data);
-      g_object_unref (G_OBJECT (lp->data));
-    }
-  g_list_free (selected_files);
+  poke_data = thunar_launcher_poke_data_new (launcher->selected_files);
+  poke_data->directories_in_tabs = TRUE;
+  thunar_launcher_poke_files (launcher, poke_data);
 }
 
 
@@ -1506,6 +1513,7 @@ thunar_launcher_poke_data_new (GList *files)
   data = g_slice_new0 (ThunarLauncherPokeData);
   data->files = thunar_g_file_list_copy (files);
   data->resolved_files = NULL;
+  data->directories_in_tabs = FALSE;
 
   return data;
 }


More information about the Xfce4-commits mailing list