network-manager-applet r1171 - in branches/NETWORKMANAGER_APPLET_0_7: . src/gconf-helpers



Author: dcbw
Date: Mon Feb 16 22:40:13 2009
New Revision: 1171
URL: http://svn.gnome.org/viewvc/network-manager-applet?rev=1171&view=rev

Log:
2009-02-16  Dan Williams  <dcbw redhat com>

	* src/gconf-helpers/gconf-upgrade.c
	  src/gconf-helpers/gconf-upgrade.h
	  src/gconf-helpers/gconf-helpers.c
		- (nm_gconf_migrate_0_7_autoconnect_default): update autoconnect
			GConf entries to preserve behavior now that autoconnect
			defaults to TRUE in libnm-util



Modified:
   branches/NETWORKMANAGER_APPLET_0_7/ChangeLog
   branches/NETWORKMANAGER_APPLET_0_7/src/gconf-helpers/gconf-helpers.c
   branches/NETWORKMANAGER_APPLET_0_7/src/gconf-helpers/gconf-upgrade.c
   branches/NETWORKMANAGER_APPLET_0_7/src/gconf-helpers/gconf-upgrade.h

Modified: branches/NETWORKMANAGER_APPLET_0_7/src/gconf-helpers/gconf-helpers.c
==============================================================================
--- branches/NETWORKMANAGER_APPLET_0_7/src/gconf-helpers/gconf-helpers.c	(original)
+++ branches/NETWORKMANAGER_APPLET_0_7/src/gconf-helpers/gconf-helpers.c	Mon Feb 16 22:40:13 2009
@@ -951,8 +951,10 @@
 	nm_gconf_migrate_0_7_vpn_properties (client);
 	nm_gconf_migrate_0_7_openvpn_properties (client);
 
-	if (stamp < 1)
+	if (stamp < 1) {
 		nm_gconf_migrate_0_7_vpn_never_default (client);
+		nm_gconf_migrate_0_7_autoconnect_default (client);
+	}
 
 	connections = gconf_client_all_dirs (client, GCONF_PATH_CONNECTIONS, NULL);
 	if (!connections) {

Modified: branches/NETWORKMANAGER_APPLET_0_7/src/gconf-helpers/gconf-upgrade.c
==============================================================================
--- branches/NETWORKMANAGER_APPLET_0_7/src/gconf-helpers/gconf-upgrade.c	(original)
+++ branches/NETWORKMANAGER_APPLET_0_7/src/gconf-helpers/gconf-upgrade.c	Mon Feb 16 22:40:13 2009
@@ -1781,3 +1781,36 @@
 	gconf_client_suggest_sync (client, NULL);
 }
 
+void
+nm_gconf_migrate_0_7_autoconnect_default (GConfClient *client)
+{
+	GSList *connections, *iter;
+
+	/* Between 0.7.0 and 0.7.1, autoconnect was switched to TRUE by default.
+	 * Since default values aren't saved in GConf to reduce clutter, when NM
+	 * gets the connection from the applet, libnm-util will helpfully fill in
+	 * autoconnect=TRUE, causing existing connections that used to be
+	 * autoconnect=FALSE to be automatically activated.
+	 */
+
+	connections = gconf_client_all_dirs (client, GCONF_PATH_CONNECTIONS, NULL);
+	for (iter = connections; iter; iter = iter->next) {
+		gboolean autoconnect = FALSE;
+
+		if (!nm_gconf_get_bool_helper (client, (const char *) iter->data,
+		                               NM_SETTING_CONNECTION_AUTOCONNECT,
+		                               NM_SETTING_CONNECTION_SETTING_NAME,
+		                               &autoconnect)) {
+			/* If the key wasn't present, that used to mean FALSE, but now
+			 * we need to make that explicit.
+			 */
+			nm_gconf_set_bool_helper (client, iter->data,
+			                          NM_SETTING_CONNECTION_AUTOCONNECT,
+			                          NM_SETTING_CONNECTION_SETTING_NAME,
+			                          FALSE);
+		}
+	}
+	nm_utils_slist_free (connections, g_free);
+	gconf_client_suggest_sync (client, NULL);
+}
+

Modified: branches/NETWORKMANAGER_APPLET_0_7/src/gconf-helpers/gconf-upgrade.h
==============================================================================
--- branches/NETWORKMANAGER_APPLET_0_7/src/gconf-helpers/gconf-upgrade.h	(original)
+++ branches/NETWORKMANAGER_APPLET_0_7/src/gconf-helpers/gconf-upgrade.h	Mon Feb 16 22:40:13 2009
@@ -46,5 +46,7 @@
 
 void nm_gconf_migrate_0_7_vpn_never_default (GConfClient *client);
 
+void nm_gconf_migrate_0_7_autoconnect_default (GConfClient *client);
+
 #endif	/* GCONF_UPGRADE_H */
 



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