Re: [Vala] Settings.with_path help
- From: Chris Daley <chebizarro gmail com>
- To: Edwin De La Cruz <edwinspire gmail com>, vala-list gnome org
- Subject: Re: [Vala] Settings.with_path help
- Date: Sun, 27 Dec 2015 14:15:14 -0800
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 <edwinspire gmail com>:
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
vala-list gnome org
https://mail.gnome.org/mailman/listinfo/vala-list
--
Chris Daley
Pacific Northwest
e: chebizarro gmail com
m: +1601 980 1249
s: chebizarro
tw: chebizarro
tz: PDT
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]