diff --git a/data/cartridges.gresource.xml.in b/data/cartridges.gresource.xml.in index b27522e..4704591 100644 --- a/data/cartridges.gresource.xml.in +++ b/data/cartridges.gresource.xml.in @@ -19,6 +19,7 @@ icons/sources/itch-source-symbolic.svg icons/sources/legendary-source-symbolic.svg icons/sources/lutris-source-symbolic.svg + icons/sources/retroarch-source-symbolic.svg icons/sources/steam-source-symbolic.svg diff --git a/data/gtk/window.blp b/data/gtk/window.blp index 0788878..7c912ae 100644 --- a/data/gtk/window.blp +++ b/data/gtk/window.blp @@ -72,7 +72,7 @@ template $CartridgesWindow : Adw.ApplicationWindow { Adw.ToastOverlay toast_overlay { Adw.NavigationView navigation_view { Adw.NavigationPage library_page { - title: _("Cartridges"); + title: _("All Games"); Adw.OverlaySplitView overlay_split_view { [sidebar] diff --git a/data/hu.kramo.Cartridges.gschema.xml.in b/data/hu.kramo.Cartridges.gschema.xml.in index 01d625d..9ec7ae1 100644 --- a/data/hu.kramo.Cartridges.gschema.xml.in +++ b/data/hu.kramo.Cartridges.gschema.xml.in @@ -97,10 +97,10 @@ - 1110 + 1170 - 795 + 798 false diff --git a/data/icons/sources/retroarch-source-symbolic.svg b/data/icons/sources/retroarch-source-symbolic.svg new file mode 100644 index 0000000..0bceb2a --- /dev/null +++ b/data/icons/sources/retroarch-source-symbolic.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/game.py b/src/game.py index bdab2ce..bef3c9a 100644 --- a/src/game.py +++ b/src/game.py @@ -69,6 +69,7 @@ class Game(Gtk.Box): self.version = shared.SPEC_VERSION self.update_values(data) + self.base_source = self.source.split("_")[0] self.set_play_icon() diff --git a/src/importer/sources/source.py b/src/importer/sources/source.py index 26b2a84..3d9a0eb 100644 --- a/src/importer/sources/source.py +++ b/src/importer/sources/source.py @@ -20,7 +20,7 @@ import sys from abc import abstractmethod from collections.abc import Iterable -from typing import Any, Generator, Collection +from typing import Any, Collection, Generator from src.game import Game from src.importer.sources.location import Location diff --git a/src/main.py b/src/main.py index d199fd0..3d50b25 100644 --- a/src/main.py +++ b/src/main.py @@ -153,7 +153,13 @@ class CartridgesApplication(Adw.Application): shared.store.add_game(game, {"skip_save": True}) def get_source_name(self, source_id): - return globals()[f'{source_id.split("_")[0].title()}Source'].name + if source_id == "all": + name = _("All Games") + elif source_id == "imported": + name = _("Added") + else: + name = globals()[f'{source_id.split("_")[0].title()}Source'].name + return name def on_about_action(self, *_args): # Get the debug info from the log files diff --git a/src/store/store.py b/src/store/store.py index 231bbdc..3f628e5 100644 --- a/src/store/store.py +++ b/src/store/store.py @@ -18,7 +18,7 @@ # SPDX-License-Identifier: GPL-3.0-or-later import logging -from typing import MutableMapping, Generator, Any +from typing import Any, Generator, MutableMapping from src import shared from src.game import Game @@ -44,7 +44,7 @@ class Store: """Check if the game is present in the store with the `in` keyword""" if not isinstance(obj, Game): return False - if not (source_mapping := self.source_games.get(obj.source)): + if not (source_mapping := self.source_games.get(obj.base_source)): return False return obj.game_id in source_mapping @@ -133,9 +133,9 @@ class Store: game.connect(signal, manager.run) # Add the game to the store - if not game.source in self.source_games: - self.source_games[game.source] = {} - self.source_games[game.source][game.game_id] = game + if not game.base_source in self.source_games: + self.source_games[game.base_source] = {} + self.source_games[game.base_source][game.game_id] = game # Run the pipeline for the game if not run_pipeline: diff --git a/src/window.py b/src/window.py index 6e98551..d475046 100644 --- a/src/window.py +++ b/src/window.py @@ -196,6 +196,8 @@ class CartridgesWindow(Adw.ApplicationWindow): case _default: value = self.source_rows[row][0] + self.library_page.set_title(self.get_application().get_source_name(value)) + self.filter_state = value self.library.invalidate_filter() @@ -304,7 +306,7 @@ class CartridgesWindow(Adw.ApplicationWindow): if not filtered: if self.filter_state == "all": pass - elif game.source != self.filter_state: + elif game.base_source != self.filter_state: filtered = True game.filtered = filtered