[nautilus/wip/antoniof/flow-box-preparation: 60/68] view-icon-controller: Update sorting on Preferences changes




commit fb728dcc1dca88ddb0759904f3d86a1457c9762d
Author: António Fernandes <antoniof gnome org>
Date:   Fri Dec 10 16:52:25 2021 +0000

    view-icon-controller: Update sorting on Preferences changes

 src/nautilus-view-icon-controller.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
---
diff --git a/src/nautilus-view-icon-controller.c b/src/nautilus-view-icon-controller.c
index 43e70924b..e82d0937c 100644
--- a/src/nautilus-view-icon-controller.c
+++ b/src/nautilus-view-icon-controller.c
@@ -1142,6 +1142,12 @@ action_zoom_to_level (GSimpleAction *action,
     }
 }
 
+static void
+on_default_sort_order_changed (NautilusViewIconController *self)
+{
+    update_sort_order_from_metadata_and_preferences (self);
+}
+
 static void
 dispose (GObject *object)
 {
@@ -1152,6 +1158,8 @@ dispose (GObject *object)
     g_clear_object (&self->multi_press_gesture);
     g_clear_handle_id (&self->scroll_to_file_handle_id, g_source_remove);
 
+    g_signal_handlers_disconnect_by_data (nautilus_preferences, self);
+
     G_OBJECT_CLASS (nautilus_view_icon_controller_parent_class)->dispose (object);
 }
 
@@ -1355,6 +1363,15 @@ static void
 nautilus_view_icon_controller_init (NautilusViewIconController *self)
 {
     set_click_mode_from_settings (self);
+
+    g_signal_connect_swapped (nautilus_preferences,
+                              "changed::" NAUTILUS_PREFERENCES_DEFAULT_SORT_ORDER,
+                              G_CALLBACK (on_default_sort_order_changed),
+                              self);
+    g_signal_connect_swapped (nautilus_preferences,
+                              "changed::" NAUTILUS_PREFERENCES_DEFAULT_SORT_IN_REVERSE_ORDER,
+                              G_CALLBACK (on_default_sort_order_changed),
+                              self);
 }
 
 NautilusViewIconController *


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]