Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrés Ambrois <andresambrois@gmail.com>2010-08-24 06:00:26 (GMT)
committer Andrés Ambrois <andresambrois@gmail.com>2010-08-24 08:49:01 (GMT)
commit588bf88a325d167f493991b5f321c9ec89100e0f (patch)
treed2b7f0f3e3816a5a77a4e035bba3b10c49d13f5e
parent0a9015338d94209f0ce4367a41f486c10f02e2b6 (diff)
Add creation_time property to the journal model.
-rw-r--r--src/jarabe/journal/listmodel.py23
-rw-r--r--src/jarabe/journal/model.py2
2 files changed, 14 insertions, 11 deletions
diff --git a/src/jarabe/journal/listmodel.py b/src/jarabe/journal/listmodel.py
index 79ed27d..3378350 100644
--- a/src/jarabe/journal/listmodel.py
+++ b/src/jarabe/journal/listmodel.py
@@ -51,11 +51,12 @@ class ListModel(gtk.GenericTreeModel, gtk.TreeDragSource):
COLUMN_ICON_COLOR = 3
COLUMN_TITLE = 4
COLUMN_TIMESTAMP = 5
- COLUMN_FILESIZE = 6
- COLUMN_PROGRESS = 7
- COLUMN_BUDDY_1 = 8
- COLUMN_BUDDY_2 = 9
- COLUMN_BUDDY_3 = 10
+ COLUMN_CREATION_TIME = 6
+ COLUMN_FILESIZE = 7
+ COLUMN_PROGRESS = 8
+ COLUMN_BUDDY_1 = 9
+ COLUMN_BUDDY_2 = 10
+ COLUMN_BUDDY_3 = 11
_COLUMN_TYPES = {COLUMN_UID: str,
COLUMN_FAVORITE: bool,
@@ -63,6 +64,7 @@ class ListModel(gtk.GenericTreeModel, gtk.TreeDragSource):
COLUMN_ICON_COLOR: object,
COLUMN_TITLE: str,
COLUMN_TIMESTAMP: str,
+ COLUMN_CREATION_TIME: str,
COLUMN_FILESIZE: str,
COLUMN_PROGRESS: int,
COLUMN_BUDDY_1: object,
@@ -145,12 +147,13 @@ class ListModel(gtk.GenericTreeModel, gtk.TreeDragSource):
timestamp = int(metadata.get('timestamp', 0))
self._cached_row.append(util.timestamp_to_elapsed_string(timestamp))
- creation_time = metadata.get('creation_time')
- if creation_time is not None:
- self._cached_row.append(
- util.timestamp_to_elapsed_string(creation_time))
- else:
+ try:
+ creation_time = float(metadata.get('creation_time'))
+ except (TypeError, ValueError):
self._cached_row.append(_('Unknown'))
+ else:
+ self._cached_row.append(
+ util.timestamp_to_elapsed_string(float(creation_time)))
try:
size = int(metadata.get('filesize'))
diff --git a/src/jarabe/journal/model.py b/src/jarabe/journal/model.py
index 4fd81ac..e84d77d 100644
--- a/src/jarabe/journal/model.py
+++ b/src/jarabe/journal/model.py
@@ -37,7 +37,7 @@ DS_DBUS_INTERFACE = 'org.laptop.sugar.DataStore'
DS_DBUS_PATH = '/org/laptop/sugar/DataStore'
# Properties the journal cares about.
-PROPERTIES = ['uid', 'title', 'mtime', 'timestamp', 'filesize',
+PROPERTIES = ['uid', 'title', 'mtime', 'timestamp', 'creation_time', 'filesize',
'keep', 'buddies', 'icon-color', 'mime_type', 'progress',
'activity', 'mountpoint', 'activity_id', 'bundle_id']