void HandleIconViewDragDataReceived (object sender, DragDataReceivedArgs args) { Widget source = Gtk.Drag.GetSourceWidget (args.Context); switch (args.Info) { case (uint)TargetType.TagList: // // Translate the event args from viewport space to window space, // drag events use the viewport. Owen sends his regrets. // int item = icon_view.CellAtPosition (args.X + (int) icon_view.Hadjustment.Value, args.Y + (int) icon_view.Vadjustment.Value); //Console.WriteLine ("Drop cell = {0} ({1},{2})", item, args.X, args.Y); if (item >= 0) { if (icon_view.Selection.Contains (item)) AttachTags (tag_selection_widget.TagHighlight, SelectedIds()); else AttachTags (tag_selection_widget.TagHighlight, new int [] {item}); } break; case (uint)TargetType.UriList: /* * If the drop is coming from inside f-spot then we don't want to import */ if (source != null) return; UriList list = new UriList (args.SelectionData); ImportUriList (list, (args.Context.Action & Gdk.DragAction.Copy) != 0); break; #if ENABLE_REPARENTING case (uint)TargetType.PhotoList: int p_item = icon_view.CellAtPosition (args.X + (int) icon_view.Hadjustment.Value, args.Y + (int) icon_view.Vadjustment.Value); if (p_item >= 0) { PhotoVersionCommands.Reparent cmd = new PhotoVersionCommands.Reparent (); cmd.Execute (db.Photos, SelectedPhotos(), query.Photos [p_item], GetToplevel (null)); UpdateQuery (); } break; #endif } Gtk.Drag.Finish (args.Context, true, false, args.Time); }
void HandleIconViewDragDataReceived (object sender, DragDataReceivedArgs args) { Widget source = Gtk.Drag.GetSourceWidget (args.Context); if (args.Info == DragDropTargets.TagListEntry.Info) { // // Translate the event args from viewport space to window space, // drag events use the viewport. Owen sends his regrets. // int item = icon_view.CellAtPosition (args.X + (int)icon_view.Hadjustment.Value, args.Y + (int)icon_view.Vadjustment.Value); //Console.WriteLine ("Drop cell = {0} ({1},{2})", item, args.X, args.Y); if (item >= 0) { if (icon_view.Selection.Contains (item)) AttachTags (tag_selection_widget.TagHighlight, SelectedIds ()); else AttachTags (tag_selection_widget.TagHighlight, new int [] { item }); } Gtk.Drag.Finish (args.Context, true, false, args.Time); return; } if (args.Info == (uint)DragDropTargets.TargetType.UriList) { /* * If the drop is coming from inside f-spot then we don't want to import */ if (source != null) return; UriList list = args.SelectionData.GetUriListData (); ImportUriList (list, (args.Context.Action & Gdk.DragAction.Copy) != 0); Gtk.Drag.Finish (args.Context, true, false, args.Time); return; } if (args.Info == DragDropTargets.PhotoListEntry.Info) { int p_item = icon_view.CellAtPosition (args.X + (int)icon_view.Hadjustment.Value, args.Y + (int)icon_view.Vadjustment.Value); if (p_item >= 0) { if (icon_view.Selection.Contains (p_item)) //We don't want to reparent ourselves! return; PhotoVersionCommands.Reparent cmd = new PhotoVersionCommands.Reparent (); Photo[] photos_to_reparent = SelectedPhotos (); // Give feedback to user that something happened, and leave the parent selected after reparenting icon_view.Selection.Add (p_item); cmd.Execute (Database.Photos, photos_to_reparent, query.Photos [p_item], GetToplevel (null)); UpdateQuery (); } Gtk.Drag.Finish (args.Context, true, false, args.Time); return; } }