[pitivi] clipproperties: Work around bugs in the storemodel data setting code
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] clipproperties: Work around bugs in the storemodel data setting code
- Date: Wed, 1 Oct 2014 07:35:30 +0000 (UTC)
commit cc2e00f89c8d5f036f636b34bbfd205df8f9bc5c
Author: Thibault Saunier <tsaunier gnome org>
Date: Mon Sep 29 12:36:23 2014 +0200
clipproperties: Work around bugs in the storemodel data setting code
We now simply store the selected effect directly on the storemodel and
use it so we avoid the use of pickle and other 'complicated' workarounds
Work around https://bugzilla.gnome.org/show_bug.cgi?id=737587
Conflicts:
pitivi/clipproperties.py
pitivi/clipproperties.py | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/pitivi/clipproperties.py b/pitivi/clipproperties.py
index 861381a..674550e 100644
--- a/pitivi/clipproperties.py
+++ b/pitivi/clipproperties.py
@@ -20,7 +20,6 @@
# Boston, MA 02110-1301, USA.
import os
-import pickle
from gi.repository import Gtk
from gi.repository import Gdk
@@ -183,9 +182,15 @@ class EffectProperties(Gtk.Expander, Loggable):
# We need to specify Gtk.TreeDragSource because otherwise we are hitting
# bug https://bugzilla.gnome.org/show_bug.cgi?id=730740.
class EffectsListStore(Gtk.ListStore, Gtk.TreeDragSource):
+ def __init__(self, *args):
+ Gtk.ListStore.__init__(self, *args)
+ # Simply set the source index on the storemodrel directly
+ # to avoid issues with the selection_data API
+ # FIXME: Work around https://bugzilla.gnome.org/show_bug.cgi?id=737587
+ self.source_index = None
+
def do_drag_data_get(self, path, selection_data):
- data = pickle.dumps(path.get_indices())
- selection_data.set(Gdk.Atom.intern("pitivi/effect", False), 0, data)
+ self.source_index = path.get_indices()[0]
self.storemodel = EffectsListStore(bool, str, str, str, str, object)
self.treeview = Gtk.TreeView(model=self.storemodel)
@@ -390,8 +395,8 @@ class EffectProperties(Gtk.Expander, Loggable):
elif drag_context.get_suggested_action() == Gdk.DragAction.MOVE:
# An effect dragged from the same treeview to change its position.
# Source
- source_indices = pickle.loads(selection_data.get_data())
- source_index = source_indices[0]
+ source_index = self.storemodel.source_index
+ self.storemodel.source_index = None
# Target
dest_row = treeview.get_dest_row_at_pos(x, y)
if dest_row:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]