network-manager-applet r856 - in branches/mbca: . po src src/connection-editor src/utils src/wireless-security



Author: kaijanma
Date: Mon Aug 18 08:31:06 2008
New Revision: 856
URL: http://svn.gnome.org/viewvc/network-manager-applet?rev=856&view=rev

Log:
keep up with trunk

Modified:
   branches/mbca/ChangeLog
   branches/mbca/po/ChangeLog
   branches/mbca/po/fr.po
   branches/mbca/po/sv.po
   branches/mbca/src/applet-device-wired.c
   branches/mbca/src/connection-editor/page-ip4.c
   branches/mbca/src/utils/utils.c
   branches/mbca/src/wired-dialog.c
   branches/mbca/src/wireless-dialog.c
   branches/mbca/src/wireless-security/eap-method-peap.c
   branches/mbca/src/wireless-security/eap-method-ttls.c
   branches/mbca/src/wireless-security/wireless-security.c
   branches/mbca/src/wireless-security/ws-wep-key.c

Modified: branches/mbca/src/applet-device-wired.c
==============================================================================
--- branches/mbca/src/applet-device-wired.c	(original)
+++ branches/mbca/src/applet-device-wired.c	Mon Aug 18 08:31:06 2008
@@ -41,6 +41,7 @@
 #include "applet-device-wired.h"
 #include "wired-dialog.h"
 #include "utils.h"
+#include "gconf-helpers.h"
 
 typedef struct {
 	NMApplet *applet;
@@ -331,19 +332,47 @@
 }
 
 static void
-pppoe_update_ui (NMSettingPPPOE *pppoe, NMPppoeInfo *info)
+pppoe_update_ui (NMConnection *connection, NMPppoeInfo *info)
 {
-	g_return_if_fail (NM_IS_SETTING_PPPOE (pppoe));
+	NMSettingPPPOE *s_pppoe;
+
+	g_return_if_fail (NM_IS_CONNECTION (connection));
 	g_return_if_fail (info != NULL);
 
-	if (pppoe->username)
-		gtk_entry_set_text (info->username_entry, pppoe->username);
+	s_pppoe = (NMSettingPPPOE *) nm_connection_get_setting (connection, NM_TYPE_SETTING_PPPOE);
+	g_return_if_fail (s_pppoe != NULL);
+
+	if (s_pppoe->username)
+		gtk_entry_set_text (info->username_entry, s_pppoe->username);
 
-	if (pppoe->service)
-		gtk_entry_set_text (info->service_entry, pppoe->service);
+	if (s_pppoe->service)
+		gtk_entry_set_text (info->service_entry, s_pppoe->service);
 
-	if (pppoe->password)
-		gtk_entry_set_text (info->password_entry, pppoe->password);
+	if (s_pppoe->password)
+		gtk_entry_set_text (info->password_entry, s_pppoe->password);
+	else {
+		const char *connection_id;
+
+		/* Grab password from keyring if possible */
+		connection_id = g_object_get_data (G_OBJECT (connection), NMA_CONNECTION_ID_TAG);
+		if (connection_id) {
+			GHashTable *secrets;
+			GError *error = NULL;
+			GValue *value;
+
+			secrets = nm_gconf_get_keyring_items (connection, connection_id,
+			                                      nm_setting_get_name (NM_SETTING (s_pppoe)),
+			                                      FALSE,
+			                                      &error);
+			if (secrets) {
+				value = g_hash_table_lookup (secrets, NM_SETTING_PPPOE_PASSWORD);
+				if (value)
+					gtk_entry_set_text (info->password_entry, g_value_get_string (value));
+				g_hash_table_destroy (secrets);
+			} else if (error)
+				g_error_free (error);
+		}
+	}
 }
 
 static NMPppoeInfo *
@@ -488,7 +517,7 @@
 	gtk_box_pack_start_defaults (GTK_BOX (GTK_DIALOG (dialog)->vbox),
 								 glade_xml_get_widget (xml, "DslPage"));
 
-	pppoe_update_ui (NM_SETTING_PPPOE (nm_connection_get_setting (connection, NM_TYPE_SETTING_PPPOE)), info);
+	pppoe_update_ui (connection, info);
 	g_object_weak_ref (G_OBJECT (dialog), pppoe_info_destroy, info);
 
 	w = glade_xml_get_widget (xml, "dsl_show_password");

