banshee r4191 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Collection src/Core/Banshee.Services/Banshee.Collection.Database src/Core/Banshee.Services/Banshee.Database src/Core/Banshee.Services/Banshee.Library src/Core/Banshee.Services/Banshee.Playlist src/Core/Banshee.Services/Banshee.Playlists.Formats src/Core/Banshee.ThickClient/Banshee.Gui src/Core/Banshee.ThickClient/Banshee.Library.Gui src/Core/Banshee.ThickClient/Resources src/Extensions/Banshee.Daap/Banshee.Daap src/Libraries/Hyena.Gui/Hyena.Gui



Author: gburt
Date: Tue Jun 24 06:03:44 2008
New Revision: 4191
URL: http://svn.gnome.org/viewvc/banshee?rev=4191&view=rev

Log:
2008-06-24  Gabriel Burt  <gabriel burt gmail com>

	Importing playlists (.m3u and .pls) should work again.

	* src/Extensions/Banshee.Daap/Banshee.Daap/DaapPlaylistSource.cs: Fix
	typo/bug.

	* src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml:
	* src/Core/Banshee.ThickClient/Banshee.Gui/GlobalActions.cs: Uncomment out
	the playlist import action/handler.

	* src/Core/Banshee.ThickClient/Banshee.Library.Gui/FileImportSource.cs:
	* src/Core/Banshee.ThickClient/Banshee.Library.Gui/FolderImportSource.cs:
	Set some default shortcut folders for the file choosers, and set a
	FileFilter from the white listed files for the File importer.

	* src/Core/Banshee.Services/Banshee.Collection/ImportManager.cs: Add
	exception handling/logging.

	* src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseImportManager.cs:
	Make string [] of white listed extensions public/readonly.

	* src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs:
	Reduce duplication in still-ugly *ForUri static methods.

	* src/Core/Banshee.Services/Banshee.Playlists.Formats/PlaylistParser.cs:
	Dispose of the input stream when finished with it.

	* src/Core/Banshee.Services/Banshee.Playlists.Formats/PlaylistFormatBase.cs:
	Add TODO.

	* src/Core/Banshee.Services/Banshee.Playlist/PlaylistFileUtil.cs: Add
	ImportPlaylistToLibrary method, and use it for the Import Playlist(s)
	actions.  Implement the ImportPlaylistWorker class to work with trunk.

	* src/Core/Banshee.Services/Banshee.Library/LibrarySource.cs: Add
	convenience method GetTrackIdForUrl that uses the DatabaseTrackInfo
	methods.

	* src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs:
	Add some indices, and fix a bug where the changes from migration 12 were
	not also done for the intial db creation code.

	* src/Libraries/Hyena.Gui/Hyena.Gui/GtkUtilities.cs: Add two methods, one
	for creating a FileFilter from a string [] of extensions, and one for
	setting a bunch of shortcut folders for a file chooser (w/ try/catch).


Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseImportManager.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Collection/ImportManager.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Library/LibrarySource.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Playlist/PlaylistFileUtil.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Playlists.Formats/PlaylistFormatBase.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Playlists.Formats/PlaylistParser.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/GlobalActions.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Library.Gui/FileImportSource.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Library.Gui/FolderImportSource.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml
   trunk/banshee/src/Extensions/Banshee.Daap/Banshee.Daap/DaapPlaylistSource.cs
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui/GtkUtilities.cs

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseImportManager.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseImportManager.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseImportManager.cs	Tue Jun 24 06:03:44 2008
@@ -52,7 +52,7 @@
         // used to see if we should allow the file to be processed by TagLib. The
         // point is to rule out, at the path level, files that we won't support.
         
