GETTEXT_PACKAGE from CFlags.
This commit is contained in:
parent
258b5e9307
commit
edb0cd9cca
|
@ -1 +1 @@
|
|||
Subproject commit df96ceb0b067844d341f0405db7c10def84d772c
|
||||
Subproject commit 972b5e5d882bb590fb5eee248c92cdc13ff19c5f
|
|
@ -1,9 +1,16 @@
|
|||
extern const string GETTEXT_PACKAGE;
|
||||
|
||||
public static int main (string[] args) {
|
||||
try {
|
||||
// Custom location:
|
||||
File exec_file = File.new_for_path (Environment.find_program_in_path (args[0]));
|
||||
string settings_dir = Path.build_path (Path.DIR_SEPARATOR_S, exec_file.get_parent().get_parent().get_path(), "share/glib-2.0/schemas");
|
||||
|
||||
// l18n location:
|
||||
string localedir = Path.build_path (Path.DIR_SEPARATOR_S, exec_file.get_parent().get_parent().get_path(), "share/locale");
|
||||
Intl.bindtextdomain (GETTEXT_PACKAGE, localedir);
|
||||
Intl.bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
||||
|
||||
SettingsSchemaSource sss = new SettingsSchemaSource.from_directory (settings_dir, null, false);
|
||||
SettingsSchema schema = sss.lookup ("ws.backbone.gschema-test", false);
|
||||
if (sss.lookup == null) {
|
||||
|
@ -16,10 +23,8 @@ public static int main (string[] args) {
|
|||
// Default location: (XDG_DATA_DIRS)
|
||||
// Settings settings = new Settings ("org.example.glib-settings-schema-source");
|
||||
|
||||
|
||||
|
||||
// Output: ``Hello, earthlings``
|
||||
string greeting = settings.get_string (_("greeting"));
|
||||
string greeting = settings.get_string ("greeting");
|
||||
stdout.printf ("%s\n", greeting);
|
||||
|
||||
// Output: ``99``
|
||||
|
@ -30,8 +35,6 @@ public static int main (string[] args) {
|
|||
bool lighting = settings.get_boolean ("lighting");
|
||||
stdout.printf ("%s\n", lighting.to_string ());
|
||||
|
||||
|
||||
|
||||
// Change notification for any key in the schema
|
||||
settings.changed.connect ((key) => {
|
||||
print ("Key '%s' changed\n", key);
|
||||
|
@ -42,7 +45,6 @@ public static int main (string[] args) {
|
|||
print ("New greeting: %s\n", settings.get_string ("greeting"));
|
||||
});
|
||||
|
||||
|
||||
// Setting keys
|
||||
|
||||
// Output:
|
||||
|
@ -54,7 +56,6 @@ public static int main (string[] args) {
|
|||
settings.set_boolean ("lighting", !lighting);
|
||||
settings.set_string ("greeting", "hello, world");
|
||||
|
||||
|
||||
stdout.puts ("\nPlease start 'dconf-editor' and edit keys in /ws/backbone/gschema-test/\n");
|
||||
new MainLoop ().run ();
|
||||
} catch (Error e) {
|
||||
|
|
Loading…
Reference in New Issue