[gtkada] configuration files

Stephen Leake stephen_leake at acm.org
Mon May 27 23:43:43 CEST 2002


Jacob Sparre Andersen <sparre at nbi.dk> writes:

> Stephen Leake wrote:
> 
> > I'm writing an application that needs to store some
> > configuation info; a database connection name, user
> > name, stuff like that.
> > 
> > Is there a recommended package to use with Gtk?
> 
> I have not run into one yes, but there really should be one.

Ok.

> And I suspect that the proper implementation for MS-Windows would
> use the "registry", where as it for Unix certainly should use "dot
> files".

Actually, for Windows I'd prefer an "ini" file. There are routines in
Windex (my Win32 binding) for that (Windows officially calls them
"profile" files). I prefer that over the registry because it is easier
to maintain many copies. For example, one "ini" file for my Science
Fiction books database, one for my wife's child therapy database, etc.

For the same reason, I would like to not use "dot files" on Unix.
These are not "personal preferences", they are "application settings".
They should be bound to the application, not the user.

I guess you can do the same thing with the registry, but I haven't
seen it done that way. And it is much easier to backup an ini file
than the registry.

Of course, if we can come up with one interface to both kinds of
files, that would be good. The Windows "ini" file interface is
actually both; if you specify a file name and directory, that is used,
but the default is the Windows directory and win.ini.

> If you do not find a general package for this purpose, then you can
> count me in as a volunteer to help deciding on a package
> specification and to help implementing a Unix version of the
> package.

Let's take the Windex Profiles API as a starting point:

http://users.erols.com/leakstan/Stephe/Ada/Windex_Packages/index.htm

file windex-profiles.ads

I believe that can easily be implemented on any file system.

It would be nice to have a standard file syntax, as well as a standard
API, so I can bundle a default or example profile file with an app,
and it would work for any OS.

-- 
-- Stephe





More information about the gtkada mailing list