From dbcd0223a87815d3b0d8c79061046d52c4418922 Mon Sep 17 00:00:00 2001 From: Andrés Ambrois Date: Sun, 23 May 2010 07:07:20 +0000 Subject: 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 --- 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): -- cgit v0.9.1