summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSpyridon Klouvas <spirosklouvas@protonmail.com>2019-09-01 11:31:08 +0300
committerAntónio Fernandes <antoniojpfernandes@gmail.com>2019-09-01 16:34:55 +0000
commit906c70d5aae8dccc77a3e5d947e10e5a0bba8739 (patch)
tree95a1a9d011b14e72ff7beab09e7d7e663c1a93aa
parent98f55e5bc6cd95c14240b9db752ace072d8a9f4a (diff)
downloadnautilus-906c70d5aae8dccc77a3e5d947e10e5a0bba8739.tar.gz
list-view: Collapse tree when toggling expanders
When subfolders are already expanded, if the "Allow folders to be expanded" preference is turned off, we still show the files contained by subfolders. This is a problem because it looks like they have moved to the parent directory. To fix this, always collapse all when toggling the setting. Fixes https://gitlab.gnome.org/GNOME/nautilus/issues/1195
-rw-r--r--src/nautilus-list-view.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
index 60a615366..fc92917c3 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -2100,6 +2100,17 @@ on_tree_view_drag_gesture_drag_update (GtkGestureDrag *gesture,
}
static void
+list_view_use_tree_changed_callback (gpointer callback_data)
+{
+ GtkTreeView *tree_view;
+
+ tree_view = GTK_TREE_VIEW (callback_data);
+
+ gtk_tree_view_collapse_all (tree_view);
+}
+
+
+static void
create_and_set_up_tree_view (NautilusListView *view)
{
GtkCellRenderer *cell;
@@ -2180,6 +2191,12 @@ create_and_set_up_tree_view (NautilusListView *view)
g_signal_connect_object (view->details->tree_view, "row-activated",
G_CALLBACK (row_activated_callback), view, 0);
+ g_signal_connect_object (nautilus_list_view_preferences,
+ "changed::" NAUTILUS_PREFERENCES_LIST_VIEW_USE_TREE,
+ G_CALLBACK (list_view_use_tree_changed_callback),
+ view->details->tree_view,
+ G_CONNECT_SWAPPED);
+
view->details->model = g_object_new (NAUTILUS_TYPE_LIST_MODEL, NULL);
gtk_tree_view_set_model (view->details->tree_view, GTK_TREE_MODEL (view->details->model));
/* Need the model for the dnd drop icon "accept" change */