diff --git a/README.md b/README.md index 96d299b..238ad20 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Cartridges is a simple game launcher written in Python using GTK4 + Libadwaita. ### Features - Manually adding and editing games -- Importing games from Steam and Heroic +- Importing games from Steam, Heroic and Bottles - Hiding games - Searching and sorting by title, date added and last played diff --git a/data/hu.kramo.Cartridges.metainfo.xml.in b/data/hu.kramo.Cartridges.metainfo.xml.in index fee29a5..a38791e 100644 --- a/data/hu.kramo.Cartridges.metainfo.xml.in +++ b/data/hu.kramo.Cartridges.metainfo.xml.in @@ -6,7 +6,7 @@ Cartridges Launch all your games -

Cartridges is a simple game launcher. It has support for importing your games from Steam and Heroic with organizational features such as hiding and sorting by date added or last played.

+

Cartridges is a simple game launcher. It has support for importing your games from Steam, Heroic and Bottles with organizational features such as hiding and sorting by date added or last played.

hu.kramo.Cartridges.desktop kramo diff --git a/src/gtk/preferences.blp b/src/gtk/preferences.blp index 556c0b0..71208a1 100644 --- a/src/gtk/preferences.blp +++ b/src/gtk/preferences.blp @@ -69,5 +69,19 @@ template PreferencesWindow : Adw.PreferencesWindow { } } } + + Adw.PreferencesGroup { + title: "Bottles"; + + Adw.ActionRow { + title: _("Bottles Install Location"); + subtitle: _("Directory to use when importing games"); + + Button bottles_file_chooser_button { + icon-name: "folder-symbolic"; + valign: center; + } + } + } } } diff --git a/src/preferences.py b/src/preferences.py index e4073ed..b9fede7 100644 --- a/src/preferences.py +++ b/src/preferences.py @@ -30,6 +30,7 @@ class PreferencesWindow(Adw.PreferencesWindow): steam_file_chooser_button = Gtk.Template.Child() heroic_file_chooser_button = Gtk.Template.Child() + bottles_file_chooser_button = Gtk.Template.Child() def __init__(self, parent_widget, **kwargs): super().__init__(**kwargs) @@ -55,8 +56,15 @@ class PreferencesWindow(Adw.PreferencesWindow): except GLib.GError: pass + def set_bottles_dir(source, result, user_data): + try: + schema.set_string("bottles-location", filechooser.select_folder_finish(result).get_path()) + except GLib.GError: + pass + def choose_folder(widget, function): filechooser.select_folder(parent_widget, None, function, None) self.steam_file_chooser_button.connect("clicked", choose_folder, set_steam_dir) self.heroic_file_chooser_button.connect("clicked", choose_folder, set_heroic_dir) + self.bottles_file_chooser_button.connect("clicked", choose_folder, set_bottles_dir) diff --git a/src/utils/bottles_parser.py b/src/utils/bottles_parser.py index 73c8f00..826a921 100644 --- a/src/utils/bottles_parser.py +++ b/src/utils/bottles_parser.py @@ -69,6 +69,11 @@ def bottles_parser(parent_widget, action): values = {} values["game_id"] = "bottles_" + game["id"] + + if values["game_id"] in parent_widget.games and "removed" not in parent_widget.games[ + values["game_id"]].keys(): + continue + values["name"] = game["name"] values["executable"] = "xdg-open bottles:run/" + game["bottle"]["name"] + "/" + game["name"] values["hidden"] = False @@ -77,7 +82,7 @@ def bottles_parser(parent_widget, action): values["last_played"] = 0 if game["thumbnail"]: - values["pixbuf_options"] = save_cover(values, parent_widget, os.path.join(bottles_dir, "bottles", game["bottle"]["path"], "grids", game["thumbnail"].replace("grid:", ""))) + values["pixbuf_options"] = save_cover(values, parent_widget, os.path.join(bottles_dir, "bottles", game["bottle"]["path"], "grids", game["thumbnail"].split(":")[1])) bottles_games[values["game_id"]] = values