aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2016-04-20 17:09:14 -0500
committerCharles Kerr <charles.kerr@canonical.com>2016-04-20 17:09:14 -0500
commitcb46051005d5d9d1f21d7cb82b9fffd21f88c4c9 (patch)
tree78edd967c7357fc6a4b7e12da10d29dc0d9055cb /src/main.cpp
parente683501043c00810558db55461b49c66ecf1aa0b (diff)
downloadayatana-indicator-display-cb46051005d5d9d1f21d7cb82b9fffd21f88c4c9.tar.gz
ayatana-indicator-display-cb46051005d5d9d1f21d7cb82b9fffd21f88c4c9.tar.bz2
ayatana-indicator-display-cb46051005d5d9d1f21d7cb82b9fffd21f88c4c9.zip
watch for the Greeter to appear on the bus
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 52cdd58..ee05f52 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -47,6 +47,15 @@ main(int /*argc*/, char** /*argv*/)
g_main_loop_quit(loop);
};
+ // get the session bus
+ GError* error {};
+ auto session_bus = g_bus_get_sync(G_BUS_TYPE_SESSION, nullptr, &error);
+ if (error != nullptr) {
+ g_critical("Unable to get session bus: %s", error->message);
+ g_clear_error(&error);
+ return 0;
+ }
+
// build all our indicators.
// Right now we've only got one -- rotation lock -- but hey, we can dream.
std::vector<std::shared_ptr<Indicator>> indicators;
@@ -63,7 +72,7 @@ main(int /*argc*/, char** /*argv*/)
static constexpr char const * ADB_SOCKET_PATH {"/dev/socket/adbd"};
static constexpr char const * PUBLIC_KEYS_FILENAME {"/data/misc/adb/adb_keys"};
auto usb_monitor = std::make_shared<GUDevUsbMonitor>();
- auto greeter = std::make_shared<UnityGreeter>();
+ auto greeter = std::make_shared<UnityGreeter>(session_bus);
UsbManager usb_manager {ADB_SOCKET_PATH, PUBLIC_KEYS_FILENAME, usb_monitor, greeter};
// let's go!
@@ -71,5 +80,6 @@ main(int /*argc*/, char** /*argv*/)
// cleanup
g_main_loop_unref(loop);
+ g_clear_object(&session_bus);
return 0;
}