From 3b96fd09796b311699dad881737000b2ff503561 Mon Sep 17 00:00:00 2001 From: Peng Huang Date: Wed, 4 Jan 2012 10:52:28 -0500 Subject: [PATCH] Add restart and exit commands in ibus tools --- tools/ibus.bash | 2 +- tools/main.vala | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/tools/ibus.bash b/tools/ibus.bash index 02303a9..18e9d6c 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 ba2fe67..575542c 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) { -- 2.7.4