[gtk+] fontchooser: Block row deleted signal handler when reloading model
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] fontchooser: Block row deleted signal handler when reloading model
- Date: Wed, 23 Aug 2017 18:42:05 +0000 (UTC)
commit 5fdcfa4739416aa3d7746da1faeaa6903c4b48f1
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Aug 23 13:54:46 2017 +0200
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.
gtk/gtkfontchooserwidget.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkfontchooserwidget.c b/gtk/gtkfontchooserwidget.c
index 2777579..d8a8f3a 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]