banshee r3990 - in trunk/banshee: . src/Core/Banshee.ThickClient src/Core/Banshee.ThickClient/Banshee.Collection.Gui src/Extensions/Banshee.Podcasting src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Data src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/PodcastManager/Dialog src/Libraries/Hyena.Gui/Hyena.Data.Gui
- From: abock svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r3990 - in trunk/banshee: . src/Core/Banshee.ThickClient src/Core/Banshee.ThickClient/Banshee.Collection.Gui src/Extensions/Banshee.Podcasting src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Data src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/PodcastManager/Dialog src/Libraries/Hyena.Gui/Hyena.Data.Gui
- Date: Tue, 27 May 2008 23:46:34 +0000 (UTC)
Author: abock
Date: Tue May 27 23:46:33 2008
New Revision: 3990
URL: http://svn.gnome.org/viewvc/banshee?rev=3990&view=rev
Log:
2008-05-27 Aaron Bockover <abock gnome org>
* src/Core/Banshee.ThickClient/Banshee.Collection.Gui/XmlColumnController.cs:
Support changing the renderer on columns
* src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellStatusIndicator.cs:
Renamed to Status indicator instead of Playback indicator
* src/Core/Banshee.ThickClient/Banshee.Collection.Gui/DefaultColumnController.cs:
Updated to reflect rename of the indicator object
* src/Libraries/Hyena.Gui/Hyena.Data.Gui/Column.cs:
Support removing and clearing renderers
* src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/ColumnCellPodcast.cs:
* src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/PodcastManager/Dialog/PodcastSubscribeDialog.cs:
* src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Data/PodcastSource.cs:
Load the podcast icons from the theme, not as resources
* src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/ColumnCellPodcastStatusIndicator.cs:
A custom indicator renderer to show podcast item status
Added:
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellStatusIndicator.cs (contents, props changed)
- copied, changed from r3983, /trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellPlaybackIndicator.cs
trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/ColumnCellPodcastStatusIndicator.cs
Removed:
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellPlaybackIndicator.cs
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/DefaultColumnController.cs
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/XmlColumnController.cs
trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am
trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Data/PodcastSource.cs
trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/ColumnCellPodcast.cs
trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/PodcastManager/Dialog/PodcastSubscribeDialog.cs
trunk/banshee/src/Extensions/Banshee.Podcasting/Makefile.am
trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Column.cs
Copied: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellStatusIndicator.cs (from r3983, /trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellPlaybackIndicator.cs)
==============================================================================
--- /trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellPlaybackIndicator.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellStatusIndicator.cs Tue May 27 23:46:33 2008
@@ -1,10 +1,10 @@
//
-// ColumnCellPlaybackIndicator.cs
+// ColumnCellStatusIndicator.cs
//
// Author:
// Aaron Bockover <abockover novell com>
//
-// Copyright (C) 2007 Novell, Inc.
+// Copyright (C) 2007-2008 Novell, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
@@ -30,6 +30,7 @@
using Gtk;
using Cairo;
+using Hyena.Gui;
using Hyena.Data.Gui;
using Banshee.Gui;
@@ -39,41 +40,69 @@
namespace Banshee.Collection.Gui
{
- public class ColumnCellPlaybackIndicator : ColumnCell
+ public class ColumnCellStatusIndicator : ColumnCell
{
- private enum Icon : int {
+ protected enum Icon : int {
Playing,
Paused,
Error,
Protected
}
- private const int pixbuf_size = 16;
- private const int pixbuf_spacing = 4;
- private Gdk.Pixbuf [] pixbufs = new Gdk.Pixbuf[4];
+ private int pixbuf_size = 16;
+ protected virtual int PixbufSize {
+ get { return pixbuf_size; }
+ set { pixbuf_size = value; }
+ }
+
+ private int pixbuf_spacing = 4;
+ protected virtual int PixbufSpacing {
+ get { return pixbuf_spacing; }
+ set { pixbuf_spacing = value; }
+ }
- public ColumnCellPlaybackIndicator (string property) : this (property, true)
+ private Gdk.Pixbuf [] pixbufs;
+ protected Gdk.Pixbuf [] Pixbufs {
+ get { return pixbufs; }
+ }
+
+ public ColumnCellStatusIndicator (string property) : this (property, true)
{
}
- public ColumnCellPlaybackIndicator (string property, bool expand) : base (property, expand)
+ public ColumnCellStatusIndicator (string property, bool expand) : base (property, expand)
{
LoadPixbufs ();
}
- private void LoadPixbufs ()
+ protected virtual int PixbufCount {
+ get { return 4; }
+ }
+
+ protected virtual int GetIconIndex (TrackInfo track)
{
- for (int i = 0; i < pixbufs.Length; i++) {
- if (pixbufs[i] != null) {
- pixbufs[i].Dispose ();
- pixbufs[i] = null;
+ return -1;
+ }
+
+ protected virtual void LoadPixbufs ()
+ {
+ if (pixbufs != null && pixbufs.Length > 0) {
+ for (int i = 0; i < pixbufs.Length; i++) {
+ if (pixbufs[i] != null) {
+ pixbufs[i].Dispose ();
+ pixbufs[i] = null;
+ }
}
}
- pixbufs[(int)Icon.Playing] = IconThemeUtils.LoadIcon (pixbuf_size, "media-playback-start");
- pixbufs[(int)Icon.Paused] = IconThemeUtils.LoadIcon (pixbuf_size, "media-playback-pause");
- pixbufs[(int)Icon.Error] = IconThemeUtils.LoadIcon (pixbuf_size, "emblem-unreadable", "dialog-error");
- pixbufs[(int)Icon.Protected] = IconThemeUtils.LoadIcon (pixbuf_size, "emblem-readonly", "dialog-error");
+ if (pixbufs == null) {
+ pixbufs = new Gdk.Pixbuf[PixbufCount];
+ }
+
+ pixbufs[(int)Icon.Playing] = IconThemeUtils.LoadIcon (PixbufSize, "media-playback-start");
+ pixbufs[(int)Icon.Paused] = IconThemeUtils.LoadIcon (PixbufSize, "media-playback-pause");
+ pixbufs[(int)Icon.Error] = IconThemeUtils.LoadIcon (PixbufSize, "emblem-unreadable", "dialog-error");
+ pixbufs[(int)Icon.Protected] = IconThemeUtils.LoadIcon (PixbufSize, "emblem-readonly", "dialog-error");
}
public override void NotifyThemeChange ()
@@ -83,37 +112,54 @@
public override void Render (CellContext context, StateType state, double cellWidth, double cellHeight)
{
- TrackInfo track = BoundObject as TrackInfo;
-
- if (track == null)
- return;
-
- if (track.PlaybackError == StreamPlaybackError.None && !ServiceManager.PlayerEngine.IsPlaying (track)) {
+ TrackInfo track = BoundTrack;
+ if (track == null) {
return;
}
- Icon icon;
-
- if (track.PlaybackError == StreamPlaybackError.None) {
- icon = ServiceManager.PlayerEngine.CurrentState == PlayerState.Paused
+ int icon_index = -1;
+
+ if (track.PlaybackError != StreamPlaybackError.None) {
+ icon_index = (int)(track.PlaybackError == StreamPlaybackError.Drm
+ ? Icon.Protected
+ : Icon.Error);
+ } else if (ServiceManager.PlayerEngine.IsPlaying (track)) {
+ icon_index = (int)(ServiceManager.PlayerEngine.CurrentState == PlayerState.Paused
? Icon.Paused
- : Icon.Playing;
- } else if (track.PlaybackError == StreamPlaybackError.Drm) {
- icon = Icon.Protected;
+ : Icon.Playing);
} else {
- icon = Icon.Error;
- }
+ icon_index = GetIconIndex (track);
+ }
+
+ if (icon_index < 0) {
+ return;
+ }
context.Context.Translate (0, 0.5);
- Gdk.Pixbuf render_pixbuf = pixbufs[(int)icon];
+ Gdk.Pixbuf render_pixbuf = pixbufs[icon_index];
- Cairo.Rectangle pixbuf_area = new Cairo.Rectangle (pixbuf_spacing,
+ Cairo.Rectangle pixbuf_area = new Cairo.Rectangle (PixbufSize,
(cellHeight - render_pixbuf.Height) / 2, render_pixbuf.Width, render_pixbuf.Height);
+ if (!context.Sensitive) {
+ context.Context.Save ();
+ }
+
Gdk.CairoHelper.SetSourcePixbuf (context.Context, render_pixbuf, pixbuf_area.X, pixbuf_area.Y);
context.Context.Rectangle (pixbuf_area);
- context.Context.Fill ();
+
+ if (!context.Sensitive) {
+ context.Context.Clip ();
+ context.Context.PaintWithAlpha (0.5);
+ context.Context.Restore ();
+ } else {
+ context.Context.Fill ();
+ }
+ }
+
+ protected TrackInfo BoundTrack {
+ get { return BoundObject as TrackInfo; }
}
}
}
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/DefaultColumnController.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/DefaultColumnController.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/DefaultColumnController.cs Tue May 27 23:46:33 2008
@@ -83,7 +83,7 @@
}
private Column indicator_column
- = new Column (null, "indicator", new ColumnCellPlaybackIndicator (null), 0.05, true, 30, 30);
+ = new Column (null, "indicator", new ColumnCellStatusIndicator (null), 0.05, true, 30, 30);
public Column IndicatorColumn {
get { return indicator_column; }
}
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/XmlColumnController.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/XmlColumnController.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/XmlColumnController.cs Tue May 27 23:46:33 2008
@@ -158,6 +158,12 @@
column.Title = title;
}
+ if (renderer_type != null) {
+ ColumnCell renderer = GetCellRenderer (renderer_type, renderer_property, renderer_expand);
+ column.RemoveCell (0);
+ column.PackStart (renderer);
+ }
+
if (renderer_property != null) {
column.GetCell (0).Property = renderer_property;
}
@@ -170,20 +176,7 @@
((SortableColumn)column).SortKey = sort_key;
}
} else {
- Type type = null;
-
- foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies ()) {
- type = asm.GetType (renderer_type, false, true);
- if (type != null) {
- break;
- }
- }
-
- if (type == null) {
- throw new TypeLoadException (renderer_type);
- }
-
- ColumnCell renderer = (ColumnCell)Activator.CreateInstance (type, renderer_property, renderer_expand);
+ ColumnCell renderer = GetCellRenderer (renderer_type, renderer_property, renderer_expand);
Column column = sort_key == null
? new Column (title, renderer, width, visible)
@@ -195,6 +188,24 @@
}
}
+ private ColumnCell GetCellRenderer (string typeName, string property, bool expand)
+ {
+ Type type = null;
+
+ foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies ()) {
+ type = asm.GetType (typeName, false, true);
+ if (type != null) {
+ break;
+ }
+ }
+
+ if (type == null) {
+ throw new TypeLoadException (typeName);
+ }
+
+ return (ColumnCell)Activator.CreateInstance (type, property, expand);
+ }
+
private bool ParseBoolean (string value)
{
value = value.ToLower ();
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am Tue May 27 23:46:33 2008
@@ -15,8 +15,8 @@
Banshee.Collection.Gui/ColumnCellDateTime.cs \
Banshee.Collection.Gui/ColumnCellDuration.cs \
Banshee.Collection.Gui/ColumnCellFileSize.cs \
- Banshee.Collection.Gui/ColumnCellPlaybackIndicator.cs \
Banshee.Collection.Gui/ColumnCellPositiveInt.cs \
+ Banshee.Collection.Gui/ColumnCellStatusIndicator.cs \
Banshee.Collection.Gui/ColumnCellTrack.cs \
Banshee.Collection.Gui/ColumnCellTrackNumber.cs \
Banshee.Collection.Gui/DefaultColumnController.cs \
Modified: trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Data/PodcastSource.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Data/PodcastSource.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Data/PodcastSource.cs Tue May 27 23:46:33 2008
@@ -96,22 +96,17 @@
{
this.baseDirectory = baseDirectory;
- Properties.SetString ("Icon.Name", "podcast-icon-22");
+ Properties.SetString ("Icon.Name", "podcast");
Properties.SetString ("ActiveSourceUIResource", "ActiveSourceUI.xml");
Properties.SetString ("GtkActionPath", "/PodcastSourcePopup");
Properties.Set<ISourceContents> ("Nereid.SourceContents", new PodcastSourceContents ());
Properties.SetString ("TrackView.ColumnControllerXml", String.Format (@"
<column-controller>
- <column>
- <visible>true</visible>
- <renderer type=""Banshee.Podcasting.Gui.PodcastItemActivityColumn"" property=""Activity"" />
- <sort-key>DownloadStatus</sort-key>
- <width>.025</width>
- <max-width>30</max-width>
- <min-width>30</min-width>
- </column>
<add-all-defaults />
+ <column modify-default=""IndicatorColumn"">
+ <renderer type=""Banshee.Podcasting.Gui.ColumnCellPodcastStatusIndicator"" />
+ </column>
<remove-default column=""TrackColumn"" />
<remove-default column=""DiscColumn"" />
<remove-default column=""ComposerColumn"" />
Modified: trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/ColumnCellPodcast.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/ColumnCellPodcast.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/ColumnCellPodcast.cs Tue May 27 23:46:33 2008
@@ -50,7 +50,7 @@
private static int pixbuf_size = 48;
// TODO replace this w/ new icon installation etc
- private static Gdk.Pixbuf default_cover_pixbuf = Gdk.Pixbuf.LoadFromResource ("podcast-icon-48.png");
+ private static Gdk.Pixbuf default_cover_pixbuf = IconThemeUtils.LoadIcon (48, "podcast");
private ArtworkManager artwork_manager;
Added: trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/ColumnCellPodcastStatusIndicator.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/ColumnCellPodcastStatusIndicator.cs Tue May 27 23:46:33 2008
@@ -0,0 +1,91 @@
+//
+// ColumnCellPodcastStatusIndicator.cs
+//
+// Author:
+// Aaron Bockover <abockover novell 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 Gtk;
+
+using Hyena.Data.Gui;
+using Banshee.Gui;
+using Banshee.Collection.Gui;
+
+using Banshee.Collection;
+using Banshee.Podcasting.Data;
+
+namespace Banshee.Podcasting.Gui
+{
+ public class ColumnCellPodcastStatusIndicator : ColumnCellStatusIndicator
+ {
+ public ColumnCellPodcastStatusIndicator (string property) : base (property)
+ {
+ }
+
+ public ColumnCellPodcastStatusIndicator (string property, bool expand) : base (property, expand)
+ {
+ }
+
+ protected override int PixbufCount {
+ get { return base.PixbufCount + 1; }
+ }
+
+ protected override void LoadPixbufs ()
+ {
+ base.LoadPixbufs ();
+
+ // Downloading
+ Pixbufs[base.PixbufCount + 0] = IconThemeUtils.LoadIcon (PixbufSize, "document-save", "go-bottom");
+ }
+
+ protected override int GetIconIndex (TrackInfo track)
+ {
+ PodcastTrackInfo podcast = track as PodcastTrackInfo;
+ if (track == null) {
+ return -1;
+ }
+
+ switch (podcast.Activity) {
+ case PodcastItemActivity.Downloading:
+ case PodcastItemActivity.DownloadPending:
+ return base.PixbufCount + 0;
+ default:
+ return -1;
+ }
+ }
+
+ public override void Render (CellContext context, StateType state, double cellWidth, double cellHeight)
+ {
+ PodcastTrackInfo podcast = BoundTrack as PodcastTrackInfo;
+ if (podcast != null) {
+ if (podcast.Activity == PodcastItemActivity.DownloadPending) {
+ context.Sensitive = false;
+ }
+ }
+
+ base.Render (context, state, cellWidth, cellHeight);
+ }
+ }
+}
Modified: trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/PodcastManager/Dialog/PodcastSubscribeDialog.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/PodcastManager/Dialog/PodcastSubscribeDialog.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/PodcastManager/Dialog/PodcastSubscribeDialog.cs Tue May 27 23:46:33 2008
@@ -77,9 +77,7 @@
box.BorderWidth = 6;
box.Spacing = 12;
- Image image = new Image (
- Gdk.Pixbuf.LoadFromResource ("podcast-icon-48.png")
- );
+ Image image = new Image (IconThemeUtils.LoadIcon (48, "podcast"));
image.Yalign = 0.0f;
Modified: trunk/banshee/src/Extensions/Banshee.Podcasting/Makefile.am
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Podcasting/Makefile.am (original)
+++ trunk/banshee/src/Extensions/Banshee.Podcasting/Makefile.am Tue May 27 23:46:33 2008
@@ -10,6 +10,7 @@
Banshee.Podcasting.Data/PodcastTrackListModel.cs \
Banshee.Podcasting.Data/PodcastUnheardFilterModel.cs \
Banshee.Podcasting.Gui/ColumnCellPodcast.cs \
+ Banshee.Podcasting.Gui/ColumnCellPodcastStatusIndicator.cs \
Banshee.Podcasting.Gui/ColumnCellPublished.cs \
Banshee.Podcasting.Gui/ColumnCellUnheard.cs \
Banshee.Podcasting.Gui/DownloadManager/DownloadManagerInterface.cs \
@@ -37,11 +38,7 @@
RESOURCES = \
Banshee.Podcasting.addin.xml \
Resources/ActiveSourceUI.xml \
- Resources/GlobalUI.xml \
- Resources/Images/podcast-icon-16.png \
- Resources/Images/podcast-icon-22.png \
- Resources/Images/podcast-icon-48.png \
- Resources/Images/podcast-new-16.png
+ Resources/GlobalUI.xml
if ENABLE_PODCAST
include $(top_srcdir)/build/build.mk
Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Column.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Column.cs (original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Column.cs Tue May 27 23:46:33 2008
@@ -114,6 +114,16 @@
return cells[index];
}
+ public void RemoveCell (int index)
+ {
+ cells.RemoveAt (index);
+ }
+
+ public void ClearCells ()
+ {
+ cells.Clear ();
+ }
+
IEnumerator IEnumerable.GetEnumerator ()
{
return cells.GetEnumerator ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]