diff options
-rw-r--r-- | src/trg-files-tree-view.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/trg-files-tree-view.c b/src/trg-files-tree-view.c index 70147f7..2b739c9 100644 --- a/src/trg-files-tree-view.c +++ b/src/trg-files-tree-view.c @@ -180,6 +180,18 @@ view_onButtonPressed(GtkWidget * treeview, return handled; } +static gboolean +search_func (GtkTreeModel *model, gint column, + const gchar *key, GtkTreeIter *iter, + gpointer search_data) +{ + gchar *iter_string = NULL; + gtk_tree_model_get(model, iter, column, &iter_string, -1); + gboolean result = g_strrstr(g_utf8_strdown(iter_string, -1), key) == NULL; + g_free(iter_string); + return result; +} + static void trg_files_tree_view_init(TrgFilesTreeView * self) { TrgTreeView *ttv = TRG_TREE_VIEW(self); @@ -200,6 +212,11 @@ static void trg_files_tree_view_init(TrgFilesTreeView * self) gtk_tree_view_set_search_column(GTK_TREE_VIEW(self), FILESCOL_NAME); + gtk_tree_view_set_search_equal_func(GTK_TREE_VIEW(self), + (GtkTreeViewSearchEqualFunc) search_func, + gtk_tree_view_get_model(GTK_TREE_VIEW(self)), + NULL); + g_signal_connect(self, "button-press-event", G_CALLBACK(view_onButtonPressed), NULL); g_signal_connect(self, "popup-menu", |