[gtk+] radio-menu-item: Allow arguments to be NULL
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] radio-menu-item: Allow arguments to be NULL
- Date: Sun, 22 Mar 2015 06:16:22 +0000 (UTC)
commit ad05d848971c8837a9a14fd04db58e9f321ca660
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Mar 22 01:54:08 2015 -0400
radio-menu-item: Allow arguments to be NULL
Some arguments, like the group and the label of a RadioMenuItem, can be
NULL: the RadioMenuItem has all the code to deal with them. The argument
validation is too strict, though, for instance doing:
return_if_fail (IS_RADIO_MENU_ITEM (foo))
if (foo != NULL)
set_foo (foo)
Which is obviously incorrect.
This commit also modifies the annotations of the API, to ensure that
language bindings do the right thing.
https://bugzilla.gnome.org/show_bug.cgi?id=671362
gtk/gtkradiomenuitem.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkradiomenuitem.c b/gtk/gtkradiomenuitem.c
index ee49423..da37120 100644
--- a/gtk/gtkradiomenuitem.c
+++ b/gtk/gtkradiomenuitem.c
@@ -284,7 +284,7 @@ gtk_radio_menu_item_new_with_mnemonic (GSList *group,
/**
* gtk_radio_menu_item_new_from_widget: (constructor)
- * @group: An existing #GtkRadioMenuItem
+ * @group: (allow-none): An existing #GtkRadioMenuItem
*
* Creates a new #GtkRadioMenuItem adding it to the same group as @group.
*
@@ -297,7 +297,7 @@ gtk_radio_menu_item_new_from_widget (GtkRadioMenuItem *group)
{
GSList *list = NULL;
- g_return_val_if_fail (GTK_IS_RADIO_MENU_ITEM (group), NULL);
+ g_return_val_if_fail (group == NULL || GTK_IS_RADIO_MENU_ITEM (group), NULL);
if (group)
list = gtk_radio_menu_item_get_group (group);
@@ -307,8 +307,8 @@ gtk_radio_menu_item_new_from_widget (GtkRadioMenuItem *group)
/**
* gtk_radio_menu_item_new_with_mnemonic_from_widget: (constructor)
- * @group: An existing #GtkRadioMenuItem
- * @label: the text of the button, with an underscore in front of the
+ * @group: (allow-none): An existing #GtkRadioMenuItem
+ * @label: (allow-none): the text of the button, with an underscore in front of the
* mnemonic character
*
* Creates a new GtkRadioMenuItem containing a label. The label will be
@@ -327,7 +327,7 @@ gtk_radio_menu_item_new_with_mnemonic_from_widget (GtkRadioMenuItem *group,
{
GSList *list = NULL;
- g_return_val_if_fail (GTK_IS_RADIO_MENU_ITEM (group), NULL);
+ g_return_val_if_fail (group == NULL || GTK_IS_RADIO_MENU_ITEM (group), NULL);
if (group)
list = gtk_radio_menu_item_get_group (group);
@@ -337,8 +337,8 @@ gtk_radio_menu_item_new_with_mnemonic_from_widget (GtkRadioMenuItem *group,
/**
* gtk_radio_menu_item_new_with_label_from_widget: (constructor)
- * @group: an existing #GtkRadioMenuItem
- * @label: the text for the label
+ * @group: (allow-none): an existing #GtkRadioMenuItem
+ * @label: (allow-none): the text for the label
*
* Creates a new GtkRadioMenuItem whose child is a simple GtkLabel.
* The new #GtkRadioMenuItem is added to the same group as @group.
@@ -353,7 +353,7 @@ gtk_radio_menu_item_new_with_label_from_widget (GtkRadioMenuItem *group,
{
GSList *list = NULL;
- g_return_val_if_fail (GTK_IS_RADIO_MENU_ITEM (group), NULL);
+ g_return_val_if_fail (group == NULL || GTK_IS_RADIO_MENU_ITEM (group), NULL);
if (group)
list = gtk_radio_menu_item_get_group (group);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]