After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 450032 - GtkRecentAction should have defaults
GtkRecentAction should have defaults
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Class: GtkRecent
2.11.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
Emmanuele Bassi (:ebassi)
Depends on:
Blocks:
 
 
Reported: 2007-06-22 11:55 UTC by Murray Cumming
Modified: 2007-09-09 20:21 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Update documentation for GtkAction & C. (6.93 KB, patch)
2007-06-26 13:34 UTC, Emmanuele Bassi (:ebassi)
committed Details | Review

Description Murray Cumming 2007-06-22 11:55:39 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.
Comment 1 Emmanuele Bassi (:ebassi) 2007-06-22 12:24:52 UTC
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.
Comment 2 Michael Natterer 2007-06-26 12:43:15 UTC
"name" definitely doesn't fall into a category that needs defaults
or anything. It's an untranslated, application-specific identifier
for that action.
Comment 3 Murray Cumming 2007-06-26 12:49:21 UTC
Yes, but the others can have defaults.
Comment 4 Emmanuele Bassi (:ebassi) 2007-06-26 12:57:00 UTC
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.
Comment 5 Emmanuele Bassi (:ebassi) 2007-06-26 12:59:08 UTC
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.
Comment 6 Murray Cumming 2007-06-26 13:02:19 UTC
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.
Comment 7 Emmanuele Bassi (:ebassi) 2007-06-26 13:34:05 UTC
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.
Comment 8 Matthias Clasen 2007-09-09 20:21:15 UTC
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)