Fix db events not being sent after changing library in GUI

This commit is contained in:
Kovid Goyal 2021-08-10 23:13:40 +05:30
parent 41c4b96c33
commit e2a088a53b
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -216,7 +216,7 @@ class GuiLibraryBroker(LibraryBroker):
library_path = self.original_path_map.get(library_path, library_path)
db = LibraryDatabase(library_path, is_second_db=True)
if self.listening_for_db_events:
db.add_listener(self.on_db_event)
db.new_api.add_listener(gui_on_db_event)
return db
def get(self, library_id=None):
@ -293,6 +293,8 @@ class GuiLibraryBroker(LibraryBroker):
self.original_path_map[newloc] = original_path
self.loaded_dbs[library_id] = db
db.new_api.server_library_id = library_id
if self.listening_for_db_events:
db.new_api.add_listener(gui_on_db_event)
if olddb is not None and samefile(path_for_db(olddb), path_for_db(db)):
# This happens after a restore database, for example
olddb.close(), olddb.break_cycles()