The way in which the GNOME Desktop implements menus enables you to do the following:
Menus in the GNOME Desktop use the following components:
The gnome-vfs file abstraction layer provides a simplified and generalized way for applications to interact with files. The file abstraction layer also provides Uniform Resource Identifier (URI) locations that map to particular menu configuration files. To add a menu or a menu item for all users, you must add the menu or menu item to one of the URI locations. The following table lists the menus that you can add items to, and the URI locations that correspond to the menus.
In general terms, a vfolder is a virtual representation of items that reside in a physical location or locations on your system. For example, a vfolder might represent the contents of several directories. A vfolder is an abstraction from one or more physical locations. In terms of menus in the GNOME Desktop, a vfolder is a representation in a menu of items that might be physically located in several directories.
A vfolder information file is an XML file that describes a vfolder. Vfolder information files specify the structure of your menus. Vfolder information files specify the names of your menus and the order in which applications appear in your menus. Vfolder information files have a .vfolder-info file extension.
The following is an excerpt from a vfolder information file:
<?xml version=”1.0”?> <VFolderInfo> . . . <Folder> <Name>Applications</Name> <Desktop>Applications.directory</Desktop> <Folder> <Name>Accessories</Name> <DontShowIfEmpty/> <Desktop>Accessories.directory</Desktop> <Query> <And> <Keyword>Application</Keyword> <Keyword>Utility</Keyword> </And> </Query> </Folder> . . . </Folder> </VFolderInfo>
The following table describes some of the elements in vfolder information files.
Table E-8 Vfolder Elements
A desktop entry file is a data file that provides information about an item in a menu. This file specifies the details for the item such as a name, a command to run, or an icon. It also contains keywords which determine the location of the item in the menu hierarchy. Desktop entry files have a .desktop file extension.
The following is a sample desktop entry file:
[Desktop Entry] Encoding=UTF-8 Name=Calculator Comment=Perform calculations Exec=gcalctool Icon=gcalctool.png Terminal=false Type=Application Categories=GNOME;Application;Utility; X-GNOME-DocPath=gcalctool/gcalctool.xml
The following table describes the most important keys in desktop entry files.
Table E-9 Desktop Entry File Keys
Desktop Entry Key |
Description |
---|---|
Encoding |
Specifies the encoding of the desktop entry file. |
Name |
Specifies the name of the item. This name is displayed on the item in the menu. |
Comment |
Specifies a short description of the item. The comment is displayed as a tooltip when you point to the item in the menu. |
Exec |
Specifies a command to execute when you select the item from the menu. |
Icon |
Specifies the filename of an icon that represents the item. Does not specify the file extension or the path to the filename. |
Terminal |
Specifies whether the command in the Exec key runs in a terminal window. If the value is True, the command runs in a terminal window. If the command does not create a window in which to run, the value of this key must be True. |
Type |
Specifies the type of item. This value is one of the following:
|
Categories |
Specifies the keywords that describe the item. The keywords are separated with semicolons (;). To view a list of the standard category keywords, see the desktop menu specification at freedesktop.org The vfolder information files map the keywords to menus. |
X-GNOME-DocPath |
Specifies the help file to display when you select Help on application-name from the menu item pop-up menu. |
For more information on the keys in desktop entry files, see the desktop entry specification at freedesktop.org.
NOTE:Panel launchers and desktop objects also use desktop entry files. These desktop entry files provide the same information as for items in a menu. For example, the desktop entry files provide the command to run when a user selects the launcher or object.
A directory entry file is a data file that provides information about a menu. The directory entry file specifies the details for the menu, such as a name, a tooltip, and an icon. Directory entry files have a .directory file extension.
The following is a sample directory entry file:
[Desktop Entry] Name=Accessories Comment=Accessories menu Icon=gnome-util.png Type=Directory
The following table describes the most important keys in directory entry files.
Table E-10 Directory Entry File Keys
You use the following GNOME Desktop components to edit menus:
When you use the file manager to add menus or menu items for all users, you must add the menu or menu item to a URI location. The table in File Abstraction Layer lists the menus that you can add items to, and the URI locations that correspond to the menus.
When you use panels to customize menus for all users, you use the menu item popup menu. For more information, see Working With Menus in the GNOME 2.6 Desktop User Guide.
You can also use menu configuration files and menu data files to customize menus.
You can add menus for all users in either of the following ways.
To add a menu for all users, perform the following steps:
In a file manager window, access the location where you want to add the menu.
For example, to add a menu to the Applications menu, type applications-all-users:/// in the Location field and then press Enter.
Click
.An untitled folder is added to the view pane. The name of the folder is selected.
Type a name for the folder, then press Enter.
The vfolder information file for the location that you accessed in Step 1 is automatically updated with the details of the new menu. The name of the folder is displayed as the name of the menu.
The next time that users log in, the menu is in the assigned location.
To add a menu for all users, perform the following steps:
Create a directory entry file for the item that you want to add.
Create the directory entry file in the /opt/gnome/share/gnome/vfolders directory. For more information on directory entry files, see Directory Entry Files.
Locate the vfolder information file for the location where you want to add the menu.
For example, to add a menu to the Applications menu, locate the file /etc/opt/gnome/gnome-vfs-2.0/vfolders/applications-all-users.vfolder-info.
In the vfolder information file, add a <Folder> element for the new menu.
For more information, see Vfolders and Menus.
The next time that users log in, the menu will be in the assigned location.
To add an item to a menu for all users:
Create a desktop entry file for the item that you want to add.
For more information, see Desktop Entry Files.
Open a file manager window, then click
to open a second file manager window.In one window, access the location where you want to add the menu item.
For example, to add a menu item to the Preferences menu, type preferences-all-users:/// in the Location field and then press Enter.
In the other window, select the desktop entry file that you created for the menu item and then drag the desktop entry file to the location where you want to add the menu item.
or
Copy the desktop entry file, then paste the file into the location where you want to add the menu item.
The next time that users log in, the menu item is in the assigned location.
To edit the properties of a menu for all users:
In a panel, open the menu that you want to edit and right-click any item in the menu.
Click
.A Launcher Properties dialog is displayed.
Modify the properties of the menu in the Launcher Properties dialog.
For more information on the elements in the Launcher Properties dialog, see Working With Panels in the GNOME 2.6 Desktop User Guide.
Click
.In a panel, open the menu that contains the item that you want to edit and right-click the item that you want to edit.
Click
.A Launcher Properties dialog is displayed.
Modify the properties of the menu item in the Launcher Properties dialog.
For more information on the elements in the Launcher Properties dialog, see Working With Panels in the GNOME 2.6 Desktop User Guide.
Click
.In a panel, open the menu that contains the item that you want to delete.
Right-click the item that you want to delete.
Click
.The next time that users log in, the menu item is not displayed in the menu.
Users cannot modify a menu if the following conditions are true:
To configure a menu so that users cannot modify the menu:
Create a vfolder information file for the menu that you want to configure in the /etc/opt/gnome/gnome-vfs-2.0/vfolders directory.
Give the vfolder information file the name of the URI location that corresponds to the menu that you want to configure.
For example, to configure the Applications menu, create a vfolder information called applications.vfolder-info in the /etc/opt/gnome/gnome-vfs-2.0/vfolders directory.
Set the permissions on the vfolder information file to read only.