banshee r3167 - in trunk/banshee: . src/Core/Banshee.ThickClient/Banshee.Gui
- From: abock svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r3167 - in trunk/banshee: . src/Core/Banshee.ThickClient/Banshee.Gui
- Date: Thu, 7 Feb 2008 21:43:57 +0000 (GMT)
Author: abock
Date: Thu Feb 7 21:43:57 2008
New Revision: 3167
URL: http://svn.gnome.org/viewvc/banshee?rev=3167&view=rev
Log:
2008-02-07 Aaron Bockover <abock gnome org>
* src/Core/Banshee.ThickClient/Banshee.Gui/TrackActions.cs: Only add
the separator to the add to playlist menu if there are actually playlists
that can be added to; remove the playlist map and pass the source through
the .Data property of the object
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/TrackActions.cs
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/TrackActions.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/TrackActions.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/TrackActions.cs Thu Feb 7 21:43:57 2008
@@ -47,7 +47,6 @@
public class TrackActions : BansheeActionGroup
{
private InterfaceActionService action_service;
- private Dictionary<MenuItem, PlaylistSource> playlist_menu_map = new Dictionary<MenuItem, PlaylistSource> ();
private RatingActionProxy rating_proxy;
private static readonly string [] require_selection_actions = new string [] {
@@ -280,7 +279,6 @@
private void OnAddToPlaylist (object o, EventArgs args)
{
Gdk.Pixbuf pl_pb = Gdk.Pixbuf.LoadFromResource ("source-playlist-16.png");
- playlist_menu_map.Clear ();
Source active_source = ServiceManager.SourceManager.ActiveSource;
// TODO find just the menu that was activated instead of modifying all proxies
@@ -289,18 +287,25 @@
menu.Submenu = submenu;
submenu.Append (this ["AddToNewPlaylistAction"].CreateMenuItem ());
- submenu.Append (new SeparatorMenuItem ());
+ bool separator_added = false;
+
foreach (Source child in ServiceManager.SourceManager.DefaultSource.Children) {
PlaylistSource playlist = child as PlaylistSource;
if (playlist != null) {
+ if (!separator_added) {
+ submenu.Append (new SeparatorMenuItem ());
+ separator_added = true;
+ }
+
ImageMenuItem item = new ImageMenuItem (playlist.Name);
item.Image = new Gtk.Image (pl_pb);
item.Activated += OnAddToExistingPlaylist;
item.Sensitive = playlist != active_source;
- playlist_menu_map[item] = playlist;
+ item.Data.Add ("playlist", playlist);
submenu.Append (item);
}
}
+
submenu.ShowAll ();
}
}
@@ -319,8 +324,10 @@
private void OnAddToExistingPlaylist (object o, EventArgs args)
{
- PlaylistSource playlist = playlist_menu_map[o as MenuItem];
- playlist.AddSelectedTracks (TrackSelector.TrackModel);
+ MenuItem item = (MenuItem)o;
+ if (item.Data != null && item.Data.ContainsKey ("playlist")) {
+ ((PlaylistSource)item.Data["playlist"]).AddSelectedTracks (TrackSelector.TrackModel);
+ }
}
private void OnRemoveTracks (object o, EventArgs args)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]