aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2012-05-17 22:03:34 +0800
committerBastien Nocera <hadess@hadess.net>2012-09-27 18:23:39 +0800
commit490b4d0f533fbd1a353b3baa7e288de1f777692a (patch)
tree221613c07cf4d8cdc1b5deaecd2d8fbf7743642b /src
parent7f170008834107468882edfd29c872310506d9fd (diff)
downloadgsoc2013-epiphany-490b4d0f533fbd1a353b3baa7e288de1f777692a.tar
gsoc2013-epiphany-490b4d0f533fbd1a353b3baa7e288de1f777692a.tar.gz
gsoc2013-epiphany-490b4d0f533fbd1a353b3baa7e288de1f777692a.tar.bz2
gsoc2013-epiphany-490b4d0f533fbd1a353b3baa7e288de1f777692a.tar.lz
gsoc2013-epiphany-490b4d0f533fbd1a353b3baa7e288de1f777692a.tar.xz
gsoc2013-epiphany-490b4d0f533fbd1a353b3baa7e288de1f777692a.tar.zst
gsoc2013-epiphany-490b4d0f533fbd1a353b3baa7e288de1f777692a.zip
pdm-dialog: Add type-ahead search to personal data
The password treeview is unusable to find old passwords or cookies, as some are prefixed by "http://", and others will have different vhost names. The search function will look first for sub-string matches in the URIs, then in the usernames (or cookie names). https://bugzilla.gnome.org/show_bug.cgi?id=676240
Diffstat (limited to 'src')
-rw-r--r--src/pdm-dialog.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/pdm-dialog.c b/src/pdm-dialog.c
index 751322455..3cb8d6af5 100644
--- a/src/pdm-dialog.c
+++ b/src/pdm-dialog.c
@@ -1271,6 +1271,33 @@ passwords_show_toggled_cb (GtkWidget *button,
gtk_tree_view_column_set_visible (column, active);
}
+static gboolean
+password_search_equal (GtkTreeModel *model,
+ int column,
+ const gchar *key,
+ GtkTreeIter *iter,
+ gpointer search_data)
+{
+ char *host, *user;
+ gboolean retval;
+
+ /* Note that this is function has to return FALSE for a *match* ! */
+
+ gtk_tree_model_get (model, iter, COL_PASSWORDS_HOST, &host, -1);
+ retval = strstr (host, key) == NULL;
+ g_free (host);
+ if (retval == FALSE)
+ return retval;
+
+ gtk_tree_model_get (model, iter, COL_PASSWORDS_USER, &user, -1);
+ retval = strstr (user, key) == NULL;
+ g_free (user);
+
+ return retval;
+}
+
+
+
static void
pdm_dialog_passwords_construct (PdmActionInfo *info)
{
@@ -1353,6 +1380,11 @@ pdm_dialog_passwords_construct (PdmActionInfo *info)
gtk_tree_view_column_set_reorderable (column, TRUE);
gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
+ /* Setup basic type ahead filtering */
+ gtk_tree_view_set_search_equal_func (treeview,
+ (GtkTreeViewSearchEqualFunc) password_search_equal,
+ dialog, NULL);
+
info->treeview = treeview;
setup_action (info);
}