Compare commits
2 Commits
v2.10.1
...
auto-impor
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
37e24ea8b1 | ||
|
|
fbc4e05327 |
1
.github/FUNDING.yml
vendored
1
.github/FUNDING.yml
vendored
@@ -1 +1,2 @@
|
|||||||
github: [kra-mo]
|
github: [kra-mo]
|
||||||
|
liberapay: kramo
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ Cartridges is an easy-to-use, elegant game launcher written in Python using GTK4
|
|||||||
For updates and questions, join our [Discord server][discord-url] (bridged to [Matrix](https://matrix.to/#/#cartridges:matrix.org))!
|
For updates and questions, join our [Discord server][discord-url] (bridged to [Matrix](https://matrix.to/#/#cartridges:matrix.org))!
|
||||||
|
|
||||||
## Donations
|
## Donations
|
||||||
I accept donations through [GitHub Sponsors](https://github.com/sponsors/kra-mo).
|
I accept donations through [GitHub Sponsors](https://github.com/sponsors/kra-mo) and [Liberapay](https://liberapay.com/kramo).
|
||||||
|
|
||||||
Thank you for your generosity! 💜
|
Thank you for your generosity! 💜
|
||||||
|
|
||||||
|
|||||||
@@ -106,7 +106,6 @@ class Importer(ErrorProducer):
|
|||||||
|
|
||||||
def run(self) -> None:
|
def run(self) -> None:
|
||||||
"""Use several Gio.Task to import games from added sources"""
|
"""Use several Gio.Task to import games from added sources"""
|
||||||
|
|
||||||
shared.win.get_application().state = shared.AppState.IMPORT
|
shared.win.get_application().state = shared.AppState.IMPORT
|
||||||
|
|
||||||
if self.__class__.summary_toast:
|
if self.__class__.summary_toast:
|
||||||
@@ -137,6 +136,7 @@ class Importer(ErrorProducer):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.progress_changed_callback()
|
self.progress_changed_callback()
|
||||||
|
GLib.timeout_add(100, self.__watchdog)
|
||||||
|
|
||||||
def create_dialog(self) -> None:
|
def create_dialog(self) -> None:
|
||||||
"""Create the import dialog"""
|
"""Create the import dialog"""
|
||||||
@@ -281,8 +281,7 @@ class Importer(ErrorProducer):
|
|||||||
shared.store.duplicate_game_ids = set()
|
shared.store.duplicate_game_ids = set()
|
||||||
# Disconnect the close-attempt signal that closes the main window
|
# Disconnect the close-attempt signal that closes the main window
|
||||||
self.import_dialog.disconnect(self.close_attempt_id)
|
self.import_dialog.disconnect(self.close_attempt_id)
|
||||||
# Stupid hack because stupid libadwaita is stupid
|
self.import_dialog.force_close()
|
||||||
GLib.timeout_add(50, self.import_dialog.force_close)
|
|
||||||
self.__class__.summary_toast = self.create_summary_toast()
|
self.__class__.summary_toast = self.create_summary_toast()
|
||||||
self.create_error_dialog()
|
self.create_error_dialog()
|
||||||
shared.win.get_application().lookup_action("import").set_enabled(True)
|
shared.win.get_application().lookup_action("import").set_enabled(True)
|
||||||
@@ -397,7 +396,13 @@ class Importer(ErrorProducer):
|
|||||||
|
|
||||||
toast.set_title(toast_title)
|
toast.set_title(toast_title)
|
||||||
|
|
||||||
shared.win.toast_overlay.add_toast(toast)
|
if not (
|
||||||
|
self.n_games_added == 0
|
||||||
|
and removed_length == 0
|
||||||
|
and shared.schema.get_boolean("auto-import")
|
||||||
|
):
|
||||||
|
shared.win.toast_overlay.add_toast(toast)
|
||||||
|
|
||||||
return toast
|
return toast
|
||||||
|
|
||||||
def open_preferences(
|
def open_preferences(
|
||||||
@@ -423,3 +428,11 @@ class Importer(ErrorProducer):
|
|||||||
self.open_preferences(*args).connect("close-request", self.timeout_toast)
|
self.open_preferences(*args).connect("close-request", self.timeout_toast)
|
||||||
else:
|
else:
|
||||||
self.timeout_toast()
|
self.timeout_toast()
|
||||||
|
|
||||||
|
def __watchdog(self) -> bool:
|
||||||
|
# This can help resolve a race condition where the dialog would stay open
|
||||||
|
if not self.finished:
|
||||||
|
return True
|
||||||
|
|
||||||
|
self.import_dialog.force_close()
|
||||||
|
return shared.win.get_visible_dialog() == self.import_dialog
|
||||||
|
|||||||
@@ -118,9 +118,6 @@ class CartridgesApplication(Adw.Application):
|
|||||||
|
|
||||||
log_system_info()
|
log_system_info()
|
||||||
|
|
||||||
# Set fallback icon-name
|
|
||||||
Gtk.Window.set_default_icon_name(shared.APP_ID)
|
|
||||||
|
|
||||||
# Create the main window
|
# Create the main window
|
||||||
win = self.props.active_window # pylint: disable=no-member
|
win = self.props.active_window # pylint: disable=no-member
|
||||||
if not win:
|
if not win:
|
||||||
@@ -196,6 +193,9 @@ class CartridgesApplication(Adw.Application):
|
|||||||
|
|
||||||
shared.win.present()
|
shared.win.present()
|
||||||
|
|
||||||
|
if shared.schema.get_boolean("auto-import"):
|
||||||
|
self.on_import_action()
|
||||||
|
|
||||||
def do_handle_local_options(self, options: GLib.VariantDict) -> int:
|
def do_handle_local_options(self, options: GLib.VariantDict) -> int:
|
||||||
if search := options.lookup_value("search"):
|
if search := options.lookup_value("search"):
|
||||||
self.init_search_term = search.get_string()
|
self.init_search_term = search.get_string()
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ class CartridgesPreferences(Adw.PreferencesDialog):
|
|||||||
cover_launches_game_switch: Adw.SwitchRow = Gtk.Template.Child()
|
cover_launches_game_switch: Adw.SwitchRow = Gtk.Template.Child()
|
||||||
high_quality_images_switch: Adw.SwitchRow = Gtk.Template.Child()
|
high_quality_images_switch: Adw.SwitchRow = Gtk.Template.Child()
|
||||||
|
|
||||||
|
auto_import_switch: Adw.SwitchRow = Gtk.Template.Child()
|
||||||
remove_missing_switch: Adw.SwitchRow = Gtk.Template.Child()
|
remove_missing_switch: Adw.SwitchRow = Gtk.Template.Child()
|
||||||
|
|
||||||
steam_expander_row: Adw.ExpanderRow = Gtk.Template.Child()
|
steam_expander_row: Adw.ExpanderRow = Gtk.Template.Child()
|
||||||
@@ -237,6 +238,7 @@ class CartridgesPreferences(Adw.PreferencesDialog):
|
|||||||
"exit-after-launch",
|
"exit-after-launch",
|
||||||
"cover-launches-game",
|
"cover-launches-game",
|
||||||
"high-quality-images",
|
"high-quality-images",
|
||||||
|
"auto-import",
|
||||||
"remove-missing",
|
"remove-missing",
|
||||||
"lutris-import-steam",
|
"lutris-import-steam",
|
||||||
"lutris-import-flatpak",
|
"lutris-import-flatpak",
|
||||||
|
|||||||
@@ -61,6 +61,10 @@ template $CartridgesPreferences: Adw.PreferencesDialog {
|
|||||||
Adw.PreferencesGroup import_behavior_group {
|
Adw.PreferencesGroup import_behavior_group {
|
||||||
title: _("Behavior");
|
title: _("Behavior");
|
||||||
|
|
||||||
|
Adw.SwitchRow auto_import_switch {
|
||||||
|
title: _("Import Games Automatically");
|
||||||
|
}
|
||||||
|
|
||||||
Adw.SwitchRow remove_missing_switch {
|
Adw.SwitchRow remove_missing_switch {
|
||||||
title: _("Remove Uninstalled Games");
|
title: _("Remove Uninstalled Games");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,9 @@
|
|||||||
<schemalist gettext-domain="cartridges">
|
<schemalist gettext-domain="cartridges">
|
||||||
|
|
||||||
<schema id="@APP_ID@" path="@PREFIX@/">
|
<schema id="@APP_ID@" path="@PREFIX@/">
|
||||||
|
<key name="auto-import" type="b">
|
||||||
|
<default>false</default>
|
||||||
|
</key>
|
||||||
<key name="exit-after-launch" type="b">
|
<key name="exit-after-launch" type="b">
|
||||||
<default>false</default>
|
<default>false</default>
|
||||||
</key>
|
</key>
|
||||||
|
|||||||
Reference in New Issue
Block a user