-        private static readonly string [] white_list_file_extensions = new string [] {
+        public static readonly string [] WhiteListFileExtensions = new string [] {
             "3g2",  "3gp",  "3gp2", "3gpp", "aac",  "ac3",  "aif",  "aifc", 
             "aiff", "al",   "alaw", "ape",  "asf",  "asx",  "au",   "avi", 
             "cda",  "cdr",  "divx", "dv",   "flac", "flv",  "gvi",  "gvp", 
@@ -69,7 +69,7 @@
 
         static DatabaseImportManager ()
         {
-            Array.Sort<string> (white_list_file_extensions);
+            Array.Sort<string> (WhiteListFileExtensions);
         }
 
         public static bool IsWhiteListedFile (string path)
@@ -83,7 +83,7 @@
                 return false;
             }
             
-            return Array.BinarySearch<string> (white_list_file_extensions, 
+            return Array.BinarySearch<string> (WhiteListFileExtensions, 
                 path.Substring (index + 1).ToLower ()) >= 0;
         }
 

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs	Tue Jun 24 06:03:44 2008
@@ -543,20 +543,22 @@
 
         public static int GetTrackIdForUri (string relative_path, int [] primary_sources)
         {
-            return ServiceManager.DbConnection.Query<int> (check_command,
-                primary_sources, relative_path, relative_path);
+            return GetTrackIdForUri (relative_path, relative_path, primary_sources);
+        }
+        
+        public static int GetTrackIdForUri (string uri, string relative_path, int [] primary_sources)
+        {
+            return ServiceManager.DbConnection.Query<int> (check_command, primary_sources, uri, relative_path);
         }
         
         public static bool ContainsUri (string relative_path, int [] primary_sources)
         {
-            return ServiceManager.DbConnection.Query<int> (check_command,
-                primary_sources, relative_path, relative_path) > 0;
+            return GetTrackIdForUri (relative_path, primary_sources) > 0;
         }
 
         public static bool ContainsUri (SafeUri uri, string relative_path, int [] primary_sources)
         {
-            return ServiceManager.DbConnection.Query<int> (check_command,
-                primary_sources, relative_path, uri.AbsoluteUri) > 0;
+            return GetTrackIdForUri (uri, relative_path, primary_sources) > 0;
         }
     }
 }

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection/ImportManager.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Collection/ImportManager.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection/ImportManager.cs	Tue Jun 24 06:03:44 2008
@@ -72,8 +72,12 @@
         
             protected override string ProcessItem (string item)
             {
-                manager.OnImportRequested (item);
-                processed_count++;
+                try {
+                    manager.OnImportRequested (item);
+                    processed_count++;
+                } catch (Exception e) {
+                    Hyena.Log.Exception (e);
+                }
                 return null;   
             }
             

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs	Tue Jun 24 06:03:44 2008
@@ -52,7 +52,7 @@
         // NOTE: Whenever there is a change in ANY of the database schema,
         //       this version MUST be incremented and a migration method
         //       MUST be supplied to match the new version number
-        protected const int CURRENT_VERSION = 12;
+        protected const int CURRENT_VERSION = 13;
         protected const int CURRENT_METADATA_VERSION = 2;
         
 #region Migration Driver
@@ -419,6 +419,18 @@
         
 #endregion
 
+#region Version 13
+
+        [DatabaseVersion (13)]
+        private bool Migrate_13 ()
+        {
+            Execute("CREATE INDEX CoreAlbumsArtistIndex ON CoreAlbums(TitleLowered, ArtistNameLowered)");
+            Execute("CREATE INDEX CoreTracksUriIndex ON CoreTracks(PrimarySourceID, Uri)");
+            return true;
+        }
+        
+#endregion
+
 #pragma warning restore 0169
         
 #region Fresh database setup
@@ -502,6 +514,7 @@
             Execute("CREATE INDEX CoreTracksPrimarySourceIndex ON CoreTracks(ArtistID, AlbumID, PrimarySourceID, Disc, TrackNumber, Uri)");
             Execute("CREATE INDEX CoreTracksAggregatesIndex ON CoreTracks(FileSize, Duration)");
             Execute("CREATE INDEX CoreTracksExternalIDIndex ON CoreTracks(PrimarySourceID, ExternalID)");
