summaryrefslogtreecommitdiff
path: root/lockscreen
diff options
authorAndrea Azzarone <azzaronea@gmail.com>2014-10-21 15:45:43 +0200
committerAndrea Azzarone <azzaronea@gmail.com>2014-10-21 15:45:43 +0200
commitb62a16430805b529eae136e7f9f7265ed6f5bd3a (patch)
tree1cd3ffa92033e1ae7a896d201a6bf5d04f9856e1 /lockscreen
parent866f3432e57368109e7b51b8dd4c48888e4b9ad4 (diff)
Test suspend changes.
(bzr r3874.1.7)
Diffstat (limited to 'lockscreen')
-rw-r--r--lockscreen/CMakeLists.txt1
-rw-r--r--lockscreen/LockScreenController.cpp8
-rw-r--r--lockscreen/LockScreenController.h2
-rw-r--r--lockscreen/ShutdownNotifier.cpp5
4 files changed, 14 insertions, 2 deletions
diff --git a/lockscreen/CMakeLists.txt b/lockscreen/CMakeLists.txt
index 7b4bde35a..c0218bbe5 100644
--- a/lockscreen/CMakeLists.txt
+++ b/lockscreen/CMakeLists.txt
@@ -28,6 +28,7 @@ set (LOCKSCREEN_SOURCES
LockScreenAccelerators.cpp
ScreenSaverDBusManager.cpp
ShutdownNotifier.cpp
+ SuspendNotifier.cpp
UserAuthenticatorPam.cpp
UserPromptView.cpp
)
diff --git a/lockscreen/LockScreenController.cpp b/lockscreen/LockScreenController.cpp
index cd8eaddc9..124f6fc77 100644
--- a/lockscreen/LockScreenController.cpp
+++ b/lockscreen/LockScreenController.cpp
@@ -60,6 +60,7 @@ Controller::Controller(DBusManager::Ptr const& dbus_manager,
, upstart_wrapper_(upstart_wrapper)
, shield_factory_(shield_factory)
, shutdown_notifier_(std::make_shared<ShutdownNotifier>())
+ , suspend_notifier_(std::make_shared<SuspendNotifier>())
, fade_animator_(LOCK_FADE_DURATION)
, blank_window_animator_(IDLE_FADE_DURATION)
, test_mode_(test_mode)
@@ -78,7 +79,12 @@ Controller::Controller(DBusManager::Ptr const& dbus_manager,
});
hidden_window_connection_->block();
- suspend_connection_ = uscreen->suspending.connect([this] {
+ /*suspend_connection_ = uscreen->suspending.connect([this] {
+ if (Settings::Instance().lock_on_suspend())
+ session_manager_->PromptLockScreen();
+ });*/
+
+ suspend_notifier_->RegisterInterest([this](){
if (Settings::Instance().lock_on_suspend())
session_manager_->PromptLockScreen();
});
diff --git a/lockscreen/LockScreenController.h b/lockscreen/LockScreenController.h
index a89814aba..b49dd7112 100644
--- a/lockscreen/LockScreenController.h
+++ b/lockscreen/LockScreenController.h
@@ -28,6 +28,7 @@
#include "LockScreenAcceleratorController.h"
#include "ScreenSaverDBusManager.h"
#include "ShutdownNotifier.h"
+#include "SuspendNotifier.h"
#include "UserPromptView.h"
#include "unity-shared/BackgroundEffectHelper.h"
#include "unity-shared/UpstartWrapper.h"
@@ -87,6 +88,7 @@ private:
UpstartWrapper::Ptr upstart_wrapper_;
ShieldFactoryInterface::Ptr shield_factory_;
ShutdownNotifier::Ptr shutdown_notifier_;
+ SuspendNotifier::Ptr suspend_notifier_;
nux::animation::AnimateValue<double> fade_animator_;
nux::animation::AnimateValue<double> blank_window_animator_;
diff --git a/lockscreen/ShutdownNotifier.cpp b/lockscreen/ShutdownNotifier.cpp
index 05c550602..2a061bcef 100644
--- a/lockscreen/ShutdownNotifier.cpp
+++ b/lockscreen/ShutdownNotifier.cpp
@@ -70,7 +70,10 @@ bool ShutdownNotifier::Impl::RegisterInterest(ShutdownCallback const& cb)
logind_proxy_->CallWithUnixFdList("Inhibit",
g_variant_new("(ssss)", "shutdown", "Unity Lockscreen", "Screen is locked", "delay"),
[this](GVariant* variant, glib::Error const& e){
- LOG_ERROR(logger) << "Failed to inhbit shutdow";
+ if (e)
+ {
+ LOG_ERROR(logger) << "Failed to inhbit shutdow";
+ }
delay_inhibit_fd_ = glib::Variant(variant).GetInt32();
});