Registered Categories as per Freedesktop Menu Specification 0.8

Danny Milosavljevic danny.milo at gmx.net
Mon Jan 12 02:26:06 CET 2004


Am Mon, den 12.01.2004 schrieb Danny Milosavljevic um 01:23:
> Registered Categories as per Freedesktop Menu Specification 0.8
> attached...
> 
> I wrote it in a simple editor, so don't expect it to be 100% valid xml
> :P

Ok, now it is ;)

And a parser in python to generate 
1) donelists of Categories (i. e. which Categories are implied by
another category name)
2) itemfactory paths 
out of a given input category (i.e. all possible input categories). 
attached.
(python just as a proof of concept)

This could be cached within this or another xml file to prevent doing it
over and over again, as this is fairly static.

Or some masochist implement that in C and do it on the fly ...

----
future usage in xfdesktop ("pseudo" code):
  donelists = {}  # load! key=category value=list_or_dependent_categori
  paths = {}      # load! key=category value=path_list
  parse_dentry_category(de, category, ddonecats):
     if category in ddonecats:
          return [] # already done

     if category in paths: # known category
          ppath = paths[category]
     else: # unknown, just add somewhere, maybe "/Others/%s" or so...
          ppath = ["/Others/%s" % category]

     for path in ppath: # multiple paths per desktop file
        ... the usual ...

     return donelists[category] (if any) 
     # update the donelist so that we dont do it again for a useless
category 

  parse_dentry(de):
     ddonecats = []
     for category in de.categories:
        ddonecats.append(parse_dentry_category(de, category, ddonecats))

or something.... 



-------------- next part --------------
A non-text attachment was scrubbed...
Name: xfce-registered-categories.xml
Type: text/xml
Size: 7924 bytes
Desc: not available
URL: <http://mail.xfce.org/pipermail/xfce4-dev/attachments/20040112/cc267331/attachment.xml>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cats.py
Type: text/x-python
Size: 1614 bytes
Desc: not available
URL: <http://mail.xfce.org/pipermail/xfce4-dev/attachments/20040112/cc267331/attachment.py>


More information about the Xfce4-dev mailing list