Fix import undo logic

This commit is contained in:
kramo
2023-08-15 21:46:58 +02:00
parent b466eb7ab2
commit cb9513ff13
2 changed files with 4 additions and 1 deletions

View File

@@ -103,6 +103,7 @@ class Store:
for undo in ("remove", "hide"):
try:
shared.win.toasts[(game, undo)].dismiss()
shared.win.toasts.pop((game, undo))
except KeyError:
pass

View File

@@ -331,7 +331,9 @@ class CartridgesWindow(Adw.ApplicationWindow):
def on_undo_action(self, _widget, game=None, undo=None):
if not game: # If the action was activated via Ctrl + Z
if shared.importer.imported_game_ids or shared.importer.removed_game_ids:
if shared.importer and (
shared.importer.imported_game_ids or shared.importer.removed_game_ids
):
undo = "import"
else:
try: