Skip to content

Commit

Permalink
add timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
alainm23 committed Oct 22, 2024
1 parent be7f38a commit 812af82
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/CategoryView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ public class Switchboard.CategoryView : Adw.NavigationPage {
searchview.activate_first_item ();
});

searchview.clear_search.connect (() => {
GLib.Timeout.add_once (stack.transition_duration, () => {
search_box.text = "";
});
});

search_box_eventcontrollerkey.key_released.connect ((keyval, keycode, state) => {
switch (keyval) {
case Gdk.Key.Down:
Expand Down
5 changes: 4 additions & 1 deletion src/SearchView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public class Switchboard.SearchView : Gtk.Box {
public Gtk.SearchEntry search_entry { get; construct; }
private Gtk.ListBox listbox;

public signal void clear_search ();

public SearchView (Gtk.SearchEntry search_entry) {
Object (search_entry: search_entry);
}
Expand Down Expand Up @@ -58,7 +60,8 @@ public class Switchboard.SearchView : Gtk.Box {
((SearchRow) row).uri.replace ("settings://", ""),
Switchboard.PlugsManager.get_default ()
);
search_entry.text = "";

clear_search ();
});
}

Expand Down

0 comments on commit 812af82

Please sign in to comment.