[Sugar-devel] [RFC PATCH 7/8] Call sort_by in the list view when sorting is selected in the toolbar.

Andrés Ambrois andresambrois at gmail.com
Sat May 1 15:33:55 EDT 2010


Connect the sort-property-changed signal in the toolbar to the sort_by
method the view.

Signed-off-by: Andrés Ambrois <andresambrois at gmail.com>
---
 src/jarabe/journal/journalactivity.py |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/jarabe/journal/journalactivity.py b/src/jarabe/journal/journalactivity.py
index 0559560..f5e101b 100644
--- a/src/jarabe/journal/journalactivity.py
+++ b/src/jarabe/journal/journalactivity.py
@@ -165,6 +165,7 @@ class JournalActivity(Window):
 
         search_toolbar = self._main_toolbox.search_toolbar
         search_toolbar.connect('query-changed', self._query_changed_cb)
+        search_toolbar.connect('sort-property-changed', self._sort_changed_cb)
         search_toolbar.set_mount_point('/')
 
     def _setup_secondary_view(self):
@@ -196,6 +197,10 @@ class JournalActivity(Window):
         self._list_view.update_with_query(query)
         self.show_main_view()
 
+    def _sort_changed_cb(self, toolbar, property, order):
+        self._list_view.sort_by(property, order)
+        self.show_main_view()
+
     def show_main_view(self):
         if self.toolbar_box != self._main_toolbox:
             self.set_toolbar_box(self._main_toolbox)
-- 
1.6.3.3



More information about the Sugar-devel mailing list