diff options
| author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2014-05-16 04:24:47 +0200 | 
|---|---|---|
| committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2014-05-16 04:24:47 +0200 | 
| commit | 62ed3a4619076b243d4b9b2e3cd362414793544d (patch) | |
| tree | 55226823b131cbdc6ca99b9c87d456483be97cbc /shutdown | |
| parent | 837affc668bcff2d38c8feeee19a16c49df42d9d (diff) | |
SessionManager: add CanLock method and is_locked property
The property is now used also to emit the locked and unlocked signals (bzr r3806.11.1)
Diffstat (limited to 'shutdown')
| -rw-r--r-- | shutdown/SessionDBusManager.cpp | 26 | ||||
| -rw-r--r-- | shutdown/StandaloneSession.cpp | 1 | 
2 files changed, 21 insertions, 6 deletions
| diff --git a/shutdown/SessionDBusManager.cpp b/shutdown/SessionDBusManager.cpp index b1345f8c2..82fa1f9b3 100644 --- a/shutdown/SessionDBusManager.cpp +++ b/shutdown/SessionDBusManager.cpp @@ -53,14 +53,20 @@ R"(<node>  <method name="Suspend" />  <method name="Hibernate" />  <method name="CancelAction" /> + <method name="IsLocked"> + <arg type="b" direction="out" name="is_locked" /> + </method> + <method name="CanLock"> + <arg type="b" direction="out" name="can_lock" /> + </method>  <method name="CanShutdown"> - <arg type="b" direction="out" name="canshutdown" /> + <arg type="b" direction="out" name="can_shutdown" />  </method>  <method name="CanSuspend"> - <arg type="b" direction="out" name="cansuspend" /> + <arg type="b" direction="out" name="can_suspend" />  </method>  <method name="CanHibernate"> - <arg type="b" direction="out" name="canhibernate" /> + <arg type="b" direction="out" name="can_hibernate" />  </method>  <signal name="LockRequested" /> @@ -152,17 +158,25 @@ DBusManager::DBusManager(session::Manager::Ptr const& session)  session_->CancelAction();  session_->cancel_requested.emit();  } + else if (method == "IsLocked") + { + return g_variant_new("(b)", session_->is_locked() != false); + } + else if (method == "CanLock") + { + return g_variant_new("(b)", session_->CanLock() != false); + }  else if (method == "CanShutdown")  { - return g_variant_new("(b)", session_->CanShutdown() != FALSE); + return g_variant_new("(b)", session_->CanShutdown() != false);  }  else if (method == "CanSuspend")  { - return g_variant_new("(b)", session_->CanSuspend() != FALSE); + return g_variant_new("(b)", session_->CanSuspend() != false);  }  else if (method == "CanHibernate")  { - return g_variant_new("(b)", session_->CanHibernate() != FALSE); + return g_variant_new("(b)", session_->CanHibernate() != false);  }  return nullptr; diff --git a/shutdown/StandaloneSession.cpp b/shutdown/StandaloneSession.cpp index e12e3d45d..f785da3ee 100644 --- a/shutdown/StandaloneSession.cpp +++ b/shutdown/StandaloneSession.cpp @@ -52,6 +52,7 @@ public:  void CancelAction() { std::cout << "CancelAction" << std::endl; } + bool CanLock() const {return true;}  bool CanShutdown() const {return true;}  bool CanSuspend() const {return true;}  bool CanHibernate() const {return true;} | 
