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 683535 - alacarte does not respect $XDG_MENU_PREFIX
alacarte does not respect $XDG_MENU_PREFIX
Status: RESOLVED FIXED
Product: alacarte
Classification: Applications
Component: general
3.5.x
Other Linux
: Normal normal
: ---
Assigned To: Alacarte Maintainer(s)
Alacarte Maintainer(s)
: 678924 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-09-06 20:51 UTC by Dominique Leuenberger
Modified: 2012-10-15 13:42 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Attempt to fix the issue (999 bytes, patch)
2012-09-06 21:02 UTC, Dominique Leuenberger
committed Details | Review
Backport to the gnome-3-4 branch (698 bytes, patch)
2012-10-15 13:42 UTC, Pavel Roskin
none Details | Review

Description Dominique Leuenberger 2012-09-06 20:51:18 UTC
Alacarte does not respect $XDG_MENU_REFIX (env var), and as a consequence, when this variable is set, does not write to the right applications.menu file (at least not the same as gnome-shell is parsing).

As a consequence, hiding/unhiding items is not possible
Comment 1 Dominique Leuenberger 2012-09-06 21:02:28 UTC
Created attachment 223709 [details] [review]
Attempt to fix the issue
Comment 2 Matthias Clasen 2012-09-07 00:10:14 UTC
Where does that variable come from, and why should we look at it ?
This is the first time I hear about it...
Comment 3 Dominique Leuenberger 2012-09-07 07:09:52 UTC
gnome-menus knows about this sicne 2008:
http://git.gnome.org/browse/gnome-menus/commit/libmenu?id=eba974eb23195afbed3440f35a57b227a19ffe29
Comment 4 Dominique Leuenberger 2012-09-07 07:10:16 UTC
See also http://developer.gnome.org/menu-spec/
Comment 5 Matthias Clasen 2012-09-07 10:11:53 UTC
Ah, I didn't know that. What a terrible idea to use an env var for that :-(
But since it is there, alacarte should probably respect it, indeed
Comment 6 Dominique Leuenberger 2012-09-10 18:03:50 UTC
(In reply to comment #5)
> Ah, I didn't know that. What a terrible idea to use an env var for that :-(
> But since it is there, alacarte should probably respect it, indeed

Indeed... having the same behavior across the tools is the way to go (even if we consider it not the best approach... still  better than being inconsistent between our own tools)
Comment 7 Ray Strode [halfline] 2012-09-18 19:48:10 UTC
Review of attachment 223709 [details] [review]:

::: Alacarte/MenuEditor.py
@@ +25,2 @@
 class MenuEditor(object):
+    def __init__(self, name=os.environ['XDG_MENU_PREFIX'] + 'applications.menu'):

concatenating paths with "+" is a bad idea (since you might not get the / separator).  should use os.path.join.
Comment 8 Ray Strode [halfline] 2012-09-18 19:49:41 UTC
oh nevermind, i should have read the spec about what the variable is defined to be.
Comment 9 Jasper St. Pierre (not reading bugmail) 2012-09-18 19:51:48 UTC
I'd rather move the path calculation utilities into gnome-menus so that we can remove the duplicated code here.
Comment 10 Dominique Leuenberger 2012-09-26 20:34:01 UTC
*** Bug 678924 has been marked as a duplicate of this bug. ***
Comment 11 Jasper St. Pierre (not reading bugmail) 2012-10-13 02:01:17 UTC
(In reply to comment #7)
> Review of attachment 223709 [details] [review]:
> 
> ::: Alacarte/MenuEditor.py
> @@ +25,2 @@
>  class MenuEditor(object):
> +    def __init__(self, name=os.environ['XDG_MENU_PREFIX'] +
> 'applications.menu'):
> 
> concatenating paths with "+" is a bad idea (since you might not get the /
> separator).  should use os.path.join.

It's not supposed to be a subdir. It's supposed to be something like /etc/xdg/menus/xfce-applications.menu, so you'd set XDG_MENU_PREFIX to be 'xfce-'
Comment 12 Jasper St. Pierre (not reading bugmail) 2012-10-13 02:01:45 UTC
Review of attachment 223709 [details] [review]:

On second thought, this is a better solution. Commit, please.
Comment 13 Dominique Leuenberger 2012-10-13 11:00:54 UTC
JFYI: I can't commit; no access.
Comment 14 Pavel Roskin 2012-10-15 13:42:02 UTC
Created attachment 226465 [details] [review]
Backport to the gnome-3-4 branch

I backported the fix to the gnome-3-4 branch and I confirm that bug 678924 is fixed now.  New menus and items can be created under LXDE on Fedora 17.