[gtk+/gtk-3-6] scale: update style properties on GtkRange at init



commit ff4a4b2c9c2cc164f8380b0384402cf0a1764f64
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Oct 22 13:13:11 2012 -0400

    scale: update style properties on GtkRange at init
    
    Same fix as in ef027c93d49e2e31ccb8c181d0096c705c141906, but for
    the GtkScale subclass of GtkRange.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=686280

 gtk/gtkscale.c |   29 +++++++++++++++++------------
 1 files changed, 17 insertions(+), 12 deletions(-)
---
diff --git a/gtk/gtkscale.c b/gtk/gtkscale.c
index 25c5a44..be388c9 100644
--- a/gtk/gtkscale.c
+++ b/gtk/gtkscale.c
@@ -221,6 +221,21 @@ gtk_scale_notify (GObject    *object,
     G_OBJECT_CLASS (gtk_scale_parent_class)->notify (object, pspec);
 }
 
+static void
+gtk_scale_update_style (GtkScale *scale)
+{
+  gint slider_length;
+  GtkRange *range;
+
+  range = GTK_RANGE (scale);
+
+  gtk_widget_style_get (GTK_WIDGET (scale),
+                        "slider-length", &slider_length,
+                        NULL);
+
+  gtk_range_set_min_slider_size (range, slider_length);
+  _gtk_scale_clear_layout (scale);
+}
 
 #define add_slider_binding(binding_set, keyval, mask, scroll)              \
   gtk_binding_entry_add_signal (binding_set, keyval, mask,                 \
@@ -492,6 +507,7 @@ gtk_scale_init (GtkScale *scale)
 
   context = gtk_widget_get_style_context (GTK_WIDGET (scale));
   gtk_style_context_add_class (context, GTK_STYLE_CLASS_SCALE);
+  gtk_scale_update_style (scale);
 }
 
 static void
@@ -1020,18 +1036,7 @@ gtk_scale_get_mark_label_size (GtkScale        *scale,
 static void
 gtk_scale_style_updated (GtkWidget *widget)
 {
-  gint slider_length;
-  GtkRange *range;
-
-  range = GTK_RANGE (widget);
-  
-  gtk_widget_style_get (widget,
-                        "slider-length", &slider_length,
-                        NULL);
-
-  gtk_range_set_min_slider_size (range, slider_length);
-
-  _gtk_scale_clear_layout (GTK_SCALE (widget));
+  gtk_scale_update_style (GTK_SCALE (widget));
 
   GTK_WIDGET_CLASS (gtk_scale_parent_class)->style_updated (widget);
 }



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