Re: init clarity needed



Darin Adler <darin bentspoon com> writes: 
> > If we allow a choice here it is broken. config: should simply point to
> > GConf and apps should use config:. Apps that want something else
> > should hardcode xmldb:, but there shouldn't be special support for
> > that in GNOME, because we don't encourage it.
> 
> I am confused because I can't find an exemplar program. It seems that you can't
> call gnome_program_init without properties in the varargs part, because some
> properties are required. what exactly does using "config:" entail? Do I have to
> invent a unique URL inside the config: URL space for each program?

I believe the URLs are just config: plus the directory to "chroot" to
in GConf. So to get the full GConf namespace, you would get a Bonobo
config database object from the "config:/" moniker. If I do 
"config:/foo/bar" then that is like
gnome_config_push_prefix("/foo/bar").  I could be wrong. That's how I
understand it though.

> > For example, gnome-vfs will just call gconf_init() if it hasn't been
> > called, which is on crack, because if gconf_init() was actually needed
> > (and it really isn't), then it would be important to call gconf_init()
> > only at application startup time, so it could get argc/argv. Since
> > gconf_init() is actually useless, gnome-vfs calling it is harmless,
> > but there is no reason anyone should have to call it. I believe all
> > gconf_init() does these days is call oaf_init().
> 
> I'd love to fix this in gnome-vfs to be right. What do you think it should be
> changed to do? Always call gconf_init()? Never call gconf_init()?

First we have to fix GConf so that gconf_init() isn't required (I see
now there's one thing left other than the oaf_init()).

Then you just never call gconf_init().

gnome-vfs is doing what it has to do, just that GConf is putting it in
a broken situation by having an init function for no good reason.

It doesn't matter much, since no one is using the gconf: VFS
anyhow. ;-) I'm just using it as an example of why init functions can
be a bad idea.

Havoc





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