[network-manager-applet/nma-1-2] editor: populate the list only after the type filter is set



commit d217735e5d56793b36cd18e151cb311e3684fb06
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Mon Apr 25 13:36:14 2016 +0200

    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)

 src/connection-editor/nm-connection-list.c |   38 ++++++++++++++--------------
 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 c561f66..7f2b3c7 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 32cc648..046f2e3 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 {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]