[Sugar-devel] [RFC PATCH 2/8] Add ctime and filesize columns to the journal list model.

Andrés Ambrois andresambrois at gmail.com
Sat May 1 15:33:50 EDT 2010


Add two columns to the ListModel. This will make it easy to display the
values we are sorting by by simply associating the cell renderer with
one of them.

Signed-off-by: Andrés Ambrois <andresambrois at gmail.com>
---
 src/jarabe/journal/listmodel.py |   22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/src/jarabe/journal/listmodel.py b/src/jarabe/journal/listmodel.py
index 07f8544..494f1e0 100644
--- a/src/jarabe/journal/listmodel.py
+++ b/src/jarabe/journal/listmodel.py
@@ -48,18 +48,22 @@ class ListModel(gtk.GenericTreeModel, gtk.TreeDragSource):
     COLUMN_ICON = 2
     COLUMN_ICON_COLOR = 3
     COLUMN_TITLE = 4
-    COLUMN_DATE = 5
-    COLUMN_PROGRESS = 6
-    COLUMN_BUDDY_1 = 7
-    COLUMN_BUDDY_2 = 8
-    COLUMN_BUDDY_3 = 9
+    COLUMN_TIMESTAMP = 5
+    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,
                      COLUMN_ICON:           str,
                      COLUMN_ICON_COLOR:     object,
                      COLUMN_TITLE:          str,
-                     COLUMN_DATE:           str,
+                     COLUMN_TIMESTAMP:      str,
+                     COLUMN_CTIME:          str,
+                     COLUMN_FILESIZE:       str,
                      COLUMN_PROGRESS:       int,
                      COLUMN_BUDDY_1:        object,
                      COLUMN_BUDDY_3:        object,
@@ -141,6 +145,12 @@ class ListModel(gtk.GenericTreeModel, gtk.TreeDragSource):
         timestamp = int(metadata.get('timestamp', 0))
         self._cached_row.append(util.timestamp_to_elapsed_string(timestamp))
 
+        ctime = int(metadata.get('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))
+
         self._cached_row.append(int(metadata.get('progress', 100)))
 
         if metadata.get('buddies', ''):
-- 
1.6.3.3



More information about the Sugar-devel mailing list