summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2018-08-20 16:51:53 +0200
committerTimm Bäder <mail@baedert.org>2018-08-25 08:05:48 +0200
commit016de68ceb367cb115cf272efd3bd54f077d1a3e (patch)
tree132451ff7ea684f7ebcb6629e45c0e97917f1592 /gtk
parentd2178bcb947159a587c9c4b9d9054c69943534fd (diff)
downloadgtk+-016de68ceb367cb115cf272efd3bd54f077d1a3e.tar.gz
radiobutton: Save signal IDs like everything else
Diffstat (limited to 'gtk')
-rw-r--r--gtk/gtkradiobutton.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/gtk/gtkradiobutton.c b/gtk/gtkradiobutton.c
index 94285ed2a6..fa40d83f76 100644
--- a/gtk/gtkradiobutton.c
+++ b/gtk/gtkradiobutton.c
@@ -140,7 +140,13 @@ enum {
LAST_PROP
};
+enum {
+ GROUP_CHANGED,
+ N_SIGNALS
+};
+
static GParamSpec *radio_button_props[LAST_PROP] = { NULL, };
+static guint signals[N_SIGNALS] = { 0 };
static void gtk_radio_button_destroy (GtkWidget *widget);
static gboolean gtk_radio_button_focus (GtkWidget *widget,
@@ -157,8 +163,6 @@ static void gtk_radio_button_get_property (GObject *object,
G_DEFINE_TYPE_WITH_PRIVATE (GtkRadioButton, gtk_radio_button, GTK_TYPE_CHECK_BUTTON)
-static guint group_changed_signal = 0;
-
static void
gtk_radio_button_class_init (GtkRadioButtonClass *class)
{
@@ -205,13 +209,13 @@ gtk_radio_button_class_init (GtkRadioButtonClass *class)
* more buttons to a different one, but not when the composition
* of the group that a button belongs to changes.
*/
- group_changed_signal = g_signal_new (I_("group-changed"),
- G_OBJECT_CLASS_TYPE (gobject_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GtkRadioButtonClass, group_changed),
- NULL, NULL,
- NULL,
- G_TYPE_NONE, 0);
+ signals[GROUP_CHANGED] = g_signal_new (I_("group-changed"),
+ G_OBJECT_CLASS_TYPE (gobject_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GtkRadioButtonClass, group_changed),
+ NULL, NULL,
+ NULL,
+ G_TYPE_NONE, 0);
gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_RADIO_BUTTON_ACCESSIBLE);
gtk_widget_class_set_css_name (widget_class, I_("radiobutton"));
@@ -340,15 +344,15 @@ gtk_radio_button_set_group (GtkRadioButton *radio_button,
g_object_ref (radio_button);
g_object_notify_by_pspec (G_OBJECT (radio_button), radio_button_props[PROP_GROUP]);
- g_signal_emit (radio_button, group_changed_signal, 0);
+ g_signal_emit (radio_button, signals[GROUP_CHANGED], 0);
if (old_group_singleton)
{
- g_signal_emit (old_group_singleton, group_changed_signal, 0);
+ g_signal_emit (old_group_singleton, signals[GROUP_CHANGED], 0);
g_object_unref (old_group_singleton);
}
if (new_group_singleton)
{
- g_signal_emit (new_group_singleton, group_changed_signal, 0);
+ g_signal_emit (new_group_singleton, signals[GROUP_CHANGED], 0);
g_object_unref (new_group_singleton);
}
@@ -604,9 +608,9 @@ gtk_radio_button_destroy (GtkWidget *widget)
priv->group = NULL;
if (old_group_singleton)
- g_signal_emit (old_group_singleton, group_changed_signal, 0);
+ g_signal_emit (old_group_singleton, signals[GROUP_CHANGED], 0);
if (was_in_group)
- g_signal_emit (radio_button, group_changed_signal, 0);
+ g_signal_emit (radio_button, signals[GROUP_CHANGED], 0);
GTK_WIDGET_CLASS (gtk_radio_button_parent_class)->destroy (widget);
}