Re: path="" (or not) in GSettings schemas

On 17/10/12 18:02, Ryan Lortie wrote:

One of the big design mistakes I made with GSettings is that this is really weird:

  <schema id="org.a11y.atspi" path="/org/a11y/atspi/">

The requirement to specify a separate path is confusing. It causes people to think that maybe the path should have a prefix like /apps/. If you manage to avoid this trap and do it properly then it is completely redundant.

Of course, it is possible to omit the path to create a relocatable schema.

  <schema id="org.a11y.atspi">

That's the crux of the mistake.

Relocatable schemas are somewhat rare in their use. The non-relocatable case is the 'ordinary one'. Ideally, the syntax (immediately) above should have been reserved to that common case.

Changing this now is a no-go, of course. There are existing applications that use the above syntax to define relocatable schemas.

I propose that we could bail ourselves out of this mess with a two-step process, as follows:

1) Start looking for a relocatable='' attribute on <schema>.  If a
   schema has no path and has not been marked as relocatable='yes' then
   emit a warning (similar to what we do for path='/apps/*' already).

2) After a year or so, assume that schemas without relocatable='yes'
   and with no path='' are schemas that wish to have a path
   automatically assigned using the expected '.' to '/' mapping.

In this way we turn:

  <schema id='a.b.c' path='/a/b/c/'>       <!-- common case -->
  <schema id='x.y.z'>                      <!-- uncommon case -->


  <schema id='a.b.c'>                      <!-- common case -->
  <schema id='x.y.z' relocatable='yes'>    <!-- uncommon case -->

Even if we don't do #2, I think doing #1 might be useful. I don't have any evidence (even anecdotal) to support the idea that the current situation is confusing but it seems that a helpful warning explaining to the user that "<schema id='a.b.c'>" doesn't mean what they think may be useful...

I remember one time when I was writing an applet and I forgot to set the path and then as a result my settings were not being saved. This cost me quite a big amount of time to figure out that the path was necessary in my specific case. So I think this is a nice proposal if it makes thing easier to use.
gtk-devel-list mailing list
gtk-devel-list gnome org

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