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



Author: gburt
Date: Sun Jul 27 19:12:06 2008
New Revision: 4260
URL: http://svn.gnome.org/viewvc/banshee?rev=4260&view=rev

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

	* src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView_DragAndDrop.cs:
	When a Uri list is dropped onto a source, import the uris into the
	library.


Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView_DragAndDrop.cs

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView_DragAndDrop.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView_DragAndDrop.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView_DragAndDrop.cs	Sun Jul 27 19:12:06 2008
@@ -52,7 +52,8 @@
             
         private static TargetEntry [] dnd_dest_entries = new TargetEntry [] {
             Banshee.Gui.DragDrop.DragDropTarget.Source,
-            Hyena.Data.Gui.ListViewDragDropTarget.ModelSelection
+            Hyena.Data.Gui.ListViewDragDropTarget.ModelSelection,
+            Banshee.Gui.DragDrop.DragDropTarget.UriList
         };
         
         private Source new_playlist_source = null;
@@ -196,7 +197,7 @@
         }
 
         protected override void OnDragDataReceived (Gdk.DragContext context, int x, int y,
-            Gtk.SelectionData selectionData, uint info, uint time)
+            Gtk.SelectionData data, uint info, uint time)
         {
             try {
                 if (final_drag_start_time != context.StartTime || final_drag_source == null) {
@@ -214,14 +215,23 @@
                     drop_source = playlist;
                 }
                 
-                if (Gtk.Drag.GetSourceWidget (context) == this) {
-                    DragDropList<Source> sources = selectionData;
+                if (data.Target.Name == Banshee.Gui.DragDrop.DragDropTarget.Source.Target) {
+                    DragDropList<Source> sources = data;
                     if (sources.Count > 0) {
                         drop_source.MergeSourceInput (sources[0], SourceMergeType.Source);
                     }
-                } else {
+                } else if (data.Target.Name == Banshee.Gui.DragDrop.DragDropTarget.UriList.Target) {
+                    foreach (string uri in DragDropUtilities.SplitSelectionData (data)) {
+                        // TODO if we dropped onto a playlist, add ourselves
+                        // to it after importing (or if already imported, find
+                        // and add to playlist)
+                        ServiceManager.Get<Banshee.Library.LibraryImportManager> ().Enqueue (uri);
+                    }
+                } else if (data.Target.Name == Hyena.Data.Gui.ListViewDragDropTarget.ModelSelection.Target) {
                     drop_source.MergeSourceInput (ServiceManager.SourceManager.ActiveSource, 
                         SourceMergeType.ModelSelection);
+                } else {
+                    Hyena.Log.DebugFormat ("SourceView got unknown drag target type: {0}", data.Target.Name);
                 }
                 
                 Gtk.Drag.Finish (context, true, false, time);



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