Re: question about schema files and defaults

Hi Thomas,
	I think gnome-panel is the only other example of this dilemma. As
you've noticed, there aren't any problems when you just want to provide
on instance in the defaults, but things get messy when you want a number
of instances in the defaults.

On Sun, 2003-12-14 at 00:33, Thomas Vander Stichele wrote:

> I have a schema file that has a profile_list key, which keeps track of
> the defined profiles.  It also contains schema entries for all of the
> keys a profile is made up of.
> Now the question is - I want to provide the user with a few default
> profiles on installation time.  I also want to make sure that
> a) these are treated like any profile the user can create; ie. the user
> can delete the profile completely, change the name, values, ...
> b) on reinstall, it doesn't overwrite the customized settings.
> I see two possible ways to do this:
> 1) the schema file contains *the same list of schema entries* over and
> over for each profile, together with the chosen default values for that
> profile.  This would then work like the Default profile in
> gnome-terminal.  The drawback is that it seems ugly and redundant to
> have to specify the same information over and over, and only change the
> default value and the path for each profile we want to provide.

	This is what the panel used to do up until 2.3 and it clearly sucked. A
schema is meta-information which can be used to describe any number of
keys, so doing it this way is conceptually wrong.

> 2) Somehow GConf already has provisions for this; ie. I can make a
> schema entry apply to more than one actual key.  The schema file looks
> like this could be allowed, and it looks like I can put more than one
> <applyto> entry per <schema> section.  But does it work that way ? My
> tests seem to indicate it doesn't, and I'm not sure it's supposed to
> work.

	But you're problem is that for some of those keys the schema applies
to, you want them to have a different value right ? i.e. you'd like to
be able to write something like


	There's no recommended practice here. I can only suggest you do it the
way I did in the panel. Havoc hates that, but here you go:

  1) Treat the schemas as a "template" as you say and don't apply it to
     any keys.
  2) Install multiple profiles into the defaults database using 
     gconftool --load. Each of those keys installed this way will have
     the schema applied to it.

	Take a look at panel-default-setup.entries and how it gets installed.
You'll note that instead of installing these keys into
/apps/panel/profiles/default they get installed into
/apps/panel/default_setup. You can ignore that - that's a side effect of
the fact that the panel allows multiple profiles, screens *and* panels.

Have fun,

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