From b8e9c1f0debb1ec7bacafb1a10180bc0226ac430 Mon Sep 17 00:00:00 2001 From: heliguy Date: Sat, 23 Sep 2023 02:33:52 -0400 Subject: [PATCH] Sync work --- src/filter.blp | 11 +---------- src/filter_window.py | 13 +++++-------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/src/filter.blp b/src/filter.blp index a7fc5354..fcfb7d58 100644 --- a/src/filter.blp +++ b/src/filter.blp @@ -44,17 +44,8 @@ template FilterWindow : Adw.Window { selection-mode: none; styles["boxed-list"] - Adw.ActionRow runtimes_row { + Adw.SwitchRow runtimes_row { title: _("Show Runtimes"); - - [suffix] - Box { - valign: center; - Switch runtimes_switch { - } - } - - activatable-widget: runtimes_switch; } } // ListBox install_type_list { diff --git a/src/filter_window.py b/src/filter_window.py index 25c957d3..fc66fa7b 100644 --- a/src/filter_window.py +++ b/src/filter_window.py @@ -11,10 +11,10 @@ class FilterWindow(Adw.Window): cancel_button = Gtk.Template.Child() apply_button = Gtk.Template.Child() remotes_list = Gtk.Template.Child() - runtimes_switch = Gtk.Template.Child() + runtimes_row = Gtk.Template.Child() - def runtimesHandler(self, switch, state): - print(state) + def runtimesHandler(self, switch, _a): + print(switch.get_active()) def generateList(self): for i in range(len(self.host_remotes)): @@ -22,16 +22,13 @@ def generateList(self): 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) + remote_row = Adw.SwitchRow(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) @@ -48,7 +45,7 @@ def __init__(self, main_window, **kwargs): 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) + self.runtimes_row.connect("notify::active", self.runtimesHandler) # Calls self.generateList()