diff options
author | Andrés Ambrois <andresambrois@gmail.com> | 2010-05-23 07:07:20 (GMT) |
---|---|---|
committer | Andrés Ambrois <andresambrois@gmail.com> | 2010-08-24 08:49:01 (GMT) |
commit | 321958b6e1b8dce03785d084d307d672e48aa079 (patch) | |
tree | 7eebc9cd39c493ac8ee57a4f11cd02cf314cd55a | |
parent | 2bb49bcc39f371c0c16603a4e5caa28c7619bf36 (diff) |
Display the sorting property in the last column.
update_with_query() is called when the query is modified in the toolbox.
Get the name of the property and set the sort_column cell renderer accordingly.
Signed-off-by: Andrés Ambrois <andresambrois@gmail.com>
-rw-r--r-- | src/jarabe/journal/listview.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/jarabe/journal/listview.py b/src/jarabe/journal/listview.py index 375a8ee..deffe84 100644 --- a/src/jarabe/journal/listview.py +++ b/src/jarabe/journal/listview.py @@ -252,11 +252,16 @@ class BaseListView(gtk.Bin): def update_with_query(self, query_dict): logging.debug('ListView.update_with_query') + if 'order_by' not in query_dict: + query_dict['order_by'] = ['+timestamp'] + if query_dict['order_by'] != self._query.get('order_by'): + property = query_dict['order_by'][0][1:] + cell_text = self.sort_column.get_cell_renderers()[0] + self.sort_column.set_attributes(cell_text, + text=getattr(ListModel, 'COLUMN_' + property.upper(), + ListModel.COLUMN_TIMESTAMP)) self._query = query_dict - if 'order_by' not in self._query: - self._query['order_by'] = ['+timestamp'] - self.refresh() def refresh(self): |