From a8aff6ef8f54552cab53f99b093f441a5be093a8 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 30 Oct 2017 09:04:09 -0400 Subject: [PATCH] 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 file changed, 19 insertions(+) diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c index a7b0c7952e..fdf7b572b2 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);