banshee r4265 - in trunk/banshee: . src/Core/Banshee.ThickClient/Banshee.Gui src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying



Author: gburt
Date: Sun Jul 27 23:10:16 2008
New Revision: 4265
URL: http://svn.gnome.org/viewvc/banshee?rev=4265&view=rev

Log:
2008-07-27  Gabriel Burt  <gabriel burt gmail com>

	* src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/ScreensaverManager.cs:
	Keep track of whether the screensaver is already inhibited.  Implement
	IDisposable and uninhibit when Disposed.

	* src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/NowPlayingInterface.cs:
	Override Dispose and call Dispose on the ScreensaveManager.

	* src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/NowPlayingSource.cs:
	Call Dispose on the NowPlayingInterface.

	* src/Core/Banshee.ThickClient/Banshee.Gui/TrackActions.cs: Make all track
	actions not visible/sensitive when dealing with a non ITrackModelSoure,
	for example the Now Playing source (BGO #538398).


Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/TrackActions.cs
   trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/NowPlayingInterface.cs
   trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/NowPlayingSource.cs
   trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/ScreensaverManager.cs

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/TrackActions.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/TrackActions.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/TrackActions.cs	Sun Jul 27 23:10:16 2008
@@ -205,6 +205,7 @@
             Hyena.Collections.Selection selection = (source is ITrackModelSource) ? (source as ITrackModelSource).TrackModel.Selection : null;
 
             if (selection != null) {
+                Sensitive = Visible = true;
                 bool has_selection = selection.Count > 0;
                 foreach (string action in require_selection_actions) {
                     this[action].Sensitive = has_selection;
@@ -228,9 +229,10 @@
                     
                     UpdateAction ("TrackPropertiesAction", in_database, has_selection, source);
                     UpdateAction ("RateTracksAction", in_database, has_selection, null);
-
                     UpdateAction ("AddToPlaylistAction", in_database && primary_source != null && primary_source.SupportsPlaylists, has_selection, null);
                 }
+            } else {
+                Sensitive = Visible = false;
             }
         }
 

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	Sun Jul 27 23:10:16 2008
@@ -78,6 +78,13 @@
             screensaver = new ScreensaverManager ();
         }
         
+        public override void Dispose ()
+        {
+            base.Dispose ();
+            screensaver.Dispose ();
+        }
+
+        
         private void MoveVideoExternal (bool hidden)
         {
             if (video_display.Parent != video_window) {

Modified: trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/NowPlayingSource.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/NowPlayingSource.cs	(original)
+++ trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/NowPlayingSource.cs	Sun Jul 27 23:10:16 2008
@@ -73,6 +73,7 @@
 
             if (now_playing_interface != null) {
                 now_playing_interface.Destroy ();
+                now_playing_interface.Dispose ();
                 now_playing_interface = null;
             }
         }

Modified: trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/ScreensaverManager.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/ScreensaverManager.cs	(original)
+++ trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/ScreensaverManager.cs	Sun Jul 27 23:10:16 2008
@@ -32,9 +32,10 @@
 
 namespace Banshee.NowPlaying
 {
-    public class ScreensaverManager : IScreensaverManager
+    public class ScreensaverManager : IScreensaverManager, IDisposable
     {
         private IScreensaverManager manager;
+        bool inhibited = false;
         
         public ScreensaverManager ()
         {
@@ -49,20 +50,27 @@
             }
         }
         
+        public void Dispose ()
+        {
+            UnInhibit ();
+        }
+        
         public void Inhibit ()
         {
-            if (manager != null) {
+            if (manager != null && !inhibited) {
                 Log.Information ("Inhibiting screensaver during fullscreen playback");
                 manager.Inhibit ();
+                inhibited = true;
             }
         }
         
         public void UnInhibit ()
         {
-            if (manager != null) {
-                Log.Information ("Re-enabling screensaver");
+            if (manager != null && inhibited) {
+                Log.Information ("Uninhibiting screensaver");
                 manager.UnInhibit ();
+                inhibited = false;
             }
-        }           
+        }
     }
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]