Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/jarabe/journal/listmodel.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/jarabe/journal/listmodel.py')
-rw-r--r--src/jarabe/journal/listmodel.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/jarabe/journal/listmodel.py b/src/jarabe/journal/listmodel.py
index b98d01c..dad0c76 100644
--- a/src/jarabe/journal/listmodel.py
+++ b/src/jarabe/journal/listmodel.py
@@ -16,7 +16,7 @@
import logging
-import simplejson
+import json
from gi.repository import GObject
from gi.repository import Gtk
from gettext import gettext as _
@@ -109,7 +109,7 @@ class ListModel(GObject.GObject, Gtk.TreeModel, Gtk.TreeDragSource):
return ListModel._COLUMN_TYPES[index]
def do_iter_n_children(self, iterator):
- if iterator == None:
+ if iterator is None:
return self._result_set.length
else:
return 0
@@ -176,8 +176,8 @@ class ListModel(GObject.GObject, Gtk.TreeModel, Gtk.TreeDragSource):
buddies = []
if metadata.get('buddies'):
try:
- buddies = simplejson.loads(metadata['buddies']).values()
- except simplejson.decoder.JSONDecodeError, exception:
+ buddies = json.loads(metadata['buddies']).values()
+ except json.decoder.JSONDecodeError, exception:
logging.warning('Cannot decode buddies for %r: %s',
metadata['uid'], exception)
@@ -237,14 +237,17 @@ class ListModel(GObject.GObject, Gtk.TreeModel, Gtk.TreeDragSource):
def do_drag_data_get(self, path, selection):
uid = self[path][ListModel.COLUMN_UID]
- if selection.target == 'text/uri-list':
+ target_atom = selection.get_target()
+ target_name = target_atom.name()
+ if target_name == 'text/uri-list':
# Get hold of a reference so the temp file doesn't get deleted
self._temp_drag_file_path = model.get_file(uid)
logging.debug('putting %r in selection', self._temp_drag_file_path)
- selection.set(selection.target, 8, self._temp_drag_file_path)
+ selection.set(target_atom, 8, self._temp_drag_file_path)
return True
- elif selection.target == 'journal-object-id':
- selection.set(selection.target, 8, uid)
+ elif target_name == 'journal-object-id':
+ # uid is unicode but Gtk.SelectionData.set() needs str
+ selection.set(target_atom, 8, str(uid))
return True
return False