From 8fb6c039bbfee62cadc25238091711f2f7058985 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 9 Sep 2007 20:18:24 +0000 Subject: [PATCH] Update the documentation to mark the optional constructors parameters. The 2007-09-09 Matthias Clasen * gtk/gtkaction.c: * gtk/gtkradioaction.c: * gtk/gtkrecentaction.c: * gtk/gtktoggleaction.c: Update the documentation to mark the optional constructors parameters. The GtkAction::name property is required, instead, as it is used by GtkUIManager to find the action object from the XML. (#450032, Murray Cumming, patch by Emmanuele Bassi) svn path=/trunk/; revision=18773 --- ChangeLog | 11 +++++++++++ gtk/gtkaction.c | 25 ++++++++++++------------- gtk/gtkradioaction.c | 31 +++++++++++++++---------------- gtk/gtkrecentaction.c | 22 +++++++++++++++------- gtk/gtktoggleaction.c | 23 +++++++++++------------ 5 files changed, 64 insertions(+), 48 deletions(-) diff --git a/ChangeLog b/ChangeLog index 173c77026..c28011c4e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2007-09-09 Matthias Clasen + + * gtk/gtkaction.c: + * gtk/gtkradioaction.c: + * gtk/gtkrecentaction.c: + * gtk/gtktoggleaction.c: Update the documentation to mark + the optional constructors parameters. The GtkAction::name + property is required, instead, as it is used by GtkUIManager + to find the action object from the XML. (#450032, Murray Cumming, + patch by Emmanuele Bassi) + 2007-09-09 Matthias Clasen * modules/printbackends/lpr/gtkprintbackendlpr.c: diff --git a/gtk/gtkaction.c b/gtk/gtkaction.c index c4ef50dcb..99bfcb96d 100644 --- a/gtk/gtkaction.c +++ b/gtk/gtkaction.c @@ -414,9 +414,10 @@ gtk_action_buildable_get_name (GtkBuildable *buildable) /** * gtk_action_new: * @name: A unique name for the action - * @label: the label displayed in menu items and on buttons - * @tooltip: a tooltip for the action - * @stock_id: the stock icon to display in widgets representing the action + * @label: the label displayed in menu items and on buttons, or %NULL + * @tooltip: a tooltip for the action, or %NULL + * @stock_id: the stock icon to display in widgets representing the + * action, or %NULL * * Creates a new #GtkAction object. To add the action to a * #GtkActionGroup and set the accelerator for the action, @@ -434,16 +435,14 @@ gtk_action_new (const gchar *name, const gchar *tooltip, const gchar *stock_id) { - GtkAction *action; - - action = g_object_new (GTK_TYPE_ACTION, - "name", name, - "label", label, - "tooltip", tooltip, - "stock-id", stock_id, - NULL); - - return action; + g_return_val_if_fail (name != NULL, NULL); + + return g_object_new (GTK_TYPE_ACTION, + "name", name, + "label", label, + "tooltip", tooltip, + "stock-id", stock_id, + NULL); } static void diff --git a/gtk/gtkradioaction.c b/gtk/gtkradioaction.c index 123e310c8..b2c8adee7 100644 --- a/gtk/gtkradioaction.c +++ b/gtk/gtkradioaction.c @@ -181,11 +181,12 @@ gtk_radio_action_init (GtkRadioAction *action) /** * gtk_radio_action_new: * @name: A unique name for the action - * @label: The label displayed in menu items and on buttons - * @tooltip: A tooltip for this action - * @stock_id: The stock icon to display in widgets representing this action - * @value: The value which gtk_radio_action_get_current_value() should return - * if this action is selected. + * @label: The label displayed in menu items and on buttons, or %NULL + * @tooltip: A tooltip for this action, or %NULL + * @stock_id: The stock icon to display in widgets representing this + * action, or %NULL + * @value: The value which gtk_radio_action_get_current_value() should + * return if this action is selected. * * Creates a new #GtkRadioAction object. To add the action to * a #GtkActionGroup and set the accelerator for the action, @@ -202,17 +203,15 @@ gtk_radio_action_new (const gchar *name, const gchar *stock_id, gint value) { - GtkRadioAction *action; - - action = g_object_new (GTK_TYPE_RADIO_ACTION, - "name", name, - "label", label, - "tooltip", tooltip, - "stock-id", stock_id, - "value", value, - NULL); - - return action; + g_return_val_if_fail (name != NULL, NULL); + + return g_object_new (GTK_TYPE_RADIO_ACTION, + "name", name, + "label", label, + "tooltip", tooltip, + "stock-id", stock_id, + "value", value, + NULL); } static void diff --git a/gtk/gtkrecentaction.c b/gtk/gtkrecentaction.c index 1a8f99e75..2644459ee 100644 --- a/gtk/gtkrecentaction.c +++ b/gtk/gtkrecentaction.c @@ -688,9 +688,10 @@ gtk_recent_action_init (GtkRecentAction *action) /** * gtk_recent_action_new: * @name: a unique name for the action - * @label: the label displayed in menu items and on buttons - * @tooltip: a tooltip for the action - * @stock_id: the stock icon to display in widgets representing the action + * @label: the label displayed in menu items and on buttons, or %NULL + * @tooltip: a tooltip for the action, or %NULL + * @stock_id: the stock icon to display in widgets representing the + * action, or %NULL * * Creates a new #GtkRecentAction object. To add the action to * a #GtkActionGroup and set the accelerator for the action, @@ -706,6 +707,8 @@ gtk_recent_action_new (const gchar *name, const gchar *tooltip, const gchar *stock_id) { + g_return_val_if_fail (name != NULL, NULL); + return g_object_new (GTK_TYPE_RECENT_ACTION, "name", name, "label", label, @@ -717,10 +720,12 @@ gtk_recent_action_new (const gchar *name, /** * gtk_recent_action_new_for_manager: * @name: a unique name for the action - * @label: the label displayed in menu items and on buttons - * @tooltip: a tooltip for the action - * @stock_id: the stock icon to display in widgets representing the action - * @manager: a #GtkRecentManager or %NULL + * @label: the label displayed in menu items and on buttons, or %NULL + * @tooltip: a tooltip for the action, or %NULL + * @stock_id: the stock icon to display in widgets representing the + * action, or %NULL + * @manager: a #GtkRecentManager, or %NULL for using the default + * #GtkRecentManager * * Creates a new #GtkRecentAction object. To add the action to * a #GtkActionGroup and set the accelerator for the action, @@ -737,6 +742,9 @@ gtk_recent_action_new_for_manager (const gchar *name, const gchar *stock_id, GtkRecentManager *manager) { + g_return_val_if_fail (name != NULL, NULL); + g_return_val_if_fail (manager == NULL || GTK_IS_RECENT_MANAGER (manager), NULL); + return g_object_new (GTK_TYPE_RECENT_ACTION, "name", name, "label", label, diff --git a/gtk/gtktoggleaction.c b/gtk/gtktoggleaction.c index 941b6b796..1a1eaa082 100644 --- a/gtk/gtktoggleaction.c +++ b/gtk/gtktoggleaction.c @@ -143,9 +143,10 @@ gtk_toggle_action_init (GtkToggleAction *action) /** * gtk_toggle_action_new: * @name: A unique name for the action - * @label: The label displayed in menu items and on buttons - * @tooltip: A tooltip for the action - * @stock_id: The stock icon to display in widgets representing the action + * @label: The label displayed in menu items and on buttons, or %NULL + * @tooltip: A tooltip for the action, or %NULL + * @stock_id: The stock icon to display in widgets representing the + * action, or %NULL * * Creates a new #GtkToggleAction object. To add the action to * a #GtkActionGroup and set the accelerator for the action, @@ -161,16 +162,14 @@ gtk_toggle_action_new (const gchar *name, const gchar *tooltip, const gchar *stock_id) { - GtkToggleAction *action; + g_return_val_if_fail (name != NULL, NULL); - action = g_object_new (GTK_TYPE_TOGGLE_ACTION, - "name", name, - "label", label, - "tooltip", tooltip, - "stock-id", stock_id, - NULL); - - return action; + return g_object_new (GTK_TYPE_TOGGLE_ACTION, + "name", name, + "label", label, + "tooltip", tooltip, + "stock-id", stock_id, + NULL); } static void -- 2.43.2