From ef027c93d49e2e31ccb8c181d0096c705c141906 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Mon, 22 Oct 2012 11:42:55 -0400 Subject: scrollbar: update style properties on GtkRange at init GtkScrollbar used to rely on style-updated being emitted every time after the widget was created in order to set the right values from its style properties on GtkRange. Nowadays we try to be smarter and avoid emitting style-updated at creation time, so we need to manually initialize the GtkRange values. This fixes a regression from 35e36b9fe506143f722a00f26a86143f9c95b740. https://bugzilla.gnome.org/show_bug.cgi?id=686280 --- gtk/gtkscrollbar.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'gtk/gtkscrollbar.c') diff --git a/gtk/gtkscrollbar.c b/gtk/gtkscrollbar.c index 541acc34f7..6f4f01bcd1 100644 --- a/gtk/gtkscrollbar.c +++ b/gtk/gtkscrollbar.c @@ -115,21 +115,13 @@ gtk_scrollbar_class_init (GtkScrollbarClass *class) } static void -gtk_scrollbar_init (GtkScrollbar *scrollbar) +gtk_scrollbar_update_style (GtkScrollbar *scrollbar) { - GtkStyleContext *context; - - context = gtk_widget_get_style_context (GTK_WIDGET (scrollbar)); - gtk_style_context_add_class (context, GTK_STYLE_CLASS_SCROLLBAR); -} - -static void -gtk_scrollbar_style_updated (GtkWidget *widget) -{ - GtkRange *range = GTK_RANGE (widget); gint slider_length; gboolean fixed_size; gboolean has_a, has_b, has_c, has_d; + GtkRange *range = GTK_RANGE (scrollbar); + GtkWidget *widget = GTK_WIDGET (scrollbar); gtk_widget_style_get (widget, "min-slider-length", &slider_length, @@ -144,7 +136,24 @@ gtk_scrollbar_style_updated (GtkWidget *widget) gtk_range_set_slider_size_fixed (range, fixed_size); _gtk_range_set_steppers (range, has_a, has_b, has_c, has_d); +} + +static void +gtk_scrollbar_init (GtkScrollbar *scrollbar) +{ + GtkStyleContext *context; + + context = gtk_widget_get_style_context (GTK_WIDGET (scrollbar)); + gtk_style_context_add_class (context, GTK_STYLE_CLASS_SCROLLBAR); + gtk_scrollbar_update_style (scrollbar); +} + +static void +gtk_scrollbar_style_updated (GtkWidget *widget) +{ + GtkRange *range = GTK_RANGE (widget); + gtk_scrollbar_update_style (GTK_SCROLLBAR (widget)); GTK_WIDGET_CLASS (gtk_scrollbar_parent_class)->style_updated (widget); } -- cgit v1.2.1