Hola Edwin,

To use the gschema file without installing your application first, you need
to compile it.

glib-compile-schemas /path/to/set.gschema.xml

This will create a file that you can load using the following code -

var sss = new SettingsSchemaSource.from_directory("/path/to/", null, false);

var schema = sss.lookup ("org.foo.MyApp.Window", false);

GLib.Settings settings = new Settings.full (schema, null, null);

...

If you compile and install your application, the compiled gschema file will
be installed in the application's data directory under /usr/local and the
code above will not work. You will need to add a conditional compilation
switch like this:

#if RUNLOCAL

var sss = new SettingsSchemaSource.from_directory("/path/to/", null, false);

var schema = sss.lookup ("org.foo.MyApp.Window", false);

GLib.Settings settings = new Settings.full (schema, null, null);

#else

GLib.Settings settings = new Settings ("org.foo.MyApp.Window");

#endif

valac -D RUNLOCAL myapp.vala


Espero que esto te ayude,
Saludos
Chris


2015-12-27 5:38 GMT-08:00 Edwin De La Cruz <[email protected]>:

> Best regards.
> I'm trying to reproduce the example shown in xxxxxx but using
> new_with_path and failed to run, shows me the following message
>
> (process : 29989 ) : GLib - GIO -ERROR ** : Settings schema '
> set.gschema.xml ' is not installed
>
>
> xml name is set.gschema.xml and is in the same directory as the executable
> .
>
> Of example only thing I changed was the constructor
>     var settings = new Settings.with_path ( " org.foo.MyApp.Window " ,
> "/ home / edwinspire / Documents / development / vala /") ;
>
> Not how it work , I searched in google but can not find examples to help
> me.
>
> I hope you can help me , thanks.
>
>
> Mis proyectos de software libre en:
> Github - edwinspire
> _______________________________________________
> vala-list mailing list
> [email protected]
> https://mail.gnome.org/mailman/listinfo/vala-list
>



-- 
Chris Daley
Pacific Northwest

e: [email protected]
m: +1601 980 1249
s: chebizarro
tw: chebizarro
tz: PDT
_______________________________________________
vala-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to