From 67303e8d67491318bc600a74b5f893082458f5b3 Mon Sep 17 00:00:00 2001 From: Rob Caelers Date: Fri, 10 May 2024 15:43:28 +0200 Subject: [PATCH] Log when preparing for sleep/wakeup --- ui/app/toolkits/gtkmm/LoginSession.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ui/app/toolkits/gtkmm/LoginSession.cc b/ui/app/toolkits/gtkmm/LoginSession.cc index 9b0f0fca3..cd302776d 100644 --- a/ui/app/toolkits/gtkmm/LoginSession.cc +++ b/ui/app/toolkits/gtkmm/LoginSession.cc @@ -59,7 +59,7 @@ LoginSession::init() #if GLIBMM_CHECK_VERSION(2, 68, 0) catch (std::exception &e) { - std::cerr << e.what() << std::endl; + spdlog::warn(std::string("Failed to subscribe to events from Login manager") + std::string(e.what())); } #else catch (const Glib::Exception &e) @@ -79,13 +79,22 @@ LoginSession::on_signal(const Glib::ustring &sender, const Glib::ustring &signal Glib::Variant start; params.get_child(start); auto core = context->get_core(); + if (start.get()) + { + spdlog::info("Prepare for sleep"); + } + else + { + spdlog::info("Prepare for wakeup"); + } + core->set_powersave(start.get()); } } #if GLIBMM_CHECK_VERSION(2, 68, 0) catch (std::exception &e) { - std::cerr << e.what() << std::endl; + spdlog::warn(std::string("Failed to process event from Login Manager:") + std::string(e.what())); } #else catch (const Glib::Exception &e)