[Sugar-devel] [PATCH] Sort the activities in the home in alphabetic order

godiard at sugarlabs.org godiard at sugarlabs.org
Thu Oct 4 08:06:39 EDT 2012


From: Gonzalo Odiard <godiard at gmail.com>

The change is done in the favorites view and in the list view

Signed-off-by: Gonzalo Odiard <gonzalo at laptop.org>
---
 src/jarabe/desktop/activitieslist.py  | 1 +
 src/jarabe/desktop/favoriteslayout.py | 6 +-----
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/jarabe/desktop/activitieslist.py b/src/jarabe/desktop/activitieslist.py
index 1b5ddd7..3b07e87 100644
--- a/src/jarabe/desktop/activitieslist.py
+++ b/src/jarabe/desktop/activitieslist.py
@@ -179,6 +179,7 @@ class ListModel(Gtk.TreeModelSort):
         self._model = Gtk.ListStore(str, bool, str, str, str, str, int, str)
         self._model_filter = self._model.filter_new()
         Gtk.TreeModelSort.__init__(self, model=self._model_filter)
+        self.set_sort_column_id(ListModel.COLUMN_TITLE, Gtk.SortType.ASCENDING)
 
         GObject.idle_add(self.__connect_to_bundle_registry_cb)
 
diff --git a/src/jarabe/desktop/favoriteslayout.py b/src/jarabe/desktop/favoriteslayout.py
index a367ab6..eb5deef 100644
--- a/src/jarabe/desktop/favoriteslayout.py
+++ b/src/jarabe/desktop/favoriteslayout.py
@@ -387,11 +387,7 @@ class RingLayout(ViewLayout):
             child.size_allocate(child_allocation)
 
     def compare_activities(self, icon_a, icon_b):
-        if hasattr(icon_a, 'installation_time') and \
-                hasattr(icon_b, 'installation_time'):
-            return int(icon_b.installation_time - icon_a.installation_time)
-        else:
-            return 0
+        return cmp(icon_a.get_activity_name(), icon_b.get_activity_name())
 
 
 _SUNFLOWER_CONSTANT = style.STANDARD_ICON_SIZE * .75
-- 
1.7.11.4



More information about the Sugar-devel mailing list