[gnome-text-editor/wip/exalm/reload] preference-dialog: Reload color schemes on light/dark changes




commit 9456eec27310ee1f76429df7fab474d2bf5fbf7f
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Mon Jan 10 17:41:59 2022 +0500

    preference-dialog: Reload color schemes on light/dark changes

 src/editor-preferences-dialog.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/editor-preferences-dialog.c b/src/editor-preferences-dialog.c
index 51ba11e..04bfc1d 100644
--- a/src/editor-preferences-dialog.c
+++ b/src/editor-preferences-dialog.c
@@ -219,6 +219,7 @@ update_style_schemes (EditorPreferencesDialog *self)
   const char *current_scheme;
   gboolean is_dark;
   guint j = 0;
+  GtkWidget *child;
 
   g_assert (EDITOR_IS_PREFERENCES_DIALOG (self));
 
@@ -270,6 +271,9 @@ update_style_schemes (EditorPreferencesDialog *self)
       g_array_sort (schemes, sort_schemes_cb);
     }
 
+  while ((child = gtk_widget_get_first_child (GTK_WIDGET (self->scheme_group))))
+    gtk_flow_box_remove (self->scheme_group, child);
+
   for (guint i = 0; i < schemes->len; i++)
     {
       const SchemeInfo *info = &g_array_index (schemes, SchemeInfo, i);
@@ -457,8 +461,8 @@ editor_preferences_dialog_init (EditorPreferencesDialog *self)
 
   style_manager = adw_style_manager_get_default ();
   g_signal_connect_object (style_manager,
-                           "notify::color-scheme",
-                           G_CALLBACK (update_style_scheme_selection),
+                           "notify::dark",
+                           G_CALLBACK (update_style_schemes),
                            self,
                            G_CONNECT_SWAPPED);
 }


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