From 5686bdb834320b223a1c382ed7dbe14a34f41ae7 Mon Sep 17 00:00:00 2001 From: Markus Koch Date: Fri, 3 Feb 2017 22:56:31 +0100 Subject: [PATCH] Performance improvements in filter function --- src/mainwindow.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/mainwindow.c b/src/mainwindow.c index 899c112..ce84569 100644 --- a/src/mainwindow.c +++ b/src/mainwindow.c @@ -197,18 +197,18 @@ static gboolean mainWindow_list_entry_visible(GtkTreeModel *model, GtkTreeIter * if (searchString[0] != 0) { regex = g_regex_new(searchString, G_REGEX_CASELESS, 0, NULL); - gtk_tree_model_get(model, iter, COL_TEXT, &temp, -1); + gtk_tree_model_get(model, iter, COL_TITLE, &temp, -1); if (g_regex_match(regex, temp, 0, &match_info) && g_match_info_matches(match_info)) search_matched = 1; g_free(temp); + gtk_tree_model_get(model, iter, COL_TEXT, &temp, -1); + if (!search_matched && g_regex_match(regex, temp, 0, &match_info) && g_match_info_matches(match_info)) + search_matched = 1; + g_free(temp); + gtk_tree_model_get(model, iter, COL_TAGS_TEXT, &temp, -1); - if (g_regex_match(regex, temp, 0, &match_info) && g_match_info_matches(match_info)) - search_matched = 1; - g_free(temp); - - gtk_tree_model_get(model, iter, COL_TITLE, &temp, -1); - if (g_regex_match(regex, temp, 0, &match_info) && g_match_info_matches(match_info)) + if (!search_matched && g_regex_match(regex, temp, 0, &match_info) && g_match_info_matches(match_info)) search_matched = 1; g_free(temp);