7852: Rename family tree does not update the title of the parent window.

This commit is contained in:
SNoiraud 2016-02-02 10:34:52 +01:00
parent 72e897b44b
commit e54ed1254a
2 changed files with 23 additions and 0 deletions

View File

@ -179,6 +179,8 @@ class DbManager(CLIDbManager):
self.__connect_signals()
self.__build_interface()
self._populate_model()
self.before_change = ""
self.after_change = ""
def __connect_signals(self):
"""
@ -474,6 +476,13 @@ class DbManager(CLIDbManager):
if len(new_text) > 0:
node = self.model.get_iter(path)
old_text = self.model.get_value(node, NAME_COL)
if self.model.get_value(node, ICON_COL) != None:
# this database is loaded. We must change the title
# in case we change the name several times before quitting,
# we save the first old name.
if self.before_change == "":
self.before_change = old_text
self.after_change = new_text
if not old_text.strip() == new_text.strip():
if len(path.get_indices()) > 1 :
self.__rename_revision(path, new_text)

View File

@ -1097,6 +1097,20 @@ class ViewManager(CLIManager):
(filename, title) = value
self.db_loader.read_file(filename)
self._post_load_newdb(filename, 'x-directory/normal', title)
else:
if dialog.after_change != "":
# We change the title of the main window.
old_title = self.uistate.window.get_title()
delim = old_title.find(' - ')
tit1 = old_title[:delim]
tit2 = old_title[delim:]
if '<=' in tit2:
delim2 = tit2.find('<=') + 3
tit3 = tit2[delim2:-1]
new_title = dialog.after_change + tit2.replace(']', '') + ' => ' + tit1 + ']'
else:
new_title = dialog.after_change + tit2 + ' <= [' + tit1 + ']'
self.uistate.window.set_title(new_title)
def __post_load(self):
"""