Bug 28370 - Should watch UPower AboutToSleep signal
Summary: Should watch UPower AboutToSleep signal
Status: RESOLVED FIXED
Alias: None
Product: Telepathy
Classification: Unclassified
Component: mission-control (show other bugs)
Version: unspecified
Hardware: Other All
: medium enhancement
Assignee: Telepathy bugs list
QA Contact: Telepathy bugs list
URL: http://cgit.collabora.com/git/user/wj...
Whiteboard: r+
Keywords: patch
Depends on: 38978
Blocks:
  Show dependency treegraph
 
Reported: 2010-06-03 07:52 UTC by Guillaume Desmottes
Modified: 2011-10-04 08:20 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Guillaume Desmottes 2010-06-03 07:52:32 UTC
Original bug report: https://bugzilla.gnome.org/show_bug.cgi?id=549606

By wathcing this D-Bus signal MC could disconnect all accounts when computer is about to suspend and so avoid data loss.
MC should probably remeber the requested presence and restore it when the computer wakes up.
Comment 1 Guillaume Desmottes 2011-08-16 02:30:47 UTC
See also bug #40131 which is about using a similar signal with network changes.
Comment 2 Will Thompson 2011-09-23 04:25:54 UTC
Well. I think this branch works given a quick smoke test. I'll try it harder after lunch!
Comment 3 Guillaume Desmottes 2011-09-23 05:24:14 UTC
Why G_CONNECT_AFTER?
Comment 4 Will Thompson 2011-09-27 10:21:43 UTC
(In reply to comment #3)
> Why G_CONNECT_AFTER?

No good reason. Branch updated! (It still depends on bug 38978, of course.)
Comment 5 Guillaume Desmottes 2011-09-28 01:42:48 UTC
Maybe we should factor out this code:
+  g_signal_emit (self, signals[STATE_CHANGE], 0,
+      priv->connected && priv->awake);

Especially, you check if priv->awake actually changed before firing this signal, but if priv->connected is still FALSE, you actually didn't change the state.

The opposite is probably true as well: connected changing but awake being FALSE.
Comment 6 Will Thompson 2011-09-28 09:59:51 UTC
(In reply to comment #5)
> Maybe we should factor out this code:
> +  g_signal_emit (self, signals[STATE_CHANGE], 0,
> +      priv->connected && priv->awake);
> 
> Especially, you check if priv->awake actually changed before firing this
> signal, but if priv->connected is still FALSE, you actually didn't change the
> state.
> 
> The opposite is probably true as well: connected changing but awake being
> FALSE.

Right you are. I've pushed a patch that addresses this.
Comment 7 Guillaume Desmottes 2011-09-29 00:56:32 UTC
Looks good!

Go go merge and the original bug, initally opened by Daf on 2008-08-27 will be finally closed. :)
Comment 8 Will Thompson 2011-10-04 08:20:56 UTC
It is merged! The feature will be in MC 5.9.3.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.