GNOME Bugzilla – Bug 607748
gpm_manager_is_inhibit_valid is a stub
Last modified: 2010-01-27 21:23:32 UTC
While porting a LottaNZB plug-in from the old org.freedesktop.PowerManagement.Inhibit API to the new org.gnome.SessionManager API, I noticed that after successfully passing the 0x4 flag to the D-Bus method org.gnome.SessionManager.Inhibit, the computer will still be suspended. After some investigation [1] by Chris Coulson, we noticed that gnome-power-manager doesn't actually check if there are any inhibitors before suspending, rendering the D-Bus method useless. In fact, gpm_manager_is_inhibit_valid just returns TRUE. It should use gpm-session.c to check if there are any inhibitors for that particular action. Implementing this method would also require gpm-session.c to be changed, because the term "inhibited" is limited to the concept of session timeouts there (flag 0x8). [1] https://bugs.edge.launchpad.net/ubuntu/+source/gnome-power-manager/+bug/510907
Created attachment 152366 [details] [review] 0001-Don-t-automatically-suspend-if-there-are-suspend-inh.patch Here is a patch which re-implements this functionality. If it looks ok, then I can commit this.
Review of attachment 152366 [details] [review]: Looks good to me, although I'm not sure I see the point of the last_mode as if we're in SLEEP, then we won't catch the state transition and should just go back to NORMAL when we resume. Feel free to correct me :-) Otherwise, good to apply, thanks.
Yeah, you're right - I added last_mode just out of paranoia but it probably isn't really needed, so I've removed that part. Anyway, I've committed this now as commit b9a8c88