summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2012-07-10 14:16:48 -0400
committerRyan Lortie <desrt@desrt.ca>2012-07-10 14:19:43 -0400
commitb1cf066711a06526e66bd0b271ec49c9416add9d (patch)
tree38c58426c6898029e5743964264cdf082e13aba6
parent77d9ae4b75e6811470ddbb577f25acb03f3b1506 (diff)
downloaddconf-b1cf066711a06526e66bd0b271ec49c9416add9d.tar.gz
Fix up the "changed" signal for Vala
Fix the vapi file to properly describe the changed signal (including the possibility of NULL tag). Change the dconf tool's implementation of the signal handler (and simplify it due to the changed semantics of the signal). Do the same for the editor.
-rw-r--r--bin/dconf.vala21
-rw-r--r--client/dconf.vapi2
-rw-r--r--editor/dconf-model.vala10
3 files changed, 12 insertions, 21 deletions
diff --git a/bin/dconf.vala b/bin/dconf.vala
index 88db9e6..646b275 100644
--- a/bin/dconf.vala
+++ b/bin/dconf.vala
@@ -205,29 +205,24 @@ void show_path (DConf.Client client, string path) {
}
}
-void watch_function (DConf.Client client, string path, string[] items, string tag) {
- if (items.length == 0) {
- print ("%s\n", path);
- show_path (client, path);
- print ("\n");
- } else {
- foreach (var item in items) {
- var full = path + item;
- print ("%s\n", full);
- show_path (client, full);
- }
- print ("\n");
+void watch_function (DConf.Client client, string path, string[] items, string? tag) {
+ foreach (var item in items) {
+ var full = path + item;
+ print ("%s\n", full);
+ show_path (client, full);
}
+ print ("\n");
}
void dconf_watch (string?[] args) throws Error {
var client = new DConf.Client ();
- client.changed.connect (watch_function);
var path = args[2];
DConf.verify_path (path);
+ client.changed.connect (watch_function);
client.watch_sync (path);
+
new MainLoop (null, false).run ();
}
diff --git a/client/dconf.vapi b/client/dconf.vapi
index af293aa..7e5cdae 100644
--- a/client/dconf.vapi
+++ b/client/dconf.vapi
@@ -3,7 +3,7 @@
namespace DConf {
[CCode (cheader_filename = "dconf.h")]
public class Client : GLib.Object {
- public signal void changed (string prefix, string[] changes, string tag);
+ public signal void changed (string prefix, [CCode (array_length = false, array_null_terminated = true)] string[] changes, string? tag);
public Client ();
public GLib.Variant? read (string key);
diff --git a/editor/dconf-model.vala b/editor/dconf-model.vala
index fc772a6..ff45a29 100644
--- a/editor/dconf-model.vala
+++ b/editor/dconf-model.vala
@@ -570,13 +570,9 @@ public class SettingsModel: GLib.Object, Gtk.TreeModel
public signal void item_changed (string key);
- void watch_func (DConf.Client client, string path, string[] items, string tag) {
- if (items.length == 0) {
- item_changed (path);
- } else {
- foreach (var item in items) {
- item_changed (path + item);
- }
+ void watch_func (DConf.Client client, string path, string[] items, string? tag) {
+ foreach (var item in items) {
+ item_changed (path + item);
}
}