Merge lp:~laney/docky/logind-suspend-hibernate into lp:docky

Proposed by Iain Lane
Status: Merged
Approved by: Rico Tzschichholz
Approved revision: 1841
Merged at revision: 1841
Proposed branch: lp:~laney/docky/logind-suspend-hibernate
Merge into: lp:docky
Diff against target: 65 lines (+18/-4)
1 file modified
StandardPlugins/SessionManager/src/SystemManager.cs (+18/-4)
To merge this branch: bzr merge lp:~laney/docky/logind-suspend-hibernate
Reviewer Review Type Date Requested Status
Rico Tzschichholz Approve
Review via email: mp+162140@code.launchpad.net

Description of the change

Use logind for suspend and hibernate

To post a comment you must log in.
Revision history for this message
Rico Tzschichholz (ricotz) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'StandardPlugins/SessionManager/src/SystemManager.cs'
2--- StandardPlugins/SessionManager/src/SystemManager.cs 2012-12-31 04:25:57 +0000
3+++ StandardPlugins/SessionManager/src/SystemManager.cs 2013-05-02 16:10:32 +0000
4@@ -86,11 +86,15 @@
5 [Interface (SystemdIface)]
6 interface ISystemd
7 {
8+ string CanHibernate ();
9+ string CanSuspend ();
10 string CanPowerOff ();
11 string CanReboot ();
12
13 void PowerOff (bool interactive);
14 void Reboot (bool interactive);
15+ void Suspend (bool interactive);
16+ void Hibernate (bool interactive);
17 }
18
19 [Interface (ConsoleKitIface)]
20@@ -212,7 +216,9 @@
21
22 public bool CanHibernate ()
23 {
24- if (upower != null)
25+ if (systemd != null)
26+ return String.Equals (systemd.CanHibernate (), "yes");
27+ else if (upower != null)
28 return GetBoolean (upower, UPowerName, "CanHibernate") && upower.HibernateAllowed ();
29 else if (devicekit != null)
30 return GetBoolean (devicekit, DeviceKitPowerName, "CanHibernate");
31@@ -223,7 +229,10 @@
32
33 public void Hibernate ()
34 {
35- if (upower != null) {
36+ if (systemd != null) {
37+ if (String.Equals (systemd.CanHibernate (), "yes"))
38+ systemd.Hibernate (true);
39+ } else if (upower != null) {
40 if (GetBoolean (upower, UPowerName, "CanHibernate") && upower.HibernateAllowed ())
41 upower.Hibernate ();
42 } else if (devicekit != null) {
43@@ -236,7 +245,9 @@
44
45 public bool CanSuspend ()
46 {
47- if (upower != null)
48+ if (systemd != null)
49+ return String.Equals (systemd.CanSuspend (), "yes");
50+ else if (upower != null)
51 return GetBoolean (upower, UPowerName, "CanSuspend") && upower.SuspendAllowed ();
52 else if (devicekit != null)
53 return GetBoolean (devicekit, DeviceKitPowerName, "CanSuspend");
54@@ -247,7 +258,10 @@
55
56 public void Suspend ()
57 {
58- if (upower != null) {
59+ if (systemd != null) {
60+ if (String.Equals (systemd.CanSuspend (), "yes"))
61+ systemd.Suspend (true);
62+ } else if (upower != null) {
63 if (GetBoolean (upower, UPowerName, "CanSuspend") && upower.SuspendAllowed ())
64 upower.Suspend ();
65 } else if (devicekit != null) {

Subscribers

People subscribed via source and target branches

to status/vote changes: