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




commit 1c678b11b8bfb8299c352299e18c00d8429edef6
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 9933af37c..1094c2240 100644
--- a/src/nautilus-view-icon-controller.c
+++ b/src/nautilus-view-icon-controller.c
@@ -1138,6 +1138,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)
 {
@@ -1148,6 +1154,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);
 }
 
@@ -1344,6 +1352,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]