Fix hiding game toast bug
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user