[Xfce4-commits] <thunar:master> Add new tab option to right-click menu of location buttons.

Nick Schermer noreply at xfce.org
Thu Dec 27 12:06:05 CET 2012


Updating branch refs/heads/master
         to 5b364c5a7f810b5d9d4298d8bc3c4d49c9f12bc6 (commit)
       from 31f32e62cdd7d849c610313acd213c4611b57b98 (commit)

commit 5b364c5a7f810b5d9d4298d8bc3c4d49c9f12bc6
Author: Nick Schermer <nick at xfce.org>
Date:   Thu Dec 27 11:49:54 2012 +0100

    Add new tab option to right-click menu of location buttons.

 thunar/thunar-location-buttons-ui.xml |    1 +
 thunar/thunar-location-buttons.c      |   28 ++++++++++++++++++++++++++++
 thunar/thunar-window.c                |    1 +
 3 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/thunar/thunar-location-buttons-ui.xml b/thunar/thunar-location-buttons-ui.xml
index 7c50a2a..e8e5926 100644
--- a/thunar/thunar-location-buttons-ui.xml
+++ b/thunar/thunar-location-buttons-ui.xml
@@ -14,6 +14,7 @@
 
   <popup action="location-buttons-context-menu">
     <menuitem action="location-buttons-open" />
+    <menuitem action="location-buttons-open-in-new-tab" />
     <menuitem action="location-buttons-open-in-new-window" />
     <separator />
     <menuitem action="location-buttons-create-folder" />
diff --git a/thunar/thunar-location-buttons.c b/thunar/thunar-location-buttons.c
index 45b3383..e480668 100644
--- a/thunar/thunar-location-buttons.c
+++ b/thunar/thunar-location-buttons.c
@@ -122,6 +122,8 @@ static void           thunar_location_buttons_action_empty_trash        (GtkActi
                                                                          ThunarLocationButtons      *buttons);
 static void           thunar_location_buttons_action_open               (GtkAction                  *action,
                                                                          ThunarLocationButtons      *buttons);
+static void           thunar_location_buttons_action_open_in_new_tab    (GtkAction                  *action,
+                                                                         ThunarLocationButtons      *buttons);
 static void           thunar_location_buttons_action_open_in_new_window (GtkAction                  *action,
                                                                          ThunarLocationButtons      *buttons);
 static void           thunar_location_buttons_action_paste_into_folder  (GtkAction                  *action,
@@ -166,6 +168,7 @@ static const GtkActionEntry action_entries[] =
   { "location-buttons-down-folder", NULL, "Down Folder", "<alt>Down", NULL, G_CALLBACK (thunar_location_buttons_action_down_folder), },
   { "location-buttons-context-menu", NULL, "Context Menu", NULL, "", NULL, },
   { "location-buttons-open", GTK_STOCK_OPEN, N_("_Open"), "", NULL, G_CALLBACK (thunar_location_buttons_action_open), },
+  { "location-buttons-open-in-new-tab", NULL, N_("Open in New Tab"), "", NULL, G_CALLBACK (thunar_location_buttons_action_open_in_new_tab), },
   { "location-buttons-open-in-new-window", NULL, N_("Open in New Window"), "", NULL, G_CALLBACK (thunar_location_buttons_action_open_in_new_window), },
   { "location-buttons-create-folder", NULL, N_("Create _Folder..."), "", NULL, G_CALLBACK (thunar_location_buttons_action_create_folder), },
   { "location-buttons-empty-trash", NULL, N_("_Empty Trash"), "", N_("Delete all files and folders in the Trash"), G_CALLBACK (thunar_location_buttons_action_empty_trash), },
@@ -1226,6 +1229,11 @@ thunar_location_buttons_context_menu (ThunarLocationButton  *button,
           thunar_gtk_action_set_tooltip (action, _("Open \"%s\" in a new window"), display_name);
           g_object_set_data_full (G_OBJECT (action), I_("thunar-file"), g_object_ref (G_OBJECT (file)), (GDestroyNotify) g_object_unref);
 
+          /* setup the "Open in New Tab" action */
+          action = gtk_action_group_get_action (buttons->action_group, "location-buttons-open-in-new-tab");
+          thunar_gtk_action_set_tooltip (action, _("Open \"%s\" in a new tab"), display_name);
+          g_object_set_data_full (G_OBJECT (action), I_("thunar-file"), g_object_ref (G_OBJECT (file)), (GDestroyNotify) g_object_unref);
+
           /* setup the "Create Folder..." action */
           action = gtk_action_group_get_action (buttons->action_group, "location-buttons-create-folder");
           thunar_gtk_action_set_tooltip (action, _("Create a new folder in \"%s\""), display_name);
@@ -1369,6 +1377,26 @@ thunar_location_buttons_action_open (GtkAction             *action,
 
 
 static void
+thunar_location_buttons_action_open_in_new_tab (GtkAction             *action,
+                                                ThunarLocationButtons *buttons)
+{
+  ThunarFile *directory;
+
+  _thunar_return_if_fail (THUNAR_IS_LOCATION_BUTTONS (buttons));
+  _thunar_return_if_fail (GTK_IS_ACTION (action));
+
+  /* determine the directory for the action */
+  directory = g_object_get_data (G_OBJECT (action), "thunar-file");
+  if (G_LIKELY (directory != NULL))
+    {
+      /* open tab in thsi window */
+      thunar_navigator_open_new_tab (THUNAR_NAVIGATOR (buttons), directory);
+    }
+}
+
+
+
+static void
 thunar_location_buttons_action_open_in_new_window (GtkAction             *action,
                                                    ThunarLocationButtons *buttons)
 {
diff --git a/thunar/thunar-window.c b/thunar/thunar-window.c
index 6c51a52..078df53 100644
--- a/thunar/thunar-window.c
+++ b/thunar/thunar-window.c
@@ -1797,6 +1797,7 @@ thunar_window_install_location_bar (ThunarWindow *window,
       window->location_bar = g_object_new (type, "ui-manager", window->ui_manager, NULL);
       exo_binding_new (G_OBJECT (window), "current-directory", G_OBJECT (window->location_bar), "current-directory");
       g_signal_connect_swapped (G_OBJECT (window->location_bar), "change-directory", G_CALLBACK (thunar_window_set_current_directory), window);
+      g_signal_connect_swapped (G_OBJECT (window->location_bar), "open-new-tab", G_CALLBACK (thunar_window_notebook_insert), window);
 
       /* connect the location widget to the view (if any) */
       if (G_LIKELY (window->view != NULL))


More information about the Xfce4-commits mailing list