From 8e4c7234a4a4c6a6288243338fd05597b3ba8d9b Mon Sep 17 00:00:00 2001 From: kulath Date: Tue, 28 Jun 2016 18:39:49 +0100 Subject: [PATCH] 2092: Problems when no database is open. Partial fix. Fix bookmarks display when there is no database and stop accessing the database for bookmarks when there is no database. --- gramps/gui/views/bookmarks.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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: