aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
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;
}