+            Execute("CREATE INDEX CoreTracksUriIndex ON CoreTracks(PrimarySourceID, Uri)");
             
             Execute(@"
                 CREATE TABLE CoreAlbums (
@@ -518,10 +531,14 @@
                     Duration            INTEGER,
                     Year                INTEGER,
                     
+                    ArtistName          TEXT,
+                    ArtistNameLowered   TEXT,
+                    
                     Rating              INTEGER
                 )
             ");
             Execute("CREATE INDEX CoreAlbumsIndex       ON CoreAlbums(ArtistID, TitleLowered)");
+            Execute("CREATE INDEX CoreAlbumsArtistIndex       ON CoreAlbums(TitleLowered, ArtistNameLowered)");
 
             Execute(@"
                 CREATE TABLE CoreArtists (

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Library/LibrarySource.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Library/LibrarySource.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Library/LibrarySource.cs	Tue Jun 24 06:03:44 2008
@@ -110,5 +110,17 @@
                 new_track.Save (false);
             }
         }
+        
+        public static int GetTrackIdForUri (string uri)
+        {
+            return DatabaseTrackInfo.GetTrackIdForUri (new SafeUri (uri), Paths.MakePathRelative (uri, Paths.LibraryLocation), LibraryIds);
+        }
+        
+        private static int [] library_ids;
+        private static int [] LibraryIds {
+            get {
+                return library_ids ?? library_ids = new int [] {ServiceManager.SourceManager.MusicLibrary.DbId, ServiceManager.SourceManager.VideoLibrary.DbId};
+            }
+        }
     }
 }

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Playlist/PlaylistFileUtil.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Playlist/PlaylistFileUtil.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Playlist/PlaylistFileUtil.cs	Tue Jun 24 06:03:44 2008
@@ -43,6 +43,11 @@
             PlsPlaylistFormat.FormatDescription
         };
         
+        public static readonly string [] PlaylistExtensions = new string [] {
+            M3uPlaylistFormat.FormatDescription.FileExtension,
+            PlsPlaylistFormat.FormatDescription.FileExtension
+        };
+        
         public static PlaylistFormatDescription [] ExportFormats {
             get { return export_formats; }
         }
@@ -85,7 +90,6 @@
             try {
                 DefaultExportFormat.Set (format.FileExtension);        
             } catch (Exception) {
-                // Ignore errors.                
             }            
         }
         
@@ -144,12 +148,37 @@
         
             return uris.ToArray ();
         }
+        
+        public static void ImportPlaylistToLibrary (string path)
+        {
+            try {
+                SafeUri uri = new SafeUri (path);
+                PlaylistParser parser = new PlaylistParser ();
+                string relative_dir = System.IO.Path.GetDirectoryName (uri.LocalPath);
+                if (relative_dir[relative_dir.Length - 1] != System.IO.Path.DirectorySeparatorChar) {
+                    relative_dir = relative_dir + System.IO.Path.DirectorySeparatorChar;
+                }
+                parser.BaseUri = new Uri (relative_dir);
+                if (parser.Parse (uri)) {
+                    List<string> uris = new List<string> ();
+                    foreach (Dictionary<string, object> element in parser.Elements) {
+                        uris.Add (((Uri)element["uri"]).LocalPath);
+                    }
+                    
+                    ImportPlaylistWorker worker = new ImportPlaylistWorker (System.IO.Path.GetFileNameWithoutExtension (uri.LocalPath), uris.ToArray ());
+                    worker.Import ();
+                }
+            } catch (Exception e) {
+                Hyena.Log.Exception (e);
+            }
+        }
     }
     
