[gtk+] scrollbar: update style properties on GtkRange at init
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] scrollbar: update style properties on GtkRange at init
- Date: Mon, 22 Oct 2012 15:48:19 +0000 (UTC)
commit ef027c93d49e2e31ccb8c181d0096c705c141906
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Mon Oct 22 11:42:55 2012 -0400
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 files changed, 20 insertions(+), 11 deletions(-)
---
diff --git a/gtk/gtkscrollbar.c b/gtk/gtkscrollbar.c
index 541acc3..6f4f01b 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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]