summaryrefslogtreecommitdiff
path: root/gtk/gtktogglebutton.c
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2010-10-31 14:45:19 +0100
committerCarlos Garnacho <carlosg@gnome.org>2010-12-04 15:38:32 +0100
commit1c2f27fe11776e1e65e9a31ca9f847446d0cb103 (patch)
tree7faef7c63c7ceb5384b69045171601608a429ca9 /gtk/gtktogglebutton.c
parent80d1ce9f676f7eacf66a46cf749c20b840287124 (diff)
downloadgtk+-1c2f27fe11776e1e65e9a31ca9f847446d0cb103.tar.gz
GtkToggleButton: Set widget state as state flags.
Diffstat (limited to 'gtk/gtktogglebutton.c')
-rw-r--r--gtk/gtktogglebutton.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/gtk/gtktogglebutton.c b/gtk/gtktogglebutton.c
index a4979b3fa4..4fbaad5622 100644
--- a/gtk/gtktogglebutton.c
+++ b/gtk/gtktogglebutton.c
@@ -551,13 +551,16 @@ gtk_toggle_button_update_state (GtkButton *button)
GtkToggleButton *toggle_button = GTK_TOGGLE_BUTTON (button);
GtkToggleButtonPrivate *priv = toggle_button->priv;
gboolean depressed, touchscreen;
- GtkStateType new_state;
+ GtkStateFlags new_state = 0;
g_object_get (gtk_widget_get_settings (GTK_WIDGET (button)),
"gtk-touchscreen-mode", &touchscreen,
NULL);
if (priv->inconsistent)
+ new_state |= GTK_STATE_FLAG_INCONSISTENT;
+
+ if (priv->inconsistent)
depressed = FALSE;
else if (button->priv->in_button && button->priv->button_down)
depressed = TRUE;
@@ -565,10 +568,10 @@ gtk_toggle_button_update_state (GtkButton *button)
depressed = priv->active;
if (!touchscreen && button->priv->in_button && (!button->priv->button_down || priv->draw_indicator))
- new_state = GTK_STATE_PRELIGHT;
- else
- new_state = depressed ? GTK_STATE_ACTIVE : GTK_STATE_NORMAL;
+ new_state |= GTK_STATE_FLAG_PRELIGHT;
+ else if (depressed)
+ new_state |= GTK_STATE_FLAG_ACTIVE;
- _gtk_button_set_depressed (button, depressed);
- gtk_widget_set_state (GTK_WIDGET (toggle_button), new_state);
+ _gtk_button_set_depressed (button, depressed);
+ gtk_widget_set_state_flags (GTK_WIDGET (toggle_button), new_state, TRUE);
}