summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorPeng Huang <shawn.p.huang@gmail.com>2012-01-04 10:52:28 -0500
committerPeng Huang <shawn.p.huang@gmail.com>2012-02-21 11:51:52 -0500
commit3b96fd09796b311699dad881737000b2ff503561 (patch)
treea4d02313b5ef54295f43827ed840236c20f6fddb /tools
parent55492f4491972c0cbc1f082540f639b79484269e (diff)
Add restart and exit commands in ibus tools
Diffstat (limited to 'tools')
-rw-r--r--tools/ibus.bash2
-rw-r--r--tools/main.vala16
2 files changed, 16 insertions, 2 deletions
diff --git a/tools/ibus.bash b/tools/ibus.bash
index 02303a9d..18e9d6c6 100644
--- a/tools/ibus.bash
+++ b/tools/ibus.bash
@@ -108,7 +108,7 @@ __ibus()
# echo "cwords='${cwords[@]}'"
# Commands
- local cmds=( engine list-engine watch )
+ local cmds=( engine list-engine watch restart exit )
local i c cmd subcmd
for (( i=1; i < ${#words[@]}-1; i++)) ; do
diff --git a/tools/main.vala b/tools/main.vala
index ba2fe677..575542c9 100644
--- a/tools/main.vala
+++ b/tools/main.vala
@@ -118,6 +118,18 @@ int message_watch(string[] argv) {
return 0;
}
+int restart_daemon(string[] argv) {
+ var bus = get_bus();
+ bus.exit(true);
+ return 0;
+}
+
+int exit_daemon(string[] argv) {
+ var bus = get_bus();
+ bus.exit(false);
+ return 0;
+}
+
delegate int EntryFunc(string[] argv);
struct CommandEntry {
@@ -129,7 +141,9 @@ public int main(string[] argv) {
const CommandEntry commands[] = {
{ "engine", get_set_engine },
{ "list-engine", list_engine },
- { "watch", message_watch }
+ { "watch", message_watch },
+ { "restart", restart_daemon },
+ { "exit", exit_daemon }
};
if (argv.length >= 2) {