[network-manager-netbook/MplPanelClient: 33/44] Port users of NMExportedConnection over to NMSettingsConnectionInterface



commit dacd7e46f13c55e83b4a7c84207d30c8643e0f2e
Author: Dan Williams <dcbw redhat com>
Date:   Tue Sep 29 17:11:40 2009 -0700

    Port users of NMExportedConnection over to NMSettingsConnectionInterface

 src/nmn-device-handler.c   |   23 +++++++------
 src/nmn-device-handler.h   |    4 +-
 src/nmn-ethernet-handler.c |   14 +++----
 src/nmn-ethernet-item.c    |   10 +++---
 src/nmn-network-item.c     |   35 +++++++++++--------
 src/nmn-network-item.h     |    6 ++--
 src/nmn-networks.c         |    8 ++--
 src/nmn-serial-handler.c   |    8 ++---
 src/nmn-wifi-handler.c     |   20 ++++-------
 src/nmn-wifi-item.c        |   77 +++++++++++++++++++++++---------------------
 src/nmn-wifi-item.h        |    3 +-
 src/nmn-wifi-list.c        |    2 +-
 12 files changed, 107 insertions(+), 103 deletions(-)
---
diff --git a/src/nmn-device-handler.c b/src/nmn-device-handler.c
index d48f78a..96e361b 100644
--- a/src/nmn-device-handler.c
+++ b/src/nmn-device-handler.c
@@ -18,7 +18,7 @@
  */
 
 #include <nm-settings-interface.h>
-#include <nm-setting-connection.h>
+#include <nm-settings-connection-interface.h>
 #include "nmn-device-handler.h"
 
 G_DEFINE_TYPE (NmnDeviceHandler, nmn_device_handler, G_TYPE_OBJECT)
@@ -52,20 +52,20 @@ typedef struct {
 } NmnDeviceHandlerPrivate;
 
 static void
-connection_added (NMSettingConnection *settings,
-                  NMExportedConnection *exported,
+connection_added (NMSettingsInterface *settings,
+                  NMSettingsConnectionInterface *connection,
                   gpointer user_data)
 {
     NmnDeviceHandler *handler = NMN_DEVICE_HANDLER (user_data);
 
     if (NMN_DEVICE_HANDLER_GET_CLASS (handler)->connection_added)
-        NMN_DEVICE_HANDLER_GET_CLASS (handler)->connection_added (handler, exported);
+        NMN_DEVICE_HANDLER_GET_CLASS (handler)->connection_added (handler, connection);
 }
 
 static void
 add_one_connection (gpointer data, gpointer user_data)
 {
-    connection_added (NULL, NM_EXPORTED_CONNECTION (data), user_data);
+    connection_added (NULL, NM_SETTINGS_CONNECTION_INTERFACE (data), user_data);
 }
 
 void
@@ -117,9 +117,12 @@ nmn_device_handler_start (NmnDeviceHandler *self)
                                                       G_CALLBACK (device_state_changed), self);
 
     settings = nmn_nm_data_get_user_settings (priv->nm_data);
-    if (settings)
-        priv->connection_added_id = g_signal_connect (settings, "new-connection",
-						      G_CALLBACK (connection_added), self);
+    if (settings) {
+        priv->connection_added_id = g_signal_connect (settings,
+                                                      NM_SETTINGS_INTERFACE_NEW_CONNECTION,
+                                                      G_CALLBACK (connection_added),
+                                                      self);
+    }
 
     nmn_device_handler_add_items (self);
 }