Modified: branches/mbca/src/connection-editor/page-ip4.c
==============================================================================
--- branches/mbca/src/connection-editor/page-ip4.c	(original)
+++ branches/mbca/src/connection-editor/page-ip4.c	Mon Aug 18 08:31:06 2008
@@ -32,6 +32,9 @@
 
 #include <nm-setting-connection.h>
 #include <nm-setting-ip4-config.h>
+#include <nm-setting-gsm.h>
+#include <nm-setting-cdma.h>
+#include <nm-setting-pppoe.h>
 #include <nm-setting-vpn.h>
 
 #include "page-ip4.h"
@@ -86,27 +89,49 @@
 #define COL_GATEWAY 2
 
 static void
-ip4_private_init (CEPageIP4 *self, gboolean is_vpn)
+ip4_private_init (CEPageIP4 *self, NMConnection *connection)
 {
 	CEPageIP4Private *priv = CE_PAGE_IP4_GET_PRIVATE (self);
 	GladeXML *xml;
 	GtkTreeIter iter;
+	NMSettingConnection *s_con;
+	char *str_auto = NULL, *str_auto_only = NULL;
+	gboolean is_vpn = FALSE;
 
 	xml = CE_PAGE (self)->xml;
 
+	s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
+	g_assert (s_con && s_con->type);
+
+	if (!strcmp (s_con->type, NM_SETTING_VPN_SETTING_NAME)) {
+		str_auto = _("Automatic (VPN)");
+		str_auto_only = _("Automatic (VPN) addresses only");
+		is_vpn = TRUE;
+	} else if (   !strcmp (s_con->type, NM_SETTING_GSM_SETTING_NAME)
+	    || !strcmp (s_con->type, NM_SETTING_CDMA_SETTING_NAME)) {
+		str_auto = _("Automatic (PPP)");
+		str_auto_only = _("Automatic (PPP) addresses only");
+	} else if (!strcmp (s_con->type, NM_SETTING_PPPOE_SETTING_NAME)) {
+		str_auto = _("Automatic (PPPoE)");
+		str_auto_only = _("Automatic (PPPoE) addresses only");
+	} else {
+		str_auto = _("Automatic (DHCP)");
+		str_auto_only = _("Automatic (DHCP) addresses only");
+	}
+
 	priv->method = GTK_COMBO_BOX (glade_xml_get_widget (xml, "ip4_method"));
 
 	priv->method_store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_UINT);
 
 	gtk_list_store_append (priv->method_store, &iter);
 	gtk_list_store_set (priv->method_store, &iter,
-	                    METHOD_COL_NAME, _("Automatic"),
+	                    METHOD_COL_NAME, str_auto,
 	                    METHOD_COL_NUM, IP4_METHOD_AUTO,
 	                    -1);
 
 	gtk_list_store_append (priv->method_store, &iter);
 	gtk_list_store_set (priv->method_store, &iter,
-	                    METHOD_COL_NAME, _("Automatic addresses only"),
+	                    METHOD_COL_NAME, str_auto_only,
 	                    METHOD_COL_NUM, IP4_METHOD_AUTO_ADDRESSES,
 	                    -1);
 
@@ -540,7 +565,6 @@
 	GtkTreeViewColumn *column;
 	GtkCellRenderer *renderer;
 	GtkListStore *store;
-	gboolean is_vpn = FALSE;
 
 	self = CE_PAGE_IP4 (g_object_new (CE_TYPE_PAGE_IP4, NULL));
 	parent = CE_PAGE (self);
@@ -562,16 +586,13 @@
 
 	parent->title = g_strdup (_("IPv4 Settings"));
 
-	s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
-	g_assert (s_con && s_con->type);
-
-	if (!strcmp (s_con->type, NM_SETTING_VPN_SETTING_NAME))
-		is_vpn = TRUE;
-
-	ip4_private_init (self, is_vpn);
+	ip4_private_init (self, connection);
 	priv = CE_PAGE_IP4_GET_PRIVATE (self);
 
 	priv->window_group = gtk_window_group_new ();
+
+	s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
+	g_assert (s_con);
 	priv->connection_id = g_strdup (s_con->id);
 
 	priv->setting = (NMSettingIP4Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG);

