diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2010-11-19 19:56:25 +0100 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2010-12-04 15:39:20 +0100 |
commit | 756e20f58c59c606d3bf62e1369127fa96538b54 (patch) | |
tree | 4a98068657e7967682338fecbe9c0d633a9d4488 /gtk/gtktogglebutton.c | |
parent | 84d586043e50b833eb59bfe80d9bb267c147efb9 (diff) | |
download | gtk+-756e20f58c59c606d3bf62e1369127fa96538b54.tar.gz |
Make "button" class depend on mode for GtkToggleButtons
Diffstat (limited to 'gtk/gtktogglebutton.c')
-rw-r--r-- | gtk/gtktogglebutton.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gtk/gtktogglebutton.c b/gtk/gtktogglebutton.c index 4fbaad5622..9f67cf7e91 100644 --- a/gtk/gtktogglebutton.c +++ b/gtk/gtktogglebutton.c @@ -329,6 +329,8 @@ gtk_toggle_button_set_mode (GtkToggleButton *toggle_button, if (priv->draw_indicator != draw_indicator) { + GtkStyleContext *context; + priv->draw_indicator = draw_indicator; GTK_BUTTON (toggle_button)->priv->depress_on_activate = !draw_indicator; @@ -336,6 +338,16 @@ gtk_toggle_button_set_mode (GtkToggleButton *toggle_button, gtk_widget_queue_resize (GTK_WIDGET (toggle_button)); g_object_notify (G_OBJECT (toggle_button), "draw-indicator"); + + /* Make toggle buttons conditionally have the "button" + * class depending on draw_indicator. + */ + context = gtk_widget_get_style_context (GTK_WIDGET (toggle_button)); + + if (draw_indicator) + gtk_style_context_remove_class (context, GTK_STYLE_CLASS_BUTTON); + else + gtk_style_context_add_class (context, GTK_STYLE_CLASS_BUTTON); } } |