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:53:02 +0200
Owen Taylor wrote:
> Dietmar Maurer <dietmar ximian com> writes:
>
> > Owen Taylor wrote:
> >
> > > Dietmar Maurer <dietmar ximian com> writes:
> > >
> > > 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);
>
> To reiterate:
>
> * Hardcoding defaults into multiple places in the code is _evil_,
> because they _will_ get out of sync.
As you already mentioned, that default will only be used if everything else
does not work. It is not the suggested method to hardcode defaults. It is
totally pointless it that value is out of sync, since it will not be used
normally. It is only a way to make the application more robust. Anyway, if
gconf can really provide default values under all circumstances there is no
problem at all.
Another reason for providing those functions is because it was already there
in gnome_config_*, and it is also very useable to read PropertyBags associated
with Controls.
- Dietmar
_______________________________________________
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]