[banshee] Add initial core support for 'external' tracks



commit 261f30fcbc61fe3be0e831f0ccb3accc8d3cbe45
Author: Aaron Bockover <abockover novell com>
Date:   Mon Aug 2 11:57:30 2010 -0400

    Add initial core support for 'external' tracks
    
    Simply put, this means tracks that are in the database and can be
    searched, sorted, etc. like normal, but that will not actually play.
    When an external track is activated manually, it is launched in an
    external viewer.
    
    This allows for instance, PDF files ("Digital Booklet") to be associated
    with an album. An external track is currently indicated by a document
    icon. More tweaks here to come.

 .../Banshee.Collection/TrackMediaAttributes.cs     |    1 +
 .../Banshee.Collection.Gui/BaseTrackListView.cs    |    8 ++++++--
 .../ColumnCellStatusIndicator.cs                   |    9 +++++++--
 3 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/src/Core/Banshee.Core/Banshee.Collection/TrackMediaAttributes.cs b/src/Core/Banshee.Core/Banshee.Collection/TrackMediaAttributes.cs
index 2e631ee..5bbce2e 100644
--- a/src/Core/Banshee.Core/Banshee.Collection/TrackMediaAttributes.cs
+++ b/src/Core/Banshee.Core/Banshee.Collection/TrackMediaAttributes.cs
@@ -41,6 +41,7 @@ namespace Banshee.Collection
         Podcast = (1 << 4),     // 16
         TvShow = (1 << 5),      // 32
         Movie = (1 << 6),       // 64
+        ExternalResource = (1 << 7), // 128
 
         Default = AudioStream | Music // 5
     }
diff --git a/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/BaseTrackListView.cs b/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/BaseTrackListView.cs
index c1e1a77..120c4f7 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/BaseTrackListView.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/BaseTrackListView.cs
@@ -61,8 +61,12 @@ namespace Banshee.Collection.Gui
             RowActivated += (o, a) => {
                 ITrackModelSource source = ServiceManager.SourceManager.ActiveSource as ITrackModelSource;
                 if (source != null && source.TrackModel == Model) {
-                    ServiceManager.PlaybackController.Source = source;
-                    ServiceManager.PlayerEngine.OpenPlay (a.RowValue);
+                    if ((a.RowValue.MediaAttributes & TrackMediaAttributes.ExternalResource) != 0) {
+                        System.Diagnostics.Process.Start (a.RowValue.Uri);
+                    } else {
+                        ServiceManager.PlaybackController.Source = source;
+                        ServiceManager.PlayerEngine.OpenPlay (a.RowValue);
+                    }
                 }
             };
 
diff --git a/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellStatusIndicator.cs b/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellStatusIndicator.cs
index 31c59ab..addcd14 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellStatusIndicator.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellStatusIndicator.cs
@@ -104,7 +104,8 @@ namespace Banshee.Collection.Gui
             Playing,
             Paused,
             Error,
-            Protected
+            Protected,
+            External
         }
 
         private string [] status_names;
@@ -169,7 +170,7 @@ namespace Banshee.Collection.Gui
         }
 
         protected virtual int PixbufCount {
-            get { return 4; }
+            get { return 5; }
         }
 
         protected virtual int GetIconIndex (TrackInfo track)
@@ -184,6 +185,8 @@ namespace Banshee.Collection.Gui
                 icon_index = (int)(ServiceManager.PlayerEngine.CurrentState == PlayerState.Paused
                     ? Icon.Paused
                     : Icon.Playing);
+            } else if ((track.MediaAttributes & TrackMediaAttributes.ExternalResource) != 0) {
+                icon_index = (int)Icon.External;
             } else {
                 icon_index = -1;
             }
@@ -210,6 +213,7 @@ namespace Banshee.Collection.Gui
             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");
+            pixbufs[(int)Icon.External]  = IconThemeUtils.LoadIcon (PixbufSize, "x-office-document");
 
             if (status_names == null) {
                 status_names = new string[PixbufCount];
@@ -221,6 +225,7 @@ namespace Banshee.Collection.Gui
             status_names[(int)Icon.Paused]    = Catalog.GetString ("Paused");
             status_names[(int)Icon.Error]     = Catalog.GetString ("Error");
             status_names[(int)Icon.Protected] = Catalog.GetString ("Protected");
+            status_names[(int)Icon.External]  = Catalog.GetString ("External Document");
         }
 
         public override void NotifyThemeChange ()



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