diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2016-04-25 13:36:14 +0200 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2016-04-26 18:34:42 +0200 |
commit | d217735e5d56793b36cd18e151cb311e3684fb06 (patch) | |
tree | 8b6182966a20d1dcbba6c344755b8beada37554d | |
parent | 4e2d8351b641f1ce534a8bab3f060fa17a00962f (diff) |
editor: populate the list only after the type filter is set
Otherwise the --type filtering does not work at all.
(cherry picked from commit 035e3622fd588bea113bfc8a59ff69412d554fdb)
-rw-r--r-- | src/connection-editor/nm-connection-list.c | 38 | ||||
-rw-r--r-- | src/connection-editor/nm-connection-list.h | 2 |
2 files changed, 20 insertions, 20 deletions
diff --git a/src/connection-editor/nm-connection-list.c b/src/connection-editor/nm-connection-list.c index c561f666..7f2b3c7c 100644 --- a/src/connection-editor/nm-connection-list.c +++ b/src/connection-editor/nm-connection-list.c @@ -836,10 +836,6 @@ NMConnectionList * nm_connection_list_new (void) { NMConnectionList *list; - GtkTreePath *path; - GtkTreeIter iter; - const GPtrArray *all_cons; - int i; GError *error = NULL; const char *objects[] = { "NMConnectionList", NULL }; @@ -873,19 +869,6 @@ nm_connection_list_new (void) initialize_treeview (list); add_connection_buttons (list); - /* Fill the treeview initially */ - all_cons = nm_client_get_connections (list->client); - for (i = 0; i < all_cons->len; i++) - connection_added (list->client, all_cons->pdata[i], list); - - if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (list->sortable), &iter)) { - path = gtk_tree_model_get_path (GTK_TREE_MODEL (list->sortable), &iter); - gtk_tree_view_scroll_to_cell (list->connection_list, - path, NULL, - FALSE, 0, 0); - gtk_tree_path_free (path); - } - list->dialog = GTK_WIDGET (gtk_builder_get_object (list->gui, "NMConnectionList")); if (!list->dialog) goto error; @@ -975,14 +958,31 @@ list_close_cb (GtkDialog *dialog, gpointer user_data) void nm_connection_list_present (NMConnectionList *list) { + const GPtrArray *all_cons; + GtkTreePath *path; + GtkTreeIter iter; + int i; + g_return_if_fail (NM_IS_CONNECTION_LIST (list)); - if (!list->signals_connected) { + if (!list->populated) { + /* Fill the treeview initially */ + all_cons = nm_client_get_connections (list->client); + for (i = 0; i < all_cons->len; i++) + connection_added (list->client, all_cons->pdata[i], list); + if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (list->sortable), &iter)) { + path = gtk_tree_model_get_path (GTK_TREE_MODEL (list->sortable), &iter); + gtk_tree_view_scroll_to_cell (list->connection_list, + path, NULL, + FALSE, 0, 0); + gtk_tree_path_free (path); + } + g_signal_connect (G_OBJECT (list->dialog), "response", G_CALLBACK (list_response_cb), list); g_signal_connect (G_OBJECT (list->dialog), "close", G_CALLBACK (list_close_cb), list); - list->signals_connected = TRUE; + list->populated = TRUE; } gtk_window_present (GTK_WINDOW (list->dialog)); diff --git a/src/connection-editor/nm-connection-list.h b/src/connection-editor/nm-connection-list.h index 32cc648d..046f2e3f 100644 --- a/src/connection-editor/nm-connection-list.h +++ b/src/connection-editor/nm-connection-list.h @@ -48,7 +48,7 @@ typedef struct { GtkBuilder *gui; GtkWidget *dialog; - gboolean signals_connected; + gboolean populated; } NMConnectionList; typedef struct { |