@@ -192,7 +195,7 @@ nmn_device_handler_get_connections (NmnDeviceHandler *self)
 
 NmnNetworkItem *
 nmn_device_handler_get_item_for_connection (NmnDeviceHandler *self,
-                                            NMExportedConnection *connection)
+                                            NMSettingsConnectionInterface *connection)
 {
     GSList *list;
     GSList *iter;
@@ -202,7 +205,7 @@ nmn_device_handler_get_item_for_connection (NmnDeviceHandler *self,
 
     list = GET_PRIVATE (self)->items;
     for (iter = list; iter; iter = iter->next) {
-        if (nmn_network_item_get_connection (NMN_NETWORK_ITEM (iter->data)) == NM_EXPORTED_CONNECTION (connection))
+        if (nmn_network_item_get_connection (NMN_NETWORK_ITEM (iter->data)) == connection)
             return NMN_NETWORK_ITEM (iter->data);
     }
 
diff --git a/src/nmn-device-handler.h b/src/nmn-device-handler.h
index 15d4b9b..91da3f6 100644
--- a/src/nmn-device-handler.h
+++ b/src/nmn-device-handler.h
@@ -45,7 +45,7 @@ typedef struct {
 
     /* methods */
     void (*connection_added) (NmnDeviceHandler *self,
-                              NMExportedConnection *exported);
+                              NMSettingsConnectionInterface *connection);
 
     /* signals */
     void (*item_added) (NmnDeviceHandler *self,
@@ -66,7 +66,7 @@ GSList *nmn_device_handler_get_items (NmnDeviceHandler *self);
 GSList *nmn_device_handler_get_connections (NmnDeviceHandler *self);
 
 NmnNetworkItem *nmn_device_handler_get_item_for_connection (NmnDeviceHandler *self,
-                                                            NMExportedConnection *connection);
+                                                            NMSettingsConnectionInterface *connection);
 
 void nmn_device_handler_remove_items (NmnDeviceHandler *self);
 
diff --git a/src/nmn-ethernet-handler.c b/src/nmn-ethernet-handler.c
index aca4de6..01490f4 100644
--- a/src/nmn-ethernet-handler.c
+++ b/src/nmn-ethernet-handler.c
@@ -48,14 +48,14 @@ nmn_ethernet_handler_new (NmnNMData *nm_data,
 
 static gboolean
 have_item_for_connection (NmnDeviceHandler *handler,
-                          NMExportedConnection *exported)
+                          NMSettingsConnectionInterface *connection)
 {
     GSList *list;
     GSList *iter;
 
     list = nmn_device_handler_get_items (handler);
     for (iter = list; iter; iter = iter->next) {
-        if (nmn_network_item_get_connection (NMN_NETWORK_ITEM (iter->data)) == exported)
+        if (nmn_network_item_get_connection (NMN_NETWORK_ITEM (iter->data)) == connection)
             return TRUE;
     }
  
@@ -64,9 +64,8 @@ have_item_for_connection (NmnDeviceHandler *handler,
 
 static void
 connection_added (NmnDeviceHandler *handler,
-                  NMExportedConnection *exported)
+                  NMSettingsConnectionInterface *connection)
 {
-    NMConnection *wrapped;
     NMDeviceEthernet *device;
     GtkWidget *item;
 
@@ -74,11 +73,10 @@ connection_added (NmnDeviceHandler *handler,
     if (!nm_device_ethernet_get_carrier (device))
         return;
 
-    wrapped = NM_CONNECTION (exported);
-    if (utils_connection_valid_for_device (wrapped, NM_DEVICE (device), NULL) &&
-        !have_item_for_connection (handler, exported)) {
+    if (utils_connection_valid_for_device (NM_CONNECTION (connection), NM_DEVICE (device), NULL) &&
+        !have_item_for_connection (handler, connection)) {
         item = nmn_ethernet_item_new (nmn_device_handler_get_nm_data (handler), device);
-        g_object_set (item, NMN_NETWORK_ITEM_CONNECTION, exported, NULL);
+        g_object_set (item, NMN_NETWORK_ITEM_CONNECTION, NM_CONNECTION (connection), NULL);
         nmn_device_handler_add_item (handler, NMN_NETWORK_ITEM (item));
     }
 }
diff --git a/src/nmn-ethernet-item.c b/src/nmn-ethernet-item.c
index c1d4edf..7cbe042 100644
--- a/src/nmn-ethernet-item.c
+++ b/src/nmn-ethernet-item.c
@@ -89,21 +89,21 @@ update_cb (NMSettingsConnectionInterface *connection,
 static gboolean
 update_autoconnect (NmnNetworkItem *item, gboolean connect_automatically)
 {
-    NMExportedConnection *exported;
+    NMSettingsConnectionInterface *connection;
     NMConnection *wrapped;
     NMSettingConnection *s_con;
     GError *error = NULL;
 
-    exported = nmn_network_item_get_connection (item);
-    wrapped = NM_CONNECTION (exported);
-    s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (wrapped, NM_TYPE_SETTING_CONNECTION));
+    connection = nmn_network_item_get_connection (item);
+    s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (NM_CONNECTION (connection), NM_TYPE_SETTING_CONNECTION));
 
     if (nm_setting_connection_get_autoconnect (s_con) == connect_automatically)
         return FALSE;
 
     g_object_set (s_con, NM_SETTING_CONNECTION_AUTOCONNECT, connect_automatically, NULL);
     nm_settings_connection_interface_update (NM_SETTINGS_CONNECTION_INTERFACE (s_con),
-    					     update_cb, item);
+                                             update_cb,
+                                             item);
 
     return TRUE;
 }
diff --git a/src/nmn-network-item.c b/src/nmn-network-item.c
index 63410ee..7984cd3 100644
--- a/src/nmn-network-item.c
+++ b/src/nmn-network-item.c
@@ -73,8 +73,8 @@ typedef struct {
 
     NmnNMData *nm_data;
     NMDevice *device;
-    NMExportedConnection *connection;
-NMActiveConnection *ac;
+    NMSettingsConnectionInterface *connection;
+    NMActiveConnection *ac;
 
     gulong connection_updated_id;
     gulong connection_removed_id;
@@ -305,7 +305,7 @@ nmn_network_item_set_icon (NmnNetworkItem *self,
 }
 
 static void
-connection_secrets_requested_cb (NMExportedConnection *connection,
+connection_secrets_requested_cb (NMAGConfConnection *connection,
                                  const char *setting_name,
                                  const char **hints,
                                  gboolean ask_user,
@@ -495,7 +495,7 @@ nmn_network_item_set_delete_visible (NmnNetworkItem *item,
     }
 }
 
-NMExportedConnection *
+NMSettingsConnectionInterface *
 nmn_network_item_get_connection (NmnNetworkItem *self)
 {
     g_return_val_if_fail (NMN_IS_NETWORK_ITEM (self), NULL);
@@ -505,7 +505,7 @@ nmn_network_item_get_connection (NmnNetworkItem *self)
 
 void
 nmn_network_item_set_connection (NmnNetworkItem *self,
-                                 NMExportedConnection *connection)
+                                 NMSettingsConnectionInterface *connection)
 {
     NmnNetworkItemPrivate *priv;
 
@@ -525,8 +525,14 @@ nmn_network_item_set_connection (NmnNetworkItem *self,
 
     if (connection) {
         priv->connection = g_object_ref (connection);
-        priv->connection_updated_id = g_signal_connect (connection, "updated", G_CALLBACK (updated), self);
-        priv->connection_removed_id = g_signal_connect (connection, "removed", G_CALLBACK (removed), self);
+        priv->connection_updated_id = g_signal_connect (connection,
+                                                        NM_SETTINGS_CONNECTION_INTERFACE_UPDATED,
+                                                        G_CALLBACK (updated),
+                                                        self);
+        priv->connection_removed_id = g_signal_connect (connection,
+                                                        NM_SETTINGS_CONNECTION_INTERFACE_REMOVED,
+                                                        G_CALLBACK (removed),
+                                                        self);
 
         if (NMA_IS_GCONF_CONNECTION (connection))
             priv->secrets_requested_id = g_signal_connect (connection, "new-secrets-requested",
@@ -544,11 +550,10 @@ nmn_network_item_set_connection (NmnNetworkItem *self,
 static void
 item_delete (NmnNetworkItem *item)
 {
-    NMExportedConnection *exported = nmn_network_item_get_connection (item);
+    NMSettingsConnectionInterface *connection = nmn_network_item_get_connection (item);
 
-    if (exported)
-    	nm_settings_connection_interface_delete (NM_SETTINGS_CONNECTION_INTERFACE (exported),
-    						 NULL, NULL);
+    if (connection)
+    	nm_settings_connection_interface_delete (connection, NULL, NULL);
 }
 
 static guint
@@ -760,7 +765,7 @@ set_property (GObject *object, guint prop_id,
         break;
     case PROP_CONNECTION:
         nmn_network_item_set_connection (NMN_NETWORK_ITEM (object),
-                                         (NMExportedConnection *) g_value_get_object (value));
+                                         (NMSettingsConnectionInterface *) g_value_get_object (value));
         break;
     case PROP_AC:
         nmn_network_item_set_active_connection (NMN_NETWORK_ITEM (object),
@@ -872,9 +877,9 @@ nmn_network_item_class_init (NmnNetworkItemClass *class)
     g_object_class_install_property
         (object_class, PROP_CONNECTION,
          g_param_spec_object (NMN_NETWORK_ITEM_CONNECTION,
-                              "NMExportedConnection",
-                              "NMExportedConnection",
-                              NM_TYPE_EXPORTED_CONNECTION,
+                              "NMSettingsConnectionInterface",
+                              "NMSettingsConnectionInterface",
+                              NM_TYPE_SETTINGS_CONNECTION_INTERFACE,
                               G_PARAM_READWRITE));
 
     g_object_class_install_property
diff --git a/src/nmn-network-item.h b/src/nmn-network-item.h
index 726baaf..1d215ec 100644
--- a/src/nmn-network-item.h
+++ b/src/nmn-network-item.h
@@ -22,7 +22,7 @@
 
 #include <gtk/gtk.h>
 #include <dbus/dbus-glib.h>
-#include <nm-exported-connection.h>
+#include <nm-settings-connection-interface.h>
 #include "nmn-item.h"
 #include "nmn-connection-details.h"
 #include "nmn-nm-data.h"
@@ -93,9 +93,9 @@ gboolean              nmn_network_item_has_details           (NmnNetworkItem *se
 NmnConnectionDetails *nmn_network_item_get_details           (NmnNetworkItem *self);
 NmnNMData            *nmn_network_item_get_nm_data           (NmnNetworkItem *self);
 NMDevice             *nmn_network_item_get_device            (NmnNetworkItem *self);
-NMExportedConnection *nmn_network_item_get_connection        (NmnNetworkItem *self);
+NMSettingsConnectionInterface *nmn_network_item_get_connection (NmnNetworkItem *self);
 void                  nmn_network_item_set_connection        (NmnNetworkItem *self,
-                                                              NMExportedConnection *connection);
+                                                              NMSettingsConnectionInterface *connection);
 
 NMActiveConnection   *nmn_network_item_get_active_connection (NmnNetworkItem *self);
 void                  nmn_network_item_set_active_connection (NmnNetworkItem *self,
diff --git a/src/nmn-networks.c b/src/nmn-networks.c
index fc26945..95953e3 100644
--- a/src/nmn-networks.c
+++ b/src/nmn-networks.c
@@ -190,7 +190,7 @@ find_ac_for_item (NmnNetworks *self, NmnNetworkItem *item)
 
 typedef struct {
     NmnItem *item;
-    NMExportedConnection *exported;
+    NMSettingsConnectionInterface *connection;
     NMDevice *device;
     GSList *items_to_remove;
     guint counter;
@@ -205,7 +205,7 @@ remove_connections_cb (GtkWidget *widget, gpointer data)
     info->counter++;
 
     if ((info->item && (NmnItem *) item == info->item) ||
-        (info->exported && nmn_network_item_get_connection (item) == info->exported) ||
+        (info->connection && nmn_network_item_get_connection (item) == info->connection) ||
         (info->device && nmn_network_item_get_device (item) == info->device))
 
         info->items_to_remove = g_slist_prepend (info->items_to_remove, g_object_ref (widget));
@@ -214,13 +214,13 @@ remove_connections_cb (GtkWidget *widget, gpointer data)
 static void
 remove_connections (NmnNetworks *self,
                     NmnItem *item,
-                    NMExportedConnection *connection,
+                    NMSettingsConnectionInterface *connection,
                     NMDevice *device)
 {
     RemoveInfo info;
 
     info.item = item;
-    info.exported = connection;
+    info.connection = connection;
     info.device = device;
     info.items_to_remove = NULL;
     info.counter = 0;
diff --git a/src/nmn-serial-handler.c b/src/nmn-serial-handler.c
index 53d2b12..d440d12 100644
--- a/src/nmn-serial-handler.c
+++ b/src/nmn-serial-handler.c
@@ -46,20 +46,18 @@ nmn_serial_handler_new (NmnNMData *nm_data,
 
 static void
 connection_added (NmnDeviceHandler *handler,
-                  NMExportedConnection *exported)
+                  NMSettingsConnectionInterface *connection)
 {
-    NMConnection *wrapped;
     NMDevice *device;
     GtkWidget *item;
 
-    wrapped = NM_CONNECTION (exported);
     device = nmn_device_handler_get_device (handler);
 
-    if (!utils_connection_valid_for_device (wrapped, device, NULL))
+    if (!utils_connection_valid_for_device (NM_CONNECTION (connection), device, NULL))
         return;
 
     item = nmn_serial_item_new (nmn_device_handler_get_nm_data (handler), NM_SERIAL_DEVICE (device));
-    g_object_set (item, NMN_NETWORK_ITEM_CONNECTION, exported, NULL);
+    g_object_set (item, NMN_NETWORK_ITEM_CONNECTION, NM_CONNECTION (connection), NULL);
     nmn_device_handler_add_item (handler, NMN_NETWORK_ITEM (item));
 }
 
diff --git a/src/nmn-wifi-handler.c b/src/nmn-wifi-handler.c
index 1ba8098..72db539 100644
--- a/src/nmn-wifi-handler.c
+++ b/src/nmn-wifi-handler.c
@@ -93,19 +93,17 @@ find_best_compatible_ap (const GPtrArray *aps, NMAccessPoint *current_ap)
 
 static NMAccessPoint *
 find_best_ap_for_connection (NMDeviceWifi *device,
-                             NMExportedConnection *connection)
+                             NMConnection *connection)
 {
     const GPtrArray *aps;
-    NMConnection *wrapped;
     NMAccessPoint *best_ap = NULL;
     int i;
 
-    wrapped = NM_CONNECTION (connection);
     aps = nm_device_wifi_get_access_points (device);
     for (i = 0; aps && i < aps->len; i++) {
         NMAccessPoint *ap = NM_ACCESS_POINT (g_ptr_array_index (aps, i));
 
-        if (utils_connection_valid_for_device (wrapped, NM_DEVICE (device), ap)) {
+        if (utils_connection_valid_for_device (connection, NM_DEVICE (device), ap)) {
             if (!best_ap)
                 best_ap = ap;
             else if (nm_access_point_get_strength (best_ap) < nm_access_point_get_strength (ap))
@@ -179,17 +177,15 @@ ap_removed (NMDeviceWifi *device,
 
 static void
 connection_added (NmnDeviceHandler *handler,
-                  NMExportedConnection *exported)
+                  NMSettingsConnectionInterface *connection)
 {
-    NMConnection *wrapped;
     NMSettingConnection *s_con;
     const char *connection_type;
     NMDeviceWifi *device;
     NMAccessPoint *ap;
     GtkWidget *item;
 
-    wrapped = NM_CONNECTION (exported);
-    s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (wrapped, NM_TYPE_SETTING_CONNECTION));
+    s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (NM_CONNECTION (connection), NM_TYPE_SETTING_CONNECTION));
     connection_type = nm_setting_connection_get_connection_type (s_con);
 
     if (!connection_type || strcmp (connection_type, NM_SETTING_WIRELESS_SETTING_NAME))
@@ -197,14 +193,14 @@ connection_added (NmnDeviceHandler *handler,
         return;
 
     /* Make sure it doesn't exist yet */
-    if (nmn_device_handler_get_item_for_connection (handler, exported))
+    if (nmn_device_handler_get_item_for_connection (handler, connection))
         return;
 
     device = NM_DEVICE_WIFI (nmn_device_handler_get_device (handler));
-    ap = find_best_ap_for_connection (device, exported);
+    ap = find_best_ap_for_connection (device, NM_CONNECTION (connection));
     if (ap) {
         item = nmn_wifi_item_new (nmn_device_handler_get_nm_data (handler), device, ap);
-        g_object_set (item, NMN_NETWORK_ITEM_CONNECTION, exported, NULL);
+        g_object_set (item, NMN_NETWORK_ITEM_CONNECTION, NM_CONNECTION (connection), NULL);
         nmn_network_item_set_delete_visible (NMN_NETWORK_ITEM (item), TRUE);
         nmn_device_handler_add_item (handler, NMN_NETWORK_ITEM (item));
     }
@@ -226,7 +222,7 @@ ap_added (NMDeviceWifi *device,
     /* Maybe there's an existing connection for it which hasn't been added yet? */
     list = nmn_device_handler_get_connections (handler);
     for (iter = list; iter; iter = iter->next)
-        connection_added (handler, NM_EXPORTED_CONNECTION (iter->data));
+        connection_added (handler, NM_SETTINGS_CONNECTION_INTERFACE (iter->data));
 
     g_slist_free (list);
 }
diff --git a/src/nmn-wifi-item.c b/src/nmn-wifi-item.c
index a1c9713..77b9220 100644
--- a/src/nmn-wifi-item.c
+++ b/src/nmn-wifi-item.c
@@ -396,20 +396,17 @@ static void
 wifi_item_created (NmnNetworkItem *item, NMConnection *connection)
 {
     NmnNMData *nm_data;
-    NMExportedConnection *exported;
+    NMAGConfConnection *gconf;
 
     nm_data = nmn_network_item_get_nm_data (item);
 
     /* FIXME: Maybe it already exists, try harder */
-    exported = NM_EXPORTED_CONNECTION 
-        (nma_gconf_settings_add_connection (NMA_GCONF_SETTINGS (nmn_nm_data_get_user_settings (nm_data)),
-                                            connection));
-
-    if (!exported)
+    gconf = nma_gconf_settings_add_connection (NMA_GCONF_SETTINGS (nmn_nm_data_get_user_settings (nm_data)), connection);
+    if (!gconf)
         return;
 
-    nmn_network_item_set_connection (item, exported);
-    g_object_unref (exported);
+    nmn_network_item_set_connection (item, NM_SETTINGS_CONNECTION_INTERFACE (gconf));
+    g_object_unref (connection);
 
     connect (item);
     nmn_network_item_set_connection (item, NULL);
@@ -452,14 +449,12 @@ update_cb (NMSettingsConnectionInterface *connection,
 static gboolean
 update_autoconnect (NmnNetworkItem *item, gboolean connect_automatically)
 {
-    NMExportedConnection *exported;
-    NMConnection *wrapped;
+    NMSettingsConnectionInterface *connection;
     NMSettingConnection *s_con;
     GHashTable *new_settings;
 
-    exported = nmn_network_item_get_connection (item);
-    wrapped = NM_CONNECTION (exported);
-    s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (wrapped, NM_TYPE_SETTING_CONNECTION));
+    connection = nmn_network_item_get_connection (item);
+    s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (NM_CONNECTION (connection), NM_TYPE_SETTING_CONNECTION));
 
     if (nm_setting_connection_get_autoconnect (s_con) == connect_automatically)
         return FALSE;
@@ -467,7 +462,8 @@ update_autoconnect (NmnNetworkItem *item, gboolean connect_automatically)
     g_object_set (s_con, NM_SETTING_CONNECTION_AUTOCONNECT, connect_automatically, NULL);
 
     nm_settings_connection_interface_update (NM_SETTINGS_CONNECTION_INTERFACE (s_con),
-    					     update_cb, item);
+                                             update_cb,
+                                             item);
 
     return TRUE;
 }
@@ -551,7 +547,7 @@ add_one_setting (GHashTable *settings,
 }
 
 typedef struct {
-    NMExportedConnection *exported;
+    NMSettingsConnectionInterface *connection;
     DBusGMethodInvocation *context;
 } SecretsRequestInfo;
 
@@ -561,11 +557,11 @@ secrets_requested_response_cb (NMAWirelessDialog *dialog,
                                gpointer user_data)
 {
     SecretsRequestInfo *info = (SecretsRequestInfo *) user_data;
+	NMConnection *connection = NULL;
     NMSettingWirelessSecurity *s_wireless_sec;
-    const char *key_mgmt;
-    NMConnection *wrapped = NULL;
-    GHashTable *settings = NULL;
-    GError *error = NULL;
+	GHashTable *settings = NULL;
+	const char *key_mgmt, *auth_alg;
+	GError *error = NULL;
 
     if (response != GTK_RESPONSE_OK) {
         g_set_error_literal (&error, NM_SETTINGS_INTERFACE_ERROR, NM_SETTINGS_INTERFACE_ERROR_SECRETS_REQUEST_CANCELED,
@@ -573,10 +569,15 @@ secrets_requested_response_cb (NMAWirelessDialog *dialog,
         goto done;
     }
 
-    wrapped = NM_CONNECTION (info->exported);
+	connection = nma_wireless_dialog_get_connection (dialog);
+	if (!connection) {
+        g_set_error_literal (&error, NM_SETTINGS_INTERFACE_ERROR, NM_SETTINGS_INTERFACE_ERROR_INVALID_CONNECTION,
+                             G_STRLOC ": couldn't get connection from wireless dialog.");
+        goto done;
+    }
 
     /* Second-guess which setting NM wants secrets for. */
-    s_wireless_sec = NM_SETTING_WIRELESS_SECURITY (nm_connection_get_setting (wrapped, NM_TYPE_SETTING_WIRELESS_SECURITY));
+    s_wireless_sec = NM_SETTING_WIRELESS_SECURITY (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS_SECURITY));
     if (!s_wireless_sec) {
         g_set_error_literal (&error, NM_SETTINGS_INTERFACE_ERROR, NM_SETTINGS_INTERFACE_ERROR_INVALID_CONNECTION,
                              G_STRLOC ": requested setting '802-11-wireless-security'"
@@ -598,14 +599,12 @@ secrets_requested_response_cb (NMAWirelessDialog *dialog,
      */
     key_mgmt = nm_setting_wireless_security_get_key_mgmt (s_wireless_sec);
     if (!strcmp (key_mgmt, "ieee8021x") || !strcmp (key_mgmt, "wpa-eap")) {
-        const char *auth_alg;
-
         /* LEAP secrets aren't in the 802.1x setting */
         auth_alg = nm_setting_wireless_security_get_auth_alg (s_wireless_sec);
         if (!auth_alg || strcmp (auth_alg, "leap")) {
             NMSetting8021x *s_8021x;
 
-            s_8021x = (NMSetting8021x *) nm_connection_get_setting (wrapped, NM_TYPE_SETTING_802_1X);
+            s_8021x = (NMSetting8021x *) nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X);
             if (!s_8021x) {
                 g_set_error_literal (&error, NM_SETTINGS_INTERFACE_ERROR, NM_SETTINGS_INTERFACE_ERROR_INVALID_CONNECTION,
                                      G_STRLOC ": requested setting '802-1x' didn't"
@@ -614,22 +613,26 @@ secrets_requested_response_cb (NMAWirelessDialog *dialog,
             }
 
             /* Add the 802.1x setting */
-            if (!add_one_setting (settings, wrapped, NM_SETTING (s_8021x), &error))
+            if (!add_one_setting (settings, connection, NM_SETTING (s_8021x), &error))
                 goto done;
         }
     }
 
     /* Add the 802-11-wireless-security setting no matter what */
-    if (!add_one_setting (settings, wrapped, NM_SETTING (s_wireless_sec), &error))
+    if (!add_one_setting (settings, connection, NM_SETTING (s_wireless_sec), &error))
         goto done;
 
     dbus_g_method_return (info->context, settings);
 
-    /* Save the connection back to GConf _after_ hashing it, because
-     * saving to GConf might trigger the GConf change notifiers, resulting
-     * in the connection being read back in from GConf which clears secrets.
-     */
-    nma_gconf_connection_save (NMA_GCONF_CONNECTION (info->exported));
+	/* Save the connection back to GConf _after_ hashing it, because
+	 * saving to GConf might trigger the GConf change notifiers, resulting
+	 * in the connection being read back in from GConf which clears secrets.
+	 */
+	if (NMA_IS_GCONF_CONNECTION (connection)) {
+		nm_settings_connection_interface_update (NM_SETTINGS_CONNECTION_INTERFACE (connection),
+		                                         update_cb,
+		                                         NULL);
+	}
 
  done:
     if (settings)
@@ -641,8 +644,8 @@ secrets_requested_response_cb (NMAWirelessDialog *dialog,
         g_error_free (error);
     }
 
-    if (wrapped)
-        nm_connection_clear_secrets (wrapped);
+    if (connection)
+        nm_connection_clear_secrets (connection);
 
     gtk_widget_hide (GTK_WIDGET (dialog));
     gtk_widget_destroy (GTK_WIDGET (dialog));
@@ -656,17 +659,17 @@ secrets_requested (NmnNetworkItem *network_item,
                    DBusGMethodInvocation *context)
 {
     GtkWidget *dialog;
-    NMExportedConnection *exported;
+    NMSettingsConnectionInterface *connection;
     SecretsRequestInfo *info;
 
-    exported = nmn_network_item_get_connection (network_item);
+    connection = nmn_network_item_get_connection (network_item);
     dialog = nma_wireless_dialog_new (NM_CLIENT (nmn_network_item_get_nm_data (network_item)),
-                                      NM_CONNECTION (exported),
+                                      NM_CONNECTION (connection),
                                       nmn_network_item_get_device (network_item),
                                       nmn_wifi_item_get_ap (NMN_WIFI_ITEM (network_item)));
 
     info = g_new (SecretsRequestInfo, 1);
-    info->exported = exported;
+    info->connection = connection;
     info->context = context;
 
     g_signal_connect_data (dialog, "done",
diff --git a/src/nmn-wifi-item.h b/src/nmn-wifi-item.h
index ab83e88..b341d62 100644
--- a/src/nmn-wifi-item.h
+++ b/src/nmn-wifi-item.h
@@ -21,6 +21,7 @@
 #define NMN_WIFI_ITEM_H
 
 #include <nmn-network-item.h>
+#include <nm-settings-connection-interface.h>
 #include <nm-device-wifi.h>
 #include "nmn-nm-data.h"
 
@@ -49,7 +50,7 @@ GtkWidget     *nmn_wifi_item_new                   (NmnNMData *nm_data,
 
 GtkWidget     *nmn_wifi_item_create_for_connection (NmnNMData *nm_data,
                                                     NMDeviceWifi *device,
-                                                    NMExportedConnection *exported);
+                                                    NMSettingsConnectionInterface *connection);
 
 void           nmn_wifi_item_set_ap                (NmnWifiItem *self,
                                                     NMAccessPoint *ap);
diff --git a/src/nmn-wifi-list.c b/src/nmn-wifi-list.c
index 662b34e..4dd827f 100644
--- a/src/nmn-wifi-list.c
+++ b/src/nmn-wifi-list.c
@@ -76,7 +76,7 @@ matching_connection_exists (NmnWifiList *list, NMDevice *device, NMAccessPoint *
 
     connections = nm_settings_interface_list_connections (nmn_nm_data_get_user_settings (priv->nm_data));
     for (iter = connections; iter; iter = iter->next) {
-        NMConnection *connection = NM_CONNECTION (NM_EXPORTED_CONNECTION (iter->data));
+        NMConnection *connection = NM_CONNECTION (iter->data);
 
         if (utils_connection_valid_for_device (connection, device, ap)) {
             exists = TRUE;



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