From 1b90575c67de3cf6459785cc18e3d661a826bece Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 20 Aug 2014 22:35:16 -0500 Subject: add rotation lock indicator --- src/main.cpp | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 5cd3581..86bdeb3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,6 +17,9 @@ * Charles Kerr */ +#include +#include + #include // bindtextdomain() #include @@ -35,14 +38,22 @@ main(int /*argc*/, char** /*argv*/) textdomain(GETTEXT_PACKAGE); auto loop = g_main_loop_new(nullptr, false); + auto on_name_lost = [loop](const std::string& name){ + g_warning("busname lost: '%s'", name.c_str()); + g_main_loop_quit(loop); + }; + + // build all our indicators. + // Right now we've only got one -- rotation lock -- but hey, we can dream. + std::vector> indicators; + std::vector> exporters; + indicators.push_back(std::make_shared()); + for (auto& indicator : indicators) { + auto exporter = std::make_shared(indicator); + exporter->name_lost().connect(on_name_lost); + exporters.push_back(exporter); + } - // run until we lose the busname -// auto model = std::make_shared(); - // auto world = std::shared_ptr(new DBusWorld(model)); - // auto controller = std::make_shared(model, world); - // GMenuView menu_view (model, controller); - // FIXME: listen for busname-lost - g_message("entering GMainLoop that does nothing! Woo!"); g_main_loop_run(loop); // cleanup -- cgit v1.2.3