summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPeng Huang <shawn.p.huang@gmail.com>2010-01-26 21:27:16 +0800
committerPeng Huang <shawn.p.huang@gmail.com>2010-01-26 21:27:16 +0800
commit9db3894d2b02e0e7e28955bf8564dcf5e1240624 (patch)
tree234b067f2b08e66024978bbf82e788e86d24f765 /src
parent7c8dc0f92d59d0657b4edf42c03410e81bc1a8cd (diff)
downloadibus-libpinyin-9db3894d2b02e0e7e28955bf8564dcf5e1240624.tar.gz
ibus-libpinyin-9db3894d2b02e0e7e28955bf8564dcf5e1240624.tar.xz
ibus-libpinyin-9db3894d2b02e0e7e28955bf8564dcf5e1240624.zip
Exit if can not connect to ibus
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);