HEAD 1.441 patch: consolidate writes to gconf



Yesterday, I posted to the NM-list patches that removed one write to gconf. After thinking about it some more, I see that two more writes to gconf/keyring can be removed. I propose to consolidate all gconf/keyring updates in a single place -- NetworkManagerPolicy.c: nm_policy_activation_finish. No data will be written to gconf/keyring until it has been validated by a successful connection.

The current code updates gconf/keyring in four places

1. passphrase.c: nmi_passphrase_dialog_ok_clicked: nmi_save_network_info
2. NetworkManagerDevice.c: nm_device_set_user_key_for_network: nm_dbus_update_network_info 3. NetworkManagerDevice.c: nm_device_activate_stage5_ip_config_commit: nm_dbus_update_network_info 4. NetworkManagerPolicy.c: nm_policy_activation_finish: nm_dbus_add_network_address

My patches eliminate 1, 2, 3 and adds a call to nm_dbus_update_network_info to NetworkManagerPolicy.c: nm_policy_activation_finish.
________________________________________________
1. passphrase.patch: delete call to nmi_save_network_info
2. applet-dbus-info.patch: add timestap to nmi_save_network_info
3. nmdevice.patch: delete two calls to nm_dbus_update_network_info
4. nmpolicy.patch: add call to nm_dbus_update_network_info
5. netlink.patch: change g_object_new (NM_TYPE_NETLINK_MONITOR, NULL) to g_object_new (NM_TYPE_NETLINK_MONITOR, NULL, NULL). For some reason I am getting a compile warning treated as an error. It complains about not enough arguments in g_object_new. This is a mystery to me.

--
Bill Moss
Professor, Mathematical Sciences
Clemson University

--- applet-dbus-info.c_orig	2005-08-04 20:35:15.000000000 -0400
+++ applet-dbus-info.c	2005-08-06 11:08:31.000000000 -0400
@@ -866,6 +866,10 @@
 		gconf_client_set_int (applet->gconf_client, key, (int)enc_key_type, NULL);
 		g_free (key);
 
+		key = g_strdup_printf ("%s/%s/timestamp", GCONF_PATH_WIRELESS_NETWORKS, escaped_network);
+		gconf_client_set_int (applet->gconf_client, key, time (NULL), NULL);
+		g_free (key);
+
 		if (auth_method != NM_DEVICE_AUTH_METHOD_UNKNOWN)
 		{
 			key = g_strdup_printf ("%s/%s/auth_method", GCONF_PATH_WIRELESS_NETWORKS, escaped_network);
--- nm-netlink-monitor.c_orig	2005-08-04 15:54:32.000000000 -0400
+++ nm-netlink-monitor.c	2005-08-05 00:52:03.000000000 -0400
@@ -263,7 +263,7 @@
 {
 	GObject *instance;
 
-	instance = g_object_new (NM_TYPE_NETLINK_MONITOR, NULL);
+	instance = g_object_new (NM_TYPE_NETLINK_MONITOR, NULL, NULL);
 
 	return NM_NETLINK_MONITOR (instance);
 }
--- NetworkManagerDevice.c_orig	2005-08-05 14:04:17.000000000 -0400
+++ NetworkManagerDevice.c	2005-08-06 10:45:03.000000000 -0400
@@ -2962,20 +2962,6 @@
 		nm_device_update_ip4_address (dev);
 		nm_system_device_add_ip6_link_address (dev);
 		nm_system_restart_mdns_responder ();
-
-		if (nm_device_is_wireless (dev))
-		{
-			NMAccessPoint *ap = nm_act_request_get_ap (req);
-			NMAccessPoint *tmp_ap;
-
-			/* Cache details in the info-daemon since the connect was successful */
-			nm_dbus_update_network_info (data->dbus_connection, ap);
-
-			/* Cache the correct auth method in our AP list too */
-			if ((tmp_ap = nm_ap_list_get_ap_by_essid (data->allowed_ap_list, nm_ap_get_essid (ap))))
-				nm_ap_set_auth_method (tmp_ap, nm_ap_get_auth_method (ap));
-		}
-
 		nm_policy_schedule_activation_finish (req);
 		nm_device_set_link_active (dev, nm_device_probe_link_state (dev));
 	}
@@ -3282,7 +3268,6 @@
 
 		/* Be sure to update NMI with the new auth mode */
 		nm_ap_set_auth_method (allowed_ap, NM_DEVICE_AUTH_METHOD_OPEN_SYSTEM);
-		nm_dbus_update_network_info (data->dbus_connection, allowed_ap);
 
 		nm_device_activate_schedule_stage1_device_prepare (req);
 	}
--- NetworkManagerPolicy.c_orig	2005-08-06 10:17:22.000000000 -0400
+++ NetworkManagerPolicy.c	2005-08-06 10:24:16.000000000 -0400
@@ -63,6 +63,14 @@
 	{
 		struct ether_addr	addr;
 		NMAccessPoint *	ap = nm_act_request_get_ap (req);
+		NMAccessPoint *tmp_ap;
+
+		/* Cache details in the info-daemon since the connect was successful */
+		nm_dbus_update_network_info (data->dbus_connection, ap);
+
+		/* Cache the correct auth method in our AP list too */
+		if ((tmp_ap = nm_ap_list_get_ap_by_essid (data->allowed_ap_list, nm_ap_get_essid (ap))))
+			nm_ap_set_auth_method (tmp_ap, nm_ap_get_auth_method (ap));
 
 		nm_device_get_ap_address (dev, &addr);
 		if (!nm_ap_get_address (ap) || !nm_ethernet_address_is_valid (nm_ap_get_address (ap)))
--- passphrase-dialog.c_orig	2005-08-05 11:53:41.000000000 -0400
+++ passphrase-dialog.c	2005-08-05 11:58:42.000000000 -0400
@@ -217,7 +217,6 @@
 
 		/* Tell NetworkManager about the key the user typed in */
 		nmi_dbus_return_user_key (applet->connection, message, passphrase, key_type_return);
-		nmi_save_network_info (applet, wireless_network_get_essid(net), passphrase, key_type_return, NM_DEVICE_AUTH_METHOD_UNKNOWN);
 		nmi_passphrase_dialog_clear (dialog);
 	}
 }


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