This method triggers the actual sorting. This is done by placing a 'order_by' value in the query, and calling the datastore to retrieve the sorted data set. The sort_column is also modified to display the property we are sorting by.
Signed-off-by: Andrés Ambrois <andresambr...@gmail.com> --- src/jarabe/journal/listview.py | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/src/jarabe/journal/listview.py b/src/jarabe/journal/listview.py index 375a8ee..ad0390a 100644 --- a/src/jarabe/journal/listview.py +++ b/src/jarabe/journal/listview.py @@ -250,6 +250,18 @@ class BaseListView(gtk.Bin): metadata['keep'] = '1' model.write(metadata, update_mtime=False) + def sort_by(self, property, order): + 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)) + if order == gtk.SORT_ASCENDING: + sign = '+' + else: + sign = '-' + self._query['order_by'] = [sign + property] + self.refresh() + def update_with_query(self, query_dict): logging.debug('ListView.update_with_query') self._query = query_dict -- 1.6.3.3 _______________________________________________ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel