[banshee] Make status names extendable by status cells.



commit 09005f2c5c71a515bf8476cb5b74deb7f1f5ee21
Author: Eitan Isaacson <eitan monotonous org>
Date:   Fri Nov 13 12:08:23 2009 -0800

    Make status names extendable by status cells.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=601756

 .../ColumnCellStatusIndicator.cs                   |   25 ++++++++++++++-----
 .../ColumnCellPodcastStatusIndicator.cs            |    5 +++-
 2 files changed, 22 insertions(+), 8 deletions(-)
---
diff --git a/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellStatusIndicator.cs b/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellStatusIndicator.cs
index 61e4789..eff23d1 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellStatusIndicator.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellStatusIndicator.cs
@@ -105,10 +105,10 @@ namespace Banshee.Collection.Gui
             Protected
         }
 
-        private string [] icon_names = new string[] {
-            Catalog.GetString ("Playing"), Catalog.GetString ("Paused"),
-            Catalog.GetString ("Error"), Catalog.GetString ("Protected"), ""
-        };
+        private string [] status_names;
+        protected string [] StatusNames {
+            get { return status_names; }
+        }
         
         private int pixbuf_size = 16;
         protected virtual int PixbufSize {
@@ -157,10 +157,10 @@ namespace Banshee.Collection.Gui
 
             int icon_index = GetIconIndex (track);
 
-            if ((icon_index < 0) || (icon_index >= icon_names.Length))
+            if ((icon_index < 0) || (icon_index >= status_names.Length))
                 return "";
             else
-                return icon_names[GetIconIndex (track)];
+                return status_names[icon_index];
         }
 
         protected virtual int PixbufCount {
@@ -200,11 +200,22 @@ namespace Banshee.Collection.Gui
             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");
+
+            if (status_names == null) {
+                status_names = new string[PixbufCount];
+                for (int i=0; i<PixbufCount; i++)
+                    status_names[i] = "";
+            }
+
+            status_names[(int)Icon.Playing]   = Catalog.GetString ("Playing");
+            status_names[(int)Icon.Paused]    = Catalog.GetString ("Paused");
+            status_names[(int)Icon.Error]     = Catalog.GetString ("Error");
+            status_names[(int)Icon.Protected] = Catalog.GetString ("Protected");
         }
         
         public override void NotifyThemeChange ()
diff --git a/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/ColumnCellPodcastStatusIndicator.cs b/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/ColumnCellPodcastStatusIndicator.cs
index 6e849de..c636341 100644
--- a/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/ColumnCellPodcastStatusIndicator.cs
+++ b/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/ColumnCellPodcastStatusIndicator.cs
@@ -28,6 +28,7 @@
 
 using System;
 using Gtk;
+using Mono.Unix;
 
 using Hyena.Data.Gui;
 using Banshee.Gui;
@@ -51,16 +52,18 @@ namespace Banshee.Podcasting.Gui
         protected override int PixbufCount {
             get { return base.PixbufCount + 2; }
         }
-        
+
         protected override void LoadPixbufs ()
         {
             base.LoadPixbufs ();
             
             // Downloading
             Pixbufs[base.PixbufCount + 0] = IconThemeUtils.LoadIcon (PixbufSize, "document-save", "go-bottom");
+            StatusNames[base.PixbufCount + 0] = Catalog.GetString ("Downloading");
             
             // Podcast is Downloaded
             Pixbufs[base.PixbufCount + 1] = IconThemeUtils.LoadIcon (PixbufSize, "podcast-new");
+            StatusNames[base.PixbufCount + 1] = Catalog.GetString ("New");
         }
         
         protected override int GetIconIndex (TrackInfo track)



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