[gtk+/wip/matthiasc/node-dump] checkbutton: Update state initially



commit 0161894d026b2d9e69f43cf678adc2bce73f3a89
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Dec 28 10:24:02 2015 -0500

    checkbutton: Update state initially
    
    Without this, the check node starts out without the :dir(ltr)
    state, at least.

 gtk/gtkcheckbutton.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c
index 0dddd69..4db33a6 100644
--- a/gtk/gtkcheckbutton.c
+++ b/gtk/gtkcheckbutton.c
@@ -138,8 +138,7 @@ typedef struct {
 G_DEFINE_TYPE_WITH_PRIVATE (GtkCheckButton, gtk_check_button, GTK_TYPE_TOGGLE_BUTTON)
 
 static void
-gtk_check_button_state_flags_changed (GtkWidget     *widget,
-                                     GtkStateFlags  previous_state_flags)
+gtk_check_button_update_node_state (GtkWidget *widget)
 {
   GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (GTK_CHECK_BUTTON (widget));
   GtkCssImageBuiltinType image_type;
@@ -147,8 +146,9 @@ gtk_check_button_state_flags_changed (GtkWidget     *widget,
 
   state = gtk_widget_get_state_flags (widget);
 
-  /* XXX: This is soimewhat awkward here, but there's no better
-   * way to update the icon */
+  /* XXX: This is somewhat awkward here, but there's no better
+   * way to update the icon
+   */
   if (state & GTK_STATE_FLAG_CHECKED)
     image_type = GTK_IS_RADIO_BUTTON (widget) ? GTK_CSS_IMAGE_BUILTIN_OPTION_CHECKED : 
GTK_CSS_IMAGE_BUILTIN_CHECK_CHECKED;
   else if (state & GTK_STATE_FLAG_INCONSISTENT)
@@ -158,6 +158,13 @@ gtk_check_button_state_flags_changed (GtkWidget     *widget,
   gtk_builtin_icon_set_image (GTK_BUILTIN_ICON (priv->indicator_gadget), image_type);
   
   gtk_css_node_set_state (gtk_css_gadget_get_node (priv->indicator_gadget), state);
+}
+
+static void
+gtk_check_button_state_flags_changed (GtkWidget     *widget,
+                                     GtkStateFlags  previous_state_flags)
+{
+  gtk_check_button_update_node_state (widget);
 
   GTK_WIDGET_CLASS (gtk_check_button_parent_class)->state_flags_changed (widget, previous_state_flags);
 }
@@ -326,6 +333,8 @@ gtk_check_button_init (GtkCheckButton *check_button)
                                                  priv->gadget,
                                                  NULL);
   gtk_builtin_icon_set_default_size_property (GTK_BUILTIN_ICON (priv->indicator_gadget), "indicator-size");
+
+  gtk_check_button_update_node_state (GTK_WIDGET (check_button));
 }
 
 /**


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