Commit ef027c93 authored by Cosimo Cecchi's avatar Cosimo Cecchi

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 35e36b9f.

https://bugzilla.gnome.org/show_bug.cgi?id=686280
parent 247bc3ad
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment