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 20:30:10 (GMT) |
commit | dbcd0223a87815d3b0d8c79061046d52c4418922 (patch) | |
tree | 8304ec3a09e7ef3e1629cd5a6b8e936e8b2d95a2 | |
parent | addd33e5963f27996fed46f0a34ccc4f4a0c796c (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): |