From 80364a81b348d7b8197342a580a7e3f2f8330469 Mon Sep 17 00:00:00 2001 From: mdgaziur Date: Fri, 12 Nov 2021 09:25:46 +0600 Subject: [PATCH] Improve Performance --- src/query.rs | 5 ----- src/window.rs | 7 ++++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/query.rs b/src/query.rs index 43f0d84..8aa3dbb 100644 --- a/src/query.rs +++ b/src/query.rs @@ -53,11 +53,6 @@ fn on_key_press(qb: &Entry, ev: &EventKey) -> Inhibit { fn on_text_changed(qb: &Entry, apps: &[AppInfo]) { let text = regex::escape(&qb.text().to_lowercase()); if text.is_empty() { - let list_box = get_list_box(qb); - clear_listbox(&list_box); - for app in apps { - add_app_to_listbox(&list_box, app); - } return; } diff --git a/src/window.rs b/src/window.rs index 417b482..62437b2 100644 --- a/src/window.rs +++ b/src/window.rs @@ -58,9 +58,6 @@ pub fn init_window(app: &Application) { let search_box = init_query(&desktop_entries); let list_box = init_search_result(); - for app in &desktop_entries { - add_app_to_listbox(&list_box, &app); - } let scw = ScrolledWindow::builder() .min_content_height(400) @@ -81,4 +78,8 @@ pub fn init_window(app: &Application) { ); win.show_all(); + + for app in &desktop_entries { + add_app_to_listbox(&list_box, &app); + } }