diff --git a/thunar/thunar-location-buttons-ui.xml b/thunar/thunar-location-buttons-ui.xml index 7c50a2ad86c6fb69109013b9ba5efddf44fc473c..e8e592606b1e49beaa3072bf6337c028cb86fc4e 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 45b3383e737c466c151e6dbc5a51be331c0a8116..e4806688d55db97a2dd74463a285d154976220ed 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); @@ -1368,6 +1376,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 6c51a52b09e410fcabe435d00f5e6f473a5bc070..078df536fbd1b08baf81bfa828d20b61555b7963 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))