[network-manager-netbook/MplPanelClient] Remove use of nma_gconf_connection_save()



commit 350906796955b7c16faf915bfaa9f317dfa32c80
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Sep 30 11:36:56 2009 +0100

    Remove use of nma_gconf_connection_save()
    
    The last hurdle to making nm-netbook compile with NM 0.8.

 src/nmn-new-connection.c |   36 ++++++++++++++++++++++++------------
 1 files changed, 24 insertions(+), 12 deletions(-)
---
diff --git a/src/nmn-new-connection.c b/src/nmn-new-connection.c
index 53a36df..c469ca6 100644
--- a/src/nmn-new-connection.c
+++ b/src/nmn-new-connection.c
@@ -23,6 +23,7 @@
 #include <nm-gsm-device.h>
 #include <nm-cdma-device.h>
 #include <nm-connection.h>
+#include <nm-settings-interface.h>
 #include <nm-setting-connection.h>
 #include <nm-setting-serial.h>
 #include <nm-setting-ppp.h>
@@ -97,26 +98,37 @@ connect_cb (gpointer user_data,
              error ? error->message : "success");
 }
 
+static void
+save_timestamp_cb (NMSettingsConnectionInterface *connection,
+		   GError *error,
+		   gpointer user_data)
+{
+	if (error) {
+		g_warning ("Error saving connection %s timestamp: (%d) %s",
+			   nm_connection_get_path (NM_CONNECTION (connection)),
+			   error->code,
+			   error->message);
+	}
+}
+
 static gboolean
 save_connection (NmnNMData *data, NMConnection *connection)
 {
-    NMAGConfConnection *exported;
+    NMSettingConnection *s_con;
+    NMSettingsConnectionInterface *gconf_connection;
     NMAGConfSettings *settings;
 
     settings = NMA_GCONF_SETTINGS (nmn_nm_data_get_user_settings (data));
 
-	exported = nma_gconf_settings_get_by_connection (settings, connection);
-	if (exported) {
-		/* Not a new or system connection, save the updated settings to GConf */
-		nma_gconf_connection_save (exported);
-        return TRUE;
-    }
-
-    /* FIXME: Try fuzzy match */
-
-    exported = nma_gconf_settings_add_connection (settings, connection);
+    gconf_connection = nm_settings_interface_get_connection_by_path (NM_SETTINGS_INTERFACE (settings),
+								     nm_connection_get_path (connection));
+    if (!gconf_connection)
+        return FALSE;
+    s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
+    g_object_set (s_con, NM_SETTING_CONNECTION_TIMESTAMP, (guint64) time (NULL), NULL);
+    nm_settings_connection_interface_update (gconf_connection, save_timestamp_cb, NULL);
 
-    return exported != NULL;
+    return TRUE;
 }
 
 static void



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