network-manager-applet r792 - in trunk: . src/connection-editor src/gconf-helpers



Author: tambeti
Date: Thu Jul 17 09:25:04 2008
New Revision: 792
URL: http://svn.gnome.org/viewvc/network-manager-applet?rev=792&view=rev

Log:
2008-07-17  Tambet Ingo  <tambet gmail com>

	Fix connection editor's wireless security handling.

	* src/gconf-helpers/gconf-helpers.c (nm_gconf_connection_duplicate):
	Implement. Just using nm_connection_duplicate() does not add the applet
	specific object data.

	* src/connection-editor/nm-connection-list.c (do_edit): When duplicating the
	connection, use a helper function to get all the associated data as well.

	* src/connection-editor/nm-connection-editor.c (connection_editor_validate):
	Add some debug output for now to make it easier to see which page fails.


Modified:
   trunk/ChangeLog
   trunk/src/connection-editor/nm-connection-editor.c
   trunk/src/connection-editor/nm-connection-list.c
   trunk/src/gconf-helpers/gconf-helpers.c
   trunk/src/gconf-helpers/gconf-helpers.h

Modified: trunk/src/connection-editor/nm-connection-editor.c
==============================================================================
--- trunk/src/connection-editor/nm-connection-editor.c	(original)
+++ trunk/src/connection-editor/nm-connection-editor.c	Thu Jul 17 09:25:04 2008
@@ -117,8 +117,12 @@
 
 		if (!ce_page_validate (CE_PAGE (iter->data), editor->connection, &error)) {
 			/* FIXME: use the error to indicate which UI widgets are invalid */
-			if (error)
+			if (error) {
+				g_warning ("Invalid setting %s: %s", CE_PAGE (iter->data)->title, error->message);
 				g_error_free (error);
+			} else
+				g_warning ("Invalid setting %s", CE_PAGE (iter->data)->title);
+
 			goto done;
 		}
 	}

Modified: trunk/src/connection-editor/nm-connection-list.c
==============================================================================
--- trunk/src/connection-editor/nm-connection-list.c	(original)
+++ trunk/src/connection-editor/nm-connection-list.c	Thu Jul 17 09:25:04 2008
@@ -967,7 +967,7 @@
 		return;
 	}
 
-	connection = nm_connection_duplicate (nm_exported_connection_get_connection (exported));
+	connection = nm_gconf_connection_duplicate (nm_exported_connection_get_connection (exported));
 	editor = nm_connection_editor_new (connection);
 	g_object_unref (connection);
 

Modified: trunk/src/gconf-helpers/gconf-helpers.c
==============================================================================
--- trunk/src/gconf-helpers/gconf-helpers.c	(original)
+++ trunk/src/gconf-helpers/gconf-helpers.c	Thu Jul 17 09:25:04 2008
@@ -1502,3 +1502,49 @@
 	return secrets;
 }
 
