[Xfce4-commits] <thunar:master> Open in tabs in the details view too.

Nick Schermer noreply at xfce.org
Mon Oct 29 20:20:01 CET 2012


Updating branch refs/heads/master
         to bd7ca398c98ec50a9b49178b06e0de8ebd19973a (commit)
       from 872484b34da277bc3bcd167062390765ec26d253 (commit)

commit bd7ca398c98ec50a9b49178b06e0de8ebd19973a
Author: Nick Schermer <nick at xfce.org>
Date:   Mon Oct 29 20:19:02 2012 +0100

    Open in tabs in the details view too.

 thunar/thunar-details-view.c |   35 ++++++++++++++++++++++++++++-------
 1 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/thunar/thunar-details-view.c b/thunar/thunar-details-view.c
index 1c25884..b6a5f3d 100644
--- a/thunar/thunar-details-view.c
+++ b/thunar/thunar-details-view.c
@@ -29,6 +29,7 @@
 #include <thunar/thunar-gtk-extensions.h>
 #include <thunar/thunar-private.h>
 #include <thunar/thunar-text-renderer.h>
+#include <thunar/thunar-preferences.h>
 
 
 
@@ -651,11 +652,14 @@ thunar_details_view_button_press_event (GtkTreeView       *tree_view,
                                         GdkEventButton    *event,
                                         ThunarDetailsView *details_view)
 {
-  GtkTreeSelection *selection;
-  GtkTreePath      *path;
-  GtkTreeIter       iter;
-  ThunarFile       *file;
-  GtkAction        *action;
+  GtkTreeSelection  *selection;
+  GtkTreePath       *path;
+  GtkTreeIter        iter;
+  ThunarFile        *file;
+  GtkAction         *action;
+  ThunarPreferences *preferences;
+  gboolean           in_tab;
+  const gchar       *action_name;
 
   /* check if the event is for the bin window */
   if (G_UNLIKELY (event->window != gtk_tree_view_get_bin_window (tree_view)))
@@ -714,8 +718,25 @@ thunar_details_view_button_press_event (GtkTreeView       *tree_view,
               if (G_LIKELY (file != NULL))
                 {
                   /* determine the action to perform depending on the type of the file */
-                  action = thunar_gtk_ui_manager_get_action_by_name (THUNAR_STANDARD_VIEW (details_view)->ui_manager,
-                      thunar_file_is_directory (file) ? "open-in-new-window" : "open");
+                  if (thunar_file_is_directory (file))
+                    {
+                      /* lookup setting if we should open in a tab or a window */
+                      preferences = thunar_preferences_get ();
+                      g_object_get (preferences, "misc-middle-click-in-tab", &in_tab, NULL);
+                      g_object_unref (preferences);
+
+                      /* holding ctrl inverts the action */
+                      if ((event->state & GDK_CONTROL_MASK) != 0)
+                        in_tab = !in_tab;
+
+                      action_name = in_tab ? "open-in-new-tab" : "open-in-new-window";
+                    }
+                  else
+                    {
+                      action_name = "open";
+                    }
+
+                  action = thunar_gtk_ui_manager_get_action_by_name (THUNAR_STANDARD_VIEW (details_view)->ui_manager, action_name);
       
                   /* emit the action */
                   if (G_LIKELY (action != NULL))


More information about the Xfce4-commits mailing list