network-manager-applet r1006 - in trunk: . src src/gconf-helpers



Author: dcbw
Date: Mon Nov  3 22:34:06 2008
New Revision: 1006
URL: http://svn.gnome.org/viewvc/network-manager-applet?rev=1006&view=rev

Log:
2008-11-03  Dan Williams  <dcbw redhat com>

	* src/applet-device-cdma.c
	  src/applet-device-gsm.c
	  src/applet-device-wifi.c
	  src/applet-device-wired.c
	  src/applet.c
	  src/gconf-helpers/gconf-helpers.c
	  src/gconf-helpers/nma-gconf-connection.c
	  src/vpn-password-dialog.c
		- Use detailed NMSettings errors



Modified:
   trunk/ChangeLog
   trunk/src/applet-device-cdma.c
   trunk/src/applet-device-gsm.c
   trunk/src/applet-device-wifi.c
   trunk/src/applet-device-wired.c
   trunk/src/applet.c
   trunk/src/gconf-helpers/gconf-helpers.c
   trunk/src/gconf-helpers/nma-gconf-connection.c
   trunk/src/vpn-password-dialog.c

Modified: trunk/src/applet-device-cdma.c
==============================================================================
--- trunk/src/applet-device-cdma.c	(original)
+++ trunk/src/applet-device-cdma.c	Mon Nov  3 22:34:06 2008
@@ -393,7 +393,7 @@
 	g_object_weak_unref (G_OBJECT (info->active_connection), destroy_cdma_dialog, info);
 
 	if (response != GTK_RESPONSE_OK) {
-		g_set_error (&err, NM_SETTINGS_ERROR, 1,
+		g_set_error (&err, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_SECRETS_REQUEST_CANCELED,
 		             "%s.%d (%s): canceled",
 		             __FILE__, __LINE__, __func__);
 		goto done;
@@ -409,7 +409,7 @@
 
 	secrets = nm_setting_to_hash (NM_SETTING (setting));
 	if (!secrets) {
-		g_set_error (&err, NM_SETTINGS_ERROR, 1,
+		g_set_error (&err, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INTERNAL_ERROR,
 				   "%s.%d (%s): failed to hash setting '%s'.",
 			     __FILE__, __LINE__, __func__, nm_setting_get_name (NM_SETTING (setting)));
 		goto done;
@@ -512,7 +512,7 @@
 	GtkEntry *secret_entry = NULL;
 
 	if (!hints || !g_strv_length ((char **) hints)) {
-		g_set_error (error, NM_SETTINGS_ERROR, 1,
+		g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INTERNAL_ERROR,
 		             "%s.%d (%s): missing secrets hints.",
 		             __FILE__, __LINE__, __func__);
 		return FALSE;
@@ -521,14 +521,14 @@
 	if (!strcmp (hints[0], NM_SETTING_CDMA_PASSWORD))
 		widget = ask_for_password (device, connection, &secret_entry);
 	else {
-		g_set_error (error, NM_SETTINGS_ERROR, 1,
+		g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INTERNAL_ERROR,
 		             "%s.%d (%s): unknown secrets hint '%s'.",
 		             __FILE__, __LINE__, __func__, hints[0]);
 		return FALSE;
 	}
 
 	if (!widget || !secret_entry) {
-		g_set_error (error, NM_SETTINGS_ERROR, 1,
+		g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INTERNAL_ERROR,
 		             "%s.%d (%s): error asking for CDMA secrets.",
 		             __FILE__, __LINE__, __func__);
 		return FALSE;

Modified: trunk/src/applet-device-gsm.c
==============================================================================
--- trunk/src/applet-device-gsm.c	(original)
+++ trunk/src/applet-device-gsm.c	Mon Nov  3 22:34:06 2008
@@ -416,7 +416,7 @@
 	g_object_weak_unref (G_OBJECT (info->active_connection), destroy_gsm_dialog, info);
 
 	if (response != GTK_RESPONSE_OK) {
-		g_set_error (&err, NM_SETTINGS_ERROR, 1,
+		g_set_error (&err, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_SECRETS_REQUEST_CANCELED,
 		             "%s.%d (%s): canceled",
 		             __FILE__, __LINE__, __func__);
 		goto done;
@@ -431,7 +431,7 @@
 
 	secrets = nm_setting_to_hash (NM_SETTING (setting));
 	if (!secrets) {
-		g_set_error (&err, NM_SETTINGS_ERROR, 1,
+		g_set_error (&err, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INTERNAL_ERROR,
 				   "%s.%d (%s): failed to hash setting '%s'.",
 				   __FILE__, __LINE__, __func__, nm_setting_get_name (NM_SETTING (setting)));
 		goto done;
@@ -593,7 +593,7 @@
 	GtkEntry *secret_entry = NULL;
 
 	if (!hints || !g_strv_length ((char **) hints)) {
-		g_set_error (error, NM_SETTINGS_ERROR, 1,
+		g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INTERNAL_ERROR,
 		             "%s.%d (%s): missing secrets hints.",
 		             __FILE__, __LINE__, __func__);
 		return FALSE;
@@ -605,14 +605,14 @@
 	else if (!strcmp (hints[0], NM_SETTING_GSM_PASSWORD))
 		widget = ask_for_password (device, connection, &secret_entry);
 	else {
-		g_set_error (error, NM_SETTINGS_ERROR, 1,
+		g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INTERNAL_ERROR,
 		             "%s.%d (%s): unknown secrets hint '%s'.",
 		             __FILE__, __LINE__, __func__, hints[0]);
 		return FALSE;
 	}
 
 	if (!widget || !secret_entry) {
-		g_set_error (error, NM_SETTINGS_ERROR, 1,
+		g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INTERNAL_ERROR,
 		             "%s.%d (%s): error asking for GSM secrets.",
 		             __FILE__, __LINE__, __func__);
 		return FALSE;

Modified: trunk/src/applet-device-wifi.c
==============================================================================
--- trunk/src/applet-device-wifi.c	(original)
+++ trunk/src/applet-device-wifi.c	Mon Nov  3 22:34:06 2008
@@ -1463,7 +1463,7 @@
 	if (secrets) {
 		g_hash_table_insert (settings, g_strdup (nm_setting_get_name (setting)), secrets);
 	} else {
-		g_set_error (error, NM_SETTINGS_ERROR, 1,
+		g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INTERNAL_ERROR,
 		             "%s.%d (%s): failed to hash setting '%s'.",
 		             __FILE__, __LINE__, __func__, nm_setting_get_name (setting));
 	}
@@ -1532,7 +1532,7 @@
 	g_object_weak_unref (G_OBJECT (info->active_connection), destroy_wifi_dialog, info);
 
 	if (response != GTK_RESPONSE_OK) {
-		g_set_error (&error, NM_SETTINGS_ERROR, 1,
+		g_set_error (&error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_SECRETS_REQUEST_CANCELED,
 		             "%s.%d (%s): canceled",
 		             __FILE__, __LINE__, __func__);
 		goto done;
@@ -1540,7 +1540,7 @@
 
 	connection = nma_wireless_dialog_get_connection (dialog, &device, NULL);
 	if (!connection) {
-		g_set_error (&error, NM_SETTINGS_ERROR, 1,
+		g_set_error (&error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INTERNAL_ERROR,
 		             "%s.%d (%s): couldn't get connection from wireless dialog.",
 		             __FILE__, __LINE__, __func__);
 		goto done;
@@ -1549,7 +1549,7 @@
 	/* Second-guess which setting NM wants secrets for. */
 	s_wireless_sec = NM_SETTING_WIRELESS_SECURITY (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS_SECURITY));
 	if (!s_wireless_sec) {
-		g_set_error (&error, NM_SETTINGS_ERROR, 1,
+		g_set_error (&error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
 		             "%s.%d (%s): requested setting '802-11-wireless-security'"
 		             " didn't exist in the connection.",
 		             __FILE__, __LINE__, __func__);
@@ -1562,7 +1562,7 @@
 	settings = g_hash_table_new_full (g_str_hash, g_str_equal,
 	                                  g_free, (GDestroyNotify) g_hash_table_destroy);
 	if (!settings) {
-		g_set_error (&error, NM_SETTINGS_ERROR, 1,
+		g_set_error (&error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INTERNAL_ERROR,
 		             "%s.%d (%s): not enough memory to return secrets.",
 		             __FILE__, __LINE__, __func__);
 		goto done;
@@ -1583,7 +1583,7 @@
 
 			s_8021x = (NMSetting8021x *) nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X);
 			if (!s_8021x) {
-				g_set_error (&error, NM_SETTINGS_ERROR, 1,
+				g_set_error (&error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
 				             "%s.%d (%s): requested setting '802-1x' didn't"
 				             " exist in the connection.",
 				             __FILE__, __LINE__, __func__);
@@ -1641,7 +1641,7 @@
 	const char *specific_object;
 
 	if (!setting_name || !active_connection) {
-		g_set_error (error, NM_SETTINGS_ERROR, 1,
+		g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INTERNAL_ERROR,
 		             "%s.%d (%s): setting name and active connection object required",
 		             __FILE__, __LINE__, __func__);
 		return FALSE;
@@ -1649,7 +1649,7 @@
 
 	specific_object = nm_active_connection_get_specific_object (active_connection);
 	if (!specific_object) {
-		g_set_error (error, NM_SETTINGS_ERROR, 1,
+		g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INTERNAL_ERROR,
 		             "%s.%d (%s): could not determine AP for specific object",
 		             __FILE__, __LINE__, __func__);
 		return FALSE;
@@ -1660,7 +1660,7 @@
 	ap = nm_device_wifi_get_access_point_by_path (NM_DEVICE_WIFI (device), specific_object);
 	info->dialog = nma_wireless_dialog_new (applet, connection, device, ap);
 	if (!info->dialog) {
-		g_set_error (error, NM_SETTINGS_ERROR, 1,
+		g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INTERNAL_ERROR,
 		             "%s.%d (%s): couldn't display secrets UI",
 		             __FILE__, __LINE__, __func__);
 		g_free (info);

Modified: trunk/src/applet-device-wired.c
==============================================================================
--- trunk/src/applet-device-wired.c	(original)
+++ trunk/src/applet-device-wired.c	Mon Nov  3 22:34:06 2008
@@ -467,7 +467,7 @@
 	g_object_weak_unref (G_OBJECT (info->active_connection), destroy_pppoe_dialog, info);
 
 	if (response != GTK_RESPONSE_OK) {
-		g_set_error (&err, NM_SETTINGS_ERROR, 1,
+		g_set_error (&err, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_SECRETS_REQUEST_CANCELED,
 		             "%s.%d (%s): canceled",
 		             __FILE__, __LINE__, __func__);
 		goto done;
@@ -478,7 +478,7 @@
 
 	secrets = nm_setting_to_hash (setting);
 	if (!secrets) {
-		g_set_error (&err, NM_SETTINGS_ERROR, 1,
+		g_set_error (&err, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INTERNAL_ERROR,
 					 "%s.%d (%s): failed to hash setting '%s'.",
 					 __FILE__, __LINE__, __func__, nm_setting_get_name (setting));
 		goto done;
@@ -539,7 +539,7 @@
 
 	xml = glade_xml_new (GLADEDIR "/ce-page-dsl.glade", "DslPage", NULL);
 	if (!xml) {
-		g_set_error (error, NM_SETTINGS_ERROR, 1,
+		g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INTERNAL_ERROR,
 					 "%s.%d (%s): couldn't display secrets UI",
 		             __FILE__, __LINE__, __func__);
 		return FALSE;
@@ -619,7 +619,7 @@
 	g_object_weak_unref (G_OBJECT (info->active_connection), destroy_8021x_dialog, info);
 
 	if (response != GTK_RESPONSE_OK) {
-		g_set_error (&err, NM_SETTINGS_ERROR, 1,
+		g_set_error (&err, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_SECRETS_REQUEST_CANCELED,
 		             "%s.%d (%s): canceled",
 		             __FILE__, __LINE__, __func__);
 		goto done;
@@ -627,7 +627,7 @@
 
 	connection = nma_wired_dialog_get_connection (info->dialog);
 	if (!connection) {
-		g_set_error (&err, NM_SETTINGS_ERROR, 1,
+		g_set_error (&err, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INTERNAL_ERROR,
 		             "%s.%d (%s): couldn't get connection from wired dialog.",
 		             __FILE__, __LINE__, __func__);
 		goto done;
@@ -635,7 +635,7 @@
 
 	setting = nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X);
 	if (!setting) {
-		g_set_error (&err, NM_SETTINGS_ERROR, 1,
+		g_set_error (&err, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
 					 "%s.%d (%s): requested setting '802-1x' didn't"
 					 " exist in the connection.",
 					 __FILE__, __LINE__, __func__);
@@ -644,7 +644,7 @@
 
 	secrets = nm_setting_to_hash (setting);
 	if (!secrets) {
-		g_set_error (&err, NM_SETTINGS_ERROR, 1,
+		g_set_error (&err, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INTERNAL_ERROR,
 					 "%s.%d (%s): failed to hash setting '%s'.",
 					 __FILE__, __LINE__, __func__, nm_setting_get_name (setting));
 		goto done;
@@ -701,7 +701,7 @@
 								   g_object_ref (connection),
 								   device);
 	if (!dialog) {
-		g_set_error (error, NM_SETTINGS_ERROR, 1,
+		g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INTERNAL_ERROR,
 		             "%s.%d (%s): couldn't display secrets UI",
 		             __FILE__, __LINE__, __func__);
 		return FALSE;
@@ -743,7 +743,7 @@
 
 	s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
 	if (!s_con) {
-		g_set_error (error, NM_SETTINGS_ERROR, 1,
+		g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
 		             "%s.%d (%s): Invalid connection",
 		             __FILE__, __LINE__, __func__);
 		return FALSE;

Modified: trunk/src/applet.c
==============================================================================
--- trunk/src/applet.c	(original)
+++ trunk/src/applet.c	Mon Nov  3 22:34:06 2008
@@ -1859,7 +1859,7 @@
 	/* Find the active device for this connection */
 	device = find_active_device (exported, applet, &active_connection);
 	if (!device || !active_connection) {
-		g_set_error (&error, NM_SETTINGS_ERROR, 1,
+		g_set_error (&error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INTERNAL_ERROR,
 		             "%s.%d (%s): couldn't find details for connection",
 		             __FILE__, __LINE__, __func__);
 		goto error;
@@ -1867,14 +1867,14 @@
 
 	dclass = get_device_class (device, applet);
 	if (!dclass) {
-		g_set_error (&error, NM_SETTINGS_ERROR, 1,
+		g_set_error (&error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INTERNAL_ERROR,
 		             "%s.%d (%s): device type unknown",
 		             __FILE__, __LINE__, __func__);
 		goto error;
 	}
 
 	if (!dclass->get_secrets) {
-		g_set_error (&error, NM_SETTINGS_ERROR, 1,
+		g_set_error (&error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_SECRETS_UNAVAILABLE,
 		             "%s.%d (%s): no secrets found",
 		             __FILE__, __LINE__, __func__);
 		goto error;

Modified: trunk/src/gconf-helpers/gconf-helpers.c
==============================================================================
--- trunk/src/gconf-helpers/gconf-helpers.c	(original)
+++ trunk/src/gconf-helpers/gconf-helpers.c	Mon Nov  3 22:34:06 2008
@@ -1640,7 +1640,7 @@
 		filename = g_object_get_data (G_OBJECT (connection), NMA_PATH_PHASE2_PRIVATE_KEY_TAG);
 		secret_name = NM_SETTING_802_1X_PHASE2_PRIVATE_KEY;
 	} else {
-		g_set_error (error, NM_SETTINGS_ERROR, 1,
+		g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_SECRETS_UNAVAILABLE,
 		             "%s.%d - %s/%s Unknown private key password type '%s'.",
 		             __FILE__, __LINE__, nm_setting_connection_get_id (s_con), setting_name, tag);
 		return FALSE;
@@ -1663,7 +1663,7 @@
 	if (*error) {
 		goto out;
 	} else if (!array || !array->len) {
-		g_set_error (error, NM_SETTINGS_ERROR, 1,
+		g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_SECRETS_UNAVAILABLE,
 		             "%s.%d - %s/%s couldn't read private key.",
 		             __FILE__, __LINE__, nm_setting_connection_get_id (s_con), setting_name);
 		goto out;
@@ -1740,7 +1740,7 @@
 		}
 
 		if (key_name == NULL) {
-			g_set_error (error, NM_SETTINGS_ERROR, 1,
+			g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_SECRETS_UNAVAILABLE,
 			             "%s.%d - Internal error; keyring item '%s/%s' didn't "
 			             "have a 'setting-key' attribute.",
 			             __FILE__, __LINE__, connection_name, setting_name);
@@ -1756,7 +1756,7 @@
 			if (!get_one_private_key (connection, setting_name, key_name,
 			                          found->secret, secrets, error)) {
 				if (!*error) {
-					g_set_error (error, NM_SETTINGS_ERROR, 1,
+					g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_SECRETS_UNAVAILABLE,
 					             "%s.%d - %s/%s unknown error from get_one_private_key().",
 					             __FILE__, __LINE__, connection_name, setting_name);
 				}

Modified: trunk/src/gconf-helpers/nma-gconf-connection.c
==============================================================================
--- trunk/src/gconf-helpers/nma-gconf-connection.c	(original)
+++ trunk/src/gconf-helpers/nma-gconf-connection.c	Mon Nov  3 22:34:06 2008
@@ -233,7 +233,7 @@
 
 	setting = nm_connection_get_setting_by_name (connection, setting_name);
 	if (!setting) {
-		g_set_error (&error, NM_SETTINGS_ERROR, 1,
+		g_set_error (&error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
 		             "%s.%d - Connection didn't have requested setting '%s'.",
 		             __FILE__, __LINE__, setting_name);
 		secrets_return_error (context, error);
@@ -245,7 +245,7 @@
 	connection_type = s_con ? nm_setting_connection_get_connection_type (s_con) : NULL;
 
 	if (!s_con || !connection_id || !strlen (connection_id) || !connection_type) {
-		g_set_error (&error, NM_SETTINGS_ERROR, 1,
+		g_set_error (&error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
 		             "%s.%d - Connection didn't have required '"
 		             NM_SETTING_CONNECTION_SETTING_NAME
 		             "' setting , or the connection name was invalid.",

Modified: trunk/src/vpn-password-dialog.c
==============================================================================
--- trunk/src/vpn-password-dialog.c	(original)
+++ trunk/src/vpn-password-dialog.c	Mon Nov  3 22:34:06 2008
@@ -216,8 +216,8 @@
 	/* find the auth-dialog binary */
 	auth_dialog_binary = find_auth_dialog_binary (service_type, id);
 	if (!auth_dialog_binary) {
-		g_set_error (&error, NM_SETTINGS_ERROR, 1,
-		             "%s.%d (%s): couldn't find VPN auth dialog  helper program '%s'.",
+		g_set_error (&error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INTERNAL_ERROR,
+		             "%s.%d (%s): couldn't find VPN auth dialog helper program '%s'.",
 		             __FILE__, __LINE__, __func__, service_type);
 		goto out;
 	}
@@ -257,7 +257,7 @@
 							  service_type);
 		gtk_window_present (GTK_WINDOW (dialog));
 		g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog);
-		g_set_error (&error, NM_SETTINGS_ERROR, 1,
+		g_set_error (&error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INTERNAL_ERROR,
 		             "%s.%d (%s): couldn't run VPN auth dialog.",
 		             __FILE__, __LINE__, __func__);
 		goto out;
@@ -314,7 +314,7 @@
 		g_hash_table_destroy (settings);
 		success = TRUE;
 	} else {
-		g_set_error (&error, NM_SETTINGS_ERROR, 1,
+		g_set_error (&error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_SECRETS_REQUEST_CANCELED,
 		             "%s.%d (%s): canceled", __FILE__, __LINE__, __func__);
 	}
 



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