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




commit e65fb7f9d5c65db0456ffb5a6b91c9b6898ebf71
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 e2b261f3f..5131f2653 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);
 }
 
@@ -1387,6 +1395,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]