diff options
-rw-r--r-- | gtk/gtkcheckbutton.c | 9 | ||||
-rw-r--r-- | gtk/gtktogglebutton.c | 12 |
2 files changed, 12 insertions, 9 deletions
diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c index 358406099b..a27290432e 100644 --- a/gtk/gtkcheckbutton.c +++ b/gtk/gtkcheckbutton.c @@ -93,18 +93,9 @@ gtk_check_button_class_init (GtkCheckButtonClass *class) static void gtk_check_button_init (GtkCheckButton *check_button) { - GtkStyleContext *context; - gtk_widget_set_has_window (GTK_WIDGET (check_button), FALSE); gtk_widget_set_receives_default (GTK_WIDGET (check_button), FALSE); gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (check_button), TRUE); - - /* Remove the "button" class added in GtkButton constructor, - * since this widget implementation doesn't look like a button - * at all. - */ - context = gtk_widget_get_style_context (GTK_WIDGET (check_button)); - gtk_style_context_remove_class (context, GTK_STYLE_CLASS_BUTTON); } GtkWidget* 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); } } |