Modified: branches/mbca/src/utils/utils.c
==============================================================================
--- branches/mbca/src/utils/utils.c	(original)
+++ branches/mbca/src/utils/utils.c	Mon Aug 18 08:31:06 2008
@@ -109,6 +109,7 @@
 	"PC Card with XJACK(r) Antenna",
 	"Wireless cardbus",
 	"Wireless LAN PC Card",
+	"Technology Group Ltd.",
 	NULL
 };
 

Modified: branches/mbca/src/wired-dialog.c
==============================================================================
--- branches/mbca/src/wired-dialog.c	(original)
+++ branches/mbca/src/wired-dialog.c	Mon Aug 18 08:31:06 2008
@@ -64,6 +64,7 @@
 			 NMConnection *connection)
 {
 	WirelessSecurity *security;
+	GtkWidget *widget;
 
 	/* Hide bunch of wireless specific widgets */
 	gtk_widget_hide (glade_xml_get_widget (xml, "device_label"));
@@ -82,6 +83,10 @@
 							"security", security,
 							(GDestroyNotify) wireless_security_unref);
 
+	gtk_window_set_icon_name (GTK_WINDOW (dialog), "dialog-password");
+	widget = glade_xml_get_widget (xml, "image1");
+	gtk_image_set_from_icon_name (GTK_IMAGE (widget), "dialog-password", GTK_ICON_SIZE_DIALOG);
+
 	return TRUE;
 }
 

