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



Author: dcbw
Date: Sun Oct 26 21:59:34 2008
New Revision: 976
URL: http://svn.gnome.org/viewvc/network-manager-applet?rev=976&view=rev

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

	Patch from Tambet Ingo <tambet gmail com>

	* src/connection-editor/ce-page.c
	  src/connection-editor/ce-page.h
	  src/connection-editor/page-wired.c
	  src/utils/utils.c
		- Use wired setting accessors



Modified:
   trunk/ChangeLog
   trunk/src/connection-editor/ce-page.c
   trunk/src/connection-editor/ce-page.h
   trunk/src/connection-editor/page-wired.c
   trunk/src/utils/utils.c

Modified: trunk/src/connection-editor/ce-page.c
==============================================================================
--- trunk/src/connection-editor/ce-page.c	(original)
+++ trunk/src/connection-editor/ce-page.c	Sun Oct 26 21:59:34 2008
@@ -105,7 +105,7 @@
 }
 
 void
-ce_page_mac_to_entry (GByteArray *mac, GtkEntry *entry)
+ce_page_mac_to_entry (const GByteArray *mac, GtkEntry *entry)
 {
 	struct ether_addr addr;
 	char *str_addr;

Modified: trunk/src/connection-editor/ce-page.h
==============================================================================
--- trunk/src/connection-editor/ce-page.h	(original)
+++ trunk/src/connection-editor/ce-page.h	Sun Oct 26 21:59:34 2008
@@ -70,7 +70,7 @@
 
 void ce_page_changed (CEPage *self);
 
-void ce_page_mac_to_entry (GByteArray *mac, GtkEntry *entry);
+void ce_page_mac_to_entry (const GByteArray *mac, GtkEntry *entry);
 
 GByteArray *ce_page_entry_to_mac (GtkEntry *entry, gboolean *invalid);
 

Modified: trunk/src/connection-editor/page-wired.c
==============================================================================
--- trunk/src/connection-editor/page-wired.c	(original)
+++ trunk/src/connection-editor/page-wired.c	Sun Oct 26 21:59:34 2008
@@ -87,25 +87,28 @@
 {
 	CEPageWiredPrivate *priv = CE_PAGE_WIRED_GET_PRIVATE (self);
 	NMSettingWired *setting = priv->setting;
+	const char *port;
+	const char *duplex;
 	int port_idx = PORT_DEFAULT;
 	int speed_idx;
 	int mtu_def;
 
 	/* Port */
-	if (setting->port) {
-		if (!strcmp (setting->port, "tp"))
+	port = nm_setting_wired_get_port (setting);
+	if (port) {
+		if (!strcmp (port, "tp"))
 			port_idx = PORT_TP;
-		else if (!strcmp (setting->port, "aui"))
+		else if (!strcmp (port, "aui"))
 			port_idx = PORT_AUI;
-		else if (!strcmp (setting->port, "bnc"))
+		else if (!strcmp (port, "bnc"))
 			port_idx = PORT_BNC;
-		else if (!strcmp (setting->port, "mii"))
+		else if (!strcmp (port, "mii"))
 			port_idx = PORT_MII;
 	}
 	gtk_combo_box_set_active (priv->port, port_idx);
 
 	/* Speed */
-	switch (setting->speed) {
+	switch (nm_setting_wired_get_speed (setting)) {
 	case 10:
 		speed_idx = SPEED_10;
 		break;
@@ -125,16 +128,18 @@
 	gtk_combo_box_set_active (priv->speed, speed_idx);
 
 	/* Duplex */
-	if (!strcmp (setting->duplex ? setting->duplex : "", "half"))
+	duplex = nm_setting_wired_get_duplex (setting);
+	if (duplex && !strcmp (duplex, "half"))
 		gtk_toggle_button_set_active (priv->duplex, FALSE);
 	else
 		gtk_toggle_button_set_active (priv->duplex, TRUE);
 
 	/* Autonegotiate */
-	gtk_toggle_button_set_active (priv->autonegotiate, setting->auto_negotiate);
+	gtk_toggle_button_set_active (priv->autonegotiate, 
+								  nm_setting_wired_get_auto_negotiate (setting));
 
 	/* MAC address */
-	ce_page_mac_to_entry (setting->mac_address, priv->mac);
+	ce_page_mac_to_entry (nm_setting_wired_get_mac_address (setting), priv->mac);
 	g_signal_connect (priv->mac, "changed", G_CALLBACK (stuff_changed), self);
 
 	/* MTU */
@@ -143,7 +148,7 @@
 	                  G_CALLBACK (ce_spin_output_with_default),
 	                  GINT_TO_POINTER (mtu_def));
 
-	gtk_spin_button_set_value (priv->mtu, (gdouble) setting->mtu);
+	gtk_spin_button_set_value (priv->mtu, (gdouble) nm_setting_wired_get_mtu (setting));
 }
 
 CEPageWired *

Modified: trunk/src/utils/utils.c
==============================================================================
--- trunk/src/utils/utils.c	(original)
+++ trunk/src/utils/utils.c	Sun Oct 26 21:59:34 2008
@@ -529,6 +529,7 @@
 	NMSettingWired *s_wired;
 	const char *str_mac;
 	struct ether_addr *bin_mac;
+	const GByteArray *setting_mac;
 	gboolean is_pppoe = FALSE;
 
 	if (!strcmp (s_con->type, NM_SETTING_PPPOE_SETTING_NAME))
@@ -543,7 +544,8 @@
 
 	if (s_wired) {
 		/* Match MAC address */
-		if (!s_wired->mac_address)
+		setting_mac = nm_setting_wired_get_mac_address (s_wired);
+		if (!setting_mac)
 			return TRUE;
 
 		str_mac = nm_device_ethernet_get_hw_address (ethdev);
@@ -552,7 +554,7 @@
 		bin_mac = ether_aton (str_mac);
 		g_return_val_if_fail (bin_mac != NULL, FALSE);
 
-		if (memcmp (bin_mac->ether_addr_octet, s_wired->mac_address->data, ETH_ALEN))
+		if (memcmp (bin_mac->ether_addr_octet, setting_mac->data, ETH_ALEN))
 			return FALSE;
 	}
 



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