[gnome-text-editor] application: notify when style-scheme setting changes



commit 22d2500265ed4637bf1feb450db8a7221fe5f9ba
Author: Christian Hergert <chergert redhat com>
Date:   Wed Dec 1 13:57:50 2021 -0800

    application: notify when style-scheme setting changes

 src/editor-application.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
---
diff --git a/src/editor-application.c b/src/editor-application.c
index 4528734..5779ab0 100644
--- a/src/editor-application.c
+++ b/src/editor-application.c
@@ -189,6 +189,17 @@ on_style_manager_notify_dark (EditorApplication *self,
   g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_STYLE_SCHEME]);
 }
 
+static void
+on_changed_style_scheme_cb (EditorApplication *self,
+                            const char        *key,
+                            GSettings         *settings)
+{
+  g_assert (EDITOR_IS_APPLICATION (self));
+  g_assert (G_IS_SETTINGS (settings));
+
+  g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_STYLE_SCHEME]);
+}
+
 static void
 editor_application_startup (GApplication *application)
 {
@@ -372,6 +383,12 @@ editor_application_init (EditorApplication *self)
   self->settings = g_settings_new ("org.gnome.TextEditor");
   self->session = _editor_session_new ();
 
+  g_signal_connect_object (self->settings,
+                           "changed::style-scheme",
+                           G_CALLBACK (on_changed_style_scheme_cb),
+                           self,
+                           G_CONNECT_SWAPPED);
+
   editor_session_set_auto_save (self->session, TRUE);
   if (!g_settings_get_boolean (self->settings, "restore-session"))
     _editor_session_set_restore_pages (self->session, FALSE);


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