diff --git a/data/icons/eye-not-looking-symbolic.svg b/data/icons/eye-not-looking-symbolic.svg new file mode 100644 index 0000000..df848f9 --- /dev/null +++ b/data/icons/eye-not-looking-symbolic.svg @@ -0,0 +1,2 @@ + + diff --git a/data/icons/eye-open-negative-filled-symbolic.svg b/data/icons/eye-open-negative-filled-symbolic.svg new file mode 100644 index 0000000..d96449e --- /dev/null +++ b/data/icons/eye-open-negative-filled-symbolic.svg @@ -0,0 +1,2 @@ + + diff --git a/data/ui/remotes.blp b/data/ui/remotes.blp index 927aba3..368e50b 100644 --- a/data/ui/remotes.blp +++ b/data/ui/remotes.blp @@ -9,6 +9,10 @@ template RemotesWindow: Adw.Window { Adw.ToolbarView main_toolbar_view { [top] HeaderBar header_bar { + Button refresh { + icon-name: "view-refresh-symbolic"; + tooltip-text: "Refresh list of remotes"; + } } content: Adw.ToastOverlay toast_overlay { @@ -17,12 +21,21 @@ template RemotesWindow: Adw.Window { Adw.PreferencesPage main_group { Adw.PreferencesGroup remotes_list { title: _("Installed Remotes"); - header-suffix: Button refresh { - Adw.ButtonContent { - label: _("Refresh"); - icon-name: "view-refresh-symbolic"; + header-suffix: ToggleButton show_disabled_button { + Adw.ButtonContent show_disabled_button_button_content { + icon-name: "eye-not-looking-symbolic"; + label: _("Show disabled"); + styles["flat"] } - styles["flat"] + // spacing: 6; + // margin-end: 6; + // Label { + // label: _("Show Disabled"); + // styles["heading", "h4"] + // } + // Switch show_disabled { + // valign: center; + // } }; Adw.ActionRow no_remotes { title: _("No remotes on the system, add some from below"); diff --git a/src/common.py b/src/common.py index 457900a..9df38f2 100644 --- a/src/common.py +++ b/src/common.py @@ -116,14 +116,12 @@ class myUtils: try: for i in range(len(data)): data[i][7] = data[i][7].split(",") - for j in range(len(data[i])): - if data[i][7][j] == "user": - data[i][7] = "user" - break - - if data[i][7][j] == "system": - data[i][7] = "system" - break + if "disabled" in data[i][7]: + data[i][7] = "disabled" + if "user" in data[i][7]: + data[i][7] = "user" + if "system" in data[i][7]: + data[i][7] = "system" except: print("error getting remote installation types") return data diff --git a/src/remotes_window.py b/src/remotes_window.py index 3dd1288..0f3e68b 100644 --- a/src/remotes_window.py +++ b/src/remotes_window.py @@ -18,6 +18,9 @@ class RemotesWindow(Adw.Window): custom_remote = Gtk.Template.Child() refresh = Gtk.Template.Child() adding = Gtk.Template.Child() + show_disabled_button = Gtk.Template.Child() + show_disabled_button_button_content = Gtk.Template.Child() + show_disabled = False # progress_bar = Gtk.Template.Child() rows_in_list = [] @@ -76,6 +79,11 @@ class RemotesWindow(Adw.Window): self.close() def generate_list(self): + if self.show_disabled_button.get_active(): + self.show_disabled_button_button_content.set_icon_name("eye-open-negative-filled-symbolic") + else: + self.show_disabled_button_button_content.set_icon_name("eye-not-looking-symbolic") + self.host_remotes = self.my_utils.getHostRemotes() self.host_flatpaks = self.get_host_flatpaks() for i in range(len(self.rows_in_list)): @@ -94,12 +102,23 @@ class RemotesWindow(Adw.Window): 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=name) + + if install_type == "disabled": + if not self.show_disabled_button.get_active(): + continue + + remote_row.add_css_class("warning") + + url = self.host_remotes[i][2] if title == "-": remote_row.set_title(name) self.remotes_list.add(remote_row) - label = Gtk.Label(label=("{} wide").format(install_type), valign=Gtk.Align.CENTER) + label = Gtk.Label(valign=Gtk.Align.CENTER) + if install_type == "disabled": + remote_row.set_subtitle(_("Disabled")) + else: + remote_row.set_subtitle(_("{} wide").format(install_type)) label.add_css_class("subtitle") # subprocess.run(['wget', f'{self.host_remotes[i][11]}']) Idea to display remote icons... Need internet connection. Not sure if that is worth it remote_row.add_suffix(label) @@ -409,6 +428,7 @@ class RemotesWindow(Adw.Window): self.add_from_file.connect("activated", self.addFromFileHandler) self.custom_remote.add_suffix(Gtk.Image.new_from_icon_name("right-large-symbolic")) self.custom_remote.connect("activated", self.add_handler) + self.show_disabled_button.connect("clicked", lambda *_: self.generate_list()) # Calls self.generate_list() diff --git a/src/warehouse.gresource.xml b/src/warehouse.gresource.xml index 36c36ed..79fa82f 100644 --- a/src/warehouse.gresource.xml +++ b/src/warehouse.gresource.xml @@ -32,5 +32,7 @@ ../data/icons/software-update-urgent-symbolic.svg ../data/icons/cross-filled-symbolic.svg ../data/icons/important-small-symbolic.svg + ../data/icons/eye-not-looking-symbolic.svg + ../data/icons/eye-open-negative-filled-symbolic.svg