banshee r4218 - in trunk/banshee: . build src/Backends/Banshee.Gnome src/Backends/Banshee.Gnome/Banshee.GnomeBackend src/Extensions/Banshee.NowPlaying src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying
- From: ahixon svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r4218 - in trunk/banshee: . build src/Backends/Banshee.Gnome src/Backends/Banshee.Gnome/Banshee.GnomeBackend src/Extensions/Banshee.NowPlaying src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying
- Date: Sat, 19 Jul 2008 08:56:49 +0000 (UTC)
Author: ahixon
Date: Sat Jul 19 08:56:49 2008
New Revision: 4218
URL: http://svn.gnome.org/viewvc/banshee?rev=4218&view=rev
Log:
2008-07-19 Alexander Hixon <ahixon gnome org>
Patch from Christopher Halse Rogers to disable the screensaver when
watching fullscreen video (BGO #531192) under GNOME (with the ability to
use other backends).
* src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/IScreensaverManager.cs:
* src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/ScreensaverManager.cs:
* src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying.addin.xml: Add an
extension point for screensaver extensions for disabling the screensaver
or power management while playing fullscreen.
* src/Backends/Banshee.Gnome/Banshee.GnomeBackend/GnomeScreensaverManager.cs:
Implement a ScreensaverManager to control GNOME screensaver.
* src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/NowPlayingInterface.cs:
Use ScreensaverManager to inhibit the screensaver when switching to
fullscreen, and re-enable it when switching away.
* build/build.environment.mk:
Add Banshee.NowPlaying to the references for Banshee.GnomeBackend to build
GnomeScreensaverManager.
Added:
trunk/banshee/src/Backends/Banshee.Gnome/Banshee.GnomeBackend/GnomeScreensaverManager.cs
trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/IScreensaverManager.cs
trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/ScreensaverManager.cs
Modified:
trunk/banshee/ChangeLog
trunk/banshee/build/build.environment.mk
trunk/banshee/src/Backends/Banshee.Gnome/Banshee.Gnome.mdp
trunk/banshee/src/Backends/Banshee.Gnome/Makefile.am
trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying.addin.xml
trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying.mdp
trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/NowPlayingInterface.cs
trunk/banshee/src/Extensions/Banshee.NowPlaying/Makefile.am
Modified: trunk/banshee/build/build.environment.mk
==============================================================================
--- trunk/banshee/build/build.environment.mk (original)
+++ trunk/banshee/build/build.environment.mk Sat Jul 19 08:56:49 2008
@@ -121,7 +121,7 @@
REF_EXTENSION_SAMPLE = $(LINK_BANSHEE_THICKCLIENT_DEPS)
# Backends
-REF_BACKEND_GNOME = $(LINK_BANSHEE_SERVICES_DEPS) $(LINK_BANSHEE_THICKCLIENT_DEPS) $(LINK_GCONF) $(LINK_GNOME)
+REF_BACKEND_GNOME = $(LINK_BANSHEE_SERVICES_DEPS) $(LINK_BANSHEE_THICKCLIENT_DEPS) $(LINK_GCONF) $(LINK_GNOME) $(LINK_EXTENSION_NOWPLAYING_DEPS)
REF_BACKEND_GSTREAMER = $(LINK_BANSHEE_SERVICES_DEPS) $(LINK_GLIB)
REF_BACKEND_UNIX = $(LINK_BANSHEE_CORE_DEPS) $(LINK_MONO_POSIX)
REF_BACKEND_HAL = $(LINK_BANSHEE_SERVICES_DEPS) $(LINK_DBUS)
Modified: trunk/banshee/src/Backends/Banshee.Gnome/Banshee.Gnome.mdp
==============================================================================
--- trunk/banshee/src/Backends/Banshee.Gnome/Banshee.Gnome.mdp (original)
+++ trunk/banshee/src/Backends/Banshee.Gnome/Banshee.Gnome.mdp Sat Jul 19 08:56:49 2008
@@ -14,6 +14,7 @@
<File name="Banshee.GnomeBackend/Brasero.cs" subtype="Code" buildaction="Compile" />
<File name="Resources/GlobalUI.xml" subtype="Code" buildaction="EmbedAsResource" />
<File name="Banshee.GnomeBackend/DiscDuplicator.cs" subtype="Code" buildaction="Compile" />
+ <File name="Banshee.GnomeBackend/GnomeScreensaverManager.cs" subtype="Code" buildaction="Compile" />
</Contents>
<References>
<ProjectReference type="Project" localcopy="True" refto="Banshee.Core" />
@@ -24,6 +25,7 @@
<ProjectReference type="Project" localcopy="True" refto="Hyena.Gui" />
<ProjectReference type="Project" localcopy="True" refto="Banshee.ThickClient" />
<ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+ <ProjectReference type="Project" localcopy="True" refto="Banshee.NowPlaying" />
</References>
<MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True" RelativeMakefileName="./Makefile.am">
<BuildFilesVar Sync="True" Name="SOURCES" />
Added: trunk/banshee/src/Backends/Banshee.Gnome/Banshee.GnomeBackend/GnomeScreensaverManager.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Backends/Banshee.Gnome/Banshee.GnomeBackend/GnomeScreensaverManager.cs Sat Jul 19 08:56:49 2008
@@ -0,0 +1,81 @@
+//
+// GnomeScreensaverManager.cs
+//
+// Author:
+// Christopher James Halse Rogers <raof ubuntu com>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+using NDesk.DBus;
+using Mono.Unix;
+using Banshee.NowPlaying;
+
+namespace Banshee.GnomeBackend
+{
+ [Interface("org.gnome.ScreenSaver")]
+ internal interface IGnomeScreensaver
+ {
+ uint Inhibit (string application_name, string reason);
+ void UnInhibit (uint cookie);
+ }
+
+ class GnomeScreensaverManager : IScreensaverManager
+ {
+ const string DBUS_INTERFACE = "org.gnome.ScreenSaver";
+ const string DBUS_PATH = "/org/gnome/ScreenSaver";
+
+ IGnomeScreensaver manager;
+ uint? cookie;
+
+ public GnomeScreensaverManager ()
+ {
+ if(!Bus.Session.NameHasOwner (DBUS_INTERFACE)) {
+ throw new ApplicationException (String.Format ("Could not find {0}", DBUS_INTERFACE));
+ }
+
+ manager = Bus.Session.GetObject<IGnomeScreensaver> (DBUS_INTERFACE,
+ new ObjectPath (DBUS_PATH));
+
+ if (manager == null) {
+ throw new ApplicationException (String.Format ("The {0} object could not be located on the DBus interface {1}",
+ DBUS_PATH, DBUS_INTERFACE));
+ }
+ }
+
+ public void Inhibit ()
+ {
+ if (!cookie.HasValue) {
+ cookie = manager.Inhibit ("Banshee",
+ Catalog.GetString ("Fullscreen video playback active"));
+ }
+ }
+
+ public void UnInhibit ()
+ {
+ if (cookie.HasValue) {
+ manager.UnInhibit (cookie.Value);
+ cookie = null;
+ }
+ }
+ }
+}
Modified: trunk/banshee/src/Backends/Banshee.Gnome/Makefile.am
==============================================================================
--- trunk/banshee/src/Backends/Banshee.Gnome/Makefile.am (original)
+++ trunk/banshee/src/Backends/Banshee.Gnome/Makefile.am Sat Jul 19 08:56:49 2008
@@ -7,6 +7,7 @@
Banshee.GnomeBackend/Brasero.cs \
Banshee.GnomeBackend/DiscDuplicator.cs \
Banshee.GnomeBackend/GConfConfigurationClient.cs \
+ Banshee.GnomeBackend/GnomeScreensaverManager.cs \
Banshee.GnomeBackend/GnomeService.cs
RESOURCES = \
Modified: trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying.addin.xml
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying.addin.xml (original)
+++ trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying.addin.xml Sat Jul 19 08:56:49 2008
@@ -27,5 +27,9 @@
<ExtensionPoint path="/Banshee/NowPlaying/FullscreenAdapter">
<ExtensionNode name="FullscreenAdapter"/>
</ExtensionPoint>
+
+ <ExtensionPoint path="/Banshee/NowPlaying/ScreensaverManager">
+ <ExtensionNode name="ScreensaverManager"/>
+ </ExtensionPoint>
</Addin>
Modified: trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying.mdp
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying.mdp (original)
+++ trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying.mdp Sat Jul 19 08:56:49 2008
@@ -20,6 +20,8 @@
<File name="Banshee.NowPlaying/FullscreenControls.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.NowPlaying/IFullscreenAdapter.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.NowPlaying/FullscreenAdapter.cs" subtype="Code" buildaction="Compile" />
+ <File name="Banshee.NowPlaying/IScreensaverManager.cs" subtype="Code" buildaction="Compile" />
+ <File name="Banshee.NowPlaying/ScreensaverManager.cs" subtype="Code" buildaction="Compile" />
</Contents>
<References>
<ProjectReference type="Project" localcopy="True" refto="Banshee.Core" />
Added: trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/IScreensaverManager.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/IScreensaverManager.cs Sat Jul 19 08:56:49 2008
@@ -0,0 +1,36 @@
+//
+// IScreensaverManager.cs
+//
+// Author:
+// Christopher James Halse Rogers <raof ubuntu com>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace Banshee.NowPlaying
+{
+ public interface IScreensaverManager
+ {
+ void Inhibit ();
+ void UnInhibit ();
+ }
+}
Modified: trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/NowPlayingInterface.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/NowPlayingInterface.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/NowPlayingInterface.cs Sat Jul 19 08:56:49 2008
@@ -45,6 +45,7 @@
private Hyena.Widgets.RoundedFrame frame;
private Gtk.Window video_window;
private FullscreenAdapter fullscreen_adapter;
+ private ScreensaverManager screensaver;
public VideoDisplay VideoDisplay {
get { return video_display; }
@@ -74,6 +75,7 @@
PackStart (frame, true, true, 0);
fullscreen_adapter = new FullscreenAdapter ();
+ screensaver = new ScreensaverManager ();
}
private void MoveVideoExternal (bool hidden)
@@ -155,7 +157,9 @@
MoveVideoExternal (true);
video_window.ShowAll ();
fullscreen_adapter.Fullscreen (video_window, true);
+ screensaver.Inhibit ();
} else {
+ screensaver.UnInhibit ();
fullscreen_adapter.Fullscreen (video_window, false);
video_window.Hide ();
}
Added: trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/ScreensaverManager.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/ScreensaverManager.cs Sat Jul 19 08:56:49 2008
@@ -0,0 +1,68 @@
+//
+// ScreensaverManager.cs
+//
+// Author:
+// Christopher James Halse Rogers <raof ubuntu com>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using Hyena;
+using Mono.Addins;
+
+namespace Banshee.NowPlaying
+{
+ public class ScreensaverManager : IScreensaverManager
+ {
+ private IScreensaverManager manager;
+
+ public ScreensaverManager ()
+ {
+ foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes ("/Banshee/NowPlaying/ScreensaverManager")) {
+ try {
+ manager = (IScreensaverManager)node.CreateInstance (typeof (IScreensaverManager));
+ Log.DebugFormat ("Loaded IScreensaverManager: {0}", manager.GetType ().FullName);
+ break;
+ } catch (Exception e) {
+ Log.Exception ("IScreensaverManager extension failed to load", e);
+ }
+ }
+ }
+
+ public void Inhibit ()
+ {
+ if (manager != null) {
+ Log.Information ("Inhibiting screensaver during fullscreen playback");
+ manager.Inhibit ();
+ }
+ }
+
+ public void UnInhibit ()
+ {
+ if (manager != null) {
+ Log.Information ("Re-enabling screensaver");
+ manager.UnInhibit ();
+ }
+ }
+ }
+}
Modified: trunk/banshee/src/Extensions/Banshee.NowPlaying/Makefile.am
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.NowPlaying/Makefile.am (original)
+++ trunk/banshee/src/Extensions/Banshee.NowPlaying/Makefile.am Sat Jul 19 08:56:49 2008
@@ -8,9 +8,11 @@
Banshee.NowPlaying/FullscreenControls.cs \
Banshee.NowPlaying/FullscreenWindow.cs \
Banshee.NowPlaying/IFullscreenAdapter.cs \
+ Banshee.NowPlaying/IScreensaverManager.cs \
Banshee.NowPlaying/NowPlayingInterface.cs \
Banshee.NowPlaying/NowPlayingSource.cs \
Banshee.NowPlaying/OverlayWindow.cs \
+ Banshee.NowPlaying/ScreensaverManager.cs \
Banshee.NowPlaying/VideoDisplay.cs \
Banshee.NowPlaying/XOverlayVideoDisplay.cs
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]