banshee r3706 - in trunk/banshee: . src/Core/Banshee.ThickClient/Banshee.Gui



Author: gburt
Date: Mon Apr  7 21:14:58 2008
New Revision: 3706
URL: http://svn.gnome.org/viewvc/banshee?rev=3706&view=rev

Log:
2008-04-07  Gabriel Burt  <gabriel burt gmail com>

	* src/Core/Banshee.ThickClient/Banshee.Gui/BansheeActionGroup.cs: Save the
	original IconName for an action within UpdateAction, like we do for
	labels, so we can restore it when we switch to a source that doesn't
	override it.

	* src/Core/Banshee.ThickClient/Banshee.Gui/SourceActions.cs: Use IconName
	instead of the StockId so icons can be overridden.


Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/BansheeActionGroup.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/SourceActions.cs

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/BansheeActionGroup.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/BansheeActionGroup.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/BansheeActionGroup.cs	Mon Apr  7 21:14:58 2008
@@ -40,6 +40,7 @@
     public class BansheeActionGroup : ActionGroup
     {
         protected Dictionary<string, string> labels = new Dictionary<string, string> ();
+        protected Dictionary<string, string> icons = new Dictionary<string, string> ();
 
         public BansheeActionGroup (string name) : base (name)
         {
@@ -78,17 +79,26 @@
             action.Sensitive = visible && sensitive;
 
             if (source != null && action.Visible) {
-                if (!labels.ContainsKey (action_name)) {
+                // Save the original label
+                if (!labels.ContainsKey (action_name))
                     labels.Add (action_name, action.Label);
-                    //Console.WriteLine ("action label {0} for {1} just not saved", action.Label, action_name);
-                }
-                string label = source.Properties.GetString (String.Format ("{0}Label", action_name));
-                string icon = source.Properties.GetString (String.Format ("{0}IconName", action_name));
-                action.Label = String.IsNullOrEmpty (label) ? labels[action_name] : label;
+
+                // Save the original icon name
+                if (!icons.ContainsKey (action_name))
+                    icons.Add (action_name, action.IconName);
+
+                // If this source has a label property for this action, override the current label, otherwise reset it
+                // to the original label
+                string label = source.Properties.GetString (String.Format ("{0}Label", action_name)) ?? labels[action_name];
+                action.Label = label;
+
+                // If this source has an icon property for this action, override the current icon, othewise reset it
+                // to the original icon
+                string icon = source.Properties.GetString (String.Format ("{0}IconName", action_name)) ?? icons[action_name];
                 if (!String.IsNullOrEmpty (icon)) {
+                    Console.WriteLine ("Setting icon for {1} to {0}", icon, action_name);
                     action.IconName = icon;
                 }
-                //Console.WriteLine ("for source {0} and action {1} got label {2}, so set action.Label = {3}", source.Name, action_name, label, action.Label);
             }
         }
 

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/SourceActions.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/SourceActions.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/SourceActions.cs	Mon Apr  7 21:14:58 2008
@@ -71,7 +71,7 @@
             action_service = actionService;
 
             Add (new ActionEntry [] {
-                new ActionEntry ("NewPlaylistAction", Stock.New,
+                new ActionEntry ("NewPlaylistAction", null,
                     Catalog.GetString ("_New Playlist"), "<control>N",
                     Catalog.GetString ("Create a new empty playlist"), OnNewPlaylist),
 
@@ -90,20 +90,25 @@
                     Catalog.GetString ("Import to Library"), null,
                     Catalog.GetString ("Import source to library"), OnImportSource),
 
-                new ActionEntry ("RenameSourceAction", "gtk-edit", 
+                new ActionEntry ("RenameSourceAction", null,
                     "Rename", "F2", "Rename", OnRenameSource),
 
                 new ActionEntry ("ExportPlaylistAction", null,
                     Catalog.GetString ("Export Playlist..."), null,
                     Catalog.GetString ("Export a playlist"), OnExportPlaylist),
 
-                new ActionEntry ("UnmapSourceAction", Stock.Delete,
+                new ActionEntry ("UnmapSourceAction", null,
                     "Unmap", "<shift>Delete", null, OnUnmapSource),
                     
-                new ActionEntry ("SourcePropertiesAction", Stock.Properties,
+                new ActionEntry ("SourcePropertiesAction", null,
                     "Source Properties", null, null, OnSourceProperties),
             });
 
+            this["NewPlaylistAction"].IconName = Stock.New;
+            this["UnmapSourceAction"].IconName = Stock.Delete;
+            this["RenameSourceAction"].IconName = "gtk-edit";
+            this["SourcePropertiesAction"].IconName = Stock.Properties;
+
             AddImportant (
                 new ActionEntry ("RefreshSmartPlaylistAction", Stock.Refresh,
                     Catalog.GetString ("Refresh"), null,



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