[network-manager-applet/lr/ui-improvements: 21/23] editor: allow the filter substring to be present anywhere in the conn id
- From: Lubomir Rintel <lkundrak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet/lr/ui-improvements: 21/23] editor: allow the filter substring to be present anywhere in the conn id
- Date: Mon, 3 Jul 2017 11:13:19 +0000 (UTC)
commit eb98ce915bb5a3a11ca038d3e7152d4a18d055d1
Author: Lubomir Rintel <lkundrak v3 sk>
Date: Mon Jul 3 11:54:28 2017 +0200
editor: allow the filter substring to be present anywhere in the conn id
Also make the search case-insensitive.
src/connection-editor/nm-connection-list.c | 19 +++++++++++++++++++
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 36ac5d0..7caa515 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 ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]