[gtk+] toolitemgroup: Fix initial state
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] toolitemgroup: Fix initial state
- Date: Thu, 19 Nov 2015 11:05:33 +0000 (UTC)
commit 86764aeb1cc598de4b4ec1893740c10eef8cf9b1
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Nov 19 06:04:26 2015 -0500
toolitemgroup: Fix initial state
GtkToolItemGroup starts out as non-collapsed, make the CSS node
state reflect that.
gtk/gtktoolitemgroup.c | 34 ++++++++++++++++++----------------
1 files changed, 18 insertions(+), 16 deletions(-)
---
diff --git a/gtk/gtktoolitemgroup.c b/gtk/gtktoolitemgroup.c
index e50be76..c4dbbcb 100644
--- a/gtk/gtktoolitemgroup.c
+++ b/gtk/gtktoolitemgroup.c
@@ -381,6 +381,21 @@ G_GNUC_END_IGNORE_DEPRECATIONS
}
static void
+update_arrow_state (GtkToolItemGroup *group)
+{
+ GtkToolItemGroupPrivate *priv = group->priv;
+ GtkStateFlags state;
+
+ state = gtk_widget_get_state_flags (GTK_WIDGET (group));
+
+ if (priv->collapsed)
+ state &= ~GTK_STATE_FLAG_CHECKED;
+ else
+ state |= GTK_STATE_FLAG_CHECKED;
+ gtk_css_node_set_state (priv->arrow_node, state);
+}
+
+static void
gtk_tool_item_group_init (GtkToolItemGroup *group)
{
GtkWidget *alignment;
@@ -394,6 +409,7 @@ gtk_tool_item_group_init (GtkToolItemGroup *group)
priv->children = NULL;
priv->header_spacing = DEFAULT_HEADER_SPACING;
priv->expander_size = DEFAULT_EXPANDER_SIZE;
+ priv->collapsed = DEFAULT_COLLAPSED;
priv->label_widget = gtk_label_new (NULL);
gtk_widget_set_halign (priv->label_widget, GTK_ALIGN_START);
@@ -426,6 +442,8 @@ G_GNUC_END_IGNORE_DEPRECATIONS
gtk_css_node_set_parent (priv->arrow_node, widget_node);
gtk_css_node_set_state (priv->arrow_node, gtk_css_node_get_state (widget_node));
g_object_unref (priv->arrow_node);
+
+ update_arrow_state (group);
}
static void
@@ -1288,22 +1306,6 @@ gtk_tool_item_group_style_updated (GtkWidget *widget)
}
static void
-update_arrow_state (GtkToolItemGroup *group)
-{
- GtkToolItemGroupPrivate *priv = group->priv;
- GtkStateFlags state;
-
- state = gtk_widget_get_state_flags (GTK_WIDGET (group));
-
- if (priv->collapsed)
- state &= ~GTK_STATE_FLAG_CHECKED;
- else
- state |= GTK_STATE_FLAG_CHECKED;
-
- gtk_css_node_set_state (priv->arrow_node, state);
-}
-
-static void
gtk_tool_item_group_state_flags_changed (GtkWidget *widget,
GtkStateFlags previous_flags)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]