diff options
author | Matthias Clasen <mclasen@redhat.com> | 2015-05-06 00:52:23 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2015-05-06 00:52:23 -0400 |
commit | 07f4c9c31505f25d1bc5e436a0dd260138171646 (patch) | |
tree | adf5af45e2c0d5fbcffd357278c581d24aa4a924 /gtk/gtkfontchooserwidget.c | |
parent | 487332c458b8e6d24f00afbdf05c2ae2f615af74 (diff) | |
download | gtk+-07f4c9c31505f25d1bc5e436a0dd260138171646.tar.gz |
GtkFontChooserWidget: Listen for fontconfig changes
We were relying on indirectly getting notify when fontconfig
configuration changes, by GtkSettings translating the timestamp
change into a style-invalidation, which gets fed through the
css invalidation machinery. That machinery has gotten good enough
at optimizing away redundant changes that it no longer emits
::style-updated in this case.
So, instead make the font chooser listen directly to what it
cares about: the fontconfig change notification from GtkSettings.
Diffstat (limited to 'gtk/gtkfontchooserwidget.c')
-rw-r--r-- | gtk/gtkfontchooserwidget.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gtk/gtkfontchooserwidget.c b/gtk/gtkfontchooserwidget.c index 9e22fbc277..a991702fc1 100644 --- a/gtk/gtkfontchooserwidget.c +++ b/gtk/gtkfontchooserwidget.c @@ -46,6 +46,7 @@ #include "gtktreeselection.h" #include "gtktreeview.h" #include "gtkwidget.h" +#include "gtksettings.h" /** * SECTION:gtkfontchooserwidget @@ -96,6 +97,7 @@ struct _GtkFontChooserWidgetPrivate gpointer filter_data; GDestroyNotify filter_data_destroy; + GtkSettings *settings; guint last_fontconfig_timestamp; }; @@ -953,10 +955,20 @@ gtk_font_chooser_widget_screen_changed (GtkWidget *widget, GdkScreen *previous_screen) { GtkFontChooserWidget *fontchooser = GTK_FONT_CHOOSER_WIDGET (widget); + GtkSettings *settings; if (GTK_WIDGET_CLASS (gtk_font_chooser_widget_parent_class)->screen_changed) GTK_WIDGET_CLASS (gtk_font_chooser_widget_parent_class)->screen_changed (widget, previous_screen); + if (previous_screen) + { + settings = gtk_settings_get_for_screen (previous_screen); + g_signal_handlers_disconnect_by_func (settings, gtk_font_chooser_widget_load_fonts, widget); + } + settings = gtk_widget_get_settings (widget); + g_signal_connect_object (settings, "notify::gtk-fontconfig-timestamp", + G_CALLBACK (gtk_font_chooser_widget_load_fonts), widget, G_CONNECT_SWAPPED); + if (previous_screen == NULL) previous_screen = gdk_screen_get_default (); |