From c2afbf795524cbbfdbbd3383c34e55f6adb01381 Mon Sep 17 00:00:00 2001 From: Soeren Sandmann Date: Sat, 24 Jan 2004 16:49:31 +0000 Subject: [PATCH] Add a write-only property ::group to be consistent with GtkRadioAction and Sat Jan 24 17:38:48 2004 Soeren Sandmann * gtk/gtkradiotoolbutton.c (gtk_radio_tool_button_class_init): Add a write-only property ::group to be consistent with GtkRadioAction and GtkRadioButton. (#132159, Patch from Olivier Andrieu) --- ChangeLog | 7 +++++ ChangeLog.pre-2-10 | 7 +++++ ChangeLog.pre-2-4 | 7 +++++ ChangeLog.pre-2-6 | 7 +++++ ChangeLog.pre-2-8 | 7 +++++ gtk/gtkradiotoolbutton.c | 64 ++++++++++++++++++++++++++++++++++++++-- 6 files changed, 97 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1d867858a4..7c4ba995bf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Sat Jan 24 17:38:48 2004 Soeren Sandmann + + * gtk/gtkradiotoolbutton.c (gtk_radio_tool_button_class_init): + Add a write-only property ::group to be consistent with + GtkRadioAction and GtkRadioButton. (#132159, Patch from Olivier + Andrieu) + Fri Jan 23 23:46:12 2004 Matthias Clasen * gtk/gtkfontbutton.c (gtk_font_button_label_use_font): Don't leak the diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 1d867858a4..7c4ba995bf 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,10 @@ +Sat Jan 24 17:38:48 2004 Soeren Sandmann + + * gtk/gtkradiotoolbutton.c (gtk_radio_tool_button_class_init): + Add a write-only property ::group to be consistent with + GtkRadioAction and GtkRadioButton. (#132159, Patch from Olivier + Andrieu) + Fri Jan 23 23:46:12 2004 Matthias Clasen * gtk/gtkfontbutton.c (gtk_font_button_label_use_font): Don't leak the diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 1d867858a4..7c4ba995bf 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,10 @@ +Sat Jan 24 17:38:48 2004 Soeren Sandmann + + * gtk/gtkradiotoolbutton.c (gtk_radio_tool_button_class_init): + Add a write-only property ::group to be consistent with + GtkRadioAction and GtkRadioButton. (#132159, Patch from Olivier + Andrieu) + Fri Jan 23 23:46:12 2004 Matthias Clasen * gtk/gtkfontbutton.c (gtk_font_button_label_use_font): Don't leak the diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 1d867858a4..7c4ba995bf 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,10 @@ +Sat Jan 24 17:38:48 2004 Soeren Sandmann + + * gtk/gtkradiotoolbutton.c (gtk_radio_tool_button_class_init): + Add a write-only property ::group to be consistent with + GtkRadioAction and GtkRadioButton. (#132159, Patch from Olivier + Andrieu) + Fri Jan 23 23:46:12 2004 Matthias Clasen * gtk/gtkfontbutton.c (gtk_font_button_label_use_font): Don't leak the diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 1d867858a4..7c4ba995bf 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,10 @@ +Sat Jan 24 17:38:48 2004 Soeren Sandmann + + * gtk/gtkradiotoolbutton.c (gtk_radio_tool_button_class_init): + Add a write-only property ::group to be consistent with + GtkRadioAction and GtkRadioButton. (#132159, Patch from Olivier + Andrieu) + Fri Jan 23 23:46:12 2004 Matthias Clasen * gtk/gtkfontbutton.c (gtk_font_button_label_use_font): Don't leak the diff --git a/gtk/gtkradiotoolbutton.c b/gtk/gtkradiotoolbutton.c index 7a332039dc..e9fb3702a1 100644 --- a/gtk/gtkradiotoolbutton.c +++ b/gtk/gtkradiotoolbutton.c @@ -24,8 +24,17 @@ #include "gtkradiobutton.h" #include "gtkintl.h" -static void gtk_radio_tool_button_init (GtkRadioToolButton *button); -static void gtk_radio_tool_button_class_init (GtkRadioToolButtonClass *klass); +enum { + PROP_0, + PROP_GROUP +}; + +static void gtk_radio_tool_button_init (GtkRadioToolButton *button); +static void gtk_radio_tool_button_class_init (GtkRadioToolButtonClass *klass); +static void gtk_radio_tool_button_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); GType gtk_radio_tool_button_get_type (void) @@ -57,11 +66,31 @@ gtk_radio_tool_button_get_type (void) static void gtk_radio_tool_button_class_init (GtkRadioToolButtonClass *klass) { + GObjectClass *object_class; GtkToolButtonClass *toolbutton_class; + object_class = (GObjectClass *)klass; toolbutton_class = (GtkToolButtonClass *)klass; + + object_class->set_property = gtk_radio_tool_button_set_property; toolbutton_class->button_type = GTK_TYPE_RADIO_BUTTON; + + /** + * GtkRadioToolButton:group: + * + * Sets a new group for a radio tool button. + * + * Since: 2.4 + */ + g_object_class_install_property (object_class, + PROP_GROUP, + g_param_spec_object ("group", + _("Group"), + _("The radio tool button whose group this button belongs to."), + GTK_TYPE_RADIO_TOOL_BUTTON, + G_PARAM_WRITABLE)); + } static void @@ -71,6 +100,37 @@ gtk_radio_tool_button_init (GtkRadioToolButton *button) gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (_gtk_tool_button_get_button (tool_button)), FALSE); } +static void +gtk_radio_tool_button_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GtkRadioToolButton *button; + + button = GTK_RADIO_TOOL_BUTTON (object); + + switch (prop_id) + { + case PROP_GROUP: + { + GtkRadioToolButton *arg; + GSList *slist = NULL; + if (G_VALUE_HOLDS_OBJECT (value)) + { + arg = GTK_RADIO_TOOL_BUTTON (g_value_get_object (value)); + if (arg) + slist = gtk_radio_tool_button_get_group (arg); + gtk_radio_tool_button_set_group (button, slist); + } + } + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + /** * gtk_radio_tool_button_new: * @group: An existing radio button group, or %NULL if you are creating a new group