diff --git a/src/filter.blp b/src/filter.blp index a7fc535..fcfb7d5 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 25c957d..fc66fa7 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 @@ class FilterWindow(Adw.Window): 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 @@ class FilterWindow(Adw.Window): 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()