summaryrefslogtreecommitdiff
path: root/src/caja-window.c
diff options
context:
space:
mode:
authorYetoo1 <[email protected]>2019-12-25 00:32:31 -0800
committerraveit65 <[email protected]>2019-12-29 14:01:02 +0100
commit5374078bd1bc634ca8bb737204301151b5110cb1 (patch)
tree3f3085f4a1d5eb1c5f5749034a308eeac14a06d1 /src/caja-window.c
parent24fa3a2fe7af65c9e91a40daae04258bf3fbc8a2 (diff)
downloadcaja-5374078bd1bc634ca8bb737204301151b5110cb1.tar.bz2
caja-5374078bd1bc634ca8bb737204301151b5110cb1.tar.xz
Keep path same when opening new window from an existing one
solved https://github.com/mate-desktop/caja/issues/1335
Diffstat (limited to 'src/caja-window.c')
-rw-r--r--src/caja-window.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/caja-window.c b/src/caja-window.c
index 9710bb6f..f8570bcb 100644
--- a/src/caja-window.c
+++ b/src/caja-window.c
@@ -308,6 +308,42 @@ caja_window_new_tab (CajaWindow *window)
}
}
+/*Opens a new window when called from an existing window and goes to the same location that's in the existing window.*/
+void
+caja_window_new_window (CajaWindow *window)
+{
+ CajaWindowSlot *current_slot;
+ GFile *location = NULL;
+ g_return_if_fail (CAJA_IS_WINDOW (window));
+
+ /*Get and set the directory location of current window (slot).*/
+ current_slot = window->details->active_pane->active_slot;
+ location = caja_window_slot_get_location (current_slot);
+
+ if (location != NULL)
+ {
+ CajaWindow *new_window;
+ CajaWindowSlot *new_slot;
+ CajaWindowOpenFlags flags;
+ flags = FALSE;
+
+ /*Create a new window*/
+ new_window = caja_application_create_navigation_window (
+ window->application,
+ gtk_window_get_screen (GTK_WINDOW (window)));
+
+ /*Create a slot in the new window.*/
+ new_slot = new_window->details->active_pane->active_slot;
+ g_return_if_fail (CAJA_IS_WINDOW_SLOT (new_slot));
+
+ /*Open a directory at the set location in the new window (slot).*/
+ caja_window_slot_open_location_full (new_slot, location,
+ CAJA_WINDOW_OPEN_ACCORDING_TO_MODE,
+ flags, NULL, NULL, NULL);
+ g_object_unref (location);
+ }
+}
+
void
caja_window_go_up (CajaWindow *window, gboolean close_behind, gboolean new_tab)
{