forked from AuroraMiddleware/gtk
button: Handle :checked in gtktogglebutton.c
Don't try to handle it elsewhere.
This commit is contained in:
parent
65cc3630c8
commit
cd349dcd48
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user