9.06.2008

Gnome Menu Editing - Mystery Cracked!!

After tireless questing and relentless diligence, I discovered a copy of the long lost 'Notes on menu editing in Gnome 2' from a mysterious website which vanished from the internet, http://www.redtux.demon.co.uk/docs/gnome_menu_edit_doc.20_6.html

I discovered an unexpected treasure, a hacked version of Gnome Panel which has the menu editing functions put back in gnome-panel-menu_edit-2.0.1.tar.bz2. I'm not sure yet how terribly valuable this is, but given the lack of resources in the area, it could be an invaluable key item. ..or just another useless patch.

Anyway, here's the long lost text I've been looking for in it's entirety. There's no copyright notice on it anywhere, so I would assume a generic 'in it's entirety' license, as opposed to public, if you're planning on copying it off anywhere. I'm certain I'm not the only who has gone searching for this document.. just the first to find it! :D Enjoy!

Gnome2 Menus

Notes on menu editing in Gnome2

This has been a problematic issue in gnome 2 leading to its complete removal between Gnome2 RC1 (gnome-panel-2.0.0) and gnome-panel-2.0.1 which will probably be the version in Gnome2 final.

So if you want to have panel based menu editing you will need to have gnome-panel version 2.0.0 (or my hacked version of 2.0.1 with menu editing put back in , all other packages should be fine.
The oustanding problem is dealing with gnome 1.4 desktop files.
The current spec for .desktop files depends on a Categories line in the file

Eg: Categories=Application;Network for galeon etc
In gnome 1.4 this information was provided by the sub-directory that the desktop file was in ie: for galeon the file was in Data directory/Network
In gnome2 there is a file called /etc/gnome-vfs-2.0/vfolders/application.vfolder-info (if gnome is built in a different directory prefix that to /etc), which is copied to $Home/.gnome2/vfolders when a succesful edit takes place.
This file together with the .desktop files per application and a .directory file per menu category determines the menu layout
The structure of application.vfolder-info is fairly simple



>/etc/X11/applnk/<;>

@datadir@/gnome/apps/


/usr/share/gnome/apps/



@datadir@/control-center-2.0/capplets/
@datadir@/gnome/capplets/

@datadir@/gnome/vfolders/

starts off with a list of directories to look in for .desktop files



Applications
Applications.directory

gnome-search-tool.desktop



Core


Merged





Then has a header entry defining the root menu followed by entries for each menu category eg: applications, with the display name being determined by the name field in the appropriate .directory file, which must be referenced here.
ie: for Accesories the Folder name will be Accessories referring to a file called Accesories.directory, which has a Name=Accessories field

This listing is then sorted alphabetically depending on the name field in the relevant .directory file
This is per level so sub-folders will be sorted seperately
Then the menu items are sorted in the same way depending on the name field in the ,desktop files included.




Accesories #name of menu category
Accessories.directory# in prefix/share/gnome/vfolders



Application#words to look for all words in
Utility # have to be in the file


System #cannot be in the file






additional keywords can be added inside Or brackets
These keywords which appear in the Categories line in gnome2
Desktop files determine where a menu entry appears.

I have two scripts on my http://www.redtux.demon.co.uk/docs which solve the problem by basically putting a Categories line in each legacy desktop file.

After this you just need to play around with $prefix/etc/gnome-vfs-2.0/volders/application.vfolder-info, a modified copy is at the same location.
The scripts are very simple, a bash script desktop_create1, which creates a list of files needing work, and a perl script, desktop_create which adds the line.
Both files can be amended to suit your system and taste.

Also neither do anything destructive.
Simply copy both files into the same directory.

Easy editing

(only applies to apps that generate good .desktop files and files modified by the above scripts, and not at all to gnome-panel-2.0.1)

To add menu item

Click on applications menu, move mouse to any item, right click, move mouse to entire menu , right click again, choose add new item
Fill in properties window as required

To delete menu item

Click on applications menu, move mouse to any item, right click, move mouse to entire menu , right click again, choose remove item
Fill in properties window as required

To add menu item

Click on applications menu, move mouse to any item, right click, move mouse to entire menu , choose properties
Fill in properties window as required

To move menu items

Open Nautilus
Find item you want to move to a different category, copy, move to directory entry where you want it to go, paste it.
Nautilus is liable to freeze but it works.

Hard(er) way but fullproof

Cp appropriate desktop file to your ~/.gnome2/applications/directory (or for a new one choose an appropriate file as a model) Edit the file for

Name=(descriptive name)
Type=application
Exec=(command)
Categories=Application;then other keywords from your ~/.gnome2/vfolders/application.vfolder-info

Works on all applications

Adding modifying new categories

Edit ~/.gnome2/vfolders/application.vfolder-info to taste following style of file (submenus created by nesting subfolders)
If you create a new category, create a new .directory file to match, primary location $prefix/share/vfolders/, use existing one as a model.
If you try to add,edit any old app menu item from the menu editor it will dissappear until you add the Categories field.
This works all the time, so if you want to edit menus in gnome2, this is how you do it, even if it seems a bit hacky.

Mike Martin
mike@redtux.demon.co.uk

26 June 2002

External Link

0 Comments:

Post a Comment

<< Home

Site Meter logo

Google