Modified: branches/mbca/src/wireless-dialog.c
==============================================================================
--- branches/mbca/src/wireless-dialog.c	(original)
+++ branches/mbca/src/wireless-dialog.c	Mon Aug 18 08:31:06 2008
@@ -841,20 +841,29 @@
 static gboolean
 internal_init (NMAWirelessDialog *self,
                NMConnection *specific_connection,
-               NMDevice *specific_device)
+               NMDevice *specific_device,
+               gboolean auth_only)
 {
 	NMAWirelessDialogPrivate *priv = NMA_WIRELESS_DIALOG_GET_PRIVATE (self);
 	GtkWidget *widget;
-	char *label;
+	char *label, *icon_name = "network-wireless";
 	gboolean security_combo_focus = FALSE;
 
 	gtk_window_set_position (GTK_WINDOW (self), GTK_WIN_POS_CENTER_ALWAYS);
 	gtk_container_set_border_width (GTK_CONTAINER (self), 6);
 	gtk_window_set_default_size (GTK_WINDOW (self), 488, -1);
-	gtk_window_set_icon_name (GTK_WINDOW (self), "gtk-dialog-authentication");
 	gtk_window_set_resizable (GTK_WINDOW (self), FALSE);
 	gtk_dialog_set_has_separator (GTK_DIALOG (self), FALSE);
 
+	if (auth_only)
+		icon_name = "dialog-password";
+	else
+		icon_name = "network-wireless";
+
+	gtk_window_set_icon_name (GTK_WINDOW (self), icon_name);
+	widget = glade_xml_get_widget (priv->xml, "image1");
+	gtk_image_set_from_icon_name (GTK_IMAGE (widget), icon_name, GTK_ICON_SIZE_DIALOG);
+
 	gtk_box_set_spacing (GTK_BOX (gtk_bin_get_child (GTK_BIN (self))), 2);
 
 	widget = gtk_dialog_add_button (GTK_DIALOG (self), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
@@ -1055,7 +1064,7 @@
 	priv->sec_combo = glade_xml_get_widget (priv->xml, "security_combo");
 	priv->group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
 
-	if (!internal_init (self, connection, device)) {
+	if (!internal_init (self, connection, device, TRUE)) {
 		nm_warning ("Couldn't create wireless security dialog.");
 		g_object_unref (self);
 		return NULL;
@@ -1083,7 +1092,7 @@
 	priv->group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
 	priv->adhoc_create = create;
 
-	if (!internal_init (self, NULL, NULL)) {
+	if (!internal_init (self, NULL, NULL, FALSE)) {
 		nm_warning ("Couldn't create wireless security dialog.");
 		g_object_unref (self);
 		return NULL;

Modified: branches/mbca/src/wireless-security/eap-method-peap.c
==============================================================================
--- branches/mbca/src/wireless-security/eap-method-peap.c	(original)
+++ branches/mbca/src/wireless-security/eap-method-peap.c	Mon Aug 18 08:31:06 2008
@@ -424,10 +424,16 @@
 			gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 1);
 	} else
 		gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 1);
+	g_signal_connect (G_OBJECT (widget), "changed",
+	                  (GCallback) wireless_security_changed_cb,
+	                  parent);
 
 	widget = glade_xml_get_widget (xml, "eap_peap_anon_identity_entry");
 	if (s_8021x && s_8021x->anonymous_identity)
 		gtk_entry_set_text (GTK_ENTRY (widget), s_8021x->anonymous_identity);
+	g_signal_connect (G_OBJECT (widget), "changed",
+	                  (GCallback) wireless_security_changed_cb,
+	                  parent);
 
 	return method;
 }

Modified: branches/mbca/src/wireless-security/eap-method-ttls.c
==============================================================================
--- branches/mbca/src/wireless-security/eap-method-ttls.c	(original)
+++ branches/mbca/src/wireless-security/eap-method-ttls.c	Mon Aug 18 08:31:06 2008
@@ -454,6 +454,9 @@
 	widget = glade_xml_get_widget (xml, "eap_ttls_anon_identity_entry");
 	if (s_8021x && s_8021x->anonymous_identity)
 		gtk_entry_set_text (GTK_ENTRY (widget), s_8021x->anonymous_identity);
+	g_signal_connect (G_OBJECT (widget), "changed",
+	                  (GCallback) wireless_security_changed_cb,
+	                  parent);
 
 	widget = inner_auth_combo_init (method, glade_file, connection, connection_id, s_8021x);
 	inner_auth_combo_changed_cb (widget, (gpointer) method);

Modified: branches/mbca/src/wireless-security/wireless-security.c
==============================================================================
--- branches/mbca/src/wireless-security/wireless-security.c	(original)
+++ branches/mbca/src/wireless-security/wireless-security.c	Mon Aug 18 08:31:06 2008
@@ -174,14 +174,20 @@
 	g_assert (s_wireless_sec);
 
 	// FIXME: allow protocol selection and filter on device capabilities
+	g_slist_foreach (s_wireless_sec->proto, (GFunc) g_free, NULL);
+	g_slist_free (s_wireless_sec->proto);
 	s_wireless_sec->proto = g_slist_append (s_wireless_sec->proto, g_strdup ("wpa"));
 	s_wireless_sec->proto = g_slist_append (s_wireless_sec->proto, g_strdup ("rsn"));
 
 	// FIXME: allow pairwise cipher selection and filter on device capabilities
+	g_slist_foreach (s_wireless_sec->pairwise, (GFunc) g_free, NULL);
+	g_slist_free (s_wireless_sec->pairwise);
 	s_wireless_sec->pairwise = g_slist_append (s_wireless_sec->pairwise, g_strdup ("tkip"));
 	s_wireless_sec->pairwise = g_slist_append (s_wireless_sec->pairwise, g_strdup ("ccmp"));
 
 	// FIXME: allow group cipher selection and filter on device capabilities
+	g_slist_foreach (s_wireless_sec->group, (GFunc) g_free, NULL);
+	g_slist_free (s_wireless_sec->group);
 	s_wireless_sec->group = g_slist_append (s_wireless_sec->group, g_strdup ("wep40"));
 	s_wireless_sec->group = g_slist_append (s_wireless_sec->group, g_strdup ("wep104"));
 	s_wireless_sec->group = g_slist_append (s_wireless_sec->group, g_strdup ("tkip"));

Modified: branches/mbca/src/wireless-security/ws-wep-key.c
==============================================================================
--- branches/mbca/src/wireless-security/ws-wep-key.c	(original)
+++ branches/mbca/src/wireless-security/ws-wep-key.c	Mon Aug 18 08:31:06 2008
@@ -68,6 +68,8 @@
 	/* Populate entry with key from new index */
 	gtk_entry_set_text (GTK_ENTRY (entry), sec->keys[key_index]);
 	sec->cur_index = key_index;
+
+	wireless_security_changed_cb (combo, parent);
 }
 
 static void
@@ -406,6 +408,10 @@
 		gtk_widget_hide (widget);
 	}
 
+	g_signal_connect (G_OBJECT (widget), "changed",
+	                  (GCallback) wireless_security_changed_cb,
+	                  sec);
+
 	return sec;
 }
 



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