Fix menus when operating with read-only db (#622)

Fixes #10614

An earlier attempt to deal with closed dbs messed up the read-only ActionGroup settings. This corrects that situation.
This commit is contained in:
Paul Culley 2018-06-09 22:40:36 -05:00 committed by Sam Manzi
parent 9c21b98601
commit 58c6da3fb5

View File

@ -1233,26 +1233,24 @@ class ViewManager(CLIManager):
if title: if title:
name = title name = title
if self.dbstate.db.readonly: rw = not self.dbstate.db.readonly
msg = "%s (%s) - Gramps" % (name, _('Read Only')) if rw:
self.uistate.window.set_title(msg)
self.actiongroup.set_sensitive(False)
else:
msg = "%s - Gramps" % name msg = "%s - Gramps" % name
self.uistate.window.set_title(msg) else:
self.actiongroup.set_sensitive(True) msg = "%s (%s) - Gramps" % (name, _('Read Only'))
self.uistate.window.set_title(msg)
self.__change_page(self.notebook.get_current_page()) self.__change_page(self.notebook.get_current_page())
self.actiongroup.set_visible(True) self.actiongroup.set_visible(rw)
self.readonlygroup.set_visible(True) self.readonlygroup.set_visible(True)
self.undoactions.set_visible(True) self.undoactions.set_visible(rw)
self.redoactions.set_visible(True) self.redoactions.set_visible(rw)
self.undohistoryactions.set_visible(True) self.undohistoryactions.set_visible(rw)
self.actiongroup.set_sensitive(True) self.actiongroup.set_sensitive(rw)
self.readonlygroup.set_sensitive(True) self.readonlygroup.set_sensitive(True)
self.undoactions.set_sensitive(True) self.undoactions.set_sensitive(rw)
self.redoactions.set_sensitive(True) self.redoactions.set_sensitive(rw)
self.undohistoryactions.set_sensitive(True) self.undohistoryactions.set_sensitive(rw)
self.recent_manager.build() self.recent_manager.build()