diff --git a/ui/gtk3/indicator.vala b/ui/gtk3/indicator.vala index dac72b49..7da0fa92 100644 --- a/ui/gtk3/indicator.vala +++ b/ui/gtk3/indicator.vala @@ -139,12 +139,17 @@ class Indicator : IBus.Service m_watcher_interface_info = m_watcher_node_info.lookup_interface( NOTIFICATION_WATCHER_DBUS_IFACE); - check_connect(); + try { + check_connect(); + } catch (GLib.IOError e) { + warning("Failed to call dbus proxy: " + e.message); + return; + } } - private void check_connect() { + private async void check_connect() throws IOError { if (m_proxy == null) { - GLib.DBusProxy.new.begin( + m_proxy = yield new GLib.DBusProxy( connection, GLib.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES | GLib.DBusProxyFlags.DO_NOT_CONNECT_SIGNALS, @@ -152,23 +157,7 @@ class Indicator : IBus.Service NOTIFICATION_WATCHER_DBUS_ADDR, NOTIFICATION_WATCHER_DBUS_OBJ, NOTIFICATION_WATCHER_DBUS_IFACE, - null, - (obj, res) => { - bus_watcher_ready(obj, res); - }); - } else { - bus_watcher_ready(null, null); - } - } - - private void bus_watcher_ready(GLib.Object? obj, GLib.AsyncResult? res) { - if (res != null) { - try { - m_proxy = GLib.DBusProxy.new.end(res); - } catch (GLib.IOError e) { - warning("Failed to call dbus proxy: " + e.message); - return; - } + null); m_proxy.notify["g-name-owner"].connect((obj, pspec) => { var name = m_proxy.get_name_owner(); @@ -176,7 +165,10 @@ class Indicator : IBus.Service check_connect(); }); } + bus_watcher_ready(); + } + private void bus_watcher_ready() { var name = m_proxy.get_name_owner(); // KDE panel does not run yet if name == null if (name == null)