diff options
author | Michal Hruby <michal.mhr@gmail.com> | 2011-10-13 17:59:53 +0200 |
---|---|---|
committer | Michal Hruby <michal.mhr@gmail.com> | 2011-10-13 17:59:53 +0200 |
commit | 4d660567d642ba318d29ff39203a73654c86a101 (patch) | |
tree | 585419a1fc125289a7c1afd3aa45c9538d55df3f | |
parent | 9f9eb97053983aa173b852dc5fd282e79b721693 (diff) | |
parent | 52e0b89f25330af65c83a3b61aa7087a02403e83 (diff) |
Merge from my branch
-rw-r--r-- | src/zeitgeist-daemon.vala | 56 |
1 files changed, 23 insertions, 33 deletions
diff --git a/src/zeitgeist-daemon.vala b/src/zeitgeist-daemon.vala index 54ec7f31..5bd6700d 100644 --- a/src/zeitgeist-daemon.vala +++ b/src/zeitgeist-daemon.vala @@ -253,20 +253,2 @@ namespace Zeitgeist - static void on_bus_acquired (DBusConnection conn) - { - try - { - instance = new Daemon (); - instance.register_dbus_object (conn); - } - catch (EngineError err) - { - critical ("%s", err.message); - mainloop.quit (); - } - catch (IOError e) - { - critical ("Could not register service"); - } - } - private static bool quit_running_instance (DBusConnection conn) @@ -308,3 +290,8 @@ namespace Zeitgeist { - if (instance != null && !name_acquired) + if (conn == null) + { + // something happened to our bus connection + mainloop.quit (); + } + else if (instance != null && !name_acquired) { @@ -334,7 +321,2 @@ namespace Zeitgeist } - else if (conn == null) - { - // we couldn't even acquire the bus connection - mainloop.quit (); - } } @@ -360,3 +342,3 @@ namespace Zeitgeist { - if (replace_mode) + if (replace_mode || quit_daemon) { @@ -371,4 +353,18 @@ namespace Zeitgeist } - on_bus_acquired (connection); - if (instance == null) return; + + /* don't do anything else if we were called with --quit param */ + if (quit_daemon) return; + + /* setup Engine instance and register objects on dbus */ + try + { + instance = new Daemon (); + instance.register_dbus_object (connection); + } + catch (Error err) + { + critical ("%s", err.message); + return; + } + uint owner_id = Bus.own_name_on_connection (connection, @@ -436,8 +432,2 @@ namespace Zeitgeist } - if (quit_daemon) - { - var conn = Bus.get_sync (BusType.SESSION); - quit_running_instance (conn); - return 0; - } run (); |