summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Bus.h4
-rw-r--r--src/Main.cc6
2 files changed, 10 insertions, 0 deletions
diff --git a/src/Bus.h b/src/Bus.h
index be76894..6de9d66 100644
--- a/src/Bus.h
+++ b/src/Bus.h
@@ -11,6 +11,10 @@ public:
Bus (void) {
set (ibus_bus_new ());
}
+
+ bool isConnected (void) {
+ return ibus_bus_is_connected (*this);
+ }
};
};
diff --git a/src/Main.cc b/src/Main.cc
index a93030a..7d7c472 100644
--- a/src/Main.cc
+++ b/src/Main.cc
@@ -42,6 +42,12 @@ start_component (void)
ibus_init ();
Bus bus;
+
+ if (!bus.isConnected ()) {
+ g_warning ("Can not connect to ibus");
+ exit (0);
+ }
+
Config config (bus);
g_signal_connect (bus, "disconnected", G_CALLBACK (ibus_disconnected_cb), NULL);