Flatpak source cleanups
This commit is contained in:
@@ -216,6 +216,20 @@ template $PreferencesWindow : Adw.PreferencesWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Adw.ExpanderRow flatpak_expander_row {
|
||||||
|
title: _("Flatpak Games");
|
||||||
|
show-enable-switch: true;
|
||||||
|
|
||||||
|
Adw.ActionRow flatpak_data_action_row {
|
||||||
|
title: _("Install Location");
|
||||||
|
|
||||||
|
Button flatpak_config_file_chooser_button {
|
||||||
|
icon-name: "folder-symbolic";
|
||||||
|
valign: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class FlatpakSourceIterator(SourceIterator):
|
|||||||
with entry.open("r", encoding="utf-8") as open_file:
|
with entry.open("r", encoding="utf-8") as open_file:
|
||||||
string = open_file.read()
|
string = open_file.read()
|
||||||
|
|
||||||
desktop_values = {"Name": None, "Icon": None}
|
desktop_values = {"Name": None, "Icon": None, "Categories": None}
|
||||||
for key in desktop_values:
|
for key in desktop_values:
|
||||||
if regex := re.findall(f"{key}=(.*)\n", string):
|
if regex := re.findall(f"{key}=(.*)\n", string):
|
||||||
desktop_values[key] = regex[0]
|
desktop_values[key] = regex[0]
|
||||||
@@ -54,6 +54,12 @@ class FlatpakSourceIterator(SourceIterator):
|
|||||||
if not desktop_values["Name"]:
|
if not desktop_values["Name"]:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if not desktop_values["Categories"]:
|
||||||
|
continue
|
||||||
|
|
||||||
|
if not "Game" in desktop_values["Categories"].split(";"):
|
||||||
|
continue
|
||||||
|
|
||||||
values = {
|
values = {
|
||||||
"source": self.source.id,
|
"source": self.source.id,
|
||||||
"added": added_time,
|
"added": added_time,
|
||||||
@@ -67,8 +73,10 @@ class FlatpakSourceIterator(SourceIterator):
|
|||||||
|
|
||||||
additional_data = {}
|
additional_data = {}
|
||||||
if icon_name := desktop_values["Icon"]:
|
if icon_name := desktop_values["Icon"]:
|
||||||
if icon_path := IconTheme.getIconPath(icon_name):
|
if icon_path := IconTheme.getIconPath(icon_name, 512):
|
||||||
additional_data = {"local_image_path": Path(icon_path)}
|
additional_data = {"local_image_path": Path(icon_path)}
|
||||||
|
else:
|
||||||
|
print(":(")
|
||||||
|
|
||||||
# Produce game
|
# Produce game
|
||||||
yield (game, additional_data)
|
yield (game, additional_data)
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ class CartridgesApplication(Adw.Application):
|
|||||||
if shared.schema.get_boolean("bottles"):
|
if shared.schema.get_boolean("bottles"):
|
||||||
importer.add_source(BottlesSource())
|
importer.add_source(BottlesSource())
|
||||||
|
|
||||||
if not shared.schema.get_boolean("flatpak"):
|
if shared.schema.get_boolean("flatpak"):
|
||||||
importer.add_source(FlatpakSource())
|
importer.add_source(FlatpakSource())
|
||||||
|
|
||||||
if shared.schema.get_boolean("itch"):
|
if shared.schema.get_boolean("itch"):
|
||||||
|
|||||||
@@ -80,6 +80,10 @@ class PreferencesWindow(Adw.PreferencesWindow):
|
|||||||
legendary_config_action_row = Gtk.Template.Child()
|
legendary_config_action_row = Gtk.Template.Child()
|
||||||
legendary_config_file_chooser_button = Gtk.Template.Child()
|
legendary_config_file_chooser_button = Gtk.Template.Child()
|
||||||
|
|
||||||
|
flatpak_expander_row = Gtk.Template.Child()
|
||||||
|
flatpak_data_action_row = Gtk.Template.Child()
|
||||||
|
flatpak_config_file_chooser_button = Gtk.Template.Child()
|
||||||
|
|
||||||
sgdb_key_group = Gtk.Template.Child()
|
sgdb_key_group = Gtk.Template.Child()
|
||||||
sgdb_key_entry_row = Gtk.Template.Child()
|
sgdb_key_entry_row = Gtk.Template.Child()
|
||||||
sgdb_switch = Gtk.Template.Child()
|
sgdb_switch = Gtk.Template.Child()
|
||||||
|
|||||||
Reference in New Issue
Block a user