HEAD 1.450 applet.c patch



The 'Connect to Other Network...' dialog will add a menu item to 'Wireless Networks' and will add the entered ESSID and a timestamp to GConf. If the user makes an error in typing the ESSID or is just experimenting, he end up with multiple bogus entries in GConf. Following the theme of not adding data to GConf until it has been verified by a successful connection, I submit the attached patch to gnome/applet/applet.c.

The call to nmwa_date_network_timestamp in nmwa_menu_item_active has been removed. Since this is the only place the function nmwa_date_network_timestamp is used, it has been eliminated as well.

--
Bill Moss
Professor, Mathematical Sciences
Clemson University

--- applet.c_orig	2005-08-15 00:19:33.000000000 -0400
+++ applet.c	2005-08-15 00:27:47.000000000 -0400
@@ -1184,41 +1184,6 @@
 
 
 /*
- * nmwa_update_network_timestamp
- *
- * Update the timestamp of a network in GConf.
- *
- */
-static void nmwa_update_network_timestamp (NMWirelessApplet *applet, WirelessNetwork *network)
-{
-	char *		key;
-	char *		escaped_network;
-	const char *	net_essid;
-
-	g_return_if_fail (applet != NULL);
-	g_return_if_fail (network != NULL);
-
-	net_essid = wireless_network_get_essid (network);
-
-	/* Update GConf to set timestamp for this network, or add it if
-	 * it doesn't already exist.
-	 */
-
-	/* Update timestamp on network */
-	escaped_network = gconf_escape_key (net_essid, strlen (net_essid));
-	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);
-
-	/* Force-set the essid too so that we have a semi-complete network entry */
-	key = g_strdup_printf ("%s/%s/essid", GCONF_PATH_WIRELESS_NETWORKS, escaped_network);
-	gconf_client_set_string (applet->gconf_client, key, net_essid, NULL);
-	g_free (key);
-	g_free (escaped_network);
-}
-
-
-/*
  * nmwa_get_device_for_nm_device
  *
  * Searches the device list for a device that matches the
@@ -1274,12 +1239,8 @@
 	if (!dev)
 		return;
 
-	if ((tag = g_object_get_data (G_OBJECT (item), "network")))
-	{
-		if ((net = network_device_get_wireless_network_by_essid (dev, tag)))
-			nmwa_update_network_timestamp (applet, net);
-	}
-
+	tag = g_object_get_data (G_OBJECT (item), "network");
+	net = network_device_get_wireless_network_by_essid (dev, tag);
 	nmwa_dbus_set_device (applet->connection, dev, net ? wireless_network_get_essid (net) : NULL, -1, NULL);
 	network_device_unref (dev);
 }


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