[network-manager-netbook] Remove deleted GConf connections from user settings list.



commit 7c915da0b2650636bc2094e587528bcf94ace705
Author: Tambet Ingo <tambet gmail com>
Date:   Tue May 26 15:57:02 2009 +0300

    Remove deleted GConf connections from user settings list.
---
 src/gconf-helpers/nma-gconf-settings.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/gconf-helpers/nma-gconf-settings.c b/src/gconf-helpers/nma-gconf-settings.c
index f230ee5..cbe4c17 100644
--- a/src/gconf-helpers/nma-gconf-settings.c
+++ b/src/gconf-helpers/nma-gconf-settings.c
@@ -60,6 +60,15 @@ connection_new_secrets_requested_cb (NMAGConfConnection *connection,
 }
 
 static void
+connection_removed (NMAGConfConnection *connection,
+				gpointer user_data)
+{
+	NMAGConfSettingsPrivate *priv = NMA_GCONF_SETTINGS_GET_PRIVATE (user_data);
+
+	priv->connections = g_slist_remove (priv->connections, connection);
+}
+
+static void
 add_connection_real (NMAGConfSettings *self, NMAGConfConnection *connection)
 {
 	NMAGConfSettingsPrivate *priv = NMA_GCONF_SETTINGS_GET_PRIVATE (self);
@@ -70,6 +79,8 @@ add_connection_real (NMAGConfSettings *self, NMAGConfConnection *connection)
 					   G_CALLBACK (connection_new_secrets_requested_cb),
 					   self);
 
+		g_signal_connect (connection, "removed", G_CALLBACK (connection_removed), self);
+
 		nm_settings_signal_new_connection (NM_SETTINGS (self),
 									NM_EXPORTED_CONNECTION (connection));
 	}
@@ -261,14 +272,7 @@ connection_changes_done (gpointer data)
 	if (!connection) {
 		/* New connection */
 		connection = nma_gconf_connection_new (priv->client, info->path);
-		if (connection) {
-			g_signal_connect (connection, "new-secrets-requested",
-						   G_CALLBACK (connection_new_secrets_requested_cb),
-						   info->settings);
-			priv->connections = g_slist_append (priv->connections, connection);
-			nm_settings_signal_new_connection (NM_SETTINGS (info->settings),
-										NM_EXPORTED_CONNECTION (connection));
-		}
+		add_connection_real (info->settings, connection);
 	} else {
 		if (gconf_client_dir_exists (priv->client, info->path, NULL)) {
 			/* Updated connection */



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