[gtk+] check button: Match documented behavior



commit ac553d7e44f44e161c204a04ab8480a9b619304c
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Nov 2 23:06:57 2015 -0500

    check button: Match documented behavior
    
    We were not actually adding the style classes that the
    documentation is talking about, for the !draw-indicator case.
    Fix that.

 gtk/gtkcheckbutton.c |   25 ++++++++++++++++++++-----
 1 files changed, 20 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c
index 16f0bf2..c1963f3 100644
--- a/gtk/gtkcheckbutton.c
+++ b/gtk/gtkcheckbutton.c
@@ -169,16 +169,31 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
     {
       gtk_button_set_alignment (button, 0.0, 0.5);
       gtk_css_node_set_visible (priv->indicator_node, TRUE);
-      if (GTK_IS_CHECK_BUTTON (button))
-        gtk_css_node_set_name (widget_node, I_("checkbutton"));
-      else if (GTK_IS_RADIO_BUTTON (button))
-        gtk_css_node_set_name (widget_node, I_("radiobutton"));
+      if (GTK_IS_RADIO_BUTTON (button))
+        {
+          gtk_css_node_remove_class (widget_node, g_quark_from_static_string ("radio"));
+          gtk_css_node_set_name (widget_node, I_("radiobutton"));
+        }
+      else if (GTK_IS_CHECK_BUTTON (button))
+        {
+          gtk_css_node_remove_class (widget_node, g_quark_from_static_string ("check"));
+          gtk_css_node_set_name (widget_node, I_("checkbutton"));
+        }
     }
   else
     {
       gtk_button_set_alignment (button, 0.5, 0.5);
       gtk_css_node_set_visible (priv->indicator_node, FALSE);
-      gtk_css_node_set_name (widget_node, I_("button"));
+      if (GTK_IS_RADIO_BUTTON (button))
+        {
+          gtk_css_node_add_class (widget_node, g_quark_from_static_string ("radio"));
+          gtk_css_node_set_name (widget_node, I_("button"));
+        }
+      else if (GTK_IS_CHECK_BUTTON (button))
+        {
+          gtk_css_node_add_class (widget_node, g_quark_from_static_string ("check"));
+          gtk_css_node_set_name (widget_node, I_("button"));
+        }
     }
 G_GNUC_END_IGNORE_DEPRECATIONS
 }


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