Removed win.games
This commit is contained in:
@@ -70,9 +70,6 @@ class Game(Gtk.Box):
|
||||
|
||||
self.update_values(data)
|
||||
|
||||
if allow_side_effects:
|
||||
self.win.games[self.game_id] = self
|
||||
|
||||
self.set_play_icon()
|
||||
|
||||
self.event_contoller_motion = Gtk.EventControllerMotion.new()
|
||||
|
||||
@@ -56,6 +56,7 @@ class CartridgesApplication(Adw.Application):
|
||||
win = None
|
||||
|
||||
def __init__(self):
|
||||
shared.store = Store()
|
||||
super().__init__(
|
||||
application_id=shared.APP_ID, flags=Gio.ApplicationFlags.FLAGS_NONE
|
||||
)
|
||||
@@ -82,12 +83,9 @@ class CartridgesApplication(Adw.Application):
|
||||
"is-maximized", self.win, "maximized", Gio.SettingsBindFlags.DEFAULT
|
||||
)
|
||||
|
||||
# Create the games store ready to load games from disk
|
||||
if not shared.store:
|
||||
shared.store = Store()
|
||||
# Load games from disk
|
||||
shared.store.add_manager(FileManager(), False)
|
||||
shared.store.add_manager(DisplayManager())
|
||||
|
||||
self.load_games_from_disk()
|
||||
|
||||
# Add rest of the managers for game imports
|
||||
|
||||
@@ -212,7 +212,7 @@ class PreferencesWindow(Adw.PreferencesWindow):
|
||||
self.toast.dismiss()
|
||||
|
||||
def remove_all_games(self, *_args):
|
||||
for game in self.win.games.values():
|
||||
for game in shared.store.games.values():
|
||||
if not game.removed:
|
||||
self.removed_games.add(game)
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from src import shared
|
||||
from src.game import Game
|
||||
from src.game_cover import GameCover
|
||||
from src.store.managers.manager import Manager
|
||||
@@ -32,7 +31,6 @@ class DisplayManager(Manager):
|
||||
signals = {"update-ready"}
|
||||
|
||||
def manager_logic(self, game: Game, _additional_data: dict) -> None:
|
||||
shared.win.games[game.game_id] = game
|
||||
if game.get_parent():
|
||||
game.get_parent().get_parent().remove(game)
|
||||
if game.get_parent():
|
||||
|
||||
@@ -64,7 +64,6 @@ class CartridgesWindow(Adw.ApplicationWindow):
|
||||
hidden_search_entry = Gtk.Template.Child()
|
||||
hidden_search_button = Gtk.Template.Child()
|
||||
|
||||
games = {}
|
||||
game_covers = {}
|
||||
toasts = {}
|
||||
active_game = None
|
||||
@@ -118,7 +117,7 @@ class CartridgesWindow(Adw.ApplicationWindow):
|
||||
def set_library_child(self):
|
||||
child, hidden_child = self.notice_empty, self.hidden_notice_empty
|
||||
|
||||
for game in self.games.values():
|
||||
for game in shared.store.games.values():
|
||||
if game.removed or game.blacklisted:
|
||||
continue
|
||||
if game.hidden:
|
||||
|
||||
Reference in New Issue
Block a user