[nautilus/gnome-42] nautilus-window-slot: Open with correct view after navigating to other-locations
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/gnome-42] nautilus-window-slot: Open with correct view after navigating to other-locations
- Date: Thu, 4 Aug 2022 13:45:34 +0000 (UTC)
commit 40d37727b0ab9c39629621baba69fcf52ea352cf
Author: Corey Berla <corey berla me>
Date: Wed Jun 8 20:24:41 2022 +0000
nautilus-window-slot: Open with correct view after navigating to other-locations
When navigating to Other Locations with "Open in New Tab" or
"Open in New Window", you are always presented with the icon view
because view_mode_before_places was never initialized. An uninitialized
gint == 0 (and NAUTILUS_VIEW_GRID_ID == 0).
Initialize view_mode_before_places in init to NAUTILUS_VIEW_INVALID_ID
so that it will follow the default behavior. For best practices,
change NAUTILUS_VIEW_INVALID_ID to 0 (which would have also prevented
this issue) and NAUTILUS_VIEW_GRID_ID to 2 (matching the keyboard
shortcut).
Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2281
data/org.gnome.nautilus.gschema.xml | 2 +-
src/nautilus-view.h | 4 ++--
src/nautilus-window-slot.c | 1 +
3 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/data/org.gnome.nautilus.gschema.xml b/data/org.gnome.nautilus.gschema.xml
index 75f736e38..843f308ec 100644
--- a/data/org.gnome.nautilus.gschema.xml
+++ b/data/org.gnome.nautilus.gschema.xml
@@ -18,8 +18,8 @@
</enum>
<enum id="org.gnome.nautilus.FolderView">
- <value value="0" nick="icon-view"/>
<value value="1" nick="list-view"/>
+ <value value="2" nick="icon-view"/>
</enum>
<enum id="org.gnome.nautilus.SortOrder">
diff --git a/src/nautilus-view.h b/src/nautilus-view.h
index 677e9b53b..8a17b35de 100644
--- a/src/nautilus-view.h
+++ b/src/nautilus-view.h
@@ -25,11 +25,11 @@
#include "nautilus-toolbar-menu-sections.h"
/* Keep values in sync with the org.gnome.nautilus.FolderView schema enums: */
-#define NAUTILUS_VIEW_GRID_ID 0
#define NAUTILUS_VIEW_LIST_ID 1
+#define NAUTILUS_VIEW_GRID_ID 2
/* Special ids, not used by GSettings schemas: */
+#define NAUTILUS_VIEW_INVALID_ID 0
#define NAUTILUS_VIEW_OTHER_LOCATIONS_ID 3
-#define NAUTILUS_VIEW_INVALID_ID 4
G_BEGIN_DECLS
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index bde3337dc..3a0cf8ec4 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -1152,6 +1152,7 @@ nautilus_window_slot_init (NautilusWindowSlot *self)
nautilus_application_set_accelerators (app, "slot.search-visible", search_visible_accels);
self->view_mode_before_search = NAUTILUS_VIEW_INVALID_ID;
+ self->view_mode_before_places = NAUTILUS_VIEW_INVALID_ID;
}
#define DEBUG_FLAG NAUTILUS_DEBUG_WINDOW
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]