Re: .desktop parser, and xdg basedir api

Hi Jonathan,

* There are two major use cases for desktop files.  The first is to
  read a file, extract some information, and free it.  The second is to
  open a desktop file with the intention of editing it.  In the latter
  case, you need to keep all the translations around so that you can
  write them back.  We've had performance problems in the past from
storing all the translations of a desktop file when not needed.
  It makes sense to provide two different modes of the parser when you
  create one.
Interesting points. I think you are right. Those two use cases are different enough that it makes sense to me for the parser to have options for specifying
its behavior.

* There's one already a parser written in gtk/gtkiconthemeparser.c.
  You might look there for inspiration.
Thank you. This parser made me realize a number of things that should be done
differently in my code.
- Conditionally check for LC_MESSAGES and fallback to LC_CTYPE if it isn't
- get_string and get_locale_string should automatically unescape key value's
  - a new function should be provided to get the escaped key values
  - the iconthemeparser has serialization support which my code needs
  - its parsing code was written in nice, short functions.

* Loading a file isn't the right API.  We need to use this from GNOME
  VFS, etc, and will need to feed it data.  gmarkup.c has some examples
  of code you can look at to see how to do this.
Oh I see.  Okay, I'll make it support incremental loading and provide a
_from_file convenience function on top.

I'm also going to rename the data type to GDesktopEntry (as suggested by
James Henstridge) since the code does more than parse.

I had some free time today and I have some free time tomorrow, so hopefully I'll
have an updated patch soon.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]