diff --git a/gramps/gen/config.py b/gramps/gen/config.py
index b0920b5aa..68d6352f9 100644
--- a/gramps/gen/config.py
+++ b/gramps/gen/config.py
@@ -293,6 +293,7 @@ register('preferences.invalid-date-format', "%s")
register('preferences.iprefix', 'I%04d')
register('preferences.name-format', 1)
register('preferences.place-format', 0)
+register('preferences.place-title', False)
register('preferences.patronimic-surname', False)
register('preferences.no-given-text', "[%s]" % _("Missing Given Name"))
register('preferences.no-record-text', "[%s]" % _("Missing Record"))
diff --git a/gramps/gui/configure.py b/gramps/gui/configure.py
index 842def5c7..ec3b7b2d4 100644
--- a/gramps/gui/configure.py
+++ b/gramps/gui/configure.py
@@ -1013,6 +1013,12 @@ class GrampsPreferences(ConfigureDialog):
grid.attach(obox, 1, row, 2, 1)
row += 1
+ # Legacy place title mode
+ self.add_checkbox(grid,
+ _("Display legacy place title field in editors"),
+ row, 'preferences.place-title', stop=3)
+ row += 1
+
# Age precision:
# precision=1 for "year", 2: "year, month" or 3: "year, month, days"
obox = Gtk.ComboBoxText()
diff --git a/gramps/gui/editors/displaytabs/placerefembedlist.py b/gramps/gui/editors/displaytabs/placerefembedlist.py
index 39dfb4216..4afbbe136 100644
--- a/gramps/gui/editors/displaytabs/placerefembedlist.py
+++ b/gramps/gui/editors/displaytabs/placerefembedlist.py
@@ -61,9 +61,10 @@ class PlaceRefEmbedList(EmbeddedList):
(_('Date'), 3, 150, TEXT_COL, -1, None),
]
- def __init__(self, dbstate, uistate, track, data, handle):
+ def __init__(self, dbstate, uistate, track, data, handle, callback):
self.data = data
self.handle = handle
+ self.callback = callback
EmbeddedList.__init__(self, dbstate, uistate, track,
_('Enclosed By'), PlaceRefModel,
share_button=True, move_buttons=True)
@@ -132,6 +133,9 @@ class PlaceRefEmbedList(EmbeddedList):
def edit_callback(self, ref, place):
self.rebuild()
+ def post_rebuild(self, prebuildpath):
+ self.callback()
+
def handle_extra_type(self, objtype, obj):
if obj in self.get_skip_list(self.handle):
ErrorDialog(_("Place cycle detected"),
diff --git a/gramps/gui/editors/editplace.py b/gramps/gui/editors/editplace.py
index 00486cf09..ce90131c3 100644
--- a/gramps/gui/editors/editplace.py
+++ b/gramps/gui/editors/editplace.py
@@ -55,6 +55,7 @@ from ..widgets import (MonitoredEntry, PrivacyButton, MonitoredTagList,
from gramps.gen.errors import ValidationError
from gramps.gen.utils.place import conv_lat_lon
from gramps.gen.display.place import displayer as place_displayer
+from gramps.gen.config import config
from ..dialog import ErrorDialog
from ..glade import Glade
@@ -105,13 +106,17 @@ class EditPlace(EditPrimary):
def _setup_fields(self):
- self.title = MonitoredEntry(self.top.get_object("place_title"),
- self.obj.set_title, self.obj.get_title,
- self.db.readonly)
+ if config.get('preferences.place-title'):
+ self.top.get_object("place_title").show()
+ self.top.get_object("place_title_label").show()
+ self.title = MonitoredEntry(self.top.get_object("place_title"),
+ self.obj.set_title, self.obj.get_title,
+ self.db.readonly)
self.name = MonitoredEntry(self.top.get_object("name_entry"),
self.obj.set_name, self.obj.get_name,
- self.db.readonly)
+ self.db.readonly,
+ changed=self.name_changed)
self.gid = MonitoredEntry(self.top.get_object("gid"),
self.obj.set_gramps_id,
@@ -163,6 +168,13 @@ class EditPlace(EditPrimary):
return ValidationError(_("Invalid longitude (syntax: 18\u00b09'") +
_('48.21"E, -18.2412 or -18:9:48.21)'))
+ def update_title(self):
+ new_title = place_displayer.display(self.db, self.obj)
+ self.top.get_object("preview_title").set_text(new_title)
+
+ def name_changed(self, obj):
+ self.update_title()
+
def build_menu_names(self, place):
return (_('Edit Place'), self.get_menu_title())
@@ -178,7 +190,8 @@ class EditPlace(EditPrimary):
self.uistate,
self.track,
self.obj.get_placeref_list(),
- self.obj.handle)
+ self.obj.handle,
+ self.update_title)
self._add_tab(notebook, self.placeref_list)
self.track_ref_for_deletion("placeref_list")
diff --git a/gramps/gui/editors/editplaceref.py b/gramps/gui/editors/editplaceref.py
index 6bd1dfd5c..ec3bf3db9 100644
--- a/gramps/gui/editors/editplaceref.py
+++ b/gramps/gui/editors/editplaceref.py
@@ -35,6 +35,8 @@ from gramps.gen.lib import NoteType
from gramps.gen.db import DbTxn
from gramps.gen.errors import ValidationError
from gramps.gen.utils.place import conv_lat_lon
+from gramps.gen.display.place import displayer as place_displayer
+from gramps.gen.config import config
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
@@ -102,13 +104,18 @@ class EditPlaceRef(EditReference):
self.uistate, self.track,
self.db.readonly)
- self.title = MonitoredEntry(self.top.get_object("place_title"),
- self.source.set_title, self.source.get_title,
- self.db.readonly)
+ if config.get('preferences.place-title'):
+ self.top.get_object("place_title").show()
+ self.top.get_object("place_title_label").show()
+ self.title = MonitoredEntry(self.top.get_object("place_title"),
+ self.source.set_title,
+ self.source.get_title,
+ self.db.readonly)
self.name = MonitoredEntry(self.top.get_object("name_entry"),
self.source.set_name, self.source.get_name,
- self.db.readonly)
+ self.db.readonly,
+ changed=self.name_changed)
self.gid = MonitoredEntry(self.top.get_object("gid"),
self.source.set_gramps_id,
@@ -160,6 +167,13 @@ class EditPlaceRef(EditReference):
return ValidationError(_("Invalid longitude (syntax: 18\u00b09'") +
_('48.21"E, -18.2412 or -18:9:48.21)'))
+ def update_title(self):
+ new_title = place_displayer.display(self.db, self.source)
+ self.top.get_object("preview_title").set_text(new_title)
+
+ def name_changed(self, obj):
+ self.update_title()
+
def _create_tabbed_pages(self):
"""
Create the notebook tabs and inserts them into the main
@@ -178,7 +192,8 @@ class EditPlaceRef(EditReference):
self.uistate,
self.track,
self.source.get_placeref_list(),
- self.source.handle)
+ self.source.handle,
+ self.update_title)
self._add_tab(notebook, self.placeref_list)
self.track_ref_for_deletion("placeref_list")
diff --git a/gramps/gui/glade/addmedia.glade b/gramps/gui/glade/addmedia.glade
index bdb45f2f9..f9ac11e06 100644
--- a/gramps/gui/glade/addmedia.glade
+++ b/gramps/gui/glade/addmedia.glade
@@ -1,7 +1,7 @@
-
+