-    /*public class ImportPlaylistWorker
+    public class ImportPlaylistWorker
     {
         private string [] uris;
         private string name;
+        private LibraryImportManager importer;
         
         public ImportPlaylistWorker (string name, string [] uris)
         {
@@ -158,38 +187,39 @@
         }
         
         public void Import ()
-        {    
+        {
             try {
-                Banshee.ServiceStack.ServiceManager.Get<LibraryImportManager> ().ImportFinished += delegate {
-                    CreatePlaylist ();
-                };
-
-                Banshee.ServiceStack.ServiceManager.Get<LibraryImportManager> ().QueueSource (uris);
-            } catch (PlaylistImportCanceledException) {
-                // Do nothing, user canceled import.
+                importer = new LibraryImportManager ();
+                importer.ImportFinished += CreatePlaylist;
+                importer.Enqueue (uris);
+            } catch (PlaylistImportCanceledException e) {
+                Hyena.Log.Exception (e);
             }
         }
         
-        private void CreatePlaylist ()
+        private void CreatePlaylist (object o, EventArgs args)
         {
             try {
                 PlaylistSource playlist = new PlaylistSource (name, ServiceManager.SourceManager.MusicLibrary.DbId);
                 playlist.Save ();
+                ServiceManager.SourceManager.MusicLibrary.AddChildSource (playlist);
 
-                HyenaSqliteCommand command = new HyenaSqliteCommand (
-                    @"INSERT INTO CorePlaylistEntries (PlaylistID, TrackID)
-                        VALUES (?, (SELECT TrackID FROM CoreTracks WHERE Uri = ?))"
-                );
+                HyenaSqliteCommand insert_command = new HyenaSqliteCommand (String.Format (
+                    @"INSERT INTO CorePlaylistEntries (PlaylistID, TrackID) VALUES ({0}, ?)", playlist.DbId));
 
-                ServiceManager.DbConnection.BeginTransaction ();
+                //ServiceManager.DbConnection.BeginTransaction ();
                 foreach (string uri in uris) {
-                    ServiceManager.DbConnection.Execute (command, playlist.DbId, uri);
+                    int track_id = LibrarySource.GetTrackIdForUri (uri);
+                    if (track_id > 0) {
+                        ServiceManager.DbConnection.Execute (insert_command, track_id);
+                    }
                 }
-                ServiceManager.DbConnection.CommitTransaction ();
+                
+                playlist.Reload ();
+                playlist.NotifyUser ();
             } catch (Exception e) {
-                Log.Exception (e);
-                ServiceManager.DbConnection.RollbackTransaction ();
+                Hyena.Log.Exception (e);
             }
         }
-    }*/
+    }
 }

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Playlists.Formats/PlaylistFormatBase.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Playlists.Formats/PlaylistFormatBase.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Playlists.Formats/PlaylistFormatBase.cs	Tue Jun 24 06:03:44 2008
@@ -76,6 +76,7 @@
                 return uri.IsLocalPath ? uri.LocalPath : uri.AbsoluteUri;
             }
             
+            // TODO replace with call to Paths.MakeRelativeTo
             string base_uri = uri.IsLocalPath ? BaseUri.LocalPath : BaseUri.AbsoluteUri;
             string relative_uri = uri.IsLocalPath ? uri.LocalPath : uri.AbsoluteUri;
             

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Playlists.Formats/PlaylistParser.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Playlists.Formats/PlaylistParser.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Playlists.Formats/PlaylistParser.cs	Tue Jun 24 06:03:44 2008
@@ -114,6 +114,7 @@
                 IPlaylistFormat playlist = (IPlaylistFormat)Activator.CreateInstance(matching_format.Type);
                 playlist.BaseUri = BaseUri;
                 playlist.Load(stream, false);
+                stream.Dispose ();
                 
                 elements = playlist.Elements;
                 return true;

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/GlobalActions.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/GlobalActions.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/GlobalActions.cs	Tue Jun 24 06:03:44 2008
@@ -53,9 +53,9 @@
                     Catalog.GetString ("Import _Media..."), "<control>I",
                     Catalog.GetString ("Import media from a variety of sources"), OnImport),
 
-                /*new ActionEntry ("ImportPlaylistAction", null,
+                new ActionEntry ("ImportPlaylistAction", null,
                     Catalog.GetString ("Import Playlist..."), null,
-                    Catalog.GetString ("Import a playlist"), OnImportPlaylist),*/
+                    Catalog.GetString ("Import a playlist"), OnImportPlaylist),
 
                 new ActionEntry ("OpenLocationAction", null, 
                     Catalog.GetString ("Open _Location..."), "<control>L",
@@ -165,68 +165,44 @@
             }
         }
 
