[RESENT] menu-spec confusion

Mark McLoughlin markmc at redhat.com
Tue Nov 2 20:23:42 EET 2004


Hi,

On Tue, 2004-11-02 at 17:42, Christian Neumair wrote:
> originally sent on 2004-10-13:
> 
> Hi! I'm currently implementing a glib/gobject-based parser for
> menu-spec-compliant menus. Up to now I've successfully generated
> menu/menu-item data structs that can be easily turned into application
> GtkMenus (I've coded such a widget as well), including include/exclude
> rules and most of it works.
> Now I'm actually a bit puzzled by the menu-spec - my application menu
> contains <DefaultDirectoryDirs/>, but the subdirectories don't - should
> the children use the parent's directory dirs as well?

	Yes, subdirectories inherit their parents <DirectoryDirs> and
<AppDirs>. Its kind of hidden in the language:

  "Each directory listed in a <DirectoryDir> element will be searched
   for directory entries to be used when resolving the <Directory>
   element for this menu and its submenus."

> My current implementation tries to combine each of getenv(XDG_DATA_DIRS)
> with "desktop-directories" and menu->description (backwards, as stated
> in the spec).
> If it encounters a file named like that
> (i.e. /usr/share/desktop-directories/Applications.directory), it will
> generate a desktop item from that file. This desktop item will then be
> used by the menu containing the <DefaultDirectoryDirs/> tag.
> Therefore only my "Applications" top-level menu will scan the default
> directory dirs.
> "The <DefaultDirectoryDirs> element in a menu file indicates that this
> default list of directory entry locations should be scanned at that
> point." The phrase "at that point" made me believe that after having
> scanned it, the directory information is memory-wise discarded and only
> the matching desktop item remains, so the directory information is not
> available to the children nodes/menus. Am I wrong? Should all menus
> include <DefaultDirectoryDirs/> if no <DirectoryDir/> is encountered?

	I'm not sure I follow what you're saying, but having

  <DefaultDirectoryDirs/>

	is exactly identical to having

  <DirectoryDir>~/.local/share/desktop-directories</DirectoryDir>
  <DirectoryDir>/usr/local/share</DirectoryDir>
  <DirectoryDir>/usr/share</DirectoryDir>

	so all submenus of the <Menu> that contained <DefaultDirectoryDirs/>
should also search the default dirs.

Cheers,
Mark.




More information about the xdg mailing list