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.
This commit is contained in:
kulath 2016-06-28 18:39:49 +01:00
parent c817b0dedc
commit 8e4c7234a4

View File

@ -88,11 +88,14 @@ class Bookmarks:
self.dbstate = dbstate self.dbstate = dbstate
self.uistate = uistate self.uistate = uistate
self.bookmarks = None self.bookmarks = None
self.update_bookmarks() if self.dbstate.open:
self.update_bookmarks()
self.active = DISABLED self.active = DISABLED
self.action_group = Gtk.ActionGroup(name='Bookmarks') 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('database-changed', self.db_changed)
self.dbstate.connect("no-database", self.undisplay)
# initialise attributes # initialise attributes
self.namemodel = None self.namemodel = None
@ -106,8 +109,9 @@ class Bookmarks:
""" """
Reconnect the signals on a database changed. Reconnect the signals on a database changed.
""" """
self.connect_signals() if self.dbstate.open:
self.update_bookmarks() self.connect_signals()
self.update_bookmarks()
def connect_signals(self): def connect_signals(self):
""" """
@ -159,7 +163,7 @@ class Bookmarks:
actions = [] actions = []
count = 0 count = 0
if len(self.bookmarks.get()) > 0: if self.dbstate.open and len(self.bookmarks.get()) > 0:
text.write('<placeholder name="GoToBook">') text.write('<placeholder name="GoToBook">')
for item in self.bookmarks.get(): for item in self.bookmarks.get():
try: try: