#include "gtkradiobutton.h"
#include "gtkwidgetprivate.h"
-#include "gtktogglebuttonprivate.h"
#include "gtkcheckbuttonprivate.h"
#include "gtklabel.h"
#include "gtkmarshalers.h"
gtk_widget_set_receives_default (GTK_WIDGET (radio_button), FALSE);
- _gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio_button), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio_button), TRUE);
priv->group = g_slist_prepend (NULL, radio_button);
GtkToggleButton *toggle_button = GTK_TOGGLE_BUTTON (button);
GtkToggleButton *tmp_button;
GSList *tmp_list;
- gint toggled;
-
- toggled = FALSE;
g_object_ref (GTK_WIDGET (button));
}
if (tmp_button)
- {
- toggled = TRUE;
- _gtk_toggle_button_set_active (toggle_button,
- !gtk_toggle_button_get_active (toggle_button));
- }
+ gtk_toggle_button_set_active (toggle_button,
+ !gtk_toggle_button_get_active (toggle_button));
}
else
{
- toggled = TRUE;
- _gtk_toggle_button_set_active (toggle_button,
- !gtk_toggle_button_get_active (toggle_button));
+ gtk_toggle_button_set_active (toggle_button,
+ !gtk_toggle_button_get_active (toggle_button));
tmp_list = priv->group;
while (tmp_list)
}
}
- if (toggled)
- {
- gtk_toggle_button_toggled (toggle_button);
-
- g_object_notify (G_OBJECT (toggle_button), "active");
- }
-
gtk_widget_queue_draw (GTK_WIDGET (button));
g_object_unref (button);
#include "config.h"
-#include "gtktogglebuttonprivate.h"
+#include "gtktogglebutton.h"
#include "gtkbuttonprivate.h"
#include "gtkintl.h"
*
* Sets the status of the toggle button. Set to %TRUE if you want the
* GtkToggleButton to be “pressed in”, and %FALSE to raise it.
- * This action causes the #GtkToggleButton::toggled signal and the
- * #GtkButton::clicked signal to be emitted.
+ *
+ * If the status of the button changes, this action causes the
+ * #GtkToggleButton::toggled signal to be emitted.
*/
void
gtk_toggle_button_set_active (GtkToggleButton *toggle_button,
is_active = is_active != FALSE;
- if (priv->active != is_active)
- {
- g_signal_emit_by_name (toggle_button, "clicked");
- g_object_notify_by_pspec (G_OBJECT (toggle_button), toggle_button_props[PROP_ACTIVE]);
- }
-}
-
-void
-_gtk_toggle_button_set_active (GtkToggleButton *toggle_button,
- gboolean is_active)
-{
- GtkToggleButtonPrivate *priv = gtk_toggle_button_get_instance_private (toggle_button);
+ if (priv->active == is_active)
+ return;
priv->active = is_active;
else
gtk_widget_unset_state_flags (GTK_WIDGET (toggle_button), GTK_STATE_FLAG_CHECKED);
+ gtk_toggle_button_toggled (toggle_button);
+
+ g_object_notify_by_pspec (G_OBJECT (toggle_button), toggle_button_props[PROP_ACTIVE]);
}
/**
GtkToggleButton *toggle_button = GTK_TOGGLE_BUTTON (button);
GtkToggleButtonPrivate *priv = gtk_toggle_button_get_instance_private (toggle_button);
- _gtk_toggle_button_set_active (toggle_button, !priv->active);
-
- gtk_toggle_button_toggled (toggle_button);
-
- g_object_notify_by_pspec (G_OBJECT (toggle_button), toggle_button_props[PROP_ACTIVE]);
+ gtk_toggle_button_set_active (toggle_button, !priv->active);
if (GTK_BUTTON_CLASS (gtk_toggle_button_parent_class)->clicked)
GTK_BUTTON_CLASS (gtk_toggle_button_parent_class)->clicked (button);
+++ /dev/null
-/* GTK - The GIMP Toolkit
- * Copyright (C) 2014 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#ifndef __GTK_TOGGLE_BUTTON_PRIVATE_H__
-#define __GTK_TOGGLE_BUTTON_PRIVATE_H__
-
-
-#include <gtk/gtktogglebutton.h>
-
-
-G_BEGIN_DECLS
-
-void _gtk_toggle_button_set_active (GtkToggleButton *toggle_button,
- gboolean is_active);
-
-G_END_DECLS
-
-
-#endif /* __GTK_TOGGLE_BUTTON_PRIVATE_H__ */