Merge lp:~townsend/unity/fix-resume-signal into lp:unity

Proposed by Christopher Townsend
Status: Merged
Approved by: Brandon Schaefer
Approved revision: no longer in the source branch.
Merged at revision: 3732
Proposed branch: lp:~townsend/unity/fix-resume-signal
Merge into: lp:unity
Diff against target: 27 lines (+9/-4)
1 file modified
unity-shared/UScreen.cpp (+9/-4)
To merge this branch: bzr merge lp:~townsend/unity/fix-resume-signal
Reviewer Review Type Date Requested Status
Brandon Schaefer (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+211722@code.launchpad.net

Commit message

Change the signal for detecting resuming from Suspend from UPower (which is unreliable) to logind.

Description of the change

Change the signal for detecting resuming from Suspend from UPower (which is unreliable) to logind.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

Nice, LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'unity-shared/UScreen.cpp'
2--- unity-shared/UScreen.cpp 2014-03-06 02:26:45 +0000
3+++ unity-shared/UScreen.cpp 2014-03-19 13:29:43 +0000
4@@ -28,14 +28,19 @@
5 UScreen::UScreen()
6 : primary_(0)
7 , screen_(gdk_screen_get_default(), glib::AddRef())
8- , proxy_("org.freedesktop.UPower",
9- "/org/freedesktop/UPower",
10- "org.freedesktop.UPower",
11+ , proxy_("org.freedesktop.login1",
12+ "/org/freedesktop/login1",
13+ "org.freedesktop.login1.Manager",
14 G_BUS_TYPE_SYSTEM)
15 {
16 size_changed_signal_.Connect(screen_, "size-changed", sigc::mem_fun(this, &UScreen::Changed));
17 monitors_changed_signal_.Connect(screen_, "monitors-changed", sigc::mem_fun(this, &UScreen::Changed));
18- proxy_.Connect("Resuming", [this] (GVariant* data) { resuming.emit(); });
19+ proxy_.Connect("PrepareForSleep", [this] (GVariant* data) {
20+ bool val;
21+ g_variant_get(data, "(b)", &val);
22+ if (!val)
23+ resuming.emit();
24+ });
25
26 Refresh();
27 }