Skip to content

Commit 2b70af1

Browse files
committed
nemo-window.c: Remember the second pane's location until the
remaining pane's location changes. If the user is working in the split view, and toggles split pane off (from either side), remember the location of the closed pane and restore it if the split view is toggled again. If the remaining pane's location changes, the stored location is cleared, and traditional behavior will prevail (opening the second pane in the same location as the first). If a pane had multiple tabs open, only the active tab's location is remembered and re-opened. ref: https://blog.linuxmint.com/?p=4850#comment-499214
1 parent 709835d commit 2b70af1

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

src/nemo-window-manage-views.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,6 +1520,7 @@ update_for_new_location (NemoWindowSlot *slot)
15201520
}
15211521

15221522
if (location_really_changed) {
1523+
nemo_window_clear_secondary_pane_location (window);
15231524
nemo_window_slot_remove_extra_location_widgets (slot);
15241525

15251526
directory = nemo_directory_get (slot->location);

src/nemo-window-private.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ struct NemoWindowDetails
9595
/* split view */
9696
GtkWidget *split_view_hpane;
9797

98+
// A closed pane's location, valid until the remaining pane
99+
// location changes.
100+
GFile *secondary_pane_last_location;
101+
98102
gboolean disable_chrome;
99103

100104
guint sidebar_width_handler_id;

src/nemo-window.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -873,6 +873,7 @@ nemo_window_finalize (GObject *object)
873873
nemo_window_finalize_menus (window);
874874

875875
g_clear_object (&window->details->nav_state);
876+
g_clear_object (&window->details->secondary_pane_last_location);
876877

877878
g_clear_object (&window->details->ui_manager);
878879

@@ -2195,8 +2196,9 @@ nemo_window_split_view_on (NemoWindow *window)
21952196
old_active_slot = nemo_window_get_active_slot (window);
21962197
slot = create_extra_pane (window);
21972198

2198-
location = NULL;
2199-
if (old_active_slot != NULL) {
2199+
location = window->details->secondary_pane_last_location;
2200+
2201+
if (location == NULL && old_active_slot != NULL) {
22002202
location = nemo_window_slot_get_location (old_active_slot);
22012203
if (location != NULL) {
22022204
if (g_file_has_uri_scheme (location, "x-nemo-search")) {
@@ -2228,6 +2230,8 @@ nemo_window_split_view_off (NemoWindow *window)
22282230
next = l->next;
22292231
pane = l->data;
22302232
if (pane != active_pane) {
2233+
g_clear_object (&window->details->secondary_pane_last_location);
2234+
window->details->secondary_pane_last_location = nemo_window_slot_get_location (pane->active_slot);
22312235
nemo_window_close_pane (window, pane);
22322236
}
22332237
}
@@ -2252,6 +2256,13 @@ nemo_window_split_view_showing (NemoWindow *window)
22522256
return g_list_length (NEMO_WINDOW (window)->details->panes) > 1;
22532257
}
22542258

2259+
void
2260+
nemo_window_clear_secondary_pane_location (NemoWindow *window)
2261+
{
2262+
g_return_if_fail (NEMO_IS_WINDOW (window));
2263+
g_clear_object (&window->details->secondary_pane_last_location);
2264+
}
2265+
22552266
void
22562267
nemo_window_set_sidebar_id (NemoWindow *window,
22572268
const gchar *id)

src/nemo-window.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ void nemo_window_set_ignore_meta_sort_column (NemoWindow *window, const
184184
gint nemo_window_get_ignore_meta_sort_direction (NemoWindow *window);
185185
void nemo_window_set_ignore_meta_sort_direction (NemoWindow *window, gint direction);
186186

187+
void nemo_window_clear_secondary_pane_location (NemoWindow *window);
187188
NemoWindowOpenFlags nemo_event_get_window_open_flags (void);
188189

189190
void nemo_window_slot_added (NemoWindow *window, NemoWindowSlot *slot);

0 commit comments

Comments
 (0)