summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2017-08-23 13:54:46 +0200
committerCarlos Garnacho <carlosg@gnome.org>2017-08-23 20:41:18 +0200
commit5fdcfa4739416aa3d7746da1faeaa6903c4b48f1 (patch)
tree0169e5886dbb6d5d3cb398595de393fa2866a0f0
parent84bcf7d4d3ec560c536f134d0dbcd0cb8ffa6e2b (diff)
downloadgtk+-5fdcfa4739416aa3d7746da1faeaa6903c4b48f1.tar.gz
fontchooser: Block row deleted signal handler when reloading model
This prevents the load_fonts() function from switching to the "no fonts" page and back when the model is reloaded. Given GtkSettings::gtk-fontconfig-timestamp is 0 on Wayland and style changes happen often, the stack change messes up popovers and pointer focus on the fonts treeview and test entry.
-rw-r--r--gtk/gtkfontchooserwidget.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gtk/gtkfontchooserwidget.c b/gtk/gtkfontchooserwidget.c
index 2777579e15..d8a8f3a42b 100644
--- a/gtk/gtkfontchooserwidget.c
+++ b/gtk/gtkfontchooserwidget.c
@@ -784,7 +784,9 @@ gtk_font_chooser_widget_load_fonts (GtkFontChooserWidget *fontchooser,
qsort (families, n_families, sizeof (PangoFontFamily *), cmp_families);
g_signal_handlers_block_by_func (priv->family_face_list, cursor_changed_cb, fontchooser);
+ g_signal_handlers_block_by_func (priv->filter_model, row_deleted_cb, fontchooser);
gtk_list_store_clear (list_store);
+ g_signal_handlers_unblock_by_func (priv->filter_model, row_deleted_cb, fontchooser);
g_signal_handlers_unblock_by_func (priv->family_face_list, cursor_changed_cb, fontchooser);
/* Iterate over families and faces */
@@ -828,6 +830,12 @@ gtk_font_chooser_widget_load_fonts (GtkFontChooserWidget *fontchooser,
memset (&priv->font_iter, 0, sizeof (GtkTreeIter));
gtk_font_chooser_widget_ensure_selection (fontchooser);
+
+ /* We block row_deleted_cb when reloading, now manually switch to the
+ * "empty" pane if the filter model is empty.
+ */
+ if (gtk_tree_model_iter_n_children (priv->filter_model, NULL) == 0)
+ gtk_stack_set_visible_child_name (GTK_STACK (priv->list_stack), "empty");
}
static gboolean