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-05-23 07:44:04 (GMT)
committer Sascha Silbe <sascha-pgp@silbe.org>2010-11-01 16:52:17 (GMT)
commit1dc60e50276bfb5ebb3e27a3a02bcc0228b2d4b8 (patch)
tree8702b8467462f5449f767ecc4f2b363495602dad
parentd10c89d0c0fd581d6d994c55b63cdf7c7d9b9dbc (diff)
Add ctime property to the journal model.
Signed-off-by: Andrés Ambrois <andresambrois@gmail.com>
-rw-r--r--src/jarabe/journal/listmodel.py22
-rw-r--r--src/jarabe/journal/model.py2
2 files changed, 18 insertions, 6 deletions
diff --git a/src/jarabe/journal/listmodel.py b/src/jarabe/journal/listmodel.py
index 135dc95..c07d9e1 100644
--- a/src/jarabe/journal/listmodel.py
+++ b/src/jarabe/journal/listmodel.py
@@ -19,6 +19,7 @@ import logging
import simplejson
import gobject
import gtk
+import time
from sugar.graphics.xocolor import XoColor
from sugar.graphics import style
@@ -31,6 +32,8 @@ DS_DBUS_SERVICE = 'org.laptop.sugar.DataStore'
DS_DBUS_INTERFACE = 'org.laptop.sugar.DataStore'
DS_DBUS_PATH = '/org/laptop/sugar/DataStore'
+CTIME_FORMAT = '%Y-%m-%dT%H:%M:%S'
+
class ListModel(gtk.GenericTreeModel, gtk.TreeDragSource):
__gtype_name__ = 'JournalListModel'
@@ -49,11 +52,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_CTIME = 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,
@@ -61,6 +65,7 @@ class ListModel(gtk.GenericTreeModel, gtk.TreeDragSource):
COLUMN_ICON_COLOR: object,
COLUMN_TITLE: str,
COLUMN_TIMESTAMP: str,
+ COLUMN_CTIME: str,
COLUMN_FILESIZE: str,
COLUMN_PROGRESS: int,
COLUMN_BUDDY_1: object,
@@ -143,6 +148,13 @@ class ListModel(gtk.GenericTreeModel, gtk.TreeDragSource):
timestamp = int(metadata.get('timestamp', 0))
self._cached_row.append(util.timestamp_to_elapsed_string(timestamp))
+ ctime = metadata.get('ctime')
+ if ctime:
+ ctime = time.mktime(time.strptime(ctime, CTIME_FORMAT))
+ else:
+ ctime = 0
+ self._cached_row.append(util.timestamp_to_elapsed_string(ctime))
+
size = int(metadata.get('filesize', 0))
self._cached_row.append(util.format_size(size))
diff --git a/src/jarabe/journal/model.py b/src/jarabe/journal/model.py
index 0b60d79..b0d544b 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', 'ctime', 'filesize',
'keep', 'buddies', 'icon-color', 'mime_type', 'progress',
'activity', 'mountpoint', 'activity_id', 'bundle_id']