Desktop files that have "OnlyShowIn=XFCE;" should use the GenericName= field in place of Name= if GenericName= is present. This cleans up the Settings menu ("Xfce 4 Blah Settings" -> "Blah Settings") for a lot of stuff. For the case where there's a Name[xx]= line for the current locale, but no corresponding GenericName[xx]= line, Name[xx]= should be used. I'm also leaning toward showing GenericName for desktop files that have X-XFCE in Categories as well, but I'm not sure about that. At minimum, the first two paragraphs should be implemented. Alternately, if you don't want to 'force' a choice, at least provide an accessor for GenericName, and perhaps convenience API, e.g.: gboolean xfce_menu_item_has_category(XfceMenuItem *, const gchar *); ... to test whether or not an XfceMenuItem has a particular category (so I can be lazy and not have to use _get_categories()).
You're right, I don't like to force a certain behaviour unless it follows the menu standard. But of course I'm fine with adding _get_generic_name() and _has_category() methods.
Is there some way to tell about localisation? As I said, I'd like it to prefer a translated Name= over an untranslated GenericName=, though I suppose that's not critical (you could consider it an incomplete translation bug in the app providing the desktop file). I guess I'd be fine taking the lazy way out and punting this back to the app author.
Revision 26500: * libxfce4menu/xfce-menu-item.{c,h}: Add support for "GenericName" as requested by Brian. Also add a convenience function xfce_menu_item_has_category (XfceMenuItem *, const char *).
And yeah, if translations are missing, just blame the author of the .desktop file. libxfce4menu uses XfceRc which handles i18n internally. Working around missing translations just messes things up.
Hmm, one more thing. I'd like to use GenericName if _has_category("X-XFCE"), or if OnlyShowIn=XFCE;. Right now I can't tell if the OnlyShowIn key is actually present. Any thoughts?
I've committed a new function to libxfce4menu in revision 27630. This might be exactly what you need: * libxfce4menu/xfce-menu-item.{c,h}: Add xfce_menu_item_only_show_in_environment() function which checks whether the current environment is present in the OnlyShowIn key of a menu item. This should close bug #3741.
Is this one still valid, now that we only use Name= in the settings desktop entries?
Well it's fixed regardless... I'd still like to see the sorting issue fixed, tho.