diff options
author | Jasmine Hassan <[email protected]> | 2012-11-20 07:21:57 +0200 |
---|---|---|
committer | Jasmine Hassan <[email protected]> | 2012-11-20 08:02:55 +0200 |
commit | d35f6594100ab023839c3c6ac9350adfd107f105 (patch) | |
tree | 34b1df60c894319a608a167334ac5dd7c5c7ce32 | |
parent | 71d1fdacecc445e7d8ca277422cf85ddd476bf7d (diff) | |
download | caja-d35f6594100ab023839c3c6ac9350adfd107f105.tar.bz2 caja-d35f6594100ab023839c3c6ac9350adfd107f105.tar.xz |
[sidebar-title] fix minor styling regression from 638df47e
1. Actually return if the widget isn't realized, not the other way around.
2. install the style properties (in class_init) before trying to use them
in _select_text_color().
This was basically adapted from code in lc-p/icon-container
-rw-r--r-- | src/caja-sidebar-title.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/caja-sidebar-title.c b/src/caja-sidebar-title.c index c7bda988..d9c780ce 100644 --- a/src/caja-sidebar-title.c +++ b/src/caja-sidebar-title.c @@ -210,12 +210,28 @@ caja_sidebar_title_finalize (GObject *object) static void caja_sidebar_title_class_init (CajaSidebarTitleClass *klass) { - g_type_class_add_private (klass, sizeof (CajaSidebarTitleDetails)); + GtkWidgetClass *widget_class; G_OBJECT_CLASS (klass)->finalize = caja_sidebar_title_finalize; - GTK_WIDGET_CLASS (klass)->size_allocate = caja_sidebar_title_size_allocate; - GTK_WIDGET_CLASS (klass)->style_set = style_set; + widget_class = GTK_WIDGET_CLASS (klass); + widget_class->size_allocate = caja_sidebar_title_size_allocate; + widget_class->style_set = style_set; + + gtk_widget_class_install_style_property (widget_class, + g_param_spec_boxed ("light_info_color", + "Light Info Color", + "Color used for information text against a dark background", + GDK_TYPE_COLOR, + G_PARAM_READABLE)); + gtk_widget_class_install_style_property (widget_class, + g_param_spec_boxed ("dark_info_color", + "Dark Info Color", + "Color used for information text against a light background", + GDK_TYPE_COLOR, + G_PARAM_READABLE)); + + g_type_class_add_private (klass, sizeof (CajaSidebarTitleDetails)); } /* return a new index title object */ @@ -240,7 +256,7 @@ caja_sidebar_title_select_text_color (CajaSidebarTitle *sidebar_title, GtkStyle *style; g_assert (CAJA_IS_SIDEBAR_TITLE (sidebar_title)); - g_return_if_fail (!gtk_widget_get_realized (GTK_WIDGET (sidebar_title))); + g_return_if_fail (gtk_widget_get_realized (GTK_WIDGET (sidebar_title))); /* read the info colors from the current theme; use a reasonable default if undefined */ gtk_widget_style_get (GTK_WIDGET (sidebar_title), |