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.py28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/jarabe/journal/listmodel.py b/src/jarabe/journal/listmodel.py
index 417ff61..9553aa5 100644
--- a/src/jarabe/journal/listmodel.py
+++ b/src/jarabe/journal/listmodel.py
@@ -42,7 +42,7 @@ class ListModel(gtk.GenericTreeModel, gtk.TreeDragSource):
'progress': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ([])),
}
- COLUMN_UID = 0
+ COLUMN_OBJECT_URI = 0
COLUMN_FAVORITE = 1
COLUMN_ICON = 2
COLUMN_ICON_COLOR = 3
@@ -56,7 +56,7 @@ class ListModel(gtk.GenericTreeModel, gtk.TreeDragSource):
COLUMN_BUDDY_3 = 11
_COLUMN_TYPES = {
- COLUMN_UID: str,
+ COLUMN_OBJECT_URI: str,
COLUMN_FAVORITE: bool,
COLUMN_ICON: str,
COLUMN_ICON_COLOR: object,
@@ -100,7 +100,10 @@ class ListModel(gtk.GenericTreeModel, gtk.TreeDragSource):
self._result_set.stop()
def get_metadata(self, path):
- return model.get(self[path][ListModel.COLUMN_UID])
+ return model.get(self[path][ListModel.COLUMN_OBJECT_URI])
+
+ def get_object_uri(self, path):
+ return self[path][ListModel.COLUMN_OBJECT_URI]
def on_get_n_columns(self):
return len(ListModel._COLUMN_TYPES)
@@ -125,13 +128,12 @@ class ListModel(gtk.GenericTreeModel, gtk.TreeDragSource):
return None
self._result_set.seek(index)
- metadata = self._result_set.read()
+ object_uri, metadata = self._result_set.read()
self._last_requested_index = index
- self._cached_row = []
- self._cached_row.append(metadata['uid'])
+ self._cached_row = [object_uri]
self._cached_row.append(metadata.get('keep', '0') == '1')
- self._cached_row.append(misc.get_icon_name(metadata))
+ self._cached_row.append(misc.get_icon_name(object_uri, metadata))
if misc.is_activity_bundle(metadata):
xo_color = XoColor('%s,%s' % (style.COLOR_BUTTON_GREY.get_svg(),
@@ -178,11 +180,11 @@ class ListModel(gtk.GenericTreeModel, gtk.TreeDragSource):
buddies = simplejson.loads(metadata['buddies']).values()
except simplejson.decoder.JSONDecodeError, exception:
logging.warning('Cannot decode buddies for %r: %s',
- metadata['uid'], exception)
+ object_uri, exception)
if not isinstance(buddies, list):
logging.warning('Content of buddies for %r is not a list: %r',
- metadata['uid'], buddies)
+ object_uri, buddies)
buddies = []
for n_ in xrange(0, 3):
@@ -191,7 +193,7 @@ class ListModel(gtk.GenericTreeModel, gtk.TreeDragSource):
nick, color = buddies.pop(0)
except (AttributeError, ValueError), exception:
logging.warning('Malformed buddies for %r: %s',
- metadata['uid'], exception)
+ object_uri, exception)
else:
self._cached_row.append((nick, XoColor(color)))
continue
@@ -229,15 +231,15 @@ class ListModel(gtk.GenericTreeModel, gtk.TreeDragSource):
return None
def do_drag_data_get(self, path, selection):
- uid = self[path][ListModel.COLUMN_UID]
+ object_uri = self[path][ListModel.COLUMN_OBJECT_URI]
if selection.target == '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)
+ self._temp_drag_file_path = model.get_file(object_uri)
logging.debug('putting %r in selection', self._temp_drag_file_path)
selection.set(selection.target, 8, self._temp_drag_file_path)
return True
elif selection.target == 'journal-object-id':
- selection.set(selection.target, 8, uid)
+ selection.set(selection.target, 8, object_uri)
return True
return False