network-manager-applet r979 - in trunk: . src src/connection-editor



Author: dcbw
Date: Sun Oct 26 22:06:28 2008
New Revision: 979
URL: http://svn.gnome.org/viewvc/network-manager-applet?rev=979&view=rev

Log:
2008-10-26  Dan Williams  <dcbw redhat com>

	Patch from Tambet Ingo <tambet gmail com>

	* src/applet-device-gsm.c
	  src/connection-editor/nm-connection-list.c
	  src/connection-editor/page-mobile.c
		- Use gsm setting accessors



Modified:
   trunk/ChangeLog
   trunk/src/applet-device-gsm.c
   trunk/src/connection-editor/nm-connection-list.c
   trunk/src/connection-editor/page-mobile.c

Modified: trunk/src/applet-device-gsm.c
==============================================================================
--- trunk/src/applet-device-gsm.c	(original)
+++ trunk/src/applet-device-gsm.c	Sun Oct 26 22:06:28 2008
@@ -69,7 +69,8 @@
 	connection = nm_connection_new ();
 
 	s_gsm = NM_SETTING_GSM (nm_setting_gsm_new ());
-	s_gsm->number = g_strdup ("*99#"); /* This should be a sensible default as it's seems to be quite standard */
+	/* This should be a sensible default as it's seems to be quite standard */
+	g_object_set (s_gsm, NM_SETTING_GSM_NUMBER, "*99#", NULL);
 	nm_connection_add_setting (connection, NM_SETTING (s_gsm));
 
 	/* Serial setting */
@@ -391,16 +392,10 @@
 
 	setting = NM_SETTING_GSM (nm_connection_get_setting (info->connection, NM_TYPE_SETTING_GSM));
 
-	if (!strcmp (info->secret_name, NM_SETTING_GSM_PIN)) {
-		g_free (setting->pin);
-		setting->pin = g_strdup (gtk_entry_get_text (info->secret_entry));
-	} else if (!strcmp (info->secret_name, NM_SETTING_GSM_PUK)) {
-		g_free (setting->puk);
-		setting->puk = g_strdup (gtk_entry_get_text (info->secret_entry));
-	} else if (!strcmp (info->secret_name, NM_SETTING_GSM_PASSWORD)) {
-		g_free (setting->password);
-		setting->password = g_strdup (gtk_entry_get_text (info->secret_entry));
-	}
+	if (!strcmp (info->secret_name, NM_SETTING_GSM_PIN) ||
+	    !strcmp (info->secret_name, NM_SETTING_GSM_PUK) ||
+	    !strcmp (info->secret_name, NM_SETTING_GSM_PASSWORD))
+		g_object_set (setting, info->secret_name, gtk_entry_get_text (info->secret_entry), NULL);
 
 	secrets = nm_setting_to_hash (NM_SETTING (setting));
 	if (!secrets) {

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	Sun Oct 26 22:06:28 2008
@@ -822,7 +822,8 @@
 
 			type_setting = nm_setting_gsm_new ();
 			s_gsm = NM_SETTING_GSM (type_setting);
-			s_gsm->number = g_strdup ("*99#"); /* De-facto standard for GSM */
+			 /* De-facto standard for GSM */
+			g_object_set (s_gsm, NM_SETTING_GSM_NUMBER, "*99#", NULL);
 
 			nm_connection_add_setting (connection, nm_setting_ppp_new ());
 		} else if (mb_type == NM_TYPE_SETTING_CDMA) {

Modified: trunk/src/connection-editor/page-mobile.c
==============================================================================
--- trunk/src/connection-editor/page-mobile.c	(original)
+++ trunk/src/connection-editor/page-mobile.c	Sun Oct 26 22:06:28 2008
@@ -108,20 +108,25 @@
 	GHashTable *secrets;
 	GValue *value;
 	GtkWidget *widget;
+	const char *s;
 
-	if (setting->number)
-		gtk_entry_set_text (priv->number, setting->number);
+	s = nm_setting_gsm_get_number (setting);
+	if (s)
+		gtk_entry_set_text (priv->number, s);
 
-	if (setting->username)
-		gtk_entry_set_text (priv->username, setting->username);
+	s = nm_setting_gsm_get_username (setting);
+	if (s)
+		gtk_entry_set_text (priv->username, s);
 
-	if (setting->apn)
-		gtk_entry_set_text (priv->apn, setting->apn);
+	s = nm_setting_gsm_get_apn (setting);
+	if (s)
+		gtk_entry_set_text (priv->apn, s);
 
-	if (setting->network_id)
-		gtk_entry_set_text (priv->network_id, setting->network_id);
+	s = nm_setting_gsm_get_network_id (setting);
+	if (s)
+		gtk_entry_set_text (priv->network_id, s);
 
-	switch (setting->network_type) {
+	switch (nm_setting_gsm_get_network_type (setting)) {
 	case NM_GSM_NETWORK_UMTS_HSPA:
 		type_idx = NET_TYPE_3G;
 		break;
@@ -154,24 +159,27 @@
 
 	secrets = get_secrets (connection, nm_setting_get_name (priv->setting));
 
-	if (setting->password)
-		gtk_entry_set_text (priv->password, setting->password);
+	s = nm_setting_gsm_get_password (setting);
+	if (s)
+		gtk_entry_set_text (priv->password, s);
 	else if (secrets) {
 		value = g_hash_table_lookup (secrets, NM_SETTING_GSM_PASSWORD);
 		if (value)
 			gtk_entry_set_text (priv->password, g_value_get_string (value));
 	}
 
-	if (setting->pin)
-		gtk_entry_set_text (priv->pin, setting->pin);
+	s = nm_setting_gsm_get_pin (setting);
+	if (s)
+		gtk_entry_set_text (priv->pin, s);
 	else if (secrets) {
 		value = g_hash_table_lookup (secrets, NM_SETTING_GSM_PIN);
 		if (value)
 			gtk_entry_set_text (priv->pin, g_value_get_string (value));
 	}
 
-	if (setting->puk)
-		gtk_entry_set_text (priv->pin, setting->puk);
+	s = nm_setting_gsm_get_puk (setting);
+	if (s)
+		gtk_entry_set_text (priv->pin, s);
 	else if (secrets) {
 		value = g_hash_table_lookup (secrets, NM_SETTING_GSM_PUK);
 		if (value)



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