Re: gnome-config problems



>> * The API forces me to know things I don't care about.  E.g., we
>> have gnome_config_clean_section, ..._file, and ..._key.  I think
>> there should just be one function to do the cleaning.

Miguel> The problem is that the path-parsing code gets confused: how
Miguel> is it supposed to tell appart a pathname that has multiple
Miguel> directories and a filename from a pathname with section?

Good question.  The same holds for the gnome_config_set_* functions.
If I set "/a/b/c" and then set "/a/b/c/d", what should happen?  What
if I set them in the other order?

I don't have a ready answer, I'm afraid.

One idea would be to limit the key namespace (or transform key names)
a little so that a directory and a file with the same name could
coexist.

I.e.,

	/a/b/c/d   -> the file a/b/c.conf  (key d)
	/a/b/c	   -> the file a/b.conf  (key c)

(In this example the keys would be prohibited from including "." in
the name -- or "." would be quoted somehow to avoid name clashes).

The gnome_config_clean() function would then clean recursively (or
not, depending on an argument, perhaps).  It would probably have to do
some searching of the filesystem to do the right thing.


This is just one idea.  There are other possibilities, too, I imagine.


The reason I think there should be just one API is that I want the API
to insulate me from details like files and directories.  As an
application writer, I don't much care if the data is stored in flat
files or if it is stored in one monster database.  I do care that the
API I use presents the right abstraction.  If we ever decide to move
to a database, knowledge of things like directories (even as an
abstract concept) is going to hurt us, I think.

>> * I'd really like to have a way to set/get a vector of strings.

Miguel> Oh, propose an API and I can code that :-)

void gnome_config_set_vector (const char *path, int argc,
			      const char * const *argv);
void gnome_config_get_vector (const char *path,
			      int *argc_ret, char ***argv_ret,
			      int *def);

I'm not particularly enthused about the name "_vector", but I don't
have a noticeably better suggestion.

Tom



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