From c303d0b18cf0bfc713995b9dcaae782064e08725 Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Sat, 16 Apr 2011 17:12:18 +0100 Subject: [PATCH] GtkFontChooser: The spinner now updates the slider size if it is within the range --- gtk/gtkfontchooser.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/gtk/gtkfontchooser.c b/gtk/gtkfontchooser.c index 89ea2e645b..6349de21f6 100644 --- a/gtk/gtkfontchooser.c +++ b/gtk/gtkfontchooser.c @@ -304,8 +304,6 @@ icon_press_cb (GtkEntry *entry, GdkEvent *event, gpointer user_data) { - GtkFontSelectionPrivate *priv = (GtkFontSelectionPrivate*)user_data; - gtk_entry_buffer_delete_text (gtk_entry_get_buffer (entry), 0, -1); } @@ -322,7 +320,17 @@ void spin_change_cb (GtkAdjustment *adjustment, gpointer data) { GtkFontSelectionPrivate *priv = (GtkFontSelectionPrivate*)data; + + gdouble size = gtk_adjustment_get_value (adjustment); + GtkAdjustment *slider_adj = gtk_range_get_adjustment (GTK_RANGE (priv->size_slider)); + + if (size >= gtk_adjustment_get_lower (slider_adj) || + size <= gtk_adjustment_get_upper (slider_adj)) + { + gtk_adjustment_set_value (slider_adj, size); + } + priv->size = ((gint)gtk_adjustment_get_value (adjustment)) * PANGO_SCALE; } @@ -573,8 +581,8 @@ visible_func (GtkTreeModel *model, GtkTreeIter *iter, gpointer data) -1); /* Covering some corner cases to speed up the result */ - if ((font_name == NULL) || - (strlen (search_text) > strlen (font_name))) + if (font_name == NULL || + strlen (search_text) > strlen (font_name)) { g_free (font_name); return FALSE;