-        /*private void OnImportPlaylist (object o, EventArgs args)
+        private void OnImportPlaylist (object o, EventArgs args)
         {
             // Prompt user for location of the playlist.
-            Banshee.Gui.Dialogs.FileChooserDialog chooser = new Banshee.Gui.Dialogs.FileChooserDialog(
+            Banshee.Gui.Dialogs.FileChooserDialog chooser = new Banshee.Gui.Dialogs.FileChooserDialog (
                 Catalog.GetString("Import Playlist"),
                 PrimaryWindow,
                 FileChooserAction.Open
             );
                          
             chooser.DefaultResponse = ResponseType.Ok;
-            chooser.SelectMultiple = false;
+            chooser.SelectMultiple = true;
+            chooser.AddFilter (Hyena.Gui.GtkUtilities.GetFileFilter (Catalog.GetString ("Playlists"), PlaylistFileUtil.PlaylistExtensions));
+            try {
+                chooser.AddShortcutFolder (Paths.LibraryLocation);
+            } catch {}
 
-            chooser.AddButton(Stock.Cancel, ResponseType.Cancel);
-            chooser.AddButton(Catalog.GetString("Import"), ResponseType.Ok);
+            chooser.AddButton (Stock.Cancel, ResponseType.Cancel);
+            chooser.AddButton (Catalog.GetString("Import"), ResponseType.Ok);
             
-            string playlist_uri = null;
             int response = chooser.Run();            
 
-            if(response == (int) ResponseType.Ok) {                    
-                playlist_uri = SafeUri.UriToFilename(chooser.Uri);              
-                chooser.Destroy(); 
+            string [] uris = null;
+            if (response == (int) ResponseType.Ok) {
+                uris = chooser.Uris;
+                chooser.Destroy();
             } else {
-                // User cancelled import.
-                chooser.Destroy();                 
-                return;
-            } 
-
-            // Read the contents of the playlist.
-            string[] uris = null;
-            try {                    
-                uris = PlaylistFileUtil.ImportPlaylist(playlist_uri);                    
-            } catch (Exception e) {
-                HigMessageDialog md = new HigMessageDialog(PrimaryWindow, 
-                    DialogFlags.DestroyWithParent, 
-                    MessageType.Error,  
-                    ButtonsType.Ok,
-                    Catalog.GetString("Unable to Import Playlist"),
-                    e.Message);
-
-                md.Run();
-                md.Destroy();
+                chooser.Destroy();
                 return;
             }
-
-            // Import the tracks specified in the playlist.
-            if (uris != null) {
-                ImportPlaylistWorker worker = new ImportPlaylistWorker(playlist_uri, uris);
-                worker.Import ();
-            } else {
-                HigMessageDialog md = new HigMessageDialog(PrimaryWindow, 
-                    DialogFlags.DestroyWithParent, 
-                    MessageType.Error,  
-                    ButtonsType.Ok,
-                    Catalog.GetString("Unable to Import Playlist"),
-                    Catalog.GetString("Banshee was unable to find any valid tracks to import.  Please check the playlist and try again.")
-                );
-
-                md.Run();
-                md.Destroy();
+            
+            if (uris == null || uris.Length == 0) {
                 return;
             }
-        }*/
+            
+            foreach (string uri in uris) {
+                PlaylistFileUtil.ImportPlaylistToLibrary (uri);
+            }
+        }
         
         private void OnQuit (object o, EventArgs args)
         {

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Library.Gui/FileImportSource.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Library.Gui/FileImportSource.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Library.Gui/FileImportSource.cs	Tue Jun 24 06:03:44 2008
@@ -30,6 +30,8 @@
 using Mono.Unix;
 using Gtk;
 
+using Banshee.ServiceStack;
+
 namespace Banshee.Library.Gui
 {
     public class FileImportSource : IImportSource
@@ -47,10 +49,12 @@
             
             chooser.AddButton (Stock.Cancel, ResponseType.Cancel);
             chooser.AddButton (Stock.Open, ResponseType.Ok);
-            
+            chooser.AddFilter (Hyena.Gui.GtkUtilities.GetFileFilter (Catalog.GetString ("Media Files"), Banshee.Collection.Database.DatabaseImportManager.WhiteListFileExtensions));
             chooser.SelectMultiple = true;
             chooser.DefaultResponse = ResponseType.Ok;
             
+            SetChooserShortcuts (chooser);
+            
             if (chooser.Run () == (int)ResponseType.Ok) {
                 Banshee.ServiceStack.ServiceManager.Get<LibraryImportManager> ().Enqueue (chooser.Uris);
             }
@@ -69,5 +73,13 @@
         public bool CanImport {
             get { return true; }
         }
+        
+        public static void SetChooserShortcuts (Gtk.FileChooserDialog chooser)
+        {
+            Hyena.Gui.GtkUtilities.SetChooserShortcuts (chooser,
+                ServiceManager.SourceManager.MusicLibrary.BaseDirectory,
+                ServiceManager.SourceManager.VideoLibrary.BaseDirectory
+            );
+        }
     }
 }

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Library.Gui/FolderImportSource.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Library.Gui/FolderImportSource.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Library.Gui/FolderImportSource.cs	Tue Jun 24 06:03:44 2008
@@ -48,6 +48,7 @@
             chooser.AddButton (Stock.Cancel, ResponseType.Cancel);
             chooser.AddButton (Stock.Open, ResponseType.Ok);
             chooser.DefaultResponse = ResponseType.Ok;
