banshee r4512 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.ServiceStack src/Core/Banshee.ThickClient/Banshee.Collection.Gui src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView



Author: gburt
Date: Thu Sep 11 00:30:49 2008
New Revision: 4512
URL: http://svn.gnome.org/viewvc/banshee?rev=4512&view=rev

Log:
2008-09-10  Gabriel Burt  <gabriel burt gmail com>

	* src/Core/Banshee.ThickClient/Banshee.Collection.Gui/BaseTrackListView.cs:
	Add UriList as a DragDropSource and handle setting the data when such
	DragDataGet requests come in, meaning DnD to nautilus works again (BGO
	#535128).

	* src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs: Add a
	debug message.

	* src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_DragAndDrop.cs:
	Allow overriding the DnD Drag and SourceEntries.



Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/BaseTrackListView.cs
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_DragAndDrop.cs

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs	Thu Sep 11 00:30:49 2008
@@ -260,6 +260,7 @@
         private static void DelayedInitialize (IService service)
         {
             if (have_client && service is IDelayedInitializeService) {
+                Log.DebugFormat ("Delayed Initializating {0}", service);
                 ((IDelayedInitializeService)service).DelayedInitialize ();
             }
         }

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/BaseTrackListView.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/BaseTrackListView.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/BaseTrackListView.cs	Thu Sep 11 00:30:49 2008
@@ -64,6 +64,15 @@
                 }
             };
         }
+
+        private static TargetEntry [] source_targets = new TargetEntry [] {
+            ListViewDragDropTarget.ModelSelection,
+            Banshee.Gui.DragDrop.DragDropTarget.UriList
+        };
+
+        protected override TargetEntry [] DragDropSourceEntries {
+            get { return source_targets; }
+        }
         
         protected override bool OnKeyPressEvent (Gdk.EventKey press)
         {
@@ -120,8 +129,17 @@
 
         protected override void OnDragDataGet (Gdk.DragContext context, SelectionData selection_data, uint info, uint time)
         {
-            if (info != (int)ListViewDragDropTarget.TargetType.ModelSelection || Selection.Count <= 0) {
-                return;
+            if (info == Banshee.Gui.DragDrop.DragDropTarget.UriList.Info) {
+                ITrackModelSource track_source = ServiceManager.SourceManager.ActiveSource as ITrackModelSource;
+                if (track_source != null) {
+                    System.Text.StringBuilder sb = new System.Text.StringBuilder ();
+                    foreach (TrackInfo track in track_source.TrackModel.SelectedItems) {
+                        sb.Append (track.Uri);
+                        sb.Append ("\r\n");
+                    }
+                    byte [] data = System.Text.Encoding.UTF8.GetBytes (sb.ToString ());
+                    selection_data.Set (context.Targets[0], 8, data, data.Length);
+                }
             }
         }
 

Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_DragAndDrop.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_DragAndDrop.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_DragAndDrop.cs	Thu Sep 11 00:30:49 2008
@@ -49,7 +49,11 @@
             ListViewDragDropTarget.ModelSelection
         };
         
-        protected static TargetEntry [] DragDropDestEntries {
+        protected virtual TargetEntry [] DragDropDestEntries {
+            get { return drag_drop_dest_entries; }
+        }
+
+        protected virtual TargetEntry [] DragDropSourceEntries {
             get { return drag_drop_dest_entries; }
         }
         
@@ -94,7 +98,7 @@
         {
             if (ForceDragSourceSet || Reorderable) {
                 Gtk.Drag.SourceSet (this, Gdk.ModifierType.Button1Mask | Gdk.ModifierType.Button3Mask, 
-                    DragDropDestEntries, Gdk.DragAction.Copy | Gdk.DragAction.Move);
+                    DragDropSourceEntries, Gdk.DragAction.Copy | Gdk.DragAction.Move);
             } else {
                 Gtk.Drag.SourceUnset (this);
             }



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