diff --git a/gramps/src/AddSpouse.py b/gramps/src/AddSpouse.py
index 4d02beeed..6c2bdfe9f 100644
--- a/gramps/src/AddSpouse.py
+++ b/gramps/src/AddSpouse.py
@@ -74,11 +74,7 @@ class AddSpouse:
self.surname_combo = self.glade.get_widget("surname_combo")
self.rel_combo.set_popdown_strings(const.familyRelations)
- if len(const.surnames) > 0:
- const.surnames.sort()
- self.surname_combo.set_popdown_strings(const.surnames)
- self.surname_combo.disable_activate()
- self.surname.set_text("")
+ utils.attach_surnames(self.surname_combo)
# Typing CR selects 'Add Existing' button
self.top.editable_enters(self.given)
diff --git a/gramps/src/ChooseParents.py b/gramps/src/ChooseParents.py
index 3e1524ae0..4d35a0eef 100644
--- a/gramps/src/ChooseParents.py
+++ b/gramps/src/ChooseParents.py
@@ -253,12 +253,7 @@ class ChooseParents:
window = self.xml.get_widget("addperson")
window.editable_enters(self.xml.get_widget("given"))
window.editable_enters(self.xml.get_widget("surname"))
- if len(const.surnames) > 0:
- const.surnames.sort()
- combo = self.xml.get_widget("surnameCombo")
- combo.set_popdown_strings(const.surnames)
- combo.disable_activate()
- self.xml.get_widget("surname").set_text("")
+ utils.attach_surnames(self.xml.get_widget("surnameCombo"))
def on_addfather_clicked(self,obj):
self.on_addparent_clicked(obj,"male")
diff --git a/gramps/src/EditPerson.py b/gramps/src/EditPerson.py
index 89e69c231..cabf4d603 100644
--- a/gramps/src/EditPerson.py
+++ b/gramps/src/EditPerson.py
@@ -193,9 +193,7 @@ class EditPerson:
self.window.editable_enters(self.ddate);
self.window.editable_enters(self.dplace);
- if len(const.surnames) > 0:
- const.surnames.sort()
- self.get_widget("lastNameList").set_popdown_strings(const.surnames)
+ utils.attach_surnames(self.get_widget("lastNameList"))
self.gid.set_text(person.getId())
self.gid.set_editable(Config.id_edit)
diff --git a/gramps/src/NameEdit.py b/gramps/src/NameEdit.py
index 690277ce6..3ec74a694 100644
--- a/gramps/src/NameEdit.py
+++ b/gramps/src/NameEdit.py
@@ -62,7 +62,7 @@ class NameEditor:
self.surname_field = self.top.get_widget("alt_last")
self.suffix_field = self.top.get_widget("alt_suffix")
self.note_field = self.top.get_widget("alt_note")
- self.top.get_widget("alt_surname_list").set_popdown_strings(const.surnames)
+ utils.attach_surnames(self.top.get_widget("alt_surname_list"))
self.priv = self.top.get_widget("priv")
if self.name:
diff --git a/gramps/src/SelectChild.py b/gramps/src/SelectChild.py
index 5c1e89d4a..426c8ea0c 100644
--- a/gramps/src/SelectChild.py
+++ b/gramps/src/SelectChild.py
@@ -233,6 +233,7 @@ class NewChild:
self.top = self.xml.get_widget("addChild")
self.surname = self.xml.get_widget("childSurname")
self.given = self.xml.get_widget("childGiven")
+ utils.attach_surnames(self.xml.get_widget("surname_combo"))
surname = ""
if self.person.getGender() == Person.male:
diff --git a/gramps/src/gramps.glade b/gramps/src/gramps.glade
index b89b150a9..a3503c029 100644
--- a/gramps/src/gramps.glade
+++ b/gramps/src/gramps.glade
@@ -6542,30 +6542,6 @@ Very High
-
- GtkEntry
- childSurname
- True
- True
- True
- 0
-
-
- 1
- 2
- 1
- 2
- 5
- 0
- True
- False
- False
- False
- True
- False
-
-
-
GtkHBox
hbox18
@@ -6789,6 +6765,48 @@ Unknown
Birth
+
+
+ GtkCombo
+ surname_combo
+ False
+ True
+ False
+ True
+ False
+
+
+ 1
+ 2
+ 1
+ 2
+ 5
+ 0
+ True
+ False
+ False
+ False
+ True
+ False
+
+
+
+ GtkEntry
+ GtkCombo:entry
+ childSurname
+ True
+
+ insert_text
+ on_combo_insert_text
+
+ Thu, 01 Nov 2001 02:12:35 GMT
+
+ True
+ True
+ 0
+
+
+
diff --git a/gramps/src/gramps_main.py b/gramps/src/gramps_main.py
index e9f669b5d..7c823058b 100755
--- a/gramps/src/gramps_main.py
+++ b/gramps/src/gramps_main.py
@@ -1965,6 +1965,7 @@ def post_load(name):
lastname = person.getPrimaryName().getSurname()
if lastname and lastname not in const.surnames:
const.surnames.append(lastname)
+ const.surnames.sort()
statusbar.set_progress(1.0)
full_update()
diff --git a/gramps/src/utils.py b/gramps/src/utils.py
index 5c0bf7774..a3217089f 100644
--- a/gramps/src/utils.py
+++ b/gramps/src/utils.py
@@ -411,6 +411,19 @@ def thumb_path(dir,mobj):
return find_icon(type)
+#-------------------------------------------------------------------------
+#
+#
+# Common setup code for a combo box for inputting a surname.
+#
+#-------------------------------------------------------------------------
+def attach_surnames(combo):
+ if len(const.surnames) > 0:
+ # Surnames are always sorted
+ combo.set_popdown_strings(const.surnames)
+ combo.disable_activate()
+ combo.entry.set_text("")
+
#-------------------------------------------------------------------------
#
# Sets up a delayed (0.005 sec) handler for text completion. Text