diff --git a/gramps/gui/views/bookmarks.py b/gramps/gui/views/bookmarks.py index 0689808d4..ef310c795 100644 --- a/gramps/gui/views/bookmarks.py +++ b/gramps/gui/views/bookmarks.py @@ -88,11 +88,14 @@ class Bookmarks: self.dbstate = dbstate self.uistate = uistate self.bookmarks = None - self.update_bookmarks() + if self.dbstate.open: + self.update_bookmarks() self.active = DISABLED self.action_group = Gtk.ActionGroup(name='Bookmarks') - self.connect_signals() + if self.dbstate.open: + self.connect_signals() self.dbstate.connect('database-changed', self.db_changed) + self.dbstate.connect("no-database", self.undisplay) # initialise attributes self.namemodel = None @@ -106,8 +109,9 @@ class Bookmarks: """ Reconnect the signals on a database changed. """ - self.connect_signals() - self.update_bookmarks() + if self.dbstate.open: + self.connect_signals() + self.update_bookmarks() def connect_signals(self): """ @@ -159,7 +163,7 @@ class Bookmarks: actions = [] count = 0 - if len(self.bookmarks.get()) > 0: + if self.dbstate.open and len(self.bookmarks.get()) > 0: text.write('') for item in self.bookmarks.get(): try: