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
This commit is contained in:
Matthias Clasen 2015-03-22 01:54:08 -04:00
parent 955aed9227
commit ad05d84897

View File

@ -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);