summaryrefslogtreecommitdiff
path: root/gtk/gtkfontchooserwidget.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-12-30 00:43:34 -0500
committerMatthias Clasen <mclasen@redhat.com>2021-12-30 00:45:23 -0500
commit7000b2de8d0764655143e567349af290b0e1b6fd (patch)
treeb5ed6dce78823cba525cb47bb7794e7a4c8f5939 /gtk/gtkfontchooserwidget.c
parentdd0effe957a7dafbcc7c840ba4d49cb85c814dbf (diff)
downloadgtk+-fontchooser-selection.tar.gz
fontchooser: Fix programmatic selectionfontchooser-selection
The changes in 8caadaf4047952c30d did not work since the selection model is set to autoselect, so the first time items are added to the list, we select one. Fixes: #4564 What this commit does not fix is scrolling the selected item into view.
Diffstat (limited to 'gtk/gtkfontchooserwidget.c')
-rw-r--r--gtk/gtkfontchooserwidget.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gtk/gtkfontchooserwidget.c b/gtk/gtkfontchooserwidget.c
index 0ab9c8f228..47f8e08693 100644
--- a/gtk/gtkfontchooserwidget.c
+++ b/gtk/gtkfontchooserwidget.c
@@ -2334,10 +2334,12 @@ gtk_font_chooser_widget_merge_font_desc (GtkFontChooserWidget *fontchooser
if (mask & PANGO_FONT_MASK_SIZE)
{
double font_size = (double) pango_font_description_get_size (fontchooser->font_desc) / PANGO_SCALE;
- /* XXX: This clamps, which can cause it to reloop into here, do we need
- * to block its signal handler? */
+ g_signal_handlers_block_by_func (gtk_range_get_adjustment (GTK_RANGE (fontchooser->size_slider)), size_change_cb, fontchooser);
+ g_signal_handlers_block_by_func (gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON(fontchooser->size_spin)), size_change_cb, fontchooser);
gtk_range_set_value (GTK_RANGE (fontchooser->size_slider), font_size);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (fontchooser->size_spin), font_size);
+ g_signal_handlers_unblock_by_func (gtk_range_get_adjustment (GTK_RANGE (fontchooser->size_slider)), size_change_cb, fontchooser);
+ g_signal_handlers_unblock_by_func (gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON(fontchooser->size_spin)), size_change_cb, fontchooser);
}
if (mask & (PANGO_FONT_MASK_FAMILY | PANGO_FONT_MASK_STYLE | PANGO_FONT_MASK_VARIANT |
PANGO_FONT_MASK_WEIGHT | PANGO_FONT_MASK_STRETCH))