banshee r3792 - in trunk/banshee: . src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying
- From: abock svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r3792 - in trunk/banshee: . src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying
- Date: Thu, 17 Apr 2008 20:19:57 +0100 (BST)
Author: abock
Date: Thu Apr 17 20:19:57 2008
New Revision: 3792
URL: http://svn.gnome.org/viewvc/banshee?rev=3792&view=rev
Log:
2008-04-17 Aaron Bockover <abock gnome org>
* src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/NowPlayingInterface.cs:
* src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/NowPlayingSource.cs:
Moved the fullscreen UI logic from the source to the interface
* src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/FullscreenWindow.cs:
Use Destroy explicitly
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/FullscreenWindow.cs
trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/NowPlayingInterface.cs
trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/NowPlayingSource.cs
Modified: trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/FullscreenWindow.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/FullscreenWindow.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/FullscreenWindow.cs Thu Apr 17 20:19:57 2008
@@ -47,16 +47,16 @@
Decorated = false;
}
- protected void Close ()
+ protected override void OnDestroyed ()
{
- Destroy ();
+ base.OnDestroyed ();
}
protected override bool OnKeyPressEvent (Gdk.EventKey evnt)
{
switch (evnt.Key) {
case Gdk.Key.Escape:
- Close ();
+ Destroy ();
return true;
}
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 Thu Apr 17 20:19:57 2008
@@ -31,6 +31,7 @@
using Mono.Unix;
using Gtk;
+using Banshee.ServiceStack;
using Banshee.Sources;
using Banshee.Gui;
using Banshee.Sources.Gui;
@@ -61,6 +62,70 @@
PackStart (frame, true, true, 0);
}
+#region Video Fullscreen Override
+
+ private Gtk.Window fullscreen_window;
+ private ViewActions.FullscreenHandler previous_fullscreen_handler;
+
+ private void DisableFullscreenAction ()
+ {
+ InterfaceActionService service = ServiceManager.Get<InterfaceActionService> ();
+ Gtk.ToggleAction action = service.ViewActions["FullScreenAction"] as Gtk.ToggleAction;
+ if (action != null) {
+ action.Active = false;
+ }
+ }
+
+ internal void OverrideFullscreen ()
+ {
+ InterfaceActionService service = ServiceManager.Get<InterfaceActionService> ();
+ if (service == null || service.ViewActions == null) {
+ return;
+ }
+
+ previous_fullscreen_handler = service.ViewActions.Fullscreen;
+ service.ViewActions.Fullscreen = FullscreenHandler;
+ DisableFullscreenAction ();
+ }
+
+ internal void RelinquishFullscreen ()
+ {
+ InterfaceActionService service = ServiceManager.Get<InterfaceActionService> ();
+ if (service == null || service.ViewActions == null) {
+ return;
+ }
+
+ service.ViewActions.Fullscreen = previous_fullscreen_handler;
+ }
+
+ private void OnFullscreenWindowDestroyed (object o, EventArgs args)
+ {
+ if (fullscreen_window != null) {
+ fullscreen_window.Destroyed -= OnFullscreenWindowDestroyed;
+ fullscreen_window = null;
+ }
+
+ DisableFullscreenAction ();
+ }
+
+ private void FullscreenHandler (bool fullscreen)
+ {
+ if (fullscreen) {
+ if (fullscreen_window == null) {
+ GtkElementsService service = ServiceManager.Get<GtkElementsService> ();
+ fullscreen_window = new FullscreenWindow (service.PrimaryWindow.Title, service.PrimaryWindow);
+ fullscreen_window.Destroyed += OnFullscreenWindowDestroyed;
+ }
+
+ fullscreen_window.ShowAll ();
+ fullscreen_window.Fullscreen ();
+ } else if (fullscreen_window != null) {
+ fullscreen_window.Destroy ();
+ }
+ }
+
+#endregion
+
#region ISourceContents
public bool SetSource (ISource src)
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 Thu Apr 17 20:19:57 2008
@@ -43,6 +43,7 @@
public class NowPlayingSource : Source, IDisposable
{
private TrackInfo transitioned_track;
+ private NowPlayingInterface now_playing_interface;
protected override string TypeUniqueId {
get { return "now-playing"; }
@@ -50,8 +51,10 @@
public NowPlayingSource () : base ("now-playing", Catalog.GetString ("Now Playing"), 0)
{
+ now_playing_interface = new NowPlayingInterface ();
+
Properties.SetString ("Icon.Name", "applications-multimedia");
- Properties.Set<ISourceContents> ("Nereid.SourceContents", new NowPlayingInterface ());
+ Properties.Set<ISourceContents> ("Nereid.SourceContents", now_playing_interface);
Properties.Set<bool> ("Nereid.SourceContents.HeaderVisible", false);
Properties.SetString ("ActiveSourceUIResource", "ActiveSourceUI.xml");
@@ -61,6 +64,14 @@
ServiceManager.PlaybackController.TrackStarted += OnPlaybackControllerTrackStarted;
}
+ public void Dispose ()
+ {
+ if (now_playing_interface != null) {
+ now_playing_interface.Destroy ();
+ now_playing_interface = null;
+ }
+ }
+
private void OnPlaybackControllerTransition (object o, EventArgs args)
{
transitioned_track = ServiceManager.PlaybackController.CurrentTrack;
@@ -79,73 +90,18 @@
}
}
- public void Dispose ()
- {
- }
-
-#region Video Fullscreen Override
-
- private Gtk.Window fullscreen_window;
- private ViewActions.FullscreenHandler previous_fullscreen_handler;
-
- private void DisableFullscreenAction ()
- {
- InterfaceActionService service = ServiceManager.Get<InterfaceActionService> ();
- Gtk.ToggleAction action = service.ViewActions["FullScreenAction"] as Gtk.ToggleAction;
- if (action != null) {
- action.Active = false;
- }
- }
-
public override void Activate ()
{
- InterfaceActionService service = ServiceManager.Get<InterfaceActionService> ();
- if (service == null || service.ViewActions == null) {
- return;
+ if (now_playing_interface != null) {
+ now_playing_interface.OverrideFullscreen ();
}
-
- previous_fullscreen_handler = service.ViewActions.Fullscreen;
- service.ViewActions.Fullscreen = FullscreenHandler;
- DisableFullscreenAction ();
}
public override void Deactivate ()
{
- InterfaceActionService service = ServiceManager.Get<InterfaceActionService> ();
- if (service == null || service.ViewActions == null) {
- return;
- }
-
- service.ViewActions.Fullscreen = previous_fullscreen_handler;
- }
-
- private void OnFullscreenWindowDestroyed (object o, EventArgs args)
- {
- if (fullscreen_window != null) {
- fullscreen_window.Destroyed -= OnFullscreenWindowDestroyed;
- fullscreen_window = null;
+ if (now_playing_interface != null) {
+ now_playing_interface.RelinquishFullscreen ();
}
-
- DisableFullscreenAction ();
}
-
- private void FullscreenHandler (bool fullscreen)
- {
- if (fullscreen) {
- if (fullscreen_window == null) {
- GtkElementsService service = ServiceManager.Get<GtkElementsService> ();
- fullscreen_window = new FullscreenWindow (service.PrimaryWindow.Title, service.PrimaryWindow);
- fullscreen_window.Destroyed += OnFullscreenWindowDestroyed;
- }
-
- fullscreen_window.Show ();
- fullscreen_window.Fullscreen ();
- } else if (fullscreen_window != null) {
- fullscreen_window.Destroy ();
- }
- }
-
-#endregion
-
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]