Re: GSettings child schemas



Nobody can tell me why or when to use child schemas for accessing keys instead of simply using full schema id's ?

How odd...

Geert

Op 01-03-13 13:55, Geert Janssens schreef:
Hi Osmo,

Thank you for your reply and reference to how you use GSettings. It is a nice example of how you can use child schemas.

What it still does not show me though is *why* I would want to use it.

Let me elaborate a bit on my confusion.

Broadly speaking, to get to the value of a key, you need to know where the key is in the schema. The schema defines both an id and a path. Within a given schema, keys don't have a hierarchy anymore. Hierarchy is created at the schema level.

So each key is uniquely defined by it's schema id and a key name. (ignoring relocatable schemas here for a minute). So if I want my program to get or set a certain key, those two strings are all I need.

You have taken a slightly different approach: you load a base schema and for accessing keys you seem to use the path to each key, starting from the base schema. You have set up child schemas with subpaths for this. But in the end for each key you want to access, you need the full path as well, which is roughly equivalent to knowing the schema id and key name.

So what advantage does it have to set up a hierarchical schema structure using child schemas ? Does this have something to do with relocatable schemas and if so, in what way ?

Pointers to a tutorial or more detailed explanation that helps me understand the why of child schemas are welcome.

Geert

Op 01-03-13 12:22, Osmo Antero schreef:
Hello,
I will not answer to your question directly, but I have implemented
GSettings schemas for my audio-recorder app.
It may give you some tips. Please take a look at:
http://bazaar.launchpad.net/~osmoma/audio-recorder/trunk/view/head:/src/dconf.c
However, do take grated everything is correct and optimally coded ;-)

The GNOME-desktop uses normally DConf as Gsettings backend. But that's
behind the curtains.

Bom fim de semana.
Osmo Antero


On Fri, Mar 1, 2013 at 10:45 AM, Geert Janssens <info kobaltwit be> wrote:

Hi,

I'm working on replacing GConf with GSettings in the GnuCash application.
I have read through the GSettings reference documentation and migration
guide. With that I think I can mostly manage the conversion in the code.

I'm unsure about the schema conversion though. I used
gsettings-schema-convert to automatically generate GSettings compatible
schemas from the existing GConf schemas. I notice that for some schemas the
conversion tool decided to generate schemas with child schemas.

For example, after conversion I have these two schemas defined:
<schema id="org.gnucash.general" path="/aps/gnucash/general/">
<schema id="org.gnucash.general.**register" path="/apps/gnucash/general/**
register/">

(Note: I'm aware I should not use the apps for path, but this is only
temporary during the conversion.)

The second schema is marked as a child schema of the first one.

Yet due to the way our GConf schemas were organized I also have these two
schemas:
<schema id="org.gnucash.dialogs" path="/aps/gnucash/dialogs/">
<schema id="org.gnucash.dialogs.sxs" path="/apps/gnucash/dialogs/**
scheduled_trans/">

And while they also share the same path and id prefix, the second is *not*
marked as a child schema.

I found the GSettings documentation very thin on the rationale behind
child schemas and hence I have no idea about what would be best practise
here.

Should I attempt to make the schema hierarchy complete, mark schemas as
children of others wherever I can ?
Is it illegal to have two schemas of which one is  in a subpath of the
other without it being a child schema ?
What benefit do I get from defining child schemas ?

Any advice here would be greatly appreciated.

Thanks,

Geert
______________________________**_________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
https://mail.gnome.org/**mailman/listinfo/gtk-app-**devel-list<https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list>




_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



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