GNOME Bugzilla – Bug 344946
Inhibit Gnome Power Manager from suspending while playing
Last modified: 2008-02-11 11:17:13 UTC
From: https://launchpad.net/distros/ubuntu/+source/banshee/+bug/49791 All Banshee has to do is call a simple dbus method when playing starts, and a simple dbus method when it's paused or stopped. This way Gnome-Power-Manager doesn't auto-suspend or power-down while banshee is playing. See https://wiki.ubuntu.com/GnomePowerManagerInactiveSleep for more information.
I started looking into this, and from looking at http://cvs.gnome.org/viewcvs/*checkout*/gnome-power-manager/docs/dbus-interface.html#pm-method-Inhibit and the little bit of Banshee DBus code, I think something like the following needs to happen, though I'm very unfamiliar with the Dbus foo. Connection connection = Bus.GetSessionBus(); Service service = Service.Get(connection, "org.gnome.PowerManager"); SomeType obj = (SomeType)service.GetObject(typeof(SomeType), "/org/gnome/PowerManager"); uint32 cookie = obj.Inhibit("Banshee", "Playing music"); ... obj.Uninhibit(cookie); This should also be used by the alarm clock plugin (and probably left publically modifiable (eg Uninhibit'able) for a future plugin that suspends/hibernates the computer after a certain time/album/burn/etc).
I somehow missed the link on the ubuntu wiki that gives a C example: http://cvs.gnome.org/viewcvs/*checkout*/gnome-power-manager/src/gpm-inhibit-test.c
I've committed "blind" GPM Inhibit/UnInhibit support to Banshee. I say "blind" because I don't have the proper methods supported in the DBus API for my GPM build. It should work though :) I've been thinking about other power management issues in Banshee in an effort to become more "laptop friendly". Not sure where we could be more laptop friendly in Banshee though. I'm going to close this as FIXED for now... but it's largely un-tested. If it's broken, fixing it should be very trivial.
I just tested this in Ubuntu Hardy Alpha 2 - Banshee 0.13.1 The inhibiting code does not seem to work; the player just suspended during the playback of a song.
Ah - possibly this is a problem: Warning: [01/04/2008 22:21:53] (Power Management Call Failed) - Cannot find GNOME Power Manager: Name org.gnome.PowerManager has no owner The inhibit code in Serpentine works correctly on this machine.
Can you please test the latest from the stable branch (what will soon become 0.13.2)? It should be fixed there.