+NMConnection *
+nm_gconf_connection_duplicate (NMConnection *connection)
+{
+	NMConnection *dup;
+	GObject *oc;
+	GObject *od;
+
+	g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
+
+	dup = nm_connection_duplicate (connection);
+	g_return_val_if_fail (NM_IS_CONNECTION (dup), NULL);
+
+	oc = G_OBJECT (connection);
+	od = G_OBJECT (dup);
+
+	g_object_set_data (od, NMA_CA_CERT_IGNORE_TAG, g_object_get_data (oc, NMA_CA_CERT_IGNORE_TAG));
+	g_object_set_data (od, NMA_PHASE2_CA_CERT_IGNORE_TAG, g_object_get_data (oc, NMA_PHASE2_CA_CERT_IGNORE_TAG));
+	g_object_set_data_full (od, NMA_PATH_CLIENT_CERT_TAG,
+					    g_strdup (g_object_get_data (oc, NMA_PATH_CLIENT_CERT_TAG)), g_free);
+
+	g_object_set_data_full (od, NMA_PATH_PHASE2_CLIENT_CERT_TAG,
+					    g_strdup (g_object_get_data (oc, NMA_PATH_PHASE2_CLIENT_CERT_TAG)), g_free);
+
+	g_object_set_data_full (od, NMA_PATH_CA_CERT_TAG,
+					    g_strdup (g_object_get_data (oc, NMA_PATH_CA_CERT_TAG)), g_free);
+
+	g_object_set_data_full (od, NMA_PATH_PHASE2_CA_CERT_TAG,
+					    g_strdup (g_object_get_data (oc, NMA_PATH_PHASE2_CA_CERT_TAG)), g_free);
+
+	g_object_set_data_full (od, NMA_PATH_PRIVATE_KEY_TAG,
+					    g_strdup (g_object_get_data (oc, NMA_PATH_PRIVATE_KEY_TAG)), g_free);
+
+	g_object_set_data_full (od, NMA_PRIVATE_KEY_PASSWORD_TAG,
+					    g_strdup (g_object_get_data (oc, NMA_PRIVATE_KEY_PASSWORD_TAG)), g_free);
+
+	g_object_set_data_full (od, NMA_PATH_PHASE2_PRIVATE_KEY_TAG,
+					    g_strdup (g_object_get_data (oc, NMA_PATH_PHASE2_PRIVATE_KEY_TAG)), g_free);
+
+	g_object_set_data_full (od, NMA_PHASE2_PRIVATE_KEY_PASSWORD_TAG,
+					    g_strdup (g_object_get_data (oc, NMA_PHASE2_PRIVATE_KEY_PASSWORD_TAG)), g_free);
+
+	g_object_set_data_full (od, NMA_CONNECTION_ID_TAG,
+					    g_strdup (g_object_get_data (oc, NMA_CONNECTION_ID_TAG)), g_free);
+
+	return dup;
+}

Modified: trunk/src/gconf-helpers/gconf-helpers.h
==============================================================================
--- trunk/src/gconf-helpers/gconf-helpers.h	(original)
+++ trunk/src/gconf-helpers/gconf-helpers.h	Thu Jul 17 09:25:04 2008
@@ -28,27 +28,29 @@
 
 #define GCONF_PATH_CONNECTIONS "/system/networking/connections"
 
+/* 
+   ATTENTION: Make sure to update nm_gconf_connection_duplicate() 
+   when new connection tag is added! Otherwise duplicating connection
+   will not work correctly.
+*/
 #define NMA_CA_CERT_IGNORE_TAG  "nma-ca-cert-ignore"
 #define NMA_PHASE2_CA_CERT_IGNORE_TAG  "nma-phase2-ca-cert-ignore"
-
 #define NMA_PATH_CLIENT_CERT_TAG "nma-path-client-cert"
 #define NMA_PATH_PHASE2_CLIENT_CERT_TAG "nma-path-phase2-client-cert"
-
 #define NMA_PATH_CA_CERT_TAG "nma-path-ca-cert"
 #define NMA_PATH_PHASE2_CA_CERT_TAG "nma-path-phase2-ca-cert"
-
 #define NMA_PATH_PRIVATE_KEY_TAG "nma-path-private-key"
 #define NMA_PRIVATE_KEY_PASSWORD_TAG "nma-private-key-password"
-
 #define NMA_PATH_PHASE2_PRIVATE_KEY_TAG "nma-path-phase2-private-key"
 #define NMA_PHASE2_PRIVATE_KEY_PASSWORD_TAG "nma-phase2-private-key-password"
+#define NMA_CONNECTION_ID_TAG "nma-connection-id"
+
+NMConnection *nm_gconf_connection_duplicate (NMConnection *connection);
 
 #define KEYRING_CID_TAG "connection-id"
 #define KEYRING_SN_TAG "setting-name"
 #define KEYRING_SK_TAG "setting-key"
 
-#define NMA_CONNECTION_ID_TAG "nma-connection-id"
-
 gboolean
 nm_gconf_get_int_helper (GConfClient *client,
 					const char *path,



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