aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/main.vala59
1 files changed, 31 insertions, 28 deletions
diff --git a/lib/main.vala b/lib/main.vala
index 4367e9ae..9e74ee84 100644
--- a/lib/main.vala
+++ b/lib/main.vala
@@ -577,34 +577,37 @@ public class Indicator.Keyboard.Service : Object {
}
if (ibus_panel == null && sources[i].is_ibus) {
- var connection = get_ibus ().get_connection ();
- var name = "org.freedesktop.IBus.Panel";
- var path = "/org/freedesktop/IBus/Panel";
-
- try {
- ibus_panel = connection.get_proxy_sync (name, path);
-
- ((!) ibus_panel).properties_registered.connect ((variant) => {
- var properties = new IBus.PropList ();
- properties.deserialize (variant);
-
- if (properties is IBus.PropList) {
- handle_properties_registered ((!) (properties as IBus.PropList));
- }
- });
- ((!) ibus_panel).property_updated.connect ((variant) => {
- var type = IBus.PropType.NORMAL;
- var state = IBus.PropState.INCONSISTENT;
- var text = new IBus.Text.from_static_string ("");
- var property = new IBus.Property ("", type, text, null, text, false, false, state, null);
- property.deserialize (variant);
-
- if (property is IBus.Property) {
- handle_property_updated ((!) (property as IBus.Property));
- }
- });
- } catch (IOError error) {
- warning ("error: %s", error.message);
+ DBusConnection? connection = get_ibus ().get_connection ();
+
+ if (connection != null) {
+ var name = "org.freedesktop.IBus.Panel";
+ var path = "/org/freedesktop/IBus/Panel";
+
+ try {
+ ibus_panel = ((!) connection).get_proxy_sync (name, path);
+
+ ((!) ibus_panel).properties_registered.connect ((variant) => {
+ var properties = new IBus.PropList ();
+ properties.deserialize (variant);
+
+ if (properties is IBus.PropList) {
+ handle_properties_registered ((!) (properties as IBus.PropList));
+ }
+ });
+ ((!) ibus_panel).property_updated.connect ((variant) => {
+ var type = IBus.PropType.NORMAL;
+ var state = IBus.PropState.INCONSISTENT;
+ var text = new IBus.Text.from_static_string ("");
+ var property = new IBus.Property ("", type, text, null, text, false, false, state, null);
+ property.deserialize (variant);
+
+ if (property is IBus.Property) {
+ handle_property_updated ((!) (property as IBus.Property));
+ }
+ });
+ } catch (IOError error) {
+ warning ("error: %s", error.message);
+ }
}
}
}