diff options
author | Alexander Larsson <alexl@redhat.com> | 2010-11-05 14:21:24 +0100 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2010-11-05 14:25:12 +0100 |
commit | 5f62ba26930c64e358e9e917836d56d7269eeb8a (patch) | |
tree | d27bc419a81965ab38562af72038b435e728d9a5 /gtk/gtkradioaction.c | |
parent | f03481c4f296b96b269ca986ec6729640fbb8f88 (diff) | |
download | gtk+-radio-group.tar.gz |
Convert the "group" property on radio widgets to a GtkRadioGroupradio-group
The various radio widgets all have a write-only "group" property
of the same type as the widget. This let you set the group in a
bindable way, but is quite weird when we have a real GtkRadioGroup
object.
We convert this to a real read-write GtkRadioGroup type. Additionally
we make it CONSTRUCT and use it in the various constructors instead
of hand-rolling the set_group call.
Diffstat (limited to 'gtk/gtkradioaction.c')
-rw-r--r-- | gtk/gtkradioaction.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/gtk/gtkradioaction.c b/gtk/gtkradioaction.c index a0c5c31aef..35acfce76c 100644 --- a/gtk/gtkradioaction.c +++ b/gtk/gtkradioaction.c @@ -134,9 +134,9 @@ gtk_radio_action_class_init (GtkRadioActionClass *klass) PROP_GROUP, g_param_spec_object ("group", P_("Group"), - P_("The radio action whose group this action belongs to."), - GTK_TYPE_RADIO_ACTION, - GTK_PARAM_WRITABLE)); + P_("The radio group this action belongs to."), + GTK_TYPE_RADIO_GROUP, + GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT)); /** * GtkRadioAction:current-value: @@ -263,18 +263,12 @@ gtk_radio_action_set_property (GObject *object, case PROP_VALUE: radio_action->private_data->value = g_value_get_int (value); break; - case PROP_GROUP: + case PROP_GROUP: { - GtkRadioAction *arg; - GtkRadioGroup *group = NULL; - - if (G_VALUE_HOLDS_OBJECT (value)) - { - arg = GTK_RADIO_ACTION (g_value_get_object (value)); - if (arg) - group = gtk_radio_action_get_group (arg); - gtk_radio_action_set_group (radio_action, group); - } + GtkRadioGroup *group; + + group = g_value_get_object (value); + gtk_radio_action_set_group (radio_action, group); } break; case PROP_CURRENT_VALUE: @@ -299,6 +293,9 @@ gtk_radio_action_get_property (GObject *object, switch (prop_id) { + case PROP_GROUP: + g_value_set_object (value, gtk_radio_action_get_group (radio_action)); + break; case PROP_VALUE: g_value_set_int (value, radio_action->private_data->value); break; |