Re: GSettings and you



On Wed, 2010-04-21 at 18:24 -0400, Matthias Clasen wrote:
> On Wed, Apr 21, 2010 at 6:04 PM, Shaun McCance
> 
> > How do I use the keyfile backend? 'export GSETTINGS_BACKEND=keyfile'
> > gives me this:
> >
> > Can't find GSettings backend 'keyfile' given in GSETTINGS_BACKEND
> > environment variable
> >
> > I don't have anything under $libdir/gio/modules. Did I miss something?
> 
> The keyfile backend is built in, that is why it doesn't show up in the
> modules dir. But it is not really meant to be used in that 'global'
> fashion by setting the env var. Instead, you can use it for selected
> schemas, by doing the following:
> 
> g_settings_backend_setup_keyfile ("blah", filename);
> settings = g_settings_new_with_context ("org.bla.bla", "blah");
> 
> After that, settings that you get or set with that settings object
> will be backed by the keyfile named filename. Note that you still need
> to have an installed schema for "org.bla.bla".

Ah, thanks for the clarification. For Yelp 3, I'm not
particularly worried about GConf compatibility, but I
do want it to work outside of GNOME. So I'd like it to
use the keyfile backend if GNOME (or something else)
isn't providing a backend.

Is this the sane thing to do then?

if (g_getenv ("GSETTINGS_BACKEND"))
  settings = g_settings_new ("org.gnome.yelp");
else {
  g_settings_backend_setup_keyfile ("blah", filename);
  settings = g_settings_new_with_context ("org.gnome.yelp", "blah");
}

-- 
Shaun McCance
http://syllogist.net/



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