Re: GConf - defaults.
- From: Dietmar Maurer <dietmar ximian com>
- To: Owen Taylor <otaylor redhat com>
- Cc: Havoc Pennington <hp redhat com>, Michael Meeks <michael ximian com>, Elliot Lee <sopwith redhat com>, gnome-hackers gnome org
- Subject: Re: GConf - defaults.
- Date: Thu, 21 Jun 2001 17:34:55 +0200
Owen Taylor wrote:
> Dietmar Maurer <dietmar ximian com> writes:
>
> > Hi Havoc,
> >
> > I do not suggest to remove the ability to get default values from the
> > configuration engine. But what do you do when:
> >
> > gconf_client_get_int (c, "user_level", ...)
> >
> > fails? Do you exit the program? I suggested to do something useful instead.
>
> Well, the problem with writing:
>
> GError *error = NULL;
>
> level = gconf_client_get_int (c, "user_level", &error);
> if (error)
> {
> level = DEFAULT_LEVEL;
> g_error_free (error);
> }
>
> is not just the problem with writing this all over the place, but it
> is also that these fall back defaults don't get used at all normally,
> so they'll rot, and may not work at all.
Why don't we simply use:
level = bonobo_pbclient_get_int_with_default (db, "user_level", 0, NULL);
> The idea proposed to deal with failures of:
>
> - corrupt (wrong type) keys in the database
> - Backend not being reachable.
>
> Is that we provide a fallback way of getting the real default values -
> reading them from the schema file directly. These means that the as
> long as the schema file is there, we have something half-way reasonable
> to provide. If the schema file isn't there, we have a hosed install,
> and exiting is probably the friendliest thing to do.
>
> In GConf, the basic idea is that by using such a fallback default, and
> providing appropriate global error handling settings, you can make
> writing:
>
> level = gconf_client_get_int (c, "user_level", NULL);
>
> the _right_ thing to do, not just a lazy thing that people will do
> anyways. I'm sure there is a translation of this idea into
> bonobo-config terms as well.
>
> Regards,
> Owen
_______________________________________________
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]