diff --git a/gramps2/src/ListModel.py b/gramps2/src/ListModel.py index 5738e91dc..332d910f2 100644 --- a/gramps2/src/ListModel.py +++ b/gramps2/src/ListModel.py @@ -65,8 +65,6 @@ class ListModel: if name[0] != '': self.tree.append_column(column) - if self.cids[0] != -1: - self.model.set_sort_column_id(self.cids[0],gtk.SORT_ASCENDING) self.connect_model() if select_func: @@ -97,7 +95,12 @@ class ListModel: self.tree.set_model(self.model) if self.sel_iter: self.selection.select_iter(self.sel_iter) - if self.cid: + + # if the sort column has not been defined (val[0] == -2), set + # the sort column to the first column + + val = self.model.get_sort_column_id() + if val[0] == -2 and self.cid: self.model.set_sort_column_id(self.cid[0],self.cid[1]) self.sort() diff --git a/gramps2/src/RelLib.py b/gramps2/src/RelLib.py index 3e1574c96..bd09d9a85 100644 --- a/gramps2/src/RelLib.py +++ b/gramps2/src/RelLib.py @@ -2728,6 +2728,14 @@ class GrampsDB(Persistent): self.placeTable[val] = place.getDisplayInfo() return place + def sortbyplace(self,f,s): + return cmp(self.placeTable[f][7],self.placeTable[s][7]) + + def sortPlaceKeys(self): + keys = self.placeTable.keys() + keys.sort(self.sortbyplace) + return keys + def getPlaceKeys(self): return self.placeTable.keys()