mirror of
https://github.com/morgan9e/warehouse
synced 2026-04-14 00:04:08 +09:00
Add sorting to left over data window
This commit is contained in:
@@ -8,11 +8,21 @@ template OrphansWindow : Adw.Window {
|
||||
Adw.ToolbarView main_toolbar_view {
|
||||
[top]
|
||||
HeaderBar header_bar {
|
||||
// [start]
|
||||
// Button refresh_button {
|
||||
// icon-name: "view-refresh-symbolic";
|
||||
// tooltip-text: _("Refresh the List of Installed Apps");
|
||||
// }
|
||||
[start]
|
||||
ToggleButton search_button {
|
||||
icon-name: "system-search-symbolic";
|
||||
tooltip-text: _("Search for an Installed App");
|
||||
}
|
||||
}
|
||||
[top]
|
||||
SearchBar search_bar {
|
||||
search-mode-enabled: bind-property search_button.active bidirectional;
|
||||
key-capture-widget: OrphansWindow;
|
||||
Adw.Clamp{
|
||||
maximum-size: 577;
|
||||
hexpand: true;
|
||||
SearchEntry search_entry {}
|
||||
}
|
||||
}
|
||||
content:
|
||||
Adw.ToastOverlay toast_overlay {
|
||||
|
||||
@@ -17,6 +17,8 @@ class OrphansWindow(Adw.Window):
|
||||
main_stack = Gtk.Template.Child()
|
||||
no_data = Gtk.Template.Child()
|
||||
action_bar = Gtk.Template.Child()
|
||||
search_bar = Gtk.Template.Child()
|
||||
search_entry = Gtk.Template.Child()
|
||||
|
||||
window_title = _("Manage Leftover Data")
|
||||
host_home = str(pathlib.Path.home())
|
||||
@@ -210,6 +212,10 @@ class OrphansWindow(Adw.Window):
|
||||
self.main_stack.set_visible_child(self.no_data)
|
||||
self.action_bar.set_visible(False)
|
||||
|
||||
def filter_func(self, row):
|
||||
if (self.search_entry.get_text().lower() in row.get_title().lower()):
|
||||
return True
|
||||
|
||||
def __init__(self, main_window, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
self.my_utils = myUtils(self) # Access common utils and set the window to this window
|
||||
@@ -234,4 +240,8 @@ class OrphansWindow(Adw.Window):
|
||||
self.install_button.set_visible(False)
|
||||
self.trash_button.connect("clicked", self.trashHandler)
|
||||
self.select_all_button.connect("toggled", self.selectAllHandler)
|
||||
self.main_overlay.add_overlay(self.progress_bar)
|
||||
self.main_overlay.add_overlay(self.progress_bar)
|
||||
|
||||
self.list_of_data.set_filter_func(self.filter_func)
|
||||
self.search_entry.connect("search-changed", lambda *_: self.list_of_data.invalidate_filter())
|
||||
self.search_bar.connect_entry(self.search_entry)
|
||||
Reference in New Issue
Block a user