From 88f198c09524a4c78744177fcafac2d82b741d6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Bro=C4=8Dko?= Date: Wed, 11 Nov 2020 16:43:52 +0100 Subject: Duplicate tabs using the scroll wheel (#1456) * middle-clicking the reload button duplicates tab --- src/caja-window-manage-views.c | 8 -------- src/caja-window-menus.c | 2 +- src/caja-window.c | 30 +++++++++++++++++++++++++++++- src/caja-window.h | 4 ++-- 4 files changed, 32 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/caja-window-manage-views.c b/src/caja-window-manage-views.c index 6bebb308..638d7824 100644 --- a/src/caja-window-manage-views.c +++ b/src/caja-window-manage-views.c @@ -2394,11 +2394,3 @@ caja_window_slot_reload (CajaWindowSlot *slot) g_list_free_full (selection, g_object_unref); } -void -caja_window_reload (CajaWindow *window) -{ - g_assert (CAJA_IS_WINDOW (window)); - - caja_window_slot_reload (window->details->active_pane->active_slot); -} - diff --git a/src/caja-window-menus.c b/src/caja-window-menus.c index cc4c268f..ebfd40be 100644 --- a/src/caja-window-menus.c +++ b/src/caja-window-menus.c @@ -366,7 +366,7 @@ static void action_reload_callback (GtkAction *action, gpointer user_data) { - caja_window_reload (CAJA_WINDOW (user_data)); + caja_window_reload (CAJA_WINDOW (user_data), should_open_in_new_tab ()); } static void diff --git a/src/caja-window.c b/src/caja-window.c index f7449279..6d3fa5f2 100644 --- a/src/caja-window.c +++ b/src/caja-window.c @@ -272,6 +272,12 @@ caja_window_go_up_signal (CajaWindow *window, gboolean close_behind) return TRUE; } +static void +caja_window_reload_signal (CajaWindow *window) +{ + caja_window_reload (window, FALSE); +} + void caja_window_new_tab (CajaWindow *window) { @@ -476,6 +482,28 @@ caja_window_sync_allow_stop (CajaWindow *window, } } +void +caja_window_reload (CajaWindow *window, gboolean new_tab) +{ + CajaWindowSlot *slot; + + g_assert (CAJA_IS_WINDOW (window)); + + slot = window->details->active_pane->active_slot; + + if (new_tab && slot->location != NULL) + { + caja_window_slot_open_location_full (slot, slot->location, + CAJA_WINDOW_OPEN_ACCORDING_TO_MODE, + CAJA_WINDOW_OPEN_FLAG_NEW_TAB, + NULL, NULL, NULL); + } + else + { + caja_window_slot_reload (slot); + } +} + void caja_window_allow_reload (CajaWindow *window, gboolean allow) { @@ -2220,6 +2248,6 @@ caja_window_class_init (CajaWindowClass *class) "prompt-for-location", 1, G_TYPE_STRING, "/"); - class->reload = caja_window_reload; + class->reload = caja_window_reload_signal; class->go_up = caja_window_go_up_signal; } diff --git a/src/caja-window.h b/src/caja-window.h index 323a43aa..efe48769 100644 --- a/src/caja-window.h +++ b/src/caja-window.h @@ -156,8 +156,8 @@ void caja_window_prompt_for_location (CajaWindow *window, const char *initial); void caja_window_display_error (CajaWindow *window, const char *error_msg); -void caja_window_reload (CajaWindow *window); - +void caja_window_reload (CajaWindow *window, + gboolean new_tab); void caja_window_allow_reload (CajaWindow *window, gboolean allow); void caja_window_allow_up (CajaWindow *window, -- cgit v1.2.1