[gtk+] GtkToggleButton: Set widget state as state flags.
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] GtkToggleButton: Set widget state as state flags.
- Date: Sat, 4 Dec 2010 15:07:58 +0000 (UTC)
commit 1c2f27fe11776e1e65e9a31ca9f847446d0cb103
Author: Carlos Garnacho <carlosg gnome org>
Date: Sun Oct 31 14:45:19 2010 +0100
GtkToggleButton: Set widget state as state flags.
gtk/gtktogglebutton.c | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtktogglebutton.c b/gtk/gtktogglebutton.c
index a4979b3..4fbaad5 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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]