From 43ec0e1a1f3693bdf2c6968cd79f5ae60fbd5060 Mon Sep 17 00:00:00 2001 From: kramo <93832451+kra-mo@users.noreply.github.com> Date: Sat, 15 Apr 2023 22:02:04 +0200 Subject: [PATCH] Fix hiding game toast bug --- src/main.py | 5 ++++- src/window.py | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main.py b/src/main.py index 05e22f6..1ca88b5 100644 --- a/src/main.py +++ b/src/main.py @@ -167,7 +167,7 @@ class CartridgesApplication(Adw.Application): self.win.update_games([game_id]) - def on_hide_game_action(self, _widget, _callback=None, game_id=None): + def on_hide_game_action(self, _widget, _callback=None, game_id=None, toast=True): if not game_id: game_id = self.win.active_game_id @@ -176,6 +176,9 @@ class CartridgesApplication(Adw.Application): self.win.games[game_id].toggle_hidden() self.win.update_games([game_id]) + if not toast: + return + title = self.win.games[game_id].name if self.win.games[game_id].hidden: # The variable is the title of the game diff --git a/src/window.py b/src/window.py index 5a36fe1..9a064f6 100644 --- a/src/window.py +++ b/src/window.py @@ -501,7 +501,9 @@ class CartridgesWindow(Adw.ApplicationWindow): return if undo == "hide": - self.get_application().on_hide_game_action(None, game_id=game_id) + self.get_application().on_hide_game_action( + None, game_id=game_id, toast=False + ) elif undo == "remove": data = get_games(self, [game_id])[game_id]