[gtk+/wip/matthiasc/gdk-settings: 6/12] gtk: Connect to GdkDisplay::setting-changed



commit a8aff6ef8f54552cab53f99b093f441a5be093a8
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Oct 30 09:04:09 2017 -0400

    gtk: Connect to GdkDisplay::setting-changed
    
    We still handle the setting event, for now.
    That will be removed in a future commit.

 gtk/gtksettings.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c
index a7b0c79..fdf7b57 100644
--- a/gtk/gtksettings.c
+++ b/gtk/gtksettings.c
@@ -1192,6 +1192,23 @@ settings_init_style (GtkSettings *settings)
   settings_update_key_theme (settings);
 }
 
+static void
+setting_changed (GdkDisplay       *display,
+                 const char       *name,
+                 gpointer          data)
+{
+  GtkSettings *settings = data;
+  GParamSpec *pspec;
+
+  pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (settings), name);
+
+  if (!pspec)
+    return;
+
+  if (settings_update_xsetting (settings, pspec, TRUE))
+    g_object_notify_by_pspec (G_OBJECT (settings), pspec);
+}
+
 static GtkSettings *
 gtk_settings_create_for_display (GdkDisplay *display)
 {
@@ -1218,6 +1235,8 @@ gtk_settings_create_for_display (GdkDisplay *display)
 
   settings->priv->screen = gdk_display_get_default_screen (display);
 
+  g_signal_connect_object (display, "setting-changed", G_CALLBACK (setting_changed), settings, 0);
+
   v.display = display;
   v.settings = settings;
   g_array_append_val (display_settings, v);


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