summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorNohemi Fernandez <nf68@cornell.edu>2011-08-10 17:10:28 -0500
committerEitan Isaacson <eitan@monotonous.org>2011-08-12 09:19:41 +0200
commitaae4d8f894f253b1f5d5b1da540502437c37c0ec (patch)
tree87837840ea1a650395a3594fcd232d075cba2bc7 /modules
parent514869041344f128521f60c616e1f019d3158b1b (diff)
downloadcaribou-aae4d8f894f253b1f5d5b1da540502437c37c0ec.tar.gz
Use async Bus.get_proxy()
The sync version of this method would result in apps hanging briefly at startup, however in the async version a window may be created/focused before the async callback runs.
Diffstat (limited to 'modules')
-rw-r--r--modules/gtk3/caribou-gtk-module.vala21
1 files changed, 13 insertions, 8 deletions
diff --git a/modules/gtk3/caribou-gtk-module.vala b/modules/gtk3/caribou-gtk-module.vala
index b6cc358..17ef41b 100644
--- a/modules/gtk3/caribou-gtk-module.vala
+++ b/modules/gtk3/caribou-gtk-module.vala
@@ -17,16 +17,21 @@ namespace Caribou {
public GtkModule () {
windows = new GLib.HashTable<Gtk.Window, bool> (null, null);
- try {
- display = Gdk.Display.get_default ();
+ display = Gdk.Display.get_default ();
- keyboard = Bus.get_proxy_sync (BusType.SESSION,
- "org.gnome.Caribou.Keyboard",
- "/org/gnome/Caribou/Keyboard");
- Gdk.window_add_filter (null, event_filter);
- } catch (Error e) {
- stderr.printf ("%s\n", e.message);
+ Bus.get_proxy.begin<Keyboard> (BusType.SESSION, "org.gnome.Caribou.Keyboard",
+ "/org/gnome/Caribou/Keyboard", 0, null, callback);
+
+ Gdk.window_add_filter (null, event_filter);
+ }
+
+ private void callback (GLib.Object? obj, GLib.AsyncResult res) {
+ try {
+ keyboard = Bus.get_proxy.end(res);
}
+ catch (Error e) {
+ stderr.printf ("%s\n", e.message);
+ }
}
private Gdk.FilterReturn event_filter (Gdk.XEvent xevent, Gdk.Event evt) {