Re: .desktop parser, and xdg basedir api



Ray Strode <halfline hawaii rr com> writes:

> Hi,
> 
> A couple of months ago I talked with Havoc about a new API for
> glib that would allow users to associate .desktop files with
> their applications.  The idea was to have something like:
> 
> g_set_desktop_file(FOO_DESKTOP_FILE);
> 
> so that the various libraries the program is linked against
> can have access to the information in the .desktop file.
> I.e., glib can automatically set the prgname and application
> name based on the information in the desktop file, and
> likewise the application icon can automatically be set. Another
> complementary problem is being able to find the
> .desktop file to load it.
> 
> A few weeks ago I implemented a small .desktop parser for
> the first problem and wrote a series of functions to search
> the directories specified in the XDG base directory
> specification for the second.

Hi Ray,

Some quick random thoughts:

 * Enough people need a desktop entry parser that it's probably
   interesting to put one in glib.

 * 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.

 * There's one already a parser written in gtk/gtkiconthemeparser.c.
   You might look there for inspiration.

 * 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.

Thanks,
-Jonathan



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