[banshee] Add tooltip for playback error column



commit da299fc83db6a7a4ae9a5b4289bffec71f3b22f6
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Thu Jan 28 17:51:52 2010 -0800

    Add tooltip for playback error column

 .../Banshee.Core/Banshee.Collection/TrackInfo.cs   |   18 ++++++++++++++++++
 .../ColumnCellStatusIndicator.cs                   |   14 +++++++++++---
 2 files changed, 29 insertions(+), 3 deletions(-)
---
diff --git a/src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs b/src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs
index 333cc09..8c1702c 100644
--- a/src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs
+++ b/src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs
@@ -325,6 +325,24 @@ namespace Banshee.Collection
             set { playback_error = value; }
         }
 
+        public virtual string GetPlaybackErrorMessage ()
+        {
+            switch (PlaybackError) {
+                case StreamPlaybackError.None:
+                    return null;
+                case StreamPlaybackError.ResourceNotFound:
+                    return IsLive ? Catalog.GetString ("Stream location not found") : Catalog.GetString ("File not found");
+                case StreamPlaybackError.CodecNotFound:
+                    return Catalog.GetString ("Codec for playing this media type not available");
+                case StreamPlaybackError.Drm:
+                    return Catalog.GetString ("File protected by Digital Rights Management (DRM)");
+                case StreamPlaybackError.Unknown:
+                    return Catalog.GetString ("Unknown error");
+                default:
+                    return null;
+            }
+        }
+
         public void SavePlaybackError (StreamPlaybackError value)
         {
             if (PlaybackError != value) {
diff --git a/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellStatusIndicator.cs b/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellStatusIndicator.cs
index 08c9c7e..31c59ab 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellStatusIndicator.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellStatusIndicator.cs
@@ -96,7 +96,7 @@ namespace Banshee.Collection.Gui
         }
     }
 
-    public class ColumnCellStatusIndicator : ColumnCell, ISizeRequestCell
+    public class ColumnCellStatusIndicator : ColumnCell, ISizeRequestCell, ITooltipCell
     {
         const int padding = 2;
 
@@ -159,10 +159,13 @@ namespace Banshee.Collection.Gui
 
             int icon_index = GetIconIndex (track);
 
-            if ((icon_index < 0) || (icon_index >= status_names.Length))
+            if ((icon_index < 0) || (icon_index >= status_names.Length)) {
                 return "";
-            else
+            } else if (icon_index == (int)Icon.Error) {
+                return track.GetPlaybackErrorMessage () ?? "";
+            } else {
                 return status_names[icon_index];
+            }
         }
 
         protected virtual int PixbufCount {
@@ -261,6 +264,11 @@ namespace Banshee.Collection.Gui
             }
         }
 
+        public string GetTooltipMarkup (CellContext cellContext, double columnWidth)
+        {
+            return GetTextAlternative (BoundObject);
+        }
+
         protected TrackInfo BoundTrack {
             get { return BoundObject as TrackInfo; }
         }



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