+            FileImportSource.SetChooserShortcuts (chooser);
             
             if (chooser.Run () == (int)ResponseType.Ok) {
                 Banshee.ServiceStack.ServiceManager.Get<LibraryImportManager> ().Enqueue (chooser.Uri);

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml	Tue Jun 24 06:03:44 2008
@@ -22,7 +22,7 @@
       <!--<menuitem name="NewSmartPlaylistFromSearch" action="NewSmartPlaylistFromSearchAction"/>-->
       <separator/>
       <menuitem name="Import" action="ImportAction"/>
-      <!--<menuitem name="ImportPlaylist" action="ImportPlaylistAction"/>-->
+      <menuitem name="ImportPlaylist" action="ImportPlaylistAction"/>
       <menuitem name="OpenLocation" action="OpenLocationAction"/>
       <placeholder name="BelowOpenLocation"/>
       <separator/>

Modified: trunk/banshee/src/Extensions/Banshee.Daap/Banshee.Daap/DaapPlaylistSource.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Daap/Banshee.Daap/DaapPlaylistSource.cs	(original)
+++ trunk/banshee/src/Extensions/Banshee.Daap/Banshee.Daap/DaapPlaylistSource.cs	Tue Jun 24 06:03:44 2008
@@ -46,7 +46,7 @@
     public class DaapPlaylistSource : PlaylistSource
     {
         private HyenaSqliteCommand insert_track_command = new HyenaSqliteCommand (@"
-            INSERT INTO CorePlaylistEntries (PlaylistID, EntryID) 
+            INSERT INTO CorePlaylistEntries (PlaylistID, TrackID) 
                 SELECT ?, TrackID FROM CoreTracks WHERE PrimarySourceID = ? AND ExternalID IN (?)"
         );
         

Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui/GtkUtilities.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui/GtkUtilities.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui/GtkUtilities.cs	Tue Jun 24 06:03:44 2008
@@ -64,6 +64,25 @@
             return true;
         }
         
+        public static FileFilter GetFileFilter (string name, string [] extensions)
+        {
+            FileFilter filter = new FileFilter ();
+            filter.Name = name;
+            foreach (string extension in extensions) {
+                filter.AddPattern (String.Format ("*.{0}", extension));
+            }
+            return filter;
+        }
+        
+        public static void SetChooserShortcuts (Gtk.FileChooserDialog chooser, params string [] shortcuts)
+        {
+            foreach (string shortcut in shortcuts) {
+                try {
+                    chooser.AddShortcutFolder (shortcut);
+                } catch {}
+            }
+        }
+        
         public static Gdk.Color ColorBlend (Gdk.Color a, Gdk.Color b)
         {
             // at some point, might be nice to allow any blend?



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