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

Simon Schampijer simon at schampijer.de
Thu Oct 4 09:36:58 EDT 2012


Thanks pushed as: d6e3fe411ee22dc4308cd06f54e2b5e0bd1d27ab

And added to the notes: 
http://wiki.sugarlabs.org/go/0.98/Notes#Alphabetical_ordering_in_the_Home_View

Regards,
    Simon

On 10/04/2012 02:06 PM, godiard at sugarlabs.org wrote:
> 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
>



More information about the Sugar-devel mailing list