After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 344979 - Inhibit Gnome Power Manager from suspending while playing
Inhibit Gnome Power Manager from suspending while playing
Status: RESOLVED FIXED
Product: rhythmbox
Classification: Other
Component: general
unspecified
Other All
: Normal enhancement
: ---
Assigned To: RhythmBox Maintainers
RhythmBox Maintainers
Depends on:
Blocks:
 
 
Reported: 2006-06-15 11:31 UTC by lists
Modified: 2006-10-02 10:59 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
power manager plugin (11.54 KB, patch)
2006-09-07 13:43 UTC, Jonathan Matthew
none Details | Review
updated (11.50 KB, patch)
2006-09-09 07:36 UTC, Jonathan Matthew
committed Details | Review

Description lists 2006-06-15 11:31:44 UTC
From: https://launchpad.net/distros/ubuntu/+source/rhythmbox/+bug/49260

All rhythmbox 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 music is playing.

See https://wiki.ubuntu.com/GnomePowerManagerInactiveSleep for more information.
Comment 1 William 2006-06-17 23:14:44 UTC
should this be in the tree itself, or a plugin?
Comment 2 lists 2006-06-17 23:26:21 UTC
I would have thought in the tree itself, but I imagine the person requesting a feature usually does ;)! The extra code is small, so it would be excellent if it "Just Worked" for all the people that didn't think about it. 
Comment 3 Peter Bach 2006-07-20 14:02:09 UTC
*** Bug 348088 has been marked as a duplicate of this bug. ***
Comment 4 Jonathan Matthew 2006-09-07 13:43:45 UTC
Created attachment 72372 [details] [review]
power manager plugin

Simple plugin that calls g-p-m's inhibit/uninhibit methods when playback starts/stops.  It's hidden and enabled by default, so no one needs to know it's a plugin at all.  Doesn't seem to do any harm when run on a system with no g-p-m installed.
Comment 5 William Jon McCann 2006-09-07 14:34:02 UTC
Looks nice.  Just some nitpicks you can ignore if you like :)

Looks like indentation is inconsistent in the schemas.

The cookie should be a guint32.

In most places you explicitly test for NULL eg:
"if (plugin->proxy == NULL)"
Which I think is good so that when reading the code you know without looking elsewhere that the value is not a boolean.  However you check "if (error)" in a couple places.  Yeah pretty anal but in my experience it helps.  Richard should fix his example code I guess.
Comment 6 Richard Hughes 2006-09-08 13:59:39 UTC
Thanks for doing this guys. I've added in the NULL check in to the g-p-m example file:

2006-09-08  Richard Hughes  <richard@hughsie.com>

	* src/gpm-inhibit-test.c: (dbus_inhibit_gpm), (dbus_uninhibit_gpm):
	Don't treat error like a boolean.
	Also check for a NULL proxy and warn. From a comment in #344979
Comment 7 William Jon McCann 2006-09-08 14:07:14 UTC
Hey Richard, might be nice to add an async example like this one too.  Is the example on the GNOME wiki too?
Comment 8 Richard Hughes 2006-09-08 14:26:35 UTC
The gnome wiki just links to http://cvs.gnome.org/viewcvs/*checkout*/gnome-power-manager/src/gpm-inhibit-test.c

How do you mean an async example? The code is async already, right?
Comment 9 William Jon McCann 2006-09-08 14:42:35 UTC
The patch on this bug uses dbus_g_proxy_begin_call etc which asynchronously invokes the method.  Might be a helpful example for things like rhythmbox or gnome-vfs that can't or shouldn't use synchronous IO.
Comment 10 Richard Hughes 2006-09-08 14:52:38 UTC
Ohh, dbus-call-async, gotcha. Let me add this to the example file as an example (can't promise time, I'm a bit rammed today).
Comment 11 Jonathan Matthew 2006-09-09 07:36:02 UTC
Created attachment 72438 [details] [review]
updated

just fixing the above nits.
Comment 12 Snark 2006-09-11 09:04:44 UTC
There's a possible problem with patch 72438 :
+	<key>/schemas/apps/rhythmbox/plugins/power-manager/hidden</key>
+	<applyto>/apps/rhythmbox/plugins/power-manager/active</applyto>

should probably be :
+	<key>/schemas/apps/rhythmbox/plugins/power-manager/hidden</key>
+	<applyto>/apps/rhythmbox/plugins/power-manager/hidden</applyto>

shouldn't it?
Comment 13 Jonathan Matthew 2006-09-11 09:31:39 UTC
Yes, you're right.  Thanks for spotting that.
Comment 14 William Jon McCann 2006-09-11 15:16:48 UTC
Looks good to me.
Comment 15 James "Doc" Livingston 2006-09-20 09:33:52 UTC
I haven't done any testing, but looks good to me too.
Comment 16 James "Doc" Livingston 2006-10-02 05:34:36 UTC
Feel free to commit.
Comment 17 Jonathan Matthew 2006-10-02 10:59:13 UTC
ok, committed.