[Sugar-devel] [PATCH v1 06/10] Display the sorting property in the last column.
Andrés Ambrois
andresambrois at gmail.com
Sun May 23 08:02:36 EDT 2010
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 at gmail.com>
---
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):
--
1.6.3.3
More information about the Sugar-devel
mailing list