diff --git a/src/common.py b/src/common.py
index 8ec346d..355e848 100644
--- a/src/common.py
+++ b/src/common.py
@@ -10,7 +10,7 @@ class myUtils:
self.user_data_path = self.host_home + "/.var/app/"
self.install_success = True
self.uninstall_success = True
-
+
def trashFolder(self, path):
if not os.path.exists(path):
return 1
diff --git a/src/filter.blp b/src/filter.blp
new file mode 100644
index 0000000..a7fc535
--- /dev/null
+++ b/src/filter.blp
@@ -0,0 +1,121 @@
+using Gtk 4.0;
+using Adw 1;
+
+template FilterWindow : Adw.Window {
+ default-width: 500;
+ default-height: 450;
+ title: _("Set a Filter");
+ modal: true;
+
+ Adw.ToolbarView main_toolbar_view {
+ [top]
+ HeaderBar header_bar {
+ show-title-buttons: false;
+
+ [start]
+ Button cancel_button {
+ label: _("Cancel");
+ }
+ [end]
+ Button apply_button {
+ label: _("Apply");
+ styles["suggested-action"]
+ }
+ }
+ content:
+ Adw.ToastOverlay toast_overlay {
+ Stack main_stack {
+ Box main_box {
+ orientation: vertical;
+ Overlay main_overlay {
+ ScrolledWindow scrolled_window {
+ vexpand: true;
+ Adw.Clamp{
+ Box outerbox {
+ orientation: vertical;
+
+ ListBox show_runtimes_list {
+ margin-top: 6;
+ margin-bottom: 6;
+ margin-start: 12;
+ margin-end: 12;
+ hexpand: true;
+ valign: start;
+ selection-mode: none;
+ styles["boxed-list"]
+
+ Adw.ActionRow runtimes_row {
+ title: _("Show Runtimes");
+
+ [suffix]
+ Box {
+ valign: center;
+ Switch runtimes_switch {
+ }
+ }
+
+ activatable-widget: runtimes_switch;
+ }
+ }
+ // ListBox install_type_list {
+ // margin-top: 6;
+ // margin-bottom: 6;
+ // margin-start: 12;
+ // margin-end: 12;
+ // hexpand: true;
+ // valign: start;
+ // selection-mode: none;
+ // styles["boxed-list"]
+
+ // Adw.ActionRow user {
+ // title: _("User wide");
+ // subtitle: _("Apps only available to you");
+
+ // [suffix]
+ // CheckButton user_check {
+ // }
+
+ // activatable-widget: user_check;
+ // }
+ // Adw.ActionRow system {
+ // title: _("System wide");
+ // subtitle: _("Apps available to everyone on this system");
+
+ // [suffix]
+ // CheckButton system_check {
+ // }
+
+ // activatable-widget: system_check;
+ // }
+ // }
+ ListBox remotes_list {
+ margin-top: 6;
+ margin-bottom: 6;
+ margin-start: 12;
+ margin-end: 12;
+ hexpand: true;
+ valign: start;
+ selection-mode: none;
+ styles["boxed-list"]
+ }
+ }
+ }
+ }
+ }
+ }
+ Adw.StatusPage no_data {
+ icon-name: "check-plain-symbolic";
+ title: _("No Leftover Data");
+ description: _("There is no leftover user data");
+ }
+ }
+ };
+ // [bottom]
+ // ActionBar action_bar {
+ // [start]
+ // ToggleButton select_all_button {
+ // label: _("Select All");
+ // }
+ // }
+ }
+}
\ No newline at end of file
diff --git a/src/filter_window.py b/src/filter_window.py
new file mode 100644
index 0000000..25c957d
--- /dev/null
+++ b/src/filter_window.py
@@ -0,0 +1,55 @@
+from gi.repository import Gtk, Adw, GLib, Gdk, Gio
+from .common import myUtils
+import subprocess
+import os
+import pathlib
+
+@Gtk.Template(resource_path="/io/github/heliguy4599/Warehouse/filter.ui")
+class FilterWindow(Adw.Window):
+ __gtype_name__ = "FilterWindow"
+
+ cancel_button = Gtk.Template.Child()
+ apply_button = Gtk.Template.Child()
+ remotes_list = Gtk.Template.Child()
+ runtimes_switch = Gtk.Template.Child()
+
+ def runtimesHandler(self, switch, state):
+ print(state)
+
+ def generateList(self):
+ for i in range(len(self.host_remotes)):
+ name = self.host_remotes[i][0]
+ title = self.host_remotes[i][1]
+ install_type = self.host_remotes[i][7]
+ url = self.host_remotes[i][2]
+ remote_row = Adw.ActionRow(title=title, subtitle=url)
+ if title == "-":
+ remote_row.set_title(name)
+ self.remotes_list.append(remote_row)
+ label = Gtk.Label(label=("{} wide").format(install_type))
+ label.add_css_class("subtitle")
+ remote_row.add_suffix(label)
+ row_select = Gtk.CheckButton()
+ remote_row.add_suffix(row_select)
+ remote_row.set_activatable_widget(row_select)
+
+ def __init__(self, main_window, **kwargs):
+ super().__init__(**kwargs)
+
+ # Create Variables
+ self.my_utils = myUtils(self)
+ self.host_remotes = self.my_utils.getHostRemotes()
+ self.filter_list = "the guh"
+
+ # Window Things
+ self.set_transient_for(main_window)
+
+ # Connections
+ self.apply_button.connect("clicked", lambda *_: main_window.updateFilter(self.filter_list))
+ self.apply_button.connect("clicked", lambda *_: self.close())
+ self.cancel_button.connect("clicked", lambda *_: self.close())
+ self.runtimes_switch.connect("state-set", self.runtimesHandler)
+
+ # Calls
+ self.generateList()
+
diff --git a/src/funnel-symbolic.svg b/src/funnel-symbolic.svg
new file mode 100644
index 0000000..e09e1e4
--- /dev/null
+++ b/src/funnel-symbolic.svg
@@ -0,0 +1,2 @@
+
+
diff --git a/src/main.py b/src/main.py
index d2d73bc..b195d9b 100644
--- a/src/main.py
+++ b/src/main.py
@@ -49,6 +49,7 @@ class WarehouseApplication(Adw.Application):
self.create_action("refresh-list", self.refresh_list_shortcut, ["r", "F5"])
self.create_action("show-runtimes", self.show_runtimes_shortcut, ["t"])
self.create_action("show-remotes-window", self.show_remotes_shortcut, ["m"])
+ self.create_action("set-filter", self.filters_shortcut, ["y"])
self.show_runtimes_stateful = Gio.SimpleAction.new_stateful("show-runtimes", None, GLib.Variant.new_boolean(False))
self.show_runtimes_stateful.connect("activate", self.on_show_runtimes_action)
@@ -66,7 +67,6 @@ class WarehouseApplication(Adw.Application):
self.props.active_window.batch_select_all_handler(select_button)
def manage_data_shortcut(self, widget, _):
- #self.props.active_window.orphans_window()
OrphansWindow(self.props.active_window).present()
def refresh_list_shortcut(self, widget, _):
@@ -79,9 +79,9 @@ class WarehouseApplication(Adw.Application):
def show_remotes_shortcut(self, widget, _):
RemotesWindow(self.props.active_window).present()
- # def on_manage_data_folders_action(self, widget, _):
- # #self.props.active_window.orphans_window()
- # OrphansWindow(self.props.active_window).present()
+ def filters_shortcut(self, widget, _):
+ window = self.props.active_window
+ window.filterWindowHandler(window)
def do_activate(self):
"""Called when the application is activated.
diff --git a/src/meson.build b/src/meson.build
index 6ec3c0d..dc5eeac 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -7,6 +7,7 @@ blueprints = custom_target('blueprints',
'gtk/help-overlay.blp',
'window.blp',
'orphans.blp',
+ 'filter.blp',
),
output: '.',
command: [find_program('blueprint-compiler'), 'batch-compile', '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'],
@@ -46,6 +47,8 @@ warehouse_sources = [
'remotes.py',
'common.py',
'orphans.blp',
+ 'filter_window.py',
+ 'filter.blp'
]
install_data(warehouse_sources, install_dir: moduledir)
diff --git a/src/warehouse.gresource.xml b/src/warehouse.gresource.xml
index 289ad7b..7d41a8d 100644
--- a/src/warehouse.gresource.xml
+++ b/src/warehouse.gresource.xml
@@ -3,6 +3,7 @@
window.ui
orphans.ui
+ filter.ui
gtk/help-overlay.ui
@@ -14,5 +15,6 @@
check-plain-symbolic.svg
paper-filled-symbolic.svg
plus-large-symbolic.svg
+ funnel-symbolic.svg
diff --git a/src/window.blp b/src/window.blp
index 7094929..3aa5800 100644
--- a/src/window.blp
+++ b/src/window.blp
@@ -32,6 +32,12 @@ template WarehouseWindow : Adw.ApplicationWindow {
icon-name: "selection-mode-symbolic";
tooltip-text: _("Toggle Selection Mode");
}
+
+ [end]
+ Button filter_button {
+ icon-name: "funnel-symbolic";
+ tooltip-text: _("Filter Apps List");
+ }
}
[top]
SearchBar search_bar {
@@ -153,4 +159,4 @@ menu copy_menu {
action: "win.copy-refs";
}
}
-}
+}
\ No newline at end of file
diff --git a/src/window.py b/src/window.py
index 05f0cb3..1b117b8 100644
--- a/src/window.py
+++ b/src/window.py
@@ -22,7 +22,7 @@ import subprocess
from gi.repository import Adw, Gdk, Gio, GLib, Gtk
from .properties_window import show_properties_window
-#from .orphans_window import show_orphans_window
+from .filter_window import FilterWindow
from .common import myUtils
@Gtk.Template(resource_path="/io/github/heliguy4599/Warehouse/window.ui")
@@ -46,6 +46,7 @@ class WarehouseWindow(Adw.ApplicationWindow):
main_box = Gtk.Template.Child()
main_overlay = Gtk.Template.Child()
main_toolbar_view = Gtk.Template.Child()
+ filter_button = Gtk.Template.Child()
main_progress_bar = Gtk.ProgressBar(visible=False, pulse_step=0.7)
main_progress_bar.add_css_class("osd")
@@ -169,6 +170,18 @@ class WarehouseWindow(Adw.ApplicationWindow):
self.selected_host_flatpak_indexes = []
self.should_select_all = self.batch_select_all_button.get_active()
+
+
+
+
+
+
+
+
+
+
+
+
def get_host_flatpaks():
output = subprocess.run(["flatpak-spawn", "--host", "flatpak", "list", "--columns=all"], capture_output=True, text=True).stdout
lines = output.strip().split("\n")
@@ -180,12 +193,15 @@ class WarehouseWindow(Adw.ApplicationWindow):
return data
self.host_flatpaks = get_host_flatpaks()
- if self.host_flatpaks == [[""]]:
- self.main_stack.set_visible_child(self.no_flatpaks)
- self.search_button.set_visible(False)
- self.search_bar.set_visible(False)
- self.batch_mode_button.set_visible(False)
- return
+
+
+
+
+
+
+
+
+
for index in range(len(self.host_flatpaks)):
app_name = self.host_flatpaks[index][0]
@@ -229,6 +245,13 @@ class WarehouseWindow(Adw.ApplicationWindow):
self.list_of_flatpaks.append(flatpak_row)
+ if not self.list_of_flatpaks.get_row_at_index(0):
+ self.main_stack.set_visible_child(self.no_flatpaks)
+ self.search_button.set_visible(False)
+ self.search_bar.set_visible(False)
+ self.batch_mode_button.set_visible(False)
+ return
+
def refresh_list_of_flatpaks(self, widget, should_toast):
self.list_of_flatpaks.remove_all()
self.generate_list_of_flatpaks()
@@ -349,6 +372,15 @@ class WarehouseWindow(Adw.ApplicationWindow):
self.clipboard.set(to_copy)
self.toast_overlay.add_toast(Adw.Toast.new(_("Copied selected app refs")))
+ def filterWindowHandler(self, widget):
+ filtwin = FilterWindow(self)
+ filtwin.present()
+
+ def updateFilter(self, filter):
+ self.filter_list = filter
+ self.refresh_list_of_flatpaks(self, True)
+ print(self.filter_list)
+
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.my_utils = myUtils(self)
@@ -372,3 +404,7 @@ class WarehouseWindow(Adw.ApplicationWindow):
self.create_action("copy-ids", self.copyIDs)
self.create_action("copy-refs", self.copyRefs)
+ self.filter_button.connect("clicked", self.filterWindowHandler)
+
+ self.filter_list = ""
+