Categories created by Alacarte not respected, custom launchers deleted

Bug #1315880 reported by OmegaPhil
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
MenuLibre
Fix Released
Undecided
OmegaPhil

Bug Description

XFCE4.10
Debian Testing.
alacarte 3.10.0-1/3.11.91 (the latter is the latest git code, which actually allows me to add a menu item properly...)
menulibre 2.0.3 (current trunk, 279b30bf8cd417aabe284c0ee0caee217996cca7)

In testing menulibre I made one edit - moved an item above another under the custom Scripts directory in my menu structure - on saving the menu, menulibre throughly broke it (according to XFCE4's Applications Menu):

o Top section of menu moved to bottom and reordered.
o All launchers I made throughout the structure deleted, custom directories 'deleted'.

I don't really care about the first point, but the second is very bad. Since I've always used alacarte, perhaps alacarte has just always done it wrong?

Alacarte does show the custom directories being present after the menulibre edit, so I guess they don't show as they no longer have any contents.

I have attached before and after menu screenshots, before and after menu XML, and alacarte screenshot showing the empty Scripts directory.

Thanks - I'm looking forward to using your program as a serious menu editor :)

Revision history for this message
OmegaPhil (omegaphil) wrote :
Revision history for this message
OmegaPhil (omegaphil) wrote :
Revision history for this message
OmegaPhil (omegaphil) wrote :
Revision history for this message
OmegaPhil (omegaphil) wrote :
Revision history for this message
OmegaPhil (omegaphil) wrote :
Revision history for this message
Garry Trethewey (garrytreth) wrote :
Pasi Lallinaho (knome)
summary: - Corruption of alacarte-maintained menu after editing with menulibre
+ Categories created by Alacarte not respected
OmegaPhil (omegaphil)
summary: - Categories created by Alacarte not respected
+ Categories created by Alacarte not respected, custom launchers deleted
Revision history for this message
OmegaPhil (omegaphil) wrote :

The title change was invalid - this is not just about a custom category, menulibre nuked ALL custom launchers too, I just tested moving an item up in the Accessories menu only to lose all custom launchers as I described over 1.5 years ago. This is serious corruption.

As this has been ignored, I'm going to see if I can do anything about it.

Revision history for this message
OmegaPhil (omegaphil) wrote :

It looks like the alacarte-made custom launchers are getting destroyed by menulibre because they don't have a Categories entry in the respective desktop file. According to the specification Categories in not mandatory (http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s05.html) - do you agree that menulibre not tolerating this is a bug?

Revision history for this message
Sean Davis (bluesabre) wrote :

Yes, I agree that this is a bug. I'll look into addressing this soon. Thanks for investigating!

Revision history for this message
OmegaPhil (omegaphil) wrote :

OK, if you haven't progressed further here by the time I finish or stall my current project (something like a week I think), I'll look into it.

Hopefully menulibre's design is not dependent on the category being present...

Revision history for this message
OmegaPhil (omegaphil) wrote :

Looking into this further, menulibre does not write Include nodes under Menu nodes, with all desktop files being added via Filename nodes under Layout.

Alacarte-made entries remain here, but due to not being explicitly included under particular named menus, GMenu merges them only under the Other category - and this is not included in the XFCE4 applications menu. util/gnome-menu-spec-test is available in the gmenu library source to get a quick output of what gmenu thinks the menu structure should be (e.g. via the Debian libgnome-menu-3-0 source package).

Subsequent reloading of the XML via menulibre's MenuEditor.py:MenuEditor.load therefore causes the entries to disappear from the named menus.

Looking at alacarte, MenuEditor.py:MenuEditor.addItem always adds an Include node when you add an entry. This feels a bit spammy, as presumably a proper category should really be used to place a menu entry normally.

Do you agree that for menu entries that don't have a category, menulibre should write out explicit Include nodes like alacarte does? If yes I'll do that and hopefully this corruption will be fixed.

Revision history for this message
OmegaPhil (omegaphil) wrote :

I saw you on #xfce-dev about a month ago and you agreed with this, now I've finally got enough time together to fight menulibre I've just managed to change an alacarte-created menu item without breaking everything :)

Basically I've added categories to the model created in MenuEditor.py:get_treestore, and updated everything in the code that references the structure (the indicies are still all hardcoded unfortunately and are used in quite a few places it seems).

In XmlMenuElementTree.py I added model_to_xml_includes to add Include nodes based off a lack of categories present, which is called as part of model_to_xml_menus etc.

Moving an alacarte-made entry up and down, fiddling with the categories, adding and deleting a launcher works.

Revision history for this message
Sean Davis (bluesabre) wrote :

I realize it's taking an inordinate amount of time to get this fixed. After a preliminary review of your patch, I'd say it looks good. I'll test it this weekend and hopefully get it rolled in. Thanks for the contribution!

Revision history for this message
Sean Davis (bluesabre) wrote :

The attached patch seems to cause some breakage with creating new directories in Menulibre. I'll see if I can adapt it to include your fixes and continue functioning correctly.

Revision history for this message
OmegaPhil (omegaphil) wrote : Re: [Bug 1315880] Re: Categories created by Alacarte not respected, custom launchers deleted

On 28/04/16 02:44, Sean Davis wrote:
> The attached patch seems to cause some breakage with creating new
> directories in Menulibre. I'll see if I can adapt it to include your
> fixes and continue functioning correctly.

OK - I'm currently working on something else, but when thats
done/stalled I can look into it if you haven't already.

Revision history for this message
OmegaPhil (omegaphil) wrote :

Right, I'm on this now - MenulibreApplication.py:MenulibreWindow.add_launcher, add_directory and add_separator needed to be reworked to take into account the new categories string in the model.

I can add a directory now (only at the top-level mind, a limitation I should look into at some point), how are you supposed to add a launcher inside a new directory? It just puts the launcher alongside it currently.

Revision history for this message
Sean Davis (bluesabre) wrote :

Currently, when a directory is selected and "Add Launcher" is clicked, the new launcher is created within the selected directory.

Revision history for this message
Sean Davis (bluesabre) wrote :

@omegaphil

I've extended your patch and included it at https://bazaar.launchpad.net/~menulibre-dev/menulibre/master/revision/336 - please test and confirm that everything looks good on your end.

Thanks!

Revision history for this message
OmegaPhil (omegaphil) wrote :

On 19/05/16 03:12, Sean Davis wrote:
> @omegaphil
>
> I've extended your patch and included it at https://bazaar.launchpad.net
> /~menulibre-dev/menulibre/master/revision/336 - please test and confirm
> that everything looks good on your end.
>
> Thanks!

OK, I have queued this up, will take a while to reach.

Revision history for this message
OmegaPhil (omegaphil) wrote :

Addition of a launcher and a top-level directory both work without imploding the menu structure.

I've PM'd you about suspicious XFCE4 menu loading failures which I don't think are the fault of menulibre.

Currently I can only create a top-level directory, then directories inside that - I can't create a directory in the default directories (e.g. 'Accessories'), probably a separate issue.

OmegaPhil (omegaphil)
Changed in menulibre:
assignee: nobody → OmegaPhil (omegaphil)
status: New → Fix Committed
Sean Davis (bluesabre)
Changed in menulibre:
milestone: none → 2.1.4
Sean Davis (bluesabre)
Changed in menulibre:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.