[nautilus/gtk4-preparation-trunk: 12/84] view-icon-controller: Update sorting on Preferences changes




commit be8fd4272964e627791b335442590f975b560635
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 ee9feffed..6a4bf05c0 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]