[nautilus] list-view: Collapse tree when toggling expanders
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] list-view: Collapse tree when toggling expanders
- Date: Sun, 1 Sep 2019 16:46:34 +0000 (UTC)
commit 906c70d5aae8dccc77a3e5d947e10e5a0bba8739
Author: Spyridon Klouvas <spirosklouvas protonmail com>
Date: Sun Sep 1 11:31:08 2019 +0300
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
src/nautilus-list-view.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
---
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
@@ -2099,6 +2099,17 @@ on_tree_view_drag_gesture_drag_update (GtkGestureDrag *gesture,
nautilus_list_view_dnd_drag_begin (list_view, offset_x, offset_y, event);
}
+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)
{
@@ -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 */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]