[banshee] Add back optional cover art in bottom left
- From: Gabriel Burt <gburt src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [banshee] Add back optional cover art in bottom left
- Date: Sat, 28 Nov 2009 22:29:05 +0000 (UTC)
commit 025b99a5c1335ef742985dd5275e6775282db3d8
Author: Gabriel Burt <gabriel burt gmail com>
Date: Sat Nov 28 14:17:13 2009 -0800
Add back optional cover art in bottom left
src/Clients/Nereid/Nereid/PlayerInterface.cs | 38 ++++++++-
.../Banshee.Gui.Widgets/CoverArtDisplay.cs | 90 ++++++++++++++++++++
.../Banshee.ThickClient/Banshee.Gui/ViewActions.cs | 4 +-
src/Core/Banshee.ThickClient/Makefile.am | 1 +
.../Resources/core-ui-actions-layout.xml | 2 +-
5 files changed, 130 insertions(+), 5 deletions(-)
---
diff --git a/src/Clients/Nereid/Nereid/PlayerInterface.cs b/src/Clients/Nereid/Nereid/PlayerInterface.cs
index aea08e1..3ac9401 100644
--- a/src/Clients/Nereid/Nereid/PlayerInterface.cs
+++ b/src/Clients/Nereid/Nereid/PlayerInterface.cs
@@ -64,6 +64,8 @@ namespace Nereid
private HBox footer_toolbar;
private HPaned views_pane;
private ViewContainer view_container;
+ private VBox source_box;
+ private CoverArtDisplay cover_art_display;
// Major Interaction Components
private SourceView source_view;
@@ -177,7 +179,7 @@ namespace Nereid
private void BuildViews ()
{
- VBox source_box = new VBox ();
+ source_box = new VBox ();
views_pane = new HPaned ();
PersistentPaneController.Control (views_pane, SourceViewWidth);
@@ -195,6 +197,8 @@ namespace Nereid
source_box.PackStart (source_scroll, true, true, 0);
source_box.PackStart (new UserJobTileHost (), false, false, 0);
+ UpdateCoverArtDisplay ();
+
source_view.SetSizeRequest (125, -1);
view_container.SetSizeRequest (425, -1);
@@ -208,6 +212,30 @@ namespace Nereid
primary_vbox.PackStart (views_pane, true, true, 0);
}
+ private void UpdateCoverArtDisplay ()
+ {
+ if (ShowCoverArt.Get ()) {
+ if (cover_art_display == null && source_box != null) {
+ cover_art_display = new CoverArtDisplay () { Visible = true };
+ source_box.SizeAllocated += OnSourceBoxSizeAllocated;
+ cover_art_display.HeightRequest = SourceViewWidth.Get ();
+ source_box.PackStart (cover_art_display, false, false, 0);
+ source_box.ShowAll ();
+ }
+ } else if (cover_art_display != null) {
+ cover_art_display.Hide ();
+ source_box.Remove (cover_art_display);
+ source_box.SizeAllocated -= OnSourceBoxSizeAllocated;
+ cover_art_display.Dispose ();
+ cover_art_display = null;
+ }
+ }
+
+ private void OnSourceBoxSizeAllocated (object o, EventArgs args)
+ {
+ cover_art_display.HeightRequest = source_box.Allocation.Width;
+ }
+
private void BuildFooter ()
{
footer_toolbar = new HBox () { BorderWidth = 2 };
@@ -263,6 +291,12 @@ namespace Nereid
ActionService.TrackActions ["SearchForSameArtistAction"].Activated += OnProgrammaticSearch;
ActionService.TrackActions ["SearchForSameAlbumAction"].Activated += OnProgrammaticSearch;
+ (ActionService.ViewActions ["ShowCoverArtAction"] as Gtk.ToggleAction).Active = ShowCoverArt.Get ();
+ ActionService.ViewActions ["ShowCoverArtAction"].Activated += (o, a) => {
+ ShowCoverArt.Set ((o as Gtk.ToggleAction).Active);
+ UpdateCoverArtDisplay ();
+ };
+
// UI events
view_container.SearchEntry.Changed += OnSearchEntryChanged;
views_pane.SizeRequested += delegate {
@@ -569,7 +603,7 @@ namespace Nereid
public static readonly SchemaEntry<bool> ShowCoverArt = new SchemaEntry<bool> (
"player_window", "show_cover_art",
- true,
+ false,
"Show cover art",
"Show cover art below source view if available"
);
diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/CoverArtDisplay.cs b/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/CoverArtDisplay.cs
new file mode 100644
index 0000000..c12a204
--- /dev/null
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/CoverArtDisplay.cs
@@ -0,0 +1,90 @@
+//
+// CoverArtdisplay.cs
+//
+// Author:
+// Gabriel Burt <gburt novell com>
+//
+// Copyright (C) 2009 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 System.Collections.Generic;
+using Mono.Unix;
+
+using Gtk;
+using Cairo;
+
+using Hyena;
+using Hyena.Gui;
+using Hyena.Gui.Theatrics;
+
+using Banshee.Base;
+using Banshee.Collection;
+using Banshee.Collection.Gui;
+using Banshee.ServiceStack;
+using Banshee.MediaEngine;
+
+namespace Banshee.Gui.Widgets
+{
+ public class CoverArtDisplay : TrackInfoDisplay
+ {
+ private ImageSurface idle_album;
+
+ public CoverArtDisplay ()
+ {
+ }
+
+ public override void Dispose ()
+ {
+ Console.WriteLine ("Disposing idle artwork");
+ var disposable = idle_album as IDisposable;
+ if (disposable != null) {
+ disposable.Dispose ();
+ }
+
+ base.Dispose ();
+ }
+
+
+ protected override int ArtworkSizeRequest {
+ get { return Allocation.Width; }
+ }
+
+ protected override void RenderTrackInfo (Cairo.Context cr, TrackInfo track, bool renderTrack, bool renderArtistAlbum)
+ {
+ }
+
+ protected override bool CanRenderIdle {
+ get { return true; }
+ }
+
+ protected override void RenderIdle (Cairo.Context cr)
+ {
+ idle_album = idle_album ?? PixbufImageSurface.Create (Banshee.Gui.IconThemeUtils.LoadIcon (
+ ArtworkSizeRequest, "media-optical"), true);
+
+ ArtworkRenderer.RenderThumbnail (cr, idle_album, false, Allocation.X, Allocation.Y,
+ ArtworkSizeRequest, ArtworkSizeRequest,
+ false, 0, true, BackgroundColor);
+ }
+ }
+}
diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui/ViewActions.cs b/src/Core/Banshee.ThickClient/Banshee.Gui/ViewActions.cs
index b0748a8..48435db 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Gui/ViewActions.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui/ViewActions.cs
@@ -81,11 +81,11 @@ namespace Banshee.Gui
Catalog.GetString ("Enter or leave fullscreen mode"), OnFullScreen, false),
});
- /*Add (new ToggleActionEntry [] {
+ Add (new ToggleActionEntry [] {
new ToggleActionEntry ("ShowCoverArtAction", null,
Catalog.GetString ("Show Cover _Art"), null,
Catalog.GetString ("Toggle display of album cover art"), null, false),
- });*/
+ });
ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent, PlayerEvent.StateChange);
OnFullScreen (null, EventArgs.Empty);
diff --git a/src/Core/Banshee.ThickClient/Makefile.am b/src/Core/Banshee.ThickClient/Makefile.am
index f2b709c..25defba 100644
--- a/src/Core/Banshee.ThickClient/Makefile.am
+++ b/src/Core/Banshee.ThickClient/Makefile.am
@@ -88,6 +88,7 @@ SOURCES = \
Banshee.Gui.Widgets/ConnectedMessageBar.cs \
Banshee.Gui.Widgets/ConnectedSeekSlider.cs \
Banshee.Gui.Widgets/ConnectedVolumeButton.cs \
+ Banshee.Gui.Widgets/CoverArtDisplay.cs \
Banshee.Gui.Widgets/LargeTrackInfoDisplay.cs \
Banshee.Gui.Widgets/MainMenu.cs \
Banshee.Gui.Widgets/NextButton.cs \
diff --git a/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml b/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml
index 63d808f..de1e3bf 100644
--- a/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml
+++ b/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml
@@ -58,9 +58,9 @@
</menu>
<menu name="ViewMenu" action="ViewMenuAction">
- <!--<menuitem name="ShowCoverArt" action="ShowCoverArtAction"/>-->
<placeholder name="BrowserViews"/>
<placeholder name="ViewMenuAdditions"/>
+ <menuitem name="ShowCoverArt" action="ShowCoverArtAction"/>
<menuitem name="ShowContextPane" action="ShowContextPaneAction"/>
<menuitem name="FullScreen" action="FullScreenAction"/>
<separator/>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]