GNOME Bugzilla – Bug 450032
GtkRecentAction should have defaults
Last modified: 2007-09-09 20:21:15 UTC
Here is GtkRecentAction _new() function: /** * 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 * * Creates a new #GtkRecentAction object. To add the action to * a #GtkActionGroup and set the accelerator for the action, * call gtk_action_group_add_action_with_accel(). * * Return value: the newly created #GtkRecentAction. * * Since: 2.12 */ GtkAction * gtk_recent_action_new (const gchar *name, const gchar *label, const gchar *tooltip, const gchar *stock_id) But almost every single application will want to have the same name, label, and tooltip, and we should put these strings in GTK+ so they can be the same (and translated) in all applications. It's also not clear what stock_id would be appropriate. If any of these can be NULL, then that should be documented.
the stock id issue should be resolved with bug 306445 but you might want to not use stock icons. afair, every property except for "name" can be NULL; I just lifted the apidoc from GtkAction and other subclasses, but I can definitely add "or %NULL" here and everywhere else.
"name" definitely doesn't fall into a category that needs defaults or anything. It's an untranslated, application-specific identifier for that action.
Yes, but the others can have defaults.
a GtkAction with NULL "name" would be useless, since the UIManager finds actions by name; the name is a construct-only property, so it cannot be changed later either. hence, I'll add a g_return_val_if_fail (name != NULL, NULL); in the constructors for the various actions and document that the other properties can be %NULL. will attach a patch shortly.
murray: as for the name of the menu - it should be something mandated by the HIG, if not set using the stock-id (which should probably be 'Open Recent'), like the rest of the menu item names.
Well, you can choose a default and then make a suggestion for the HIG. If the HIG ends up specifying something different then you can just change it in GTK+. Thanks for the attention to detail, by the way.
Created attachment 90663 [details] [review] Update documentation for GtkAction & C. this patch fixes the documentation for GtkAction and its subclasses, specifying which constructor parameters are optional and checking that the passed action name is always non-NULL.
2007-09-09 Matthias Clasen <mclasen@redhat.com> * 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)