Performance improvements in filter function

This commit is contained in:
Markus Koch 2017-02-03 22:56:31 +01:00
parent 1101026d19
commit 5686bdb834

View File

@ -197,18 +197,18 @@ static gboolean mainWindow_list_entry_visible(GtkTreeModel *model, GtkTreeIter *
if (searchString[0] != 0) { if (searchString[0] != 0) {
regex = g_regex_new(searchString, G_REGEX_CASELESS, 0, NULL); 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)) if (g_regex_match(regex, temp, 0, &match_info) && g_match_info_matches(match_info))
search_matched = 1; search_matched = 1;
g_free(temp); 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); 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)) 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_TITLE, &temp, -1);
if (g_regex_match(regex, temp, 0, &match_info) && g_match_info_matches(match_info))
search_matched = 1; search_matched = 1;
g_free(temp); g_free(temp);