From f21dd31e91cfaa62fea293ce91c9ec3caee8c17b Mon Sep 17 00:00:00 2001 From: Benny Malengier Date: Fri, 27 Jul 2012 14:38:52 +0000 Subject: [PATCH] GTK3: placeview drag drop, avoid crash on drag of a place leave from treeview svn: r20105 --- src/gui/views/listview.py | 4 ++++ src/plugins/lib/libplaceview.py | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/gui/views/listview.py b/src/gui/views/listview.py index a77cc5d4b..ac90a0dd5 100644 --- a/src/gui/views/listview.py +++ b/src/gui/views/listview.py @@ -463,6 +463,10 @@ class ListView(NavigationView): for handle in selected_ids], 0) sel_data.set(self.drag_list_info().atom_drag_type, 8, pickle.dumps(data)) + else: + # pass empty + data = (self.drag_info().drag_type, id(self), [], 0) + sel_data.set(self.drag_list_info().atom_drag_type, 8, pickle.dumps(data)) def set_column_order(self): """ diff --git a/src/plugins/lib/libplaceview.py b/src/plugins/lib/libplaceview.py index ac6d4e41a..8296f361d 100644 --- a/src/plugins/lib/libplaceview.py +++ b/src/plugins/lib/libplaceview.py @@ -213,8 +213,14 @@ class PlaceBaseView(ListView): widget.set_stock_id(Gtk.STOCK_JUMP_TO) if self.drag_info(): self.list.enable_model_drag_source(Gdk.ModifierType.BUTTON1_MASK, - [('text/plain', 0, 0), self.drag_info().target_data()], + [], Gdk.DragAction.COPY) + tglist = Gtk.TargetList.new([]) + tglist.add(self.drag_info().atom_drag_type, + self.drag_info().target_flags, + self.drag_info().app_id) + tglist.add_text_targets (0L) + self.list.drag_source_set_target_list(tglist) def __create_maps_menu_actions(self): """