The attached test program shows something interesting. UpClient's "changed" signal gets emitted when I close or open the laptop's lid. However, the "notify::lid-is-closed" signal doesn't get emitted at the same time. But if I open/close the lid and call up_client_get_lid_is_closed(), then *that* signal gets emitted and the function returns the correct value. This means that UpClient notices the change and emits "changed", but doesn't update the properties and emit the corresponding GObject::notify signals until up_client_get_lid_is_closed() is called. It *seems* that up_client_changed_cb(), the callback from D-Bus, could simply call up_client_get_properties_sync(), but that could probably mean a bunch of roundtrips. Still, if clients use the "changed" signal, they'll want to know the new state of some properties, so the properties need updating anyway... I've changed my code to use "changed" instead of "notify::lid-is-closed" and I'm fine with that; it just was surprising to see the latter not emitted.
Created attachment 53610 [details] foo.c
UPower doesn't use the PropertiesChanged signal at all. We could do something ugly like this: https://git.gnome.org/browse/gnome-session/tree/gnome-session/gsm-manager.c#n2314 Or we could port the whole thing to GDBus...
This is done (the hack, not the port) in my branch.
Fixed in master with the GDBus port of libupower-glib. commit 28438a7672eec8277341d14121bf267f8e0542b3 Author: Bastien Nocera <hadess@hadess.net> Date: Sat Oct 12 21:49:21 2013 +0200 lib: Emit notify:: signals In the UpClient object. https://bugs.freedesktop.org/show_bug.cgi?id=43001 commit 7531dbdac05f1698d565f564f2280aafbeb1ba57 Author: Bastien Nocera <hadess@hadess.net> Date: Sat Oct 12 21:41:33 2013 +0200 daemon: Emit the PropertiesChanged signal Use raw D-Bus. https://bugs.freedesktop.org/show_bug.cgi?id=43001
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.