From 2f95af00f7a06634d994ae99a06b837f13247c38 Mon Sep 17 00:00:00 2001 From: chikatoike Date: Sat, 26 Jan 2013 11:03:06 +0900 Subject: [PATCH] Stop agent on exit. --- sublimeibus/sublime-ibus-agent.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sublimeibus/sublime-ibus-agent.py b/sublimeibus/sublime-ibus-agent.py index 9b7a49f..2e1e1e2 100644 --- a/sublimeibus/sublime-ibus-agent.py +++ b/sublimeibus/sublime-ibus-agent.py @@ -553,9 +553,13 @@ def __stdin_cb(self, fd, condition): print_command('setq', 'error', traceback.format_exc()) return True + def __io_error_cb(self, fd, condition): + exit() + def run(self): glib.idle_add(self.__start_cb) glib.io_add_watch(0, glib.IO_IN, self.__stdin_cb) + glib.io_add_watch(0, glib.IO_ERR | glib.IO_HUP, self.__io_error_cb) while True: try: super(IBusModeMainLoop, self).run() @@ -568,7 +572,6 @@ def run(self): if ic: ic.destroy() - if __name__ == "__main__": mainloop = IBusModeMainLoop(bus)