diff options
author | Benjamin Otte <otte@redhat.com> | 2014-08-15 16:58:39 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2014-08-16 16:34:15 +0200 |
commit | cd349dcd48c9e71d81e56a0810d0f4f5cf5e9cd7 (patch) | |
tree | af768300671f2ff55b937a29b69ae7d280e7d09b | |
parent | 65cc3630c883ef2945d5067d39b440763a379822 (diff) | |
download | gtk+-cd349dcd48c9e71d81e56a0810d0f4f5cf5e9cd7.tar.gz |
button: Handle :checked in gtktogglebutton.c
Don't try to handle it elsewhere.
-rw-r--r-- | gtk/gtkcheckbutton.c | 4 | ||||
-rw-r--r-- | gtk/gtkradiobutton.c | 11 | ||||
-rw-r--r-- | gtk/gtktogglebutton.c | 12 |
3 files changed, 7 insertions, 20 deletions
diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c index 89ce961d1e..1221200b83 100644 --- a/gtk/gtkcheckbutton.c +++ b/gtk/gtkcheckbutton.c @@ -561,15 +561,11 @@ gtk_real_check_button_draw_indicator (GtkCheckButton *check_button, state &= ~(GTK_STATE_FLAG_INCONSISTENT | GTK_STATE_FLAG_ACTIVE | - GTK_STATE_FLAG_CHECKED | GTK_STATE_FLAG_PRELIGHT); if (gtk_toggle_button_get_inconsistent (toggle_button)) state |= GTK_STATE_FLAG_INCONSISTENT; - if (gtk_toggle_button_get_active (toggle_button)) - state |= GTK_STATE_FLAG_CHECKED; - if (button->priv->activate_timeout || (button->priv->button_down && button->priv->in_button)) state |= GTK_STATE_FLAG_ACTIVE; diff --git a/gtk/gtkradiobutton.c b/gtk/gtkradiobutton.c index 131348a939..e4a01a59c9 100644 --- a/gtk/gtkradiobutton.c +++ b/gtk/gtkradiobutton.c @@ -209,8 +209,6 @@ gtk_radio_button_init (GtkRadioButton *radio_button) _gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio_button), TRUE); priv->group = g_slist_prepend (NULL, radio_button); - - gtk_widget_set_state_flags (GTK_WIDGET (radio_button), GTK_STATE_FLAG_CHECKED, TRUE); } static void @@ -815,11 +813,6 @@ gtk_radio_button_clicked (GtkButton *button) if (toggled) { - if (gtk_toggle_button_get_active (toggle_button)) - gtk_widget_set_state_flags (GTK_WIDGET (button), GTK_STATE_FLAG_CHECKED, FALSE); - else - gtk_widget_unset_state_flags (GTK_WIDGET (button), GTK_STATE_FLAG_CHECKED); - gtk_toggle_button_toggled (toggle_button); g_object_notify (G_OBJECT (toggle_button), "active"); @@ -866,15 +859,11 @@ gtk_radio_button_draw_indicator (GtkCheckButton *check_button, state &= ~(GTK_STATE_FLAG_INCONSISTENT | GTK_STATE_FLAG_ACTIVE | - GTK_STATE_FLAG_CHECKED | GTK_STATE_FLAG_PRELIGHT); if (gtk_toggle_button_get_inconsistent (toggle_button)) state |= GTK_STATE_FLAG_INCONSISTENT; - if (gtk_toggle_button_get_active (toggle_button)) - state |= GTK_STATE_FLAG_CHECKED; - if (button->priv->activate_timeout || (button->priv->button_down && button->priv->in_button)) state |= GTK_STATE_FLAG_ACTIVE; diff --git a/gtk/gtktogglebutton.c b/gtk/gtktogglebutton.c index cca85e9fbb..ba97368bdd 100644 --- a/gtk/gtktogglebutton.c +++ b/gtk/gtktogglebutton.c @@ -487,6 +487,12 @@ _gtk_toggle_button_set_active (GtkToggleButton *toggle_button, gboolean is_active) { toggle_button->priv->active = is_active; + + if (is_active) + gtk_widget_set_state_flags (GTK_WIDGET (toggle_button), GTK_STATE_FLAG_CHECKED, FALSE); + else + gtk_widget_unset_state_flags (GTK_WIDGET (toggle_button), GTK_STATE_FLAG_CHECKED); + } /** @@ -624,7 +630,7 @@ gtk_toggle_button_clicked (GtkButton *button) GtkToggleButton *toggle_button = GTK_TOGGLE_BUTTON (button); GtkToggleButtonPrivate *priv = toggle_button->priv; - priv->active = !priv->active; + _gtk_toggle_button_set_active (toggle_button, !priv->active); gtk_toggle_button_toggled (toggle_button); @@ -653,15 +659,11 @@ gtk_toggle_button_update_state (GtkButton *button) new_state = gtk_widget_get_state_flags (GTK_WIDGET (button)) & ~(GTK_STATE_FLAG_INCONSISTENT | GTK_STATE_FLAG_PRELIGHT | - GTK_STATE_FLAG_CHECKED | GTK_STATE_FLAG_ACTIVE); if (priv->inconsistent) new_state |= GTK_STATE_FLAG_INCONSISTENT; - if (priv->active) - new_state |= GTK_STATE_FLAG_CHECKED; - if (button->priv->in_button && button->priv->button_down) new_state |= GTK_STATE_FLAG_ACTIVE; |