[gtk+/font-chooser: 26/84] GtkFontChooser: The spinner now updates the slider size if it is within the range



commit 3c794604f735e76203311b1ed73dbcd7a4c18489
Author: Alberto Ruiz <aruiz gnome org>
Date:   Sat Apr 16 17:12:18 2011 +0100

    GtkFontChooser: The spinner now updates the slider size if it is within the range

 gtk/gtkfontchooser.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkfontchooser.c b/gtk/gtkfontchooser.c
index 89ea2e6..6349de2 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;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]