summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2017-07-03 11:54:28 +0200
committerLubomir Rintel <lkundrak@v3.sk>2017-07-11 17:51:04 +0200
commit50996886f4a60e9d99a1187e0f300e20f52a02aa (patch)
treea37e19081d5ec011c61079c6c85eccc517cee161
parentab2b930674738f6fbbdfbe122567050f73c7cb40 (diff)
downloadnetwork-manager-applet-50996886f4a60e9d99a1187e0f300e20f52a02aa.tar.gz
editor: allow the filter substring to be present anywhere in the conn id
Also make the search case-insensitive.
-rw-r--r--src/connection-editor/nm-connection-list.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/connection-editor/nm-connection-list.c b/src/connection-editor/nm-connection-list.c
index 36ac5d00..7caa5153 100644
--- a/src/connection-editor/nm-connection-list.c
+++ b/src/connection-editor/nm-connection-list.c
@@ -649,6 +649,24 @@ tree_model_visible_func (GtkTreeModel *model,
return TRUE;
}
+static gboolean
+connection_list_equal (GtkTreeModel *model, gint column, const gchar *key,
+ GtkTreeIter *iter, gpointer user_data)
+{
+ gs_free char *id = NULL;
+ gs_unref_object NMConnection *connection = NULL;
+
+ gtk_tree_model_get (model, iter,
+ COL_ID, &id,
+ COL_CONNECTION, &connection,
+ -1);
+
+ if (!connection)
+ return TRUE;
+
+ return strcasestr (id, key) == NULL;
+}
+
static void
initialize_treeview (NMConnectionList *self)
{
@@ -687,6 +705,7 @@ initialize_treeview (NMConnectionList *self)
gtk_tree_sortable_set_sort_column_id (priv->sortable, COL_TIMESTAMP, GTK_SORT_ASCENDING);
gtk_tree_view_set_model (priv->connection_list, GTK_TREE_MODEL (priv->sortable));
+ gtk_tree_view_set_search_equal_func (priv->connection_list, connection_list_equal, NULL, NULL);
/* Name column */
renderer = gtk_cell_renderer_text_new ();