Re: State across application invocation



Soeren Sandmann <sandmann daimi au dk> writes: 
> To do this we need persistency and notifications, which is something
> GConf can do. The only reason GConf currently can't be used for this
> kind of data is that it isn't guaranteed to be writable. So I suggest
> extending the gconf database with a location that is guaranteed to be
> writable - sort of a dot-file with notifications.

Personally I think we should have a nice cheesy little gnome_config
style API (cleaned up a bit), though maybe it would actually save
XML-style files (gmarkup would work), to use for this. People got
somewhat over-gung-ho about "gconf is the way" and having only one
config API, but gnome_config_ conflated two things I think are nicely
handled separately: a preferences API, and a nice simple key-value
pairs data storage API.

(For recent documents specifically, there's a proposal for a standard
file format for that to be shared across mozilla, openoffice, kde,
etc. which I'd consider important.)

So the file is something like:

 <datafile>
 <directory>
   <entry key="foo" type="string" value="hello"/>
   <entry key="bar" type="directory">
     <directory>
       <entry ...>
     </directory>
   </entry>
 </directory>
 </datafile>

Maybe even put that in glib.

The only danger here IMO is overusing the cheesy API when you really
should be using an application-specific "DTD" of some kind (e.g. the
Metacity session format or theme format are custom "DTDs").

Random API ideas:

 GDataFile *g_data_file_open (const char *filename);
 gboolean   g_data_file_save (GDataFile *df, GError **err);

 gboolean   g_data_file_get_int (GDataFile *df, const char *path, int *value);
 gboolean   g_data_file_get_string (GDataFile *df, const char *path, char **str);

Anyway, faster and simpler than gconf, but doesn't offer systemwide
defaults, or mandatory read-only settings, or notifications, or any of
that.

Havoc
_______________________________________________
gnome-hackers mailing list
gnome-hackers gnome org
http://mail.gnome.org/mailman/listinfo/gnome-hackers



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