From 1f6f24308e96040962794c5a9ffd81597b5e072a Mon Sep 17 00:00:00 2001 From: Alessandro Ghedini Date: Sat, 3 Nov 2012 16:15:11 +0100 Subject: Imported Upstream version 0.5.4 --- src/gui/pieList.vala | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/gui/pieList.vala') diff --git a/src/gui/pieList.vala b/src/gui/pieList.vala index 474e5f5..f9fb54b 100644 --- a/src/gui/pieList.vala +++ b/src/gui/pieList.vala @@ -94,6 +94,7 @@ class PieList : Gtk.TreeView { this.enable_model_drag_source(Gdk.ModifierType.BUTTON1_MASK, entries, Gdk.DragAction.LINK); this.enable_model_drag_dest(entries, Gdk.DragAction.COPY | Gdk.DragAction.MOVE | Gdk.DragAction.LINK); this.drag_data_get.connect(this.on_dnd_source); + this.drag_data_received.connect(this.on_dnd_received); this.drag_begin.connect_after(this.on_start_drag); this.drag_motion.connect(this.on_drag_move); this.drag_leave.connect(() => { @@ -238,6 +239,29 @@ class PieList : Gtk.TreeView { return true; } + + ///////////////////////////////////////////////////////////////////// + /// Called when the user finishes a drag operation on this widget. + /// Only used for external drags. + ///////////////////////////////////////////////////////////////////// + + private void on_dnd_received(Gdk.DragContext context, int x, int y, + Gtk.SelectionData selection_data, uint info, uint time_) { + + Gtk.TreeIter active; + if (this.get_selection().get_selected(null, out active)) { + string id = ""; + this.data.get(active, DataPos.ID, out id); + + var pie = PieManager.all_pies[id]; + + foreach (var uri in selection_data.get_uris()) { + pie.add_action(ActionRegistry.new_for_uri(uri), 0); + } + + this.on_select(id); + } + } } } -- cgit v1.2.3