[gtk+] togglebutton: Add a style class



commit b350779a6f49679cb7a83be22f53bacde45bd282
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Oct 29 23:04:47 2015 -0400

    togglebutton: Add a style class
    
    This lets us differentiate toggle buttons from plain buttons
    with button.toggle, without having to redo all the styling.

 gtk/gtktogglebutton.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtktogglebutton.c b/gtk/gtktogglebutton.c
index bbe764b..c4ac1d4 100644
--- a/gtk/gtktogglebutton.c
+++ b/gtk/gtktogglebutton.c
@@ -220,9 +220,14 @@ gtk_toggle_button_class_init (GtkToggleButtonClass *class)
 static void
 gtk_toggle_button_init (GtkToggleButton *toggle_button)
 {
+  GtkStyleContext *context;
+
   toggle_button->priv = gtk_toggle_button_get_instance_private (toggle_button);
   toggle_button->priv->active = FALSE;
   toggle_button->priv->draw_indicator = FALSE;
+
+  context = gtk_widget_get_style_context (GTK_WIDGET (toggle_button));
+  gtk_style_context_add_class (context, "toggle");
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]