Patchwork [bitbake-devel,3/3] lib/bb/ui/crumbs/hoblistmodel: fix sorting of RecipeListModel

login
register
mail settings
Submitter Joshua Lock
Date March 29, 2012, 10:28 p.m.
Message ID <22a7a00f83a01b5e224b28fe147b62c33e14b5e4.1333060005.git.josh@linux.intel.com>
Download mbox | patch
Permalink /patch/24889/
State Accepted
Commit c6ab6c7caf16c04e2a0c0f2aefd3377f781206c7
Headers show

Comments

Joshua Lock - March 29, 2012, 10:28 p.m.
Sort in ascending order on the recipe name (A-Z) and unset the default sort
function so that there's no third (unsorted) state.

Signed-off-by: Joshua Lock <josh@linux.intel.com>
---
 lib/bb/ui/crumbs/hoblistmodel.py |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

Patch

diff --git a/lib/bb/ui/crumbs/hoblistmodel.py b/lib/bb/ui/crumbs/hoblistmodel.py
index bfd49bd..a09c7c7 100644
--- a/lib/bb/ui/crumbs/hoblistmodel.py
+++ b/lib/bb/ui/crumbs/hoblistmodel.py
@@ -471,11 +471,6 @@  class RecipeListModel(gtk.ListStore):
 
         return True
 
-    def sort_func(self, model, iter1, iter2):
-        val1 = model.get_value(iter1, RecipeListModel.COL_NAME)
-        val2 = model.get_value(iter2, RecipeListModel.COL_NAME)
-        return val1 > val2
-
     """
     Create, if required, and return a filtered gtk.TreeModelSort
     containing only the items which are items specified by filter
@@ -485,7 +480,8 @@  class RecipeListModel(gtk.ListStore):
         model.set_visible_func(self.tree_model_filter, filter)
 
         sort = gtk.TreeModelSort(model)
-        sort.set_default_sort_func(self.sort_func)
+        sort.set_sort_column_id(RecipeListModel.COL_NAME, gtk.SORT_ASCENDING)
+        sort.set_default_sort_func(None)
         return sort
 
     def convert_vpath_to_path(self, view_model, view_path):