forked from cromer/pamac-classic
auto search when typing in search bar
This commit is contained in:
parent
654a50daf4
commit
bb6f38b4f4
@ -189,7 +189,7 @@
|
||||
<property name="caps_lock_warning">False</property>
|
||||
<property name="primary_icon_name">edit-find-symbolic</property>
|
||||
<signal name="activate" handler="on_search_entry_activate" swapped="no"/>
|
||||
<signal name="icon-press" handler="on_search_entry_icon_press" swapped="no"/>
|
||||
<signal name="changed" handler="on_search_entry_changed" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
@ -134,6 +134,8 @@ namespace Pamac {
|
||||
|
||||
bool refreshing;
|
||||
|
||||
uint search_entry_timeout_id;
|
||||
|
||||
public ManagerWindow (Gtk.Application application) {
|
||||
Object (application: application);
|
||||
|
||||
@ -1462,9 +1464,20 @@ namespace Pamac {
|
||||
}
|
||||
}
|
||||
|
||||
[GtkCallback]
|
||||
void on_search_entry_icon_press () {
|
||||
bool search_entry_timeout_callback () {
|
||||
on_search_entry_activate ();
|
||||
search_entry_timeout_id = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
[GtkCallback]
|
||||
void on_search_entry_changed () {
|
||||
if (search_entry.get_text () != "") {
|
||||
if (search_entry_timeout_id != 0) {
|
||||
Source.remove (search_entry_timeout_id);
|
||||
}
|
||||
search_entry_timeout_id = Timeout.add (750, search_entry_timeout_callback);
|
||||
}
|
||||
}
|
||||
|
||||
async Alpm.List<unowned Alpm.Package?> search_all_dbs (string search_string) {
|
||||
|
Loading…
Reference in New Issue
Block a user