[gnome-packagekit] Make typeahead search work in the update list
- From: Richard Hughes <rhughes src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-packagekit] Make typeahead search work in the update list
- Date: Tue, 21 Apr 2009 04:35:46 -0400 (EDT)
commit b0b537a297ee20f396668643610cfc8745da1ff8
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Apr 21 09:32:19 2009 +0100
Make typeahead search work in the update list
---
src/gpk-update-viewer.c | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/src/gpk-update-viewer.c b/src/gpk-update-viewer.c
index 010ee4d..3c6019c 100644
--- a/src/gpk-update-viewer.c
+++ b/src/gpk-update-viewer.c
@@ -2473,6 +2473,34 @@ gpk_update_viewer_vpaned_realized_cb (GtkWidget *widget, gpointer data)
}
/**
+ * gpk_update_viewer_search_equal_func:
+ **/
+static gboolean
+gpk_update_viewer_search_equal_func (GtkTreeModel *model, gint column, const gchar *key, GtkTreeIter *iter, gpointer search_data)
+{
+ char *text;
+ char *cn_key;
+ char *cn_text;
+ gboolean result;
+
+ gtk_tree_model_get (model, iter, column, &text, -1);
+
+ cn_key = g_utf8_casefold (key, -1);
+ cn_text = g_utf8_casefold (text, -1);
+
+ if (strstr (cn_text, cn_key))
+ result = FALSE;
+ else
+ result = TRUE;
+
+ g_free (text);
+ g_free (cn_key);
+ g_free (cn_text);
+
+ return result;
+}
+
+/**
* main:
**/
int
@@ -2645,6 +2673,8 @@ main (int argc, char *argv[])
/* updates */
widget = GTK_WIDGET (gtk_builder_get_object (builder, "treeview_updates"));
+ gtk_tree_view_set_search_column (GTK_TREE_VIEW (widget), GPK_UPDATES_COLUMN_TEXT);
+ gtk_tree_view_set_search_equal_func (GTK_TREE_VIEW (widget), gpk_update_viewer_search_equal_func, NULL, NULL);
gtk_tree_view_columns_autosize (GTK_TREE_VIEW (widget));
gtk_tree_view_set_model (GTK_TREE_VIEW (widget),
GTK_TREE_MODEL (list_store_updates));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]