network-manager-applet r711 - in trunk: . src src/connection-editor src/gconf-helpers src/marshallers



Author: tambeti
Date: Mon May  5 07:17:15 2008
New Revision: 711
URL: http://svn.gnome.org/viewvc/network-manager-applet?rev=711&view=rev

Log:
2008-04-30  Tambet Ingo  <tambet gmail com>

	* src/applet.c (constructor): Get system connections from dbus.

2008-04-30  Tambet Ingo  <tambet gmail com>

	Implement system settings handling in the connection editor.

	* src/connection-editor/nm-connection-list.[ch]: Use NMAGconfSettings
	and NMDBusSettingsSystem to get connections. Update the connection
	lists dynamically based on signals received from the connections.

	* src/connection-editor/nm-connection-editor.[ch]: Work with
	NMExportedConnection so that updating and removing of the connections
	is handled by the connections, not special cased here.

2008-04-30  Tambet Ingo  <tambet gmail com>

	Add a toggle button to the connection editor to indicate and change the
	connection scope (system or user).

	* src/connection-editor/nm-connection-editor.c (populate_connection_ui):
	Set the toggle button state according to the connection scope.
	(connection_editor_update_connection): Update the connection scope
	according to the toggle button state.

	* src/connection-editor/nm-connection-editor.glade: Add a toggle button
	to indicate and possibly change system/user connections.

2008-04-30  Tambet Ingo  <tambet gmail com>

	Replace applet-dbus-settings.[ch] with NMAGConfSettings and
	NMAGConfConnection.

	* src/applet.c:
	* src/applet.h: Use NMAGConfSettings for locally stored settings and
	NMDBusSettingsSystem for system settings.

	* src/applet-device-cdma.c:
	* src/applet-device-gsm.c:
	* src/applet-device-wired.c:
	* src/applet-device-wireless.c: Update to use NMAGConfSettings and
	NMAGConfConnection.

	* src/Makefile.am: Remove applet-dbus-settings.[ch] from the build.

	* src/applet-dbus-settings.[ch]: Removed.

2008-04-30  Tambet Ingo  <tambet gmail com>

	Implement NMSettings and NMExportedConnection subclasses for handling
	NMConnections stored in GConf.

	* src/gconf-helpers/nma-gconf-settings.[ch]:
	* src/gconf-helpers/nma-gconf-connection.[ch]: Implement.

	* src/gconf-helpers/Makefile.am: Add new files to the build.

2008-04-30  Tambet Ingo  <tambet gmail com>

	Move marshallers to it's own directory so they can be shared.

	* src/marshallers/Makefile.am:
	* src/marshallers/nma-marshal.main.c:
	* src/marshallers/nma-marshal.list: Implement.

	* configure.ac: Create src/marshallers/Makefile.

	* src/Makefile.am: Add marshallers to the list of build directories.
	Include marshallers to the cflags and libs.
	Remove applet-marshal* references.

	* src/applet-dbus-manager.c:
	* src/applet-dbus-settings.c: Use the common marshallers.

	* src/applet-marshal-main.c:
	* src/applet-marshal.list: Remove


Added:
   trunk/src/gconf-helpers/nma-gconf-connection.c
   trunk/src/gconf-helpers/nma-gconf-connection.h
   trunk/src/gconf-helpers/nma-gconf-settings.c
   trunk/src/gconf-helpers/nma-gconf-settings.h
   trunk/src/marshallers/
   trunk/src/marshallers/Makefile.am
   trunk/src/marshallers/nma-marshal-main.c
   trunk/src/marshallers/nma-marshal.list
      - copied, changed from r710, /trunk/src/applet-marshal.list
Removed:
   trunk/src/applet-dbus-settings.c
   trunk/src/applet-dbus-settings.h
   trunk/src/applet-marshal-main.c
   trunk/src/applet-marshal.list
Modified:
   trunk/ChangeLog
   trunk/configure.ac
   trunk/src/Makefile.am
   trunk/src/applet-dbus-manager.c
   trunk/src/applet-device-cdma.c
   trunk/src/applet-device-gsm.c
   trunk/src/applet-device-wired.c
   trunk/src/applet-device-wireless.c
   trunk/src/applet.c
   trunk/src/applet.h
   trunk/src/connection-editor/nm-connection-editor.c
   trunk/src/connection-editor/nm-connection-editor.glade
   trunk/src/connection-editor/nm-connection-editor.h
   trunk/src/connection-editor/nm-connection-list.c
   trunk/src/connection-editor/nm-connection-list.h
   trunk/src/gconf-helpers/Makefile.am

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Mon May  5 07:17:15 2008
@@ -63,6 +63,8 @@
 dnl
 AC_C_BIGENDIAN
 
+PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
+
 PKG_CHECK_MODULES(NMA,
 		[dbus-glib-1 >= 0.72
 		 glib-2.0 >= 2.10
@@ -209,6 +211,7 @@
 AC_OUTPUT([
 Makefile
 src/Makefile
+src/marshallers/Makefile
 src/utils/Makefile
 src/gconf-helpers/Makefile
 src/wireless-security/Makefile

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Mon May  5 07:17:15 2008
@@ -1,4 +1,4 @@
-SUBDIRS = utils gconf-helpers wireless-security connection-editor vpn-properties
+SUBDIRS = marshallers utils gconf-helpers wireless-security connection-editor vpn-properties
 
 NULL=
 
@@ -17,6 +17,7 @@
 	-DNMALOCALEDIR=\"$(datadir)/locale\"					\
 	$(DBUS_CFLAGS)										\
 	$(DISABLE_DEPRECATED)	\
+	-I${top_srcdir}/src/marshallers \
 	-I${top_srcdir}/src/utils \
 	-I${top_srcdir}/src/gconf-helpers  \
 	-I${top_srcdir}/src/wireless-security  \
@@ -27,11 +28,8 @@
 	wireless-helper.h \
 	applet.c				\
 	applet.h				\
-	applet-marshal-main.c	\
 	applet-dbus-manager.c	\
 	applet-dbus-manager.h	\
-	applet-dbus-settings.c		\
-	applet-dbus-settings.h		\
 	vpn-password-dialog.c	\
 	vpn-password-dialog.h	\
 	wired-dialog.h \
@@ -55,30 +53,16 @@
 nm_applet_LDADD = \
 	$(NMA_LIBS) \
 	$(NOTIFY_LIBS) \
+	${top_builddir}/src/marshallers/libmarshallers.la \
 	${top_builddir}/src/utils/libutils.la \
 	${top_builddir}/src/gconf-helpers/libgconf-helpers.la \
 	${top_builddir}/src/wireless-security/libwireless-security.la
 
-applet-marshal.h: Makefile.am applet-marshal.list
-	$(GLIB_GENMARSHAL) --prefix=applet_marshal $(srcdir)/applet-marshal.list --header > \
-		xgen-gmh \
-	&& (cmp -s xgen-gmh applet-marshal.h || cp xgen-gmh applet-marshal.h) \
-	&& rm -f xgen-gmh xgen-gmh~
-
-applet-marshal.c: Makefile.am applet-marshal.list
-	$(GLIB_GENMARSHAL) --prefix=applet_marshal $(srcdir)/applet-marshal.list --body > \
-		xgen-gmc \
-	&& cp xgen-gmc applet-marshal.c \
-	&& rm -f xgen-gmc xgen-gmc~
-
-applet-marshal-main.c: applet-marshal.c applet-marshal.h
-
 gladedir = $(datadir)/nm-applet
 glade_DATA = applet.glade keyring.png
 
-CLEANFILES = *.bak *.gladep applet-marshal.c applet-marshal.h
+CLEANFILES = *.bak *.gladep
 
 EXTRA_DIST = 				\
 	$(glade_DATA)			\
-	applet-marshal.list		\
 	$(NULL)

Modified: trunk/src/applet-dbus-manager.c
==============================================================================
--- trunk/src/applet-dbus-manager.c	(original)
+++ trunk/src/applet-dbus-manager.c	Mon May  5 07:17:15 2008
@@ -26,7 +26,7 @@
 #include <string.h>
 #include "nm-utils.h"
 #include "applet.h"
-#include "applet-marshal.h"
+#include "nma-marshal.h"
 #include "applet-dbus-manager.h"
 
 enum {
@@ -101,7 +101,7 @@
 		              G_OBJECT_CLASS_TYPE (object_class),
 		              G_SIGNAL_RUN_LAST,
 		              G_STRUCT_OFFSET (AppletDBusManagerClass, dbus_connection_changed),
-		              NULL, NULL, applet_marshal_VOID__POINTER,
+		              NULL, NULL, nma_marshal_VOID__POINTER,
 		              G_TYPE_NONE, 1, G_TYPE_POINTER);
 
 	applet_dbus_manager_signals[NAME_OWNER_CHANGED] =
@@ -109,7 +109,7 @@
 		              G_OBJECT_CLASS_TYPE (object_class),
 		              G_SIGNAL_RUN_LAST,
 		              G_STRUCT_OFFSET (AppletDBusManagerClass, name_owner_changed),
-		              NULL, NULL, applet_marshal_VOID__STRING_STRING_STRING,
+		              NULL, NULL, nma_marshal_VOID__STRING_STRING_STRING,
 		              G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
 
 	g_type_class_add_private (klass, sizeof (AppletDBusManagerPrivate));

Modified: trunk/src/applet-device-cdma.c
==============================================================================
--- trunk/src/applet-device-cdma.c	(original)
+++ trunk/src/applet-device-cdma.c	Mon May  5 07:17:15 2008
@@ -36,7 +36,6 @@
 #include <nm-cdma-device.h>
 
 #include "applet.h"
-#include "applet-dbus-settings.h"
 #include "applet-device-cdma.h"
 #include "utils.h"
 
@@ -219,7 +218,7 @@
 	GtkWidget *label;
 	char *bold_text;
 
-	all = applet_dbus_settings_get_all_connections (APPLET_DBUS_SETTINGS (applet->settings));
+	all = applet_get_all_connections (applet);
 	connections = utils_filter_connections_for_device (device, all);
 	g_slist_free (all);
 

Modified: trunk/src/applet-device-gsm.c
==============================================================================
--- trunk/src/applet-device-gsm.c	(original)
+++ trunk/src/applet-device-gsm.c	Mon May  5 07:17:15 2008
@@ -37,7 +37,6 @@
 #include <nm-gsm-device.h>
 
 #include "applet.h"
-#include "applet-dbus-settings.h"
 #include "applet-device-gsm.h"
 #include "utils.h"
 
@@ -220,7 +219,7 @@
 	GtkWidget *label;
 	char *bold_text;
 
-	all = applet_dbus_settings_get_all_connections (APPLET_DBUS_SETTINGS (applet->settings));
+	all = applet_get_all_connections (applet);
 	connections = utils_filter_connections_for_device (device, all);
 	g_slist_free (all);
 

Modified: trunk/src/applet-device-wired.c
==============================================================================
--- trunk/src/applet-device-wired.c	(original)
+++ trunk/src/applet-device-wired.c	Mon May  5 07:17:15 2008
@@ -38,7 +38,6 @@
 #include <nm-device-802-3-ethernet.h>
 
 #include "applet.h"
-#include "applet-dbus-settings.h"
 #include "applet-device-wired.h"
 #include "wired-dialog.h"
 #include "utils.h"
@@ -175,7 +174,7 @@
 	GtkWidget *label;
 	char *bold_text;
 
-	all = applet_dbus_settings_get_all_connections (APPLET_DBUS_SETTINGS (applet->settings));
+	all = applet_get_all_connections (applet);
 	connections = utils_filter_connections_for_device (device, all);
 	g_slist_free (all);
 
@@ -383,7 +382,7 @@
 					  gpointer user_data)
 {
 	NMPppoeInfo *info = (NMPppoeInfo *) user_data;
-	AppletExportedConnection *exported;
+	NMAGConfConnection *gconf_connection;
 	NMSetting *setting;
 	GHashTable *settings_hash;
 	GHashTable *secrets;
@@ -421,9 +420,9 @@
 	 * saving to GConf might trigger the GConf change notifiers, resulting
 	 * in the connection being read back in from GConf which clears secrets.
 	 */
-	exported = applet_dbus_settings_user_get_by_connection (info->applet->settings, info->connection);
-	if (exported)
-		applet_exported_connection_save (exported);
+	gconf_connection = nma_gconf_settings_get_by_connection (info->applet->gconf_settings, info->connection);
+	if (gconf_connection)
+		nma_gconf_connection_save (gconf_connection);
 
 done:
 	if (err) {
@@ -499,7 +498,7 @@
 {
 	NMApplet *applet = NM_APPLET (user_data);
 	DBusGMethodInvocation *context;
-	AppletExportedConnection *exported;
+	NMAGConfConnection *gconf_connection;
 	NMConnection *connection = NULL;
 	NMSetting *setting;
 	GHashTable *settings_hash;
@@ -563,9 +562,9 @@
 	 * saving to GConf might trigger the GConf change notifiers, resulting
 	 * in the connection being read back in from GConf which clears secrets.
 	 */
-	exported = applet_dbus_settings_user_get_by_connection (applet->settings, connection);
-	if (exported)
-		applet_exported_connection_save (exported);
+	gconf_connection = nma_gconf_settings_get_by_connection (applet->gconf_settings, connection);
+	if (gconf_connection)
+		nma_gconf_connection_save (gconf_connection);
 
 done:
 	if (err) {

Modified: trunk/src/applet-device-wireless.c
==============================================================================
--- trunk/src/applet-device-wireless.c	(original)
+++ trunk/src/applet-device-wireless.c	Mon May  5 07:17:15 2008
@@ -1,3 +1,5 @@
+/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
+
 /* NetworkManager Wireless Applet -- Display wireless access points and allow user control
  *
  * Dan Williams <dcbw redhat com>
@@ -43,7 +45,6 @@
 #include <nm-utils.h>
 
 #include "applet.h"
-#include "applet-dbus-settings.h"
 #include "applet-device-wireless.h"
 #include "ap-menu-item.h"
 #include "utils.h"
@@ -646,7 +647,7 @@
 	wdev = NM_DEVICE_802_11_WIRELESS (device);
 	aps = nm_device_802_11_wireless_get_access_points (wdev);
 
-	all = applet_dbus_settings_get_all_connections (APPLET_DBUS_SETTINGS (applet->settings));
+	all = applet_get_all_connections (applet);
 	connections = utils_filter_connections_for_device (device, all);
 	g_slist_free (all);
 
@@ -712,7 +713,7 @@
 }
 
 static gboolean
-add_seen_bssid (AppletExportedConnection *exported, NMAccessPoint *ap)
+add_seen_bssid (NMAGConfConnection *gconf_connection, NMAccessPoint *ap)
 {
 	NMConnection *connection;
 	NMSettingWireless *s_wireless;
@@ -722,7 +723,7 @@
 	GSList *iter;
 	const char *bssid;
 
-	connection = nm_exported_connection_get_connection (NM_EXPORTED_CONNECTION (exported));
+	connection = nm_exported_connection_get_connection (NM_EXPORTED_CONNECTION (gconf_connection));
 	g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE);
 
 	s_wireless = NM_SETTING_WIRELESS (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS));
@@ -763,7 +764,7 @@
                              GParamSpec *pspec,
                              NMApplet *applet)
 {
-	AppletExportedConnection *exported = NULL;
+	NMAGConfConnection *gconf_connection;
 	NMConnection *connection;
 	NMSettingWireless *s_wireless;
 	NMAccessPoint *ap;
@@ -776,11 +777,11 @@
 	if (!ap)
 		return;
 
-	exported = applet_get_exported_connection_for_device (NM_DEVICE (device), applet);
-	if (!exported)
+	gconf_connection = applet_get_exported_connection_for_device (NM_DEVICE (device), applet);
+	if (!gconf_connection)
 		return;
 
-	connection = nm_exported_connection_get_connection (NM_EXPORTED_CONNECTION (exported));
+	connection = nm_exported_connection_get_connection (NM_EXPORTED_CONNECTION (gconf_connection));
 	g_return_if_fail (NM_IS_CONNECTION (connection));
 
 	s_wireless = NM_SETTING_WIRELESS (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS));
@@ -791,8 +792,8 @@
 	if (!ssid || !nm_utils_same_ssid (s_wireless->ssid, ssid, TRUE))
 		return;
 
-	if (add_seen_bssid (exported, ap))
-		applet_exported_connection_save (exported);		
+	if (add_seen_bssid (gconf_connection, ap))
+		nma_gconf_connection_save (gconf_connection);
 
 	applet_schedule_update_icon (applet);
 }
@@ -932,7 +933,7 @@
                                NMDeviceState state,
                                NMApplet *applet)
 {
-	AppletExportedConnection *exported;
+	NMAGConfConnection *gconf_connection;
 	NMAccessPoint *ap = NULL;
 	char *msg;
 	char *esc_ssid = NULL;
@@ -974,9 +975,9 @@
 		                  applet);
 
 		/* Save this BSSID to seen-bssids list */
-		exported = applet_get_exported_connection_for_device (device, applet);
-		if (exported && add_seen_bssid (exported, applet->current_ap))
-			applet_exported_connection_save (exported);
+		gconf_connection = applet_get_exported_connection_for_device (device, applet);
+		if (gconf_connection && add_seen_bssid (gconf_connection, applet->current_ap))
+			nma_gconf_connection_save (gconf_connection);
 	}
 
 	msg = g_strdup_printf (_("You are now connected to the wireless network '%s'."),
@@ -1099,7 +1100,7 @@
 	NMConnection *connection = NULL, *fuzzy_match = NULL;
 	NMDevice *device = NULL;
 	NMAccessPoint *ap = NULL;
-	AppletExportedConnection *exported = NULL;
+	NMAGConfConnection *gconf_connection;
 	gboolean ignored = FALSE;
 
 	if (response != GTK_RESPONSE_OK)
@@ -1126,15 +1127,15 @@
 	g_assert (connection);
 	g_assert (device);
 
-	exported = applet_dbus_settings_user_get_by_connection (applet->settings, connection);
-	if (exported) {
+	gconf_connection = nma_gconf_settings_get_by_connection (applet->gconf_settings, connection);
+	if (gconf_connection) {
 		/* Not a new or system connection, save the updated settings to GConf */
-		applet_exported_connection_save (exported);
+		nma_gconf_connection_save (gconf_connection);
 	} else {
 		GSList *all, *iter;
 
 		/* Find a similar connection and use that instead */
-		all = applet_dbus_settings_get_all_connections (applet->settings);
+		all = applet_get_all_connections (applet);
 		for (iter = all; iter; iter = g_slist_next (iter)) {
 			if (nm_connection_compare (connection,
 			                           NM_CONNECTION (iter->data),
@@ -1187,8 +1188,8 @@
 			}
 
 			/* Export it over D-Bus */
-			exported = applet_dbus_settings_user_add_connection (applet->settings, connection);
-			if (!exported) {
+			gconf_connection = nma_gconf_settings_add_connection (applet->gconf_settings, connection);
+			if (!gconf_connection) {
 				nm_warning ("Couldn't create other network connection.");
 				goto done;
 			}
@@ -1274,7 +1275,7 @@
 {
 	NMApplet *applet = NM_APPLET (user_data);
 	DBusGMethodInvocation *context;
-	AppletExportedConnection *exported;
+	NMAGConfConnection *gconf_connection;
 	NMConnection *connection = NULL;
 	NMSettingWirelessSecurity *s_wireless_sec;
 	NMDevice *device = NULL;
@@ -1383,9 +1384,9 @@
 	 * saving to GConf might trigger the GConf change notifiers, resulting
 	 * in the connection being read back in from GConf which clears secrets.
 	 */
-	exported = applet_dbus_settings_user_get_by_connection (applet->settings, connection);
-	if (exported)
-		applet_exported_connection_save (exported);
+	gconf_connection = nma_gconf_settings_get_by_connection (applet->gconf_settings, connection);
+	if (gconf_connection)
+		nma_gconf_connection_save (gconf_connection);
 
 done:
 	if (settings)

Modified: trunk/src/applet.c
==============================================================================
--- trunk/src/applet.c	(original)
+++ trunk/src/applet.c	Mon May  5 07:17:15 2008
@@ -51,6 +51,7 @@
 #include <nm-setting-vpn.h>
 #include <nm-setting-vpn-properties.h>
 #include <nm-active-connection.h>
+#include <nm-dbus-settings-system.h>
 
 #include <glade/glade.h>
 #include <gconf/gconf-client.h>
@@ -163,10 +164,36 @@
 	return default_ac;
 }
 
+static void
+exported_connection_to_connection (gpointer data, gpointer user_data)
+{
+	GSList **list = (GSList **) user_data;
+
+	*list = g_slist_prepend (*list, nm_exported_connection_get_connection (NM_EXPORTED_CONNECTION (data)));
+}
+
+GSList *
+applet_get_all_connections (NMApplet *applet)
+{
+	GSList *list;
+	GSList *connections = NULL;
+
+	list = nm_settings_list_connections (NM_SETTINGS (applet->dbus_settings));
+	g_slist_foreach (list, exported_connection_to_connection, &connections);
+	g_slist_free (list);
+
+	list = nm_settings_list_connections (NM_SETTINGS (applet->gconf_settings));
+	g_slist_foreach (list, exported_connection_to_connection, &connections);
+	g_slist_free (list);
+
+	return connections;
+}
+
 static NMConnection *
 applet_get_connection_for_active (NMApplet *applet, NMActiveConnection *active)
 {
 	GSList *list, *iter;
+	NMConnection *connection = NULL;
 	NMConnectionScope scope;
 	const char *path;
 
@@ -176,16 +203,20 @@
 	path = nm_active_connection_get_connection (active);
 	g_return_val_if_fail (path != NULL, NULL);
 
-	list = applet_dbus_settings_get_all_connections (applet->settings);
+	list = applet_get_all_connections (applet);
 	for (iter = list; iter; iter = g_slist_next (iter)) {
 		NMConnection *candidate = NM_CONNECTION (iter->data);
 
 		if (   (nm_connection_get_scope (candidate) == scope)
-		    && !strcmp (nm_connection_get_path (candidate), path))
-			return candidate;
+			   && !strcmp (nm_connection_get_path (candidate), path)) {
+			connection = candidate;
+			break;
+		}
 	}
 
-	return NULL;
+	g_slist_free (list);
+
+	return connection;
 }
 
 static NMActiveConnection *
@@ -254,8 +285,7 @@
                                   NMApplet *applet,
                                   gpointer user_data)
 {
-	AppletDbusSettings *applet_settings = APPLET_DBUS_SETTINGS (applet->settings);
-	AppletExportedConnection *exported = NULL;
+	NMAGConfConnection *exported;
 	const char *con_path;
 	gboolean is_system = FALSE;
 
@@ -276,7 +306,7 @@
 			return;
 		}
 
-		exported = applet_dbus_settings_user_add_connection (applet_settings, connection);
+		exported = nma_gconf_settings_add_connection (applet->gconf_settings, connection);
 		if (!exported) {
 			/* If the setting isn't valid, because it needs more authentication
 			 * or something, ask the user for it.
@@ -370,7 +400,7 @@
                              NMConnection *connection,
                              NMApplet *applet)
 {
-	AppletExportedConnection *exported = NULL;
+	NMAGConfConnection *gconf_connection;
 	const char *path;
 	NMSettingConnection *s_con;
 
@@ -378,15 +408,15 @@
 		return;
 
 	path = nm_connection_get_path (connection);
-	exported = applet_dbus_settings_user_get_by_dbus_path (applet->settings, path);
-	if (!exported)
+	gconf_connection = nma_gconf_settings_get_by_dbus_path (applet->gconf_settings, path);
+	if (!gconf_connection)
 		return;
 
 	s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
 	g_assert (s_con);
 
 	s_con->timestamp = (guint64) time (NULL);
-	applet_exported_connection_save (exported);
+	nma_gconf_connection_save (gconf_connection);
 }
 
 static char *
@@ -801,11 +831,15 @@
 			continue;
 
 		if (!strcmp (service_name, NM_DBUS_SERVICE_SYSTEM_SETTINGS)) {
-			connection = applet_dbus_settings_system_get_by_dbus_path (APPLET_DBUS_SETTINGS (applet->settings), connection_path);
+			NMDBusConnection *tmp;
+
+			tmp = nm_dbus_settings_get_connection_by_path (applet->dbus_settings, connection_path);
+			if (tmp)
+				connection = nm_exported_connection_get_connection (NM_EXPORTED_CONNECTION (tmp));
 		} else if (!strcmp (service_name, NM_DBUS_SERVICE_USER_SETTINGS)) {
-			AppletExportedConnection *tmp;
+			NMAGConfConnection *tmp;
 
-			tmp = applet_dbus_settings_user_get_by_dbus_path (APPLET_DBUS_SETTINGS (applet->settings), connection_path);
+			tmp = nma_gconf_settings_get_by_dbus_path (applet->gconf_settings, connection_path);
 			if (tmp) {
 				connection = nm_exported_connection_get_connection (NM_EXPORTED_CONNECTION (tmp));
 				if (out_active)
@@ -903,7 +937,7 @@
 	GSList *iter;
 	GSList *list = NULL;
 
-	all_connections = applet_dbus_settings_get_all_connections (APPLET_DBUS_SETTINGS (applet->settings));
+	all_connections = applet_get_all_connections (applet);
 
 	for (iter = all_connections; iter; iter = iter->next) {
 		NMConnection *connection = NM_CONNECTION (iter->data);
@@ -923,6 +957,8 @@
 		list = g_slist_prepend (list, connection);
 	}
 
+	g_slist_free (all_connections);
+
 	return g_slist_sort (list, sort_vpn_connections);
 }
 
@@ -1333,7 +1369,7 @@
 }
 
 
-AppletExportedConnection *
+NMAGConfConnection *
 applet_get_exported_connection_for_device (NMDevice *device, NMApplet *applet)
 {
 	const GPtrArray *active_connections;
@@ -1342,7 +1378,7 @@
 	active_connections = nm_client_get_active_connections (applet->nm_client);
 	for (i = 0; active_connections && (i < active_connections->len); i++) {
 		NMActiveConnection *active;
-		AppletExportedConnection *exported;
+		NMAGConfConnection *gconf_connection;
 		const char *service_name;
 		const char *connection_path;
 		const GPtrArray *devices;
@@ -1358,11 +1394,11 @@
 		if (!nm_g_ptr_array_contains (devices, device))
 			continue;
 
-		exported = applet_dbus_settings_user_get_by_dbus_path (applet->settings, connection_path);
-		if (!exported || !nm_exported_connection_get_connection (NM_EXPORTED_CONNECTION (exported)))
+		gconf_connection = nma_gconf_settings_get_by_dbus_path (applet->gconf_settings, connection_path);
+		if (!gconf_connection || !nm_exported_connection_get_connection (NM_EXPORTED_CONNECTION (gconf_connection)))
 			continue;
 
-		return exported;
+		return gconf_connection;
 	}
 	return NULL;
 }
@@ -1677,7 +1713,7 @@
 }
 
 static NMDevice *
-find_active_device (AppletExportedConnection *exported,
+find_active_device (NMAGConfConnection *exported,
                     NMApplet *applet,
                     const char **out_specific_object)
 {
@@ -1719,8 +1755,8 @@
 }
 
 static void
-applet_settings_new_secrets_requested_cb (AppletDbusSettings *settings,
-                                          AppletExportedConnection *exported,
+applet_settings_new_secrets_requested_cb (NMAGConfSettings *settings,
+                                          NMAGConfConnection *exported,
                                           const char *setting_name,
                                           const char **hints,
                                           gboolean ask_user,
@@ -1799,7 +1835,7 @@
 	for (i = 0; connections && (i < connections->len); i++) {
 		NMActiveConnection *active = NM_ACTIVE_CONNECTION (g_ptr_array_index (connections, i));
 		const char *path;
-		AppletExportedConnection *exported;
+		NMAGConfConnection *gconf_connection;
 		NMConnection *connection;
 		const GPtrArray *devices;
 		int k;
@@ -1808,8 +1844,8 @@
 			continue;
 
 		path = nm_active_connection_get_connection (active);
-		exported = applet_dbus_settings_user_get_by_dbus_path (applet->settings, path);
-		if (!exported)
+		gconf_connection = nma_gconf_settings_get_by_dbus_path (applet->gconf_settings, path);
+		if (!gconf_connection)
 			continue;
 
 		devices = nm_active_connection_get_devices (active);
@@ -1825,12 +1861,12 @@
 			if (nm_device_get_state (device) == NM_DEVICE_STATE_ACTIVATED) {
 				NMSettingConnection *s_con;
 
-				connection = nm_exported_connection_get_connection (NM_EXPORTED_CONNECTION (exported));
+				connection = nm_exported_connection_get_connection (NM_EXPORTED_CONNECTION (gconf_connection));
 				s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
 				g_assert (s_con);
 
 				s_con->timestamp = (guint64) time (NULL);
-				applet_exported_connection_save (exported);
+				nma_gconf_connection_save (gconf_connection);
 				break;
 			}
 		}
@@ -2060,12 +2096,6 @@
 	return TRUE;
 }
 
-static void
-applet_settings_system_settings_changed_cb (AppletDbusSettings *foo, gpointer user_data)
-{
-	applet_schedule_update_icon (NM_APPLET (user_data));
-}
-
 static GObject *
 constructor (GType type,
              guint n_props,
@@ -2113,15 +2143,17 @@
 		return NULL;
 	}
 
-	applet->settings = applet_dbus_settings_new ();
-	g_signal_connect (G_OBJECT (applet->settings), "new-secrets-requested",
-	                  (GCallback) applet_settings_new_secrets_requested_cb,
-	                  applet);
+	applet->dbus_settings = (NMDBusSettings *) nm_dbus_settings_system_new (applet_dbus_manager_get_connection (dbus_mgr));
 
-	g_signal_connect (G_OBJECT (applet->settings), "system-settings-changed",
-	                  (GCallback) applet_settings_system_settings_changed_cb,
+	applet->gconf_settings = nma_gconf_settings_new ();
+	g_signal_connect (applet->gconf_settings, "new-secrets-requested",
+	                  G_CALLBACK (applet_settings_new_secrets_requested_cb),
 	                  applet);
 
+	dbus_g_connection_register_g_object (applet_dbus_manager_get_connection (dbus_mgr),
+										 NM_DBUS_PATH_SETTINGS,
+										 G_OBJECT (applet->gconf_settings));
+
     /* Start our DBus service */
     if (!applet_dbus_manager_start_service (dbus_mgr)) {
 		g_object_unref (applet);
@@ -2180,6 +2212,9 @@
 	if (applet->info_dialog_xml)
 		g_object_unref (applet->info_dialog_xml);
 
+	g_object_unref (applet->gconf_settings);
+	g_object_unref (applet->dbus_settings);
+
 	g_object_unref (applet->gconf_client);
 
 	if (applet->status_icon)

Modified: trunk/src/applet.h
==============================================================================
--- trunk/src/applet.h	(original)
+++ trunk/src/applet.h	Mon May  5 07:17:15 2008
@@ -46,16 +46,10 @@
 #include <nm-device.h>
 #include <NetworkManager.h>
 #include <nm-active-connection.h>
+#include <nm-dbus-settings.h>
 
 #include "applet-dbus-manager.h"
-#include "applet-dbus-settings.h"
-
-/*
- * Preference locations
- */
-#define GCONF_PATH_PREFS				"/apps/NetworkManagerApplet"
-
-
+#include "nma-gconf-settings.h"
 
 #define NM_TYPE_APPLET			(nma_get_type())
 #define NM_APPLET(object)		(G_TYPE_CHECK_INSTANCE_CAST((object), NM_TYPE_APPLET, NMApplet))
@@ -87,7 +81,8 @@
 	NMClient *nm_client;
 	NMAccessPoint *current_ap;
 
-	AppletDbusSettings *settings;
+	NMDBusSettings *dbus_settings;
+	NMAGConfSettings *gconf_settings;
 
 	GConfClient *	gconf_client;
 	char	*		glade_file;
@@ -168,13 +163,15 @@
 
 void applet_schedule_update_icon (NMApplet *applet);
 
+GSList *applet_get_all_connections (NMApplet *applet);
+
 void applet_menu_item_activate_helper (NMDevice *device,
                                        NMConnection *connection,
                                        const char *specific_object,
                                        NMApplet *applet,
                                        gpointer user_data);
 
-AppletExportedConnection *applet_get_exported_connection_for_device (NMDevice *device, NMApplet *applet);
+NMAGConfConnection *applet_get_exported_connection_for_device (NMDevice *device, NMApplet *applet);
 
 void applet_do_notify (NMApplet *applet, 
                        NotifyUrgency urgency,

Modified: trunk/src/connection-editor/nm-connection-editor.c
==============================================================================
--- trunk/src/connection-editor/nm-connection-editor.c	(original)
+++ trunk/src/connection-editor/nm-connection-editor.c	Mon May  5 07:17:15 2008
@@ -69,6 +69,8 @@
 
 static guint editor_signals[EDITOR_LAST_SIGNAL] = { 0 };
 
+static void nm_connection_editor_set_connection (NMConnectionEditor *editor,
+									    NMExportedConnection *exported);
 
 static void
 dialog_response_cb (GtkDialog *dialog, guint response, gpointer user_data)
@@ -224,11 +226,8 @@
 	g_slist_free (editor->pages);
 	editor->pages = NULL;
 
-	if (editor->connection)
-		g_object_unref (editor->connection);
-
-	g_object_unref (editor->gconf_client);
-	g_free (editor->gconf_path);
+	if (editor->exported)
+		g_object_unref (editor->exported);
 
 	gtk_widget_destroy (editor->dialog);
 	g_object_unref (editor->xml);
@@ -256,38 +255,24 @@
 }
 
 NMConnectionEditor *
-nm_connection_editor_new (NMConnection *connection,
-                          const char *gconf_path,
-                          GConfClient *client)
+nm_connection_editor_new (NMExportedConnection *exported)
 {
 	NMConnectionEditor *editor;
 
-	g_return_val_if_fail (connection != NULL, NULL);
-	g_return_val_if_fail (client != NULL, NULL);
+	g_return_val_if_fail (NM_IS_EXPORTED_CONNECTION (exported), NULL);
 
 	editor = g_object_new (NM_TYPE_CONNECTION_EDITOR, NULL);
-	nm_connection_editor_set_connection (editor, connection);
-	editor->gconf_client = g_object_ref (client);
-	if (gconf_path)
-		editor->gconf_path = g_strdup (gconf_path);
+	nm_connection_editor_set_connection (editor, exported);
 
 	return editor;
 }
 
-NMConnection *
+NMExportedConnection *
 nm_connection_editor_get_connection (NMConnectionEditor *editor)
 {
 	g_return_val_if_fail (NM_IS_CONNECTION_EDITOR (editor), NULL);
 
-	return editor->connection;
-}
-
-const char *
-nm_connection_editor_get_gconf_path (NMConnectionEditor *editor)
-{
-	g_return_val_if_fail (NM_IS_CONNECTION_EDITOR (editor), NULL);
-
-	return editor->gconf_path;
+	return editor->exported;
 }
 
 gint
@@ -316,14 +301,17 @@
 	NMSettingConnection *s_con;
 	GtkWidget *name;
 	GtkWidget *autoconnect;
+	GtkWidget *system;
 
 	name = glade_xml_get_widget (editor->xml, "connection_name");
 	autoconnect = glade_xml_get_widget (editor->xml, "connection_autoconnect");
+	system = glade_xml_get_widget (editor->xml, "connection_system");
 
 	s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (editor->connection, NM_TYPE_SETTING_CONNECTION));
 	if (s_con) {
 		gtk_entry_set_text (GTK_ENTRY (name), s_con->id);
 		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (autoconnect), s_con->autoconnect);
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (system), nm_connection_get_scope (editor->connection) == NM_CONNECTION_SCOPE_SYSTEM);
 	} else {
 		gtk_entry_set_text (GTK_ENTRY (name), NULL);
 		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (autoconnect), FALSE);
@@ -357,24 +345,24 @@
 	editor->pages = g_slist_append (editor->pages, page);
 }
 
-void
-nm_connection_editor_set_connection (NMConnectionEditor *editor, NMConnection *connection)
+static void
+nm_connection_editor_set_connection (NMConnectionEditor *editor, NMExportedConnection *exported)
 {
 	NMSettingConnection *s_con;
 
 	g_return_if_fail (NM_IS_CONNECTION_EDITOR (editor));
-	g_return_if_fail (connection != NULL);
+	g_return_if_fail (NM_IS_EXPORTED_CONNECTION (exported));
 
 	/* clean previous connection */
-	if (editor->connection) {
-		g_object_unref (G_OBJECT (editor->connection));
-		editor->connection = NULL;
-	}
+	if (editor->exported)
+		g_object_unref (editor->exported);
+
+	editor->exported = g_object_ref (exported);
+	editor->connection = nm_exported_connection_get_connection (exported);
 
-	editor->connection = (NMConnection *) g_object_ref (connection);
 	nm_connection_editor_update_title (editor);
 
-	s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
+	s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (editor->connection, NM_TYPE_SETTING_CONNECTION));
 	g_assert (s_con);
 
 	if (!strcmp (s_con->type, NM_SETTING_WIRED_SETTING_NAME)) {
@@ -430,6 +418,7 @@
 	NMSettingConnection *s_con;
 	GtkWidget *widget;
 	const char *name;
+	GHashTable *settings;
 	gboolean autoconnect = FALSE;
 
 	s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (editor->connection, NM_TYPE_SETTING_CONNECTION));
@@ -444,6 +433,12 @@
 	              NM_SETTING_CONNECTION_AUTOCONNECT, autoconnect,
 	              NULL);
 
+	widget = glade_xml_get_widget (editor->xml, "connection_system");
+	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
+		nm_connection_set_scope (editor->connection, NM_CONNECTION_SCOPE_SYSTEM);
+	else
+		nm_connection_set_scope (editor->connection, NM_CONNECTION_SCOPE_USER);
+
 	g_slist_foreach (editor->pages, update_one_page, editor->connection);
 
 	utils_fill_connection_certs (editor->connection);
@@ -454,38 +449,9 @@
 	}
 	utils_clear_filled_connection_certs (editor->connection);
 
-	if (!editor->gconf_path) {
-		guint32 i = 0;
-
-		/* Find free GConf directory */
-		while (i++ < G_MAXUINT32) {
-			char buf[255];
-
-			snprintf (&buf[0], 255, GCONF_PATH_CONNECTIONS"/%d", i);
-			if (!gconf_client_dir_exists (editor->gconf_client, buf, NULL)) {
-				editor->gconf_path = g_strdup_printf (buf);
-				break;
-			}
-		};
-		g_assert (editor->gconf_path);
-		g_object_set_data_full (G_OBJECT (editor->connection),
-		                        NMA_CONNECTION_ID_TAG, g_path_get_basename (editor->gconf_path),
-		                        (GDestroyNotify) g_free);
-	}
-
-	if (editor->gconf_path) {
-		const char *id;
-
-		id = g_object_get_data (G_OBJECT (editor->connection), NMA_CONNECTION_ID_TAG);
-		/* Save the connection back to GConf */
-		nm_gconf_write_connection (editor->connection,
-		                           editor->gconf_client,
-		                           editor->gconf_path,
-		                           id);
-		gconf_client_notify (editor->gconf_client, editor->gconf_path);
-		gconf_client_suggest_sync (editor->gconf_client, NULL);
-	} else
-		nm_warning ("Couldn't find free GConf directory for new connection.");
+	settings = nm_connection_to_hash (editor->connection);
+	nm_exported_connection_update (editor->exported, settings);
+	/* FIXME: destroy hash? */
 }
 
 static void

Modified: trunk/src/connection-editor/nm-connection-editor.glade
==============================================================================
--- trunk/src/connection-editor/nm-connection-editor.glade	(original)
+++ trunk/src/connection-editor/nm-connection-editor.glade	Mon May  5 07:17:15 2008
@@ -149,6 +149,25 @@
 	  </child>
 
 	  <child>
+	    <widget class="GtkCheckButton" id="connection_system">
+	      <property name="visible">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="label" translatable="yes">System setting</property>
+	      <property name="use_underline">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+	      <property name="active">False</property>
+	      <property name="inconsistent">False</property>
+	      <property name="draw_indicator">True</property>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">False</property>
+	      <property name="fill">False</property>
+	    </packing>
+	  </child>
+
+	  <child>
 	    <widget class="GtkNotebook" id="notebook">
 	      <property name="visible">True</property>
 	      <property name="can_focus">True</property>
@@ -160,8 +179,8 @@
 	    </widget>
 	    <packing>
 	      <property name="padding">0</property>
-	      <property name="expand">True</property>
-	      <property name="fill">True</property>
+	      <property name="expand">False</property>
+	      <property name="fill">False</property>
 	    </packing>
 	  </child>
 	</widget>

Modified: trunk/src/connection-editor/nm-connection-editor.h
==============================================================================
--- trunk/src/connection-editor/nm-connection-editor.h	(original)
+++ trunk/src/connection-editor/nm-connection-editor.h	Mon May  5 07:17:15 2008
@@ -24,11 +24,11 @@
 #define NM_CONNECTION_EDITOR_H
 
 #include <glib-object.h>
-#include <nm-connection.h>
 #include <glade/glade-xml.h>
 #include <gtk/gtksizegroup.h>
 #include <gtk/gtkspinbutton.h>
 #include <gconf/gconf-client.h>
+#include <nm-settings.h>
 
 #define NM_TYPE_CONNECTION_EDITOR    (nm_connection_editor_get_type ())
 #define NM_IS_CONNECTION_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_CONNECTION_EDITOR))
@@ -38,9 +38,8 @@
 	GObject parent;
 
 	/* private data */
+	NMExportedConnection *exported;
 	NMConnection *connection;
-	char *gconf_path;
-	GConfClient *gconf_client;
 
 	GSList *pages;
 	GladeXML *xml;
@@ -56,13 +55,11 @@
 } NMConnectionEditorClass;
 
 GType               nm_connection_editor_get_type (void);
-NMConnectionEditor *nm_connection_editor_new (NMConnection *connection, const char *path, GConfClient *client);
+NMConnectionEditor *nm_connection_editor_new (NMExportedConnection *exported);
 
 void                nm_connection_editor_present (NMConnectionEditor *editor);
 void                nm_connection_editor_run (NMConnectionEditor *editor);
-const char *        nm_connection_editor_get_gconf_path (NMConnectionEditor *editor);
-NMConnection *      nm_connection_editor_get_connection (NMConnectionEditor *editor);
-void                nm_connection_editor_set_connection (NMConnectionEditor *editor, NMConnection *connection);
+NMExportedConnection *nm_connection_editor_get_connection (NMConnectionEditor *editor);
 
 gint ce_spin_output_with_default (GtkSpinButton *spin, gpointer user_data);
 

Modified: trunk/src/connection-editor/nm-connection-list.c
==============================================================================
--- trunk/src/connection-editor/nm-connection-list.c	(original)
+++ trunk/src/connection-editor/nm-connection-list.c	Mon May  5 07:17:15 2008
@@ -60,88 +60,91 @@
 
 static guint list_signals[LIST_LAST_SIGNAL] = { 0 };
 
-#define CE_GCONF_PATH_TAG "ce-gconf-path"
-#define CONNECTION_LIST_TAG "nm-connection-list"
-#define CONNECTION_TYPE_TAG "connection-type"
-
 #define COL_ID 			0
 #define COL_LAST_USED	1
 #define COL_TIMESTAMP	2
 #define COL_CONNECTION	3
 
-static gboolean
-get_iter_for_connection (GtkWidget *clist,
-                         NMConnection *connection,
-                         GtkTreeModel **model,
-                         GtkTreeIter *iter)
+typedef struct {
+	NMConnectionList *list;
+	GtkTreeView *treeview;
+} ActionInfo;
+
+static NMExportedConnection *
+get_active_connection (GtkTreeView *treeview)
 {
-	GtkTreeModel *sort_model;
-	GtkTreeModel *temp_model;
-	GtkTreeIter temp_iter;
-	gboolean found = FALSE;
+	GtkTreeSelection *selection;
+	GList *selected_rows;
+	GtkTreeModel *model = NULL;
+	GtkTreeIter iter;
+	NMExportedConnection *exported = NULL;
 
-	g_return_val_if_fail (GTK_IS_TREE_VIEW (clist), FALSE);
-	g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE);
-	g_return_val_if_fail (model != NULL, FALSE);
-	g_return_val_if_fail (*model == NULL, FALSE);
-	g_return_val_if_fail (iter != NULL, FALSE);
+	selection = gtk_tree_view_get_selection (treeview);
+	selected_rows = gtk_tree_selection_get_selected_rows (selection, &model);
+	if (!selected_rows)
+		return NULL;
 
-	sort_model = gtk_tree_view_get_model (GTK_TREE_VIEW (clist));
-	g_return_val_if_fail (sort_model != NULL, FALSE);
+	if (gtk_tree_model_get_iter (model, &iter, (GtkTreePath *) selected_rows->data))
+		gtk_tree_model_get (model, &iter, COL_CONNECTION, &exported, -1);
 
-	temp_model = gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (sort_model));
-	g_return_val_if_fail (temp_model != NULL, FALSE);
+	/* free memory */
+	g_list_foreach (selected_rows, (GFunc) gtk_tree_path_free, NULL);
+	g_list_free (selected_rows);
 
-	if (!gtk_tree_model_get_iter_first (temp_model, &temp_iter))
-		return FALSE;
+	return exported;
+}
 
-	do {
-		NMConnection *candidate = NULL;
+static GtkListStore *
+get_model_for_connection (NMConnectionList *list, NMExportedConnection *exported)
+{
+	NMConnection *connection;
+	NMSettingConnection *s_con;
+	GtkTreeView *treeview;
+	GtkTreeModel *model;
 
-		gtk_tree_model_get (temp_model, &temp_iter, COL_CONNECTION, &candidate, -1);
-		if (candidate && (candidate == connection)) {
-			*iter = temp_iter;
-			*model = temp_model;
-			found = TRUE;
-			break;
-		}
-	} while (gtk_tree_model_iter_next (temp_model, &temp_iter));
+	connection = nm_exported_connection_get_connection (exported);
+	s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
+	if (!s_con || !s_con->type) {
+		g_warning ("Ignoring incomplete connection");
+		return NULL;
+	}
 
-	return found;
+	treeview = (GtkTreeView *) g_hash_table_lookup (list->treeviews, s_con->type);
+	if (!treeview) {
+		g_warning ("No registered treeview for connection type '%s'", s_con->type);
+		return NULL;
+	}
+
+	model = gtk_tree_view_get_model (treeview);
+	if (GTK_IS_TREE_MODEL_SORT (model))
+		return GTK_LIST_STORE (gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (model)));
+
+	return GTK_LIST_STORE (model);
 }
 
-static NMConnection *
-get_connection_for_selection (GtkWidget *clist,
-                              GtkTreeModel **model,
-                              GtkTreeIter *iter)
+static gboolean
+get_iter_for_connection (GtkTreeModel *model,
+					NMExportedConnection *exported,
+					GtkTreeIter *iter)
 {
-	GtkTreeSelection *selection;
-	GList *selected_rows;
-	NMConnection *connection = NULL;
+	GtkTreeIter temp_iter;
+	gboolean found = FALSE;
 
-	g_return_val_if_fail (clist != NULL, NULL);
-	g_return_val_if_fail (GTK_IS_TREE_VIEW (clist), NULL);
-	g_return_val_if_fail (model != NULL, NULL);
-	g_return_val_if_fail (*model == NULL, NULL);
-	g_return_val_if_fail (iter != NULL, NULL);
-
-	/* get selected row from the tree view */
-	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (clist));
-	if (gtk_tree_selection_count_selected_rows (selection) != 1)
-		return NULL;
+	if (!gtk_tree_model_get_iter_first (model, &temp_iter))
+		return FALSE;
 
-	selected_rows = gtk_tree_selection_get_selected_rows (selection, model);
-	if (!selected_rows)
-		return NULL;
-	
-	if (gtk_tree_model_get_iter (*model, iter, (GtkTreePath *) selected_rows->data))
-		gtk_tree_model_get (*model, iter, COL_CONNECTION, &connection, -1);
+	do {
+		NMExportedConnection *candidate = NULL;
 
-	/* free memory */
-	g_list_foreach (selected_rows, (GFunc) gtk_tree_path_free, NULL);
-	g_list_free (selected_rows);
+		gtk_tree_model_get (model, &temp_iter, COL_CONNECTION, &candidate, -1);
+		if (candidate && (candidate == exported)) {
+			*iter = temp_iter;
+			found = TRUE;
+			break;
+		}
+	} while (gtk_tree_model_iter_next (model, &temp_iter));
 
-	return connection;
+	return found;
 }
 
 static char *
@@ -216,62 +219,58 @@
 	return last_used;
 }
 
-typedef struct {
-	NMConnectionList *list;
-	GtkWidget *clist;
-} EditorDoneInfo;
-
 static void
-add_done_cb (NMConnectionEditor *editor, gint response, gpointer user_data)
+update_connection_row (GtkListStore *store,
+				   GtkTreeIter *iter,
+				   NMExportedConnection *exported)
 {
-	EditorDoneInfo *info = (EditorDoneInfo *) user_data;
 	NMConnection *connection;
+	NMSettingConnection *s_con;
+	char *last_used;
 
-	connection = nm_connection_editor_get_connection (editor);
-
-	if (response == GTK_RESPONSE_OK) {
-		NMSettingConnection *s_con;
-		const char *path;
-		char *last_used;
-		GtkTreeModel *sort_model;
-		GtkListStore *store;
-		GtkTreeIter iter;
+	connection = nm_exported_connection_get_connection (exported);
+	s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
+	g_assert (s_con);
 
-		path = nm_connection_editor_get_gconf_path (editor);
+	last_used = format_last_used (s_con->timestamp);
+	gtk_list_store_set (store, iter,
+					COL_ID, s_con->id,
+					COL_LAST_USED, last_used,
+					COL_TIMESTAMP, s_con->timestamp,
+					COL_CONNECTION, exported,
+					-1);
+	g_free (last_used);
+}
 
-		g_object_set_data_full (G_OBJECT (connection),
-						    CE_GCONF_PATH_TAG, 
-						    g_strdup (path),
-						    (GDestroyNotify) g_free);
+static void
+add_done_cb (NMConnectionEditor *editor, gint response, gpointer user_data)
+{
+	ActionInfo *info = (ActionInfo *) user_data;
+	NMExportedConnection *exported;
 
-		s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
-		g_assert (s_con);
+	exported = nm_connection_editor_get_connection (editor);
+	g_hash_table_remove (info->list->editors, exported);
 
-		sort_model = gtk_tree_view_get_model (GTK_TREE_VIEW (info->clist));
-		store = GTK_LIST_STORE (gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (sort_model)));
-		gtk_list_store_insert (store, &iter, G_MAXINT);
+	if (response == GTK_RESPONSE_OK) {
+		NMConnection *connection;
 
-		last_used = format_last_used (s_con->timestamp);
-		gtk_list_store_set (store, &iter,
-		                    COL_ID, s_con->id,
-		                    COL_LAST_USED, last_used,
-		                    COL_TIMESTAMP, s_con->timestamp,
-		                    COL_CONNECTION, connection,
-		                    -1);
-		g_free (last_used);
+		connection = nm_exported_connection_get_connection (exported);
+		if (nm_connection_get_scope (connection) == NM_CONNECTION_SCOPE_SYSTEM)
+			nm_dbus_settings_system_add_connection (info->list->system_settings, connection);
+		else
+			nma_gconf_settings_add_connection (info->list->gconf_settings, connection);
 	}
-
-	g_hash_table_remove (info->list->editors, connection);
-	g_free (info);
 }
 
 static void
-add_one_name (gpointer key, gpointer data, gpointer user_data)
+add_one_name (gpointer data, gpointer user_data)
 {
-	NMConnection *connection = NM_CONNECTION (data);
+	NMExportedConnection *exported = NM_EXPORTED_CONNECTION (data);
+	NMConnection *connection;
 	NMSettingConnection *s_con;
 	GSList **list = (GSList **) user_data;
 
+	connection = nm_exported_connection_get_connection (exported);
 	s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
 	g_assert (s_con->id);
 	*list = g_slist_append (*list, s_con->id);
@@ -280,11 +279,17 @@
 static char *
 get_next_available_name (NMConnectionList *list, const char *format)
 {
+	GSList *connections;
 	GSList *names = NULL, *iter;
 	char *cname = NULL;
 	int i = 0;
 
-	g_hash_table_foreach (list->connections, add_one_name, &names);
+	connections = nm_settings_list_connections (NM_SETTINGS (list->system_settings));
+	connections = g_slist_concat (connections, nm_settings_list_connections (NM_SETTINGS (list->gconf_settings)));
+
+	g_slist_foreach (connections, add_one_name, &names);
+	g_slist_free (connections);
+
 	if (g_slist_length (names) == 0)
 		return g_strdup_printf (format, 1);
 
@@ -324,13 +329,16 @@
 }
 
 static NMConnection *
-create_new_connection_for_type (NMConnectionList *list, GType ctype)
+create_new_connection_for_type (NMConnectionList *list, const char *connection_type)
 {
+	GType ctype;
 	NMConnection *connection = NULL;
 	NMSettingConnection *s_con;
 	NMSetting *type_setting = NULL;
 	GType mb_type;
 
+	ctype = nm_connection_lookup_setting_type (connection_type);
+
 	connection = nm_connection_new ();
 	s_con = NM_SETTING_CONNECTION (nm_setting_connection_new ());
 	nm_connection_add_setting (connection, NM_SETTING (s_con));
@@ -414,34 +422,58 @@
 	return connection;
 }
 
+typedef struct {
+	const char *type;
+	GtkTreeView *treeview;
+} LookupTreeViewInfo;
+
+static void
+lookup_treeview (gpointer key, gpointer value, gpointer user_data)
+{
+	LookupTreeViewInfo *info = (LookupTreeViewInfo *) user_data;
+
+	if (!info->type && info->treeview == value)
+		info->type = (const char *) key;
+}
+
+static const char *
+get_connection_type_from_treeview (NMConnectionList *self,
+							GtkTreeView *treeview)
+{
+	LookupTreeViewInfo info;
+
+	info.type = NULL;
+	info.treeview = treeview;
+
+	g_hash_table_foreach (self->treeviews, lookup_treeview, &info);
+
+	return info.type;
+}
+
 static void
 add_connection_cb (GtkButton *button, gpointer user_data)
 {
-	GtkWidget *clist = GTK_WIDGET (user_data);
-	NMConnectionList *list;
-	NMConnectionEditor *editor;
+	ActionInfo *info = (ActionInfo *) user_data;
+	const char *connection_type;
 	NMConnection *connection;
-	EditorDoneInfo *info;
-	GType ctype;
-
-	list = NM_CONNECTION_LIST (g_object_get_data (G_OBJECT (button), CONNECTION_LIST_TAG));
-	g_assert (list);
+	NMExportedConnection *exported;
+	NMConnectionEditor *editor;
 
-	info = g_malloc0 (sizeof (EditorDoneInfo));
-	g_assert (info);
-	info->list = list;
-	info->clist = clist;
+	connection_type = get_connection_type_from_treeview (info->list, info->treeview);
+	g_assert (connection_type);
 
-	ctype = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (clist), CONNECTION_TYPE_TAG));
-	connection = create_new_connection_for_type (list, ctype);
+	connection = create_new_connection_for_type (info->list, connection_type);
 	if (!connection) {
-		g_warning ("Can't add new connection of type '%s'", g_type_name (ctype));
+		g_warning ("Can't add new connection of type '%s'", connection_type);
 		return;
 	}
 
-	editor = nm_connection_editor_new (connection, NULL, list->client);
+	exported = nm_exported_connection_new (connection);
+	g_object_unref (connection);
+
+	editor = nm_connection_editor_new (exported);
 	g_signal_connect (G_OBJECT (editor), "done", G_CALLBACK (add_done_cb), info);
-	g_hash_table_insert (list->editors, connection, editor);
+	g_hash_table_insert (info->list->editors, exported, editor);
 
 	nm_connection_editor_run (editor);
 }
@@ -449,52 +481,43 @@
 static void
 edit_done_cb (NMConnectionEditor *editor, gint response, gpointer user_data)
 {
-	EditorDoneInfo *info = (EditorDoneInfo *) user_data;
-	NMConnection *connection;
-	NMSettingConnection *s_con;
+	ActionInfo *info = (ActionInfo *) user_data;
+	NMExportedConnection *exported;
 
-	connection = nm_connection_editor_get_connection (editor);
+	exported = nm_connection_editor_get_connection (editor);
 
 	if (response == GTK_RESPONSE_OK) {
-		GtkTreeModel *model = NULL;
+		GtkListStore *store;
 		GtkTreeIter iter;
 
-		s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
-		g_assert (s_con);
-
-		if (get_iter_for_connection (info->clist, connection, &model, &iter) && model)
-			gtk_list_store_set (GTK_LIST_STORE (model), &iter, COL_ID, s_con->id, -1);
+		store = get_model_for_connection (info->list, exported);
+		g_assert (store);
+		if (get_iter_for_connection (GTK_TREE_MODEL (store), exported, &iter))
+			update_connection_row (store, &iter, exported);
 	}
 
-	g_hash_table_remove (info->list->editors, connection);
-	g_free (info);
+	g_hash_table_remove (info->list->editors, exported);
 }
 
 static void
-do_edit (NMConnectionList *list, NMConnection *connection, GtkWidget *clist)
+do_edit (ActionInfo *info)
 {
+	NMExportedConnection *exported;
 	NMConnectionEditor *editor;
-	const char *gconf_path;
-	EditorDoneInfo *info;
+
+	exported = get_active_connection (info->treeview);
+	g_return_if_fail (exported != NULL);
 
 	/* Don't allow two editors for the same connection */
-	editor = NM_CONNECTION_EDITOR (g_hash_table_lookup (list->editors, connection));
+	editor = NM_CONNECTION_EDITOR (g_hash_table_lookup (info->list->editors, exported));
 	if (editor) {
 		nm_connection_editor_present (editor);
 		return;
 	}
 
-	gconf_path = g_object_get_data (G_OBJECT (connection), CE_GCONF_PATH_TAG);
-	g_assert (gconf_path);
-
-	info = g_malloc0 (sizeof (EditorDoneInfo));
-	g_assert (info);
-	info->list = list;
-	info->clist = clist;
-
-	editor = nm_connection_editor_new (connection, gconf_path, list->client);
-	g_signal_connect (G_OBJECT (editor), "done", G_CALLBACK (edit_done_cb), info);
-	g_hash_table_insert (list->editors, connection, editor);
+	editor = nm_connection_editor_new (exported);
+	g_signal_connect (editor, "done", G_CALLBACK (edit_done_cb), info);
+	g_hash_table_insert (info->list->editors, exported, editor);
 
 	nm_connection_editor_run (editor);
 }
@@ -502,51 +525,27 @@
 static void
 edit_connection_cb (GtkButton *button, gpointer user_data)
 {
-	NMConnectionList *list;
-	GtkWidget *clist = GTK_WIDGET (user_data);
-	NMConnection *connection;
-	GtkTreeModel *ignore1 = NULL;
-	GtkTreeIter ignore2;
-
-	connection = get_connection_for_selection (clist, &ignore1, &ignore2);
-	g_return_if_fail (connection != NULL);
-
-	list = NM_CONNECTION_LIST (g_object_get_data (G_OBJECT (button), CONNECTION_LIST_TAG));
-	g_assert (list);
-
-	do_edit (list, connection, clist);
+	do_edit ((ActionInfo *) user_data);
 }
 
 static void
 delete_connection_cb (GtkButton *button, gpointer user_data)
 {
-	GtkWidget *clist = GTK_WIDGET (user_data);
-	NMConnectionList *list;
-	NMConnectionEditor *editor;
-	NMSettingConnection *s_con;
+	ActionInfo *info = (ActionInfo *) user_data;
+	NMExportedConnection *exported = NULL;
 	NMConnection *connection;
+	NMSettingConnection *s_con;
 	GtkWidget *dialog;
-	gint result;
-	const char *dir;
-	GError *error = NULL;
-	GtkTreeModel *model = NULL, *sorted_model;
-	GtkTreeIter iter, sorted_iter;
-
-	connection = get_connection_for_selection (clist, &model, &iter);
-	g_return_if_fail (connection != NULL);
-	g_return_if_fail (model != NULL);
-
-	dir = g_object_get_data (G_OBJECT (connection), CE_GCONF_PATH_TAG);
-	g_return_if_fail (dir != NULL);
+	guint result;
 
+	exported = get_active_connection (info->treeview);
+	g_return_if_fail (exported != NULL);
+	connection = nm_exported_connection_get_connection (exported);
 	s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
 	if (!s_con || !s_con->id)
 		return;
 
-	list = NM_CONNECTION_LIST (g_object_get_data (G_OBJECT (button), CONNECTION_LIST_TAG));
-	g_return_if_fail (list != NULL);
-
-	dialog = gtk_message_dialog_new (GTK_WINDOW (list->dialog),
+	dialog = gtk_message_dialog_new (GTK_WINDOW (info->list->dialog),
 	                                 GTK_DIALOG_DESTROY_WITH_PARENT,
 	                                 GTK_MESSAGE_QUESTION,
 	                                 GTK_BUTTONS_NONE,
@@ -563,63 +562,9 @@
 		return;
 
 	/* Close any open editor windows for this connection */
-	editor = g_hash_table_lookup (list->editors, connection);
-	if (editor)
-		g_hash_table_remove (list->editors, connection);
-
-	if (!gconf_client_recursive_unset (list->client, dir, 0, &error)) {
-		g_warning ("%s: Failed to completely remove connection '%s': (%d) %s",
-		           __func__, s_con->id, error->code, error->message);
-		g_error_free (error);
-	}
-
-	gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (model),
-	                                                &sorted_iter,
-	                                                &iter);
-	sorted_model = gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (model));
-	gtk_list_store_remove (GTK_LIST_STORE (sorted_model), &sorted_iter);
-
-	if (!g_hash_table_remove (list->connections, dir))
-		g_warning ("%s: couldn't remove connection from hash table.", __func__);
-}
-
-static void
-load_connections (NMConnectionList *list)
-{
-	GSList *conf_list;
-
-	g_return_if_fail (NM_IS_CONNECTION_LIST (list));
-
-	conf_list = nm_gconf_get_all_connections (list->client);
-	if (!conf_list) {
-		g_warning ("No connections defined");
-		return;
-	}
+	g_hash_table_remove (info->list->editors, exported);
 
-	while (conf_list != NULL) {
-		NMConnection *connection;
-		gchar *dir = (gchar *) conf_list->data;
-
-		connection = nm_gconf_read_connection (list->client, dir);
-		if (connection) {
-			g_object_set_data_full (G_OBJECT (connection),
-			                        NMA_CONNECTION_ID_TAG, g_path_get_basename (dir),
-			                        (GDestroyNotify) g_free);
-
-			g_object_set_data_full (G_OBJECT (connection),
-							    CE_GCONF_PATH_TAG, 
-							    g_strdup (dir),
-							    (GDestroyNotify) g_free);
-
-			g_hash_table_insert (list->connections,
-			                     g_strdup (dir),
-			                     connection);
-		}
-
-		conf_list = g_slist_remove (conf_list, dir);
-		g_free (dir);
-	}
-	g_slist_free (conf_list);
+	nm_exported_connection_delete (exported);
 }
 
 static void
@@ -641,265 +586,286 @@
                               GtkTreeViewColumn *column,
                               gpointer user_data)
 {
-	NMConnectionList *list = NM_CONNECTION_LIST (user_data);
-	GtkTreeModel *model;
-	GtkTreeIter iter;
-	NMConnection *connection;
-	gboolean success;
-
-	model = gtk_tree_view_get_model (tree_view);
-	g_return_if_fail (model != NULL);
-
-	success = gtk_tree_model_get_iter (model, &iter, path);
-	g_return_if_fail (success);
-	gtk_tree_model_get (model, &iter, COL_CONNECTION, &connection, -1);
-	g_return_if_fail (connection != NULL);
+	do_edit ((ActionInfo *) user_data);
+}
 
-	do_edit (list, connection, GTK_WIDGET (tree_view));
+static void
+dialog_response_cb (GtkDialog *dialog, guint response, gpointer user_data)
+{
+	gtk_widget_hide (GTK_WIDGET (dialog));
 }
 
-typedef struct {
-	GSList *types;
-	GtkListStore *model;
-} NewListInfo;
+static void
+nm_connection_list_init (NMConnectionList *list)
+{
+	list->treeviews = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+}
 
 static void
-hash_add_connection_to_list (gpointer key, gpointer value, gpointer user_data)
+dispose (GObject *object)
 {
-	NewListInfo *info = (NewListInfo *) user_data;
-	NMConnection *connection = (NMConnection *) value;
-	NMSettingConnection *s_con;
-	GtkTreeIter model_iter;
-	gboolean found = FALSE;
-	GSList *iter;
-	char *last_used;
+	NMConnectionList *list = NM_CONNECTION_LIST (object);
 
-	s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
-	if (!s_con || !s_con->type)
-		return;
+	if (list->dialog)
+		gtk_widget_hide (list->dialog);
 
-	/* Filter on requested types */
-	for (iter = info->types; iter; iter = g_slist_next (iter)) {
-		if (!strcmp (s_con->type, (const char *) iter->data)) {
-			found = TRUE;
-			break;
-		}
-	}
+	if (list->editors)
+		g_hash_table_destroy (list->editors);
 
-	if (!found)
-		return;
+	if (list->wired_icon)
+		g_object_unref (list->wired_icon);
+	if (list->wireless_icon)
+		g_object_unref (list->wireless_icon);
+	if (list->wwan_icon)
+		g_object_unref (list->wwan_icon);
+	if (list->vpn_icon)
+		g_object_unref (list->vpn_icon);
+	if (list->unknown_icon)
+		g_object_unref (list->unknown_icon);
 
-	last_used = format_last_used (s_con->timestamp);
+	if (list->dialog)
+		gtk_widget_destroy (list->dialog);
+	if (list->gui)
+		g_object_unref (list->gui);
+	if (list->client)
+		g_object_unref (list->client);
 
-	gtk_list_store_append (info->model, &model_iter);
-	gtk_list_store_set (info->model, &model_iter,
-	                    COL_ID, s_con->id,
-	                    COL_LAST_USED, last_used,
-	                    COL_TIMESTAMP, s_con->timestamp,
-	                    COL_CONNECTION, connection,
-	                    -1);
-	g_free (last_used);
+	g_hash_table_destroy (list->treeviews);
+
+	if (list->gconf_settings)
+		g_object_unref (list->gconf_settings);
+
+	if (list->system_settings)
+		g_object_unref (list->system_settings);
+
+	G_OBJECT_CLASS (nm_connection_list_parent_class)->dispose (object);
 }
 
-static GtkWidget *
-new_connection_list (NMConnectionList *list,
-                     GSList *types,
-                     const char *prefix,
-                     GdkPixbuf *pixbuf,
-                     const char *label_text,
-                     GType ctype)
-{
-	GtkWidget *notebook;
-	GtkWidget *clist;
-	GtkListStore *model;
-	GtkTreeModel *sort_model;
-	char *name;
-	GtkWidget *image, *hbox, *button, *child;
-	GtkTreeSelection *select;
-	NewListInfo info;
-	GtkCellRenderer *renderer;
-	GValue val = { 0, };
+static void
+nm_connection_list_class_init (NMConnectionListClass *klass)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
-	name = g_strdup_printf ("%s_child", prefix);
-	child = glade_xml_get_widget (list->gui, name);
-	g_free (name);
+	/* virtual methods */
+	object_class->dispose = dispose;
 
-	/* Tab label with icon */
-	hbox = gtk_hbox_new (FALSE, 6);
-	if (pixbuf) {
-		image = gtk_image_new_from_pixbuf (pixbuf);
-		gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
-	}
-	gtk_box_pack_start (GTK_BOX (hbox), gtk_label_new (label_text), FALSE, FALSE, 0);
-	gtk_widget_show_all (hbox);
+	/* Signals */
+	list_signals[LIST_DONE] =
+		g_signal_new ("done",
+					  G_OBJECT_CLASS_TYPE (object_class),
+					  G_SIGNAL_RUN_FIRST,
+					  G_STRUCT_OFFSET (NMConnectionListClass, done),
+					  NULL, NULL,
+					  g_cclosure_marshal_VOID__INT,
+					  G_TYPE_NONE, 1, G_TYPE_INT);
+}
 
-	notebook = glade_xml_get_widget (list->gui, "list_notebook");
-	gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), child, hbox);
+static GtkTreeView *
+add_connection_treeview (NMConnectionList *self, const char *prefix)
+{
+	GtkTreeModel *model;
+	GtkTreeModel *sort_model;
+	GtkCellRenderer *renderer;
+	GtkTreeSelection *select;
+	GValue val = { 0, };
+	char *name;
+	GtkTreeView *treeview;
 
 	name = g_strdup_printf ("%s_list", prefix);
-	clist = glade_xml_get_widget (list->gui, name);
+	treeview = GTK_TREE_VIEW (glade_xml_get_widget (self->gui, name));
 	g_free (name);
-	g_object_set_data (G_OBJECT (clist), CONNECTION_TYPE_TAG, GUINT_TO_POINTER (ctype));
-
-	model = gtk_list_store_new (4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT64, G_TYPE_OBJECT);
 
-	info.types = types;
-	info.model = model;
-	g_hash_table_foreach (list->connections,
-	                      (GHFunc) hash_add_connection_to_list,
-	                      &info);
-
-	sort_model = gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (model));
+	/* Model */
+	model = GTK_TREE_MODEL (gtk_list_store_new (4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT64, G_TYPE_OBJECT));
+	sort_model = gtk_tree_model_sort_new_with_model (model);
 	gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (sort_model),
 	                                      COL_TIMESTAMP, GTK_SORT_DESCENDING);
-	gtk_tree_view_set_model (GTK_TREE_VIEW (clist), GTK_TREE_MODEL (sort_model));
-
-	g_signal_connect (G_OBJECT (clist),
-	                  "row-activated", G_CALLBACK (connection_double_clicked_cb),
-	                  list);
+	gtk_tree_view_set_model (treeview, sort_model);
 
-	gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (clist),
+	/* Name column */
+	gtk_tree_view_insert_column_with_attributes (treeview,
 	                                             -1, "Name", gtk_cell_renderer_text_new (),
 	                                             "text", COL_ID,
 	                                             NULL);
-	gtk_tree_view_column_set_expand (gtk_tree_view_get_column (GTK_TREE_VIEW (clist), 0), TRUE);
+	gtk_tree_view_column_set_expand (gtk_tree_view_get_column (treeview, 0), TRUE);
 
+	/* Last Used column */
 	renderer = gtk_cell_renderer_text_new ();
 	g_value_init (&val, G_TYPE_STRING);
 	g_value_set_string (&val, "SlateGray");
 	g_object_set_property (G_OBJECT (renderer), "foreground", &val);
-	gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (clist),
+
+	gtk_tree_view_insert_column_with_attributes (treeview,
 	                                             -1, "Last Used", renderer,
 	                                             "text", COL_LAST_USED,
 	                                             NULL);
 
-	select = gtk_tree_view_get_selection (GTK_TREE_VIEW (clist));
+	/* Selection */
+	select = gtk_tree_view_get_selection (treeview);
 	gtk_tree_selection_set_mode (select, GTK_SELECTION_SINGLE);
 
+	return treeview;
+}
+
+static void
+add_connection_buttons (NMConnectionList *self,
+				    const char *prefix,
+				    GtkTreeView *treeview)
+{
+	char *name;
+	GtkWidget *button;
+	ActionInfo *info;
+	GtkTreeSelection *selection;
+
+	info = g_new (ActionInfo, 1);
+	info->list = self;
+	info->treeview = treeview;
+
+	selection = gtk_tree_view_get_selection (treeview);
+
+	g_object_weak_ref (G_OBJECT (self), (GWeakNotify) g_free, info);
+
+	/* Add */
 	name = g_strdup_printf ("%s_add", prefix);
-	button = glade_xml_get_widget (list->gui, name);
-	g_object_set_data (G_OBJECT (button), CONNECTION_LIST_TAG, list);
-	g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (add_connection_cb), clist);
+	button = glade_xml_get_widget (self->gui, name);
 	g_free (name);
+	g_signal_connect (button, "clicked", G_CALLBACK (add_connection_cb), info);
 
+	/* Edit */
 	name = g_strdup_printf ("%s_edit", prefix);
-	button = glade_xml_get_widget (list->gui, name);
-	g_object_set_data (G_OBJECT (button), CONNECTION_LIST_TAG, list);
-	g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (edit_connection_cb), clist);
-	g_signal_connect (G_OBJECT (select),
-	                  "changed", G_CALLBACK (list_selection_changed_cb),
-	                  button);
+	button = glade_xml_get_widget (self->gui, name);
 	g_free (name);
+	g_signal_connect (button, "clicked", G_CALLBACK (edit_connection_cb), info);
+	g_signal_connect (selection, "changed", G_CALLBACK (list_selection_changed_cb), button);
+	g_signal_connect (treeview, "row-activated", G_CALLBACK (connection_double_clicked_cb), info);
 
+	/* Delete */
 	name = g_strdup_printf ("%s_delete", prefix);
-	button = glade_xml_get_widget (list->gui, name);
-	g_object_set_data (G_OBJECT (button), CONNECTION_LIST_TAG, list);
-	g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (delete_connection_cb), clist);
-	g_signal_connect (G_OBJECT (select),
-	                  "changed", G_CALLBACK (list_selection_changed_cb),
-	                  button);
+	button = glade_xml_get_widget (self->gui, name);
+	g_free (name);
+	g_signal_connect (button, "clicked", G_CALLBACK (delete_connection_cb), info);
+	g_signal_connect (selection, "changed", G_CALLBACK (list_selection_changed_cb), button);
+}
+
+static void
+add_connection_tab (NMConnectionList *self,
+				GSList *connection_types,
+				GdkPixbuf *pixbuf,
+				const char *prefix,
+				const char *label_text)
+{
+	char *name;
+	GtkWidget *child;
+	GtkWidget *hbox;
+	GtkTreeView *treeview;
+	GSList *iter;
+
+	name = g_strdup_printf ("%s_child", prefix);
+	child = glade_xml_get_widget (self->gui, name);
 	g_free (name);
 
-	return clist;
+	/* Notebook tab */
+	hbox = gtk_hbox_new (FALSE, 6);
+	if (pixbuf) {
+		GtkWidget *image;
+
+		image = gtk_image_new_from_pixbuf (pixbuf);
+		gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
+	}
+	gtk_box_pack_start (GTK_BOX (hbox), gtk_label_new (label_text), FALSE, FALSE, 0);
+	gtk_widget_show_all (hbox);
+
+	gtk_notebook_set_tab_label (GTK_NOTEBOOK (glade_xml_get_widget (self->gui, "list_notebook")), child, hbox);
+
+	treeview = add_connection_treeview (self, prefix);
+	add_connection_buttons (self, prefix, treeview);
+
+	for (iter = connection_types; iter; iter = iter->next)
+		g_hash_table_insert (self->treeviews, g_strdup ((const char *) iter->data), treeview);
 }
 
-static gboolean
-init_connection_lists (NMConnectionList *list)
+static void
+add_connection_tabs (NMConnectionList *self)
 {
-	GSList *types = NULL;
-	GtkWidget *clist;
+	GSList *types;
 
 	types = g_slist_append (NULL, NM_SETTING_WIRED_SETTING_NAME);
-	clist = new_connection_list (list, types, "wired", list->wired_icon,
-	                             _("Wired"), NM_TYPE_SETTING_WIRED);
+	add_connection_tab (self, types, self->wired_icon, "wired", _("Wired"));
 	g_slist_free (types);
 
 	types = g_slist_append (NULL, NM_SETTING_WIRELESS_SETTING_NAME);
-	clist = new_connection_list (list, types, "wireless", list->wireless_icon,
-	                             _("Wireless"), NM_TYPE_SETTING_WIRELESS);
+	add_connection_tab (self, types, self->wireless_icon, "wireless", _("Wireless"));
 	g_slist_free (types);
 
 	types = g_slist_append (NULL, NM_SETTING_GSM_SETTING_NAME);
 	types = g_slist_append (types, NM_SETTING_CDMA_SETTING_NAME);
-	clist = new_connection_list (list, types, "wwan", list->wwan_icon,
-	                             _("Mobile Broadband"), NM_TYPE_SETTING_GSM);
+	add_connection_tab (self, types, self->wwan_icon, "wwan", _("Mobile Broadband"));
 	g_slist_free (types);
 
 	types = g_slist_append (NULL, NM_SETTING_VPN_SETTING_NAME);
-	clist = new_connection_list (list, types, "vpn", list->vpn_icon,
-	                             _("VPN"), NM_TYPE_SETTING_VPN);
+	add_connection_tab (self, types, self->vpn_icon, "vpn", _("VPN"));
 	g_slist_free (types);
 
 	types = g_slist_append (NULL, NM_SETTING_PPPOE_SETTING_NAME);
-	clist = new_connection_list (list, types, "dsl", list->wired_icon,
-	                             _("DSL"), NM_TYPE_SETTING_PPPOE);
+	add_connection_tab (self, types, self->wired_icon, "dsl", _("DSL"));
 	g_slist_free (types);
-
-	return TRUE;
 }
 
 static void
-dialog_response_cb (GtkDialog *dialog, guint response, gpointer user_data)
+connection_removed (NMExportedConnection *exported, gpointer user_data)
 {
-	gtk_widget_hide (GTK_WIDGET (dialog));
+	GtkListStore *store = GTK_LIST_STORE (user_data);
+	GtkTreeIter iter;
+
+	if (get_iter_for_connection (GTK_TREE_MODEL (store), exported, &iter))
+		gtk_list_store_remove (store, &iter);
 }
 
 static void
-nm_connection_list_init (NMConnectionList *list)
+connection_updated (NMExportedConnection *exported,
+				GHashTable *settings,
+				gpointer user_data)
 {
+	GtkListStore *store = GTK_LIST_STORE (user_data);
+	GtkTreeIter iter;
+
+	if (get_iter_for_connection (GTK_TREE_MODEL (store), exported, &iter))
+		update_connection_row (store, &iter, exported);
 }
 
 static void
-dispose (GObject *object)
+connection_added (NMSettings *settings,
+			   NMExportedConnection *exported,
+			   gpointer user_data)
 {
-	NMConnectionList *list = NM_CONNECTION_LIST (object);
-
-	if (list->dialog)
-		gtk_widget_hide (list->dialog);
-
-	if (list->editors)
-		g_hash_table_destroy (list->editors);
+	NMConnectionList *self = NM_CONNECTION_LIST (user_data);
+	GtkListStore *store;
+	GtkTreeIter iter;
+	NMConnection *connection;
+	NMSettingConnection *s_con;
+	char *last_used;
 
-	if (list->wired_icon)
-		g_object_unref (list->wired_icon);
-	if (list->wireless_icon)
-		g_object_unref (list->wireless_icon);
-	if (list->wwan_icon)
-		g_object_unref (list->wwan_icon);
-	if (list->vpn_icon)
-		g_object_unref (list->vpn_icon);
-	if (list->unknown_icon)
-		g_object_unref (list->unknown_icon);
+	store = get_model_for_connection (self, exported);
+	if (!store)
+		return;
 
-	if (list->dialog)
-		gtk_widget_destroy (list->dialog);
-	if (list->gui)
-		g_object_unref (list->gui);
-	if (list->connections)
-		g_hash_table_destroy (list->connections);
-	if (list->client)
-		g_object_unref (list->client);
+	connection = nm_exported_connection_get_connection (exported);
+	s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
 
-	G_OBJECT_CLASS (nm_connection_list_parent_class)->dispose (object);
-}
+	last_used = format_last_used (s_con->timestamp);
 
-static void
-nm_connection_list_class_init (NMConnectionListClass *klass)
-{
-	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+	gtk_list_store_append (store, &iter);
+	gtk_list_store_set (store, &iter,
+	                    COL_ID, s_con->id,
+	                    COL_LAST_USED, last_used,
+	                    COL_TIMESTAMP, s_con->timestamp,
+	                    COL_CONNECTION, exported,
+	                    -1);
 
-	/* virtual methods */
-	object_class->dispose = dispose;
+	g_free (last_used);
 
-	/* Signals */
-	list_signals[LIST_DONE] =
-		g_signal_new ("done",
-					  G_OBJECT_CLASS_TYPE (object_class),
-					  G_SIGNAL_RUN_FIRST,
-					  G_STRUCT_OFFSET (NMConnectionListClass, done),
-					  NULL, NULL,
-					  g_cclosure_marshal_VOID__INT,
-					  G_TYPE_NONE, 1, G_TYPE_INT);
+	g_signal_connect (exported, "removed", G_CALLBACK (connection_removed), store);
+	g_signal_connect (exported, "updated", G_CALLBACK (connection_updated), store);
 }
 
 #define ICON_LOAD(x, y)	\
@@ -916,6 +882,7 @@
 nm_connection_list_new (void)
 {
 	NMConnectionList *list;
+	DBusGConnection *dbus_connection;
 	GError *error = NULL;
 
 	list = g_object_new (NM_TYPE_CONNECTION_LIST, NULL);
@@ -942,10 +909,25 @@
 	if (!list->client)
 		goto error;
 
-	/* read connections */
-	list->connections = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
-	load_connections (list);
-	init_connection_lists (list);
+	dbus_connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
+	if (error) {
+		g_warning ("Could not connect to the system bus: %s", error->message);
+		g_error_free (error);
+		goto error;
+	}
+
+	list->system_settings = nm_dbus_settings_system_new (dbus_connection);
+	dbus_g_connection_unref (dbus_connection);
+	g_signal_connect (list->system_settings, "new-connection",
+				   G_CALLBACK (connection_added),
+				   list);
+
+	list->gconf_settings = nma_gconf_settings_new ();
+	g_signal_connect (list->gconf_settings, "new-connection",
+				   G_CALLBACK (connection_added),
+				   list);
+
+	add_connection_tabs (list);
 
 	list->editors = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_object_unref, g_object_unref);
 

Modified: trunk/src/connection-editor/nm-connection-list.h
==============================================================================
--- trunk/src/connection-editor/nm-connection-list.h	(original)
+++ trunk/src/connection-editor/nm-connection-list.h	Mon May  5 07:17:15 2008
@@ -29,6 +29,8 @@
 #include <gdk/gdkpixbuf.h>
 #include <gtk/gtk.h>
 #include <gtk/gtkicontheme.h>
+#include <nm-dbus-settings-system.h>
+#include "nma-gconf-settings.h"
 
 #define NM_TYPE_CONNECTION_LIST    (nm_connection_list_get_type ())
 #define NM_IS_CONNECTION_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_CONNECTION_LIST))
@@ -38,10 +40,12 @@
 	GObject parent;
 
 	/* private data */
-	GHashTable *connections;
 	GHashTable *editors;
+	GHashTable *treeviews;
 
 	GConfClient *client;
+	NMAGConfSettings *gconf_settings;
+	NMDBusSettingsSystem *system_settings;
 
 	GladeXML *gui;
 	GtkWidget *dialog;

Modified: trunk/src/gconf-helpers/Makefile.am
==============================================================================
--- trunk/src/gconf-helpers/Makefile.am	(original)
+++ trunk/src/gconf-helpers/Makefile.am	Mon May  5 07:17:15 2008
@@ -4,14 +4,20 @@
 	gconf-helpers.h		\
 	gconf-helpers.c		\
 	gconf-upgrade.h		\
-	gconf-upgrade.c
+	gconf-upgrade.c		\
+	nma-gconf-connection.h	\
+	nma-gconf-connection.c	\
+	nma-gconf-settings.h	\
+	nma-gconf-settings.c
 
 libgconf_helpers_la_CPPFLAGS = \
 	$(NMA_CFLAGS) \
 	-I${top_srcdir}/src \
+	-I${top_srcdir}/src/marshallers \
 	-I${top_srcdir}/src/utils
 
 libgconf_helpers_la_LIBADD = \
 	$(NMA_LIBS) \
+	${top_builddir}/src/marshallers/libmarshallers.la \
 	${top_builddir}/src/utils/libutils.la
 

Added: trunk/src/gconf-helpers/nma-gconf-connection.c
==============================================================================
--- (empty file)
+++ trunk/src/gconf-helpers/nma-gconf-connection.c	Mon May  5 07:17:15 2008
@@ -0,0 +1,507 @@
+/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
+
+#include <string.h>
+#include <nm-setting-connection.h>
+#include <nm-setting-vpn.h>
+#include "nma-gconf-connection.h"
+#include "gconf-helpers.h"
+#include "nm-utils.h"
+#include "utils.h"
+#include "nma-marshal.h"
+
+G_DEFINE_TYPE (NMAGConfConnection, nma_gconf_connection, NM_TYPE_EXPORTED_CONNECTION)
+
+#define NMA_GCONF_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NMA_TYPE_GCONF_CONNECTION, NMAGConfConnectionPrivate))
+
+typedef struct {
+	GConfClient *client;
+	char *dir;
+	char *id;
+
+	gboolean disposed;
+} NMAGConfConnectionPrivate;
+
+enum {
+	PROP_0,
+	PROP_CLIENT,
+	PROP_DIR,
+
+	LAST_PROP
+};
+
+enum {
+	NEW_SECRETS_REQUESTED,
+
+	LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+NMAGConfConnection *
+nma_gconf_connection_new (GConfClient *client, const char *conf_dir)
+{
+	NMConnection *connection;
+	NMAGConfConnection *gconf_connection;
+
+	g_return_val_if_fail (GCONF_IS_CLIENT (client), NULL);
+	g_return_val_if_fail (conf_dir != NULL, NULL);
+
+	/* retrieve GConf data */
+	connection = nm_gconf_read_connection (client, conf_dir);
+	if (connection) {
+		gconf_connection = nma_gconf_connection_new_from_connection (client, conf_dir, connection);
+		g_object_unref (connection);
+	} else {
+		nm_warning ("No connection read from GConf at %s.", conf_dir);
+		gconf_connection = NULL;
+	}
+	
+	return gconf_connection;
+}
+
+NMAGConfConnection *
+nma_gconf_connection_new_from_connection (GConfClient *client,
+								  const char *conf_dir,
+								  NMConnection *connection)
+{
+	g_return_val_if_fail (GCONF_IS_CLIENT (client), NULL);
+	g_return_val_if_fail (conf_dir != NULL, NULL);
+	g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
+
+	return (NMAGConfConnection *) g_object_new (NMA_TYPE_GCONF_CONNECTION,
+									    NMA_GCONF_CONNECTION_CLIENT, client,
+									    NMA_GCONF_CONNECTION_DIR, conf_dir,
+									    NM_EXPORTED_CONNECTION_CONNECTION, connection,
+									    NULL);
+}
+
+const char *
+nma_gconf_connection_get_path (NMAGConfConnection *self)
+{
+	g_return_val_if_fail (NMA_IS_GCONF_CONNECTION (self), NULL);
+
+	return NMA_GCONF_CONNECTION_GET_PRIVATE (self)->dir;
+}
+
+/* FIXME: Remove and replace the callers with nm_exported_connection_update() */
+void
+nma_gconf_connection_save (NMAGConfConnection *self)
+{
+	NMAGConfConnectionPrivate *priv;
+	NMConnection *connection;
+
+	g_return_if_fail (NMA_IS_GCONF_CONNECTION (self));
+
+	priv = NMA_GCONF_CONNECTION_GET_PRIVATE (self);
+
+	connection = nm_exported_connection_get_connection (NM_EXPORTED_CONNECTION (self));
+	nm_gconf_write_connection (connection,
+	                           priv->client,
+	                           priv->dir,
+	                           priv->id);
+	gconf_client_notify (priv->client, priv->dir);
+	gconf_client_suggest_sync (priv->client, NULL);
+}
+
+static void
+fill_vpn_user_name (NMConnection *connection)
+{
+	const char *user_name;
+	NMSettingVPN *s_vpn;
+
+	s_vpn = NM_SETTING_VPN (nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN));
+	if (!s_vpn)
+		return;
+
+	g_free (s_vpn->user_name);
+	user_name = g_get_user_name ();
+	g_assert (g_utf8_validate (user_name, -1, NULL));
+	s_vpn->user_name = g_strdup (user_name);
+}
+
+gboolean
+nma_gconf_connection_changed (NMAGConfConnection *self,
+						GConfEntry *entry)
+{
+	NMAGConfConnectionPrivate *priv;
+	GHashTable *settings;
+	NMConnection *wrapped_connection;
+	NMConnection *gconf_connection;
+	GHashTable *new_settings;
+
+	g_return_val_if_fail (NMA_IS_GCONF_CONNECTION (self), FALSE);
+	g_return_val_if_fail (entry != NULL, FALSE);
+
+	priv = NMA_GCONF_CONNECTION_GET_PRIVATE (self);
+	wrapped_connection = nm_exported_connection_get_connection (NM_EXPORTED_CONNECTION (self));
+
+	/* FIXME: just update the modified field, no need to re-read all */
+	gconf_connection = nm_gconf_read_connection (priv->client, priv->dir);
+	if (!gconf_connection) {
+		g_warning ("No connection read from GConf at %s.", priv->dir);
+		goto invalid;
+	}
+
+	utils_fill_connection_certs (gconf_connection);
+	if (!nm_connection_verify (gconf_connection)) {
+		utils_clear_filled_connection_certs (gconf_connection);
+		g_warning ("Invalid connection read from GConf at %s.", priv->dir);
+		goto invalid;
+	}
+	utils_clear_filled_connection_certs (gconf_connection);
+
+	/* Ignore the GConf update if nothing changed */
+	if (nm_connection_compare (wrapped_connection, gconf_connection, COMPARE_FLAGS_EXACT))
+		return TRUE;
+
+	new_settings = nm_connection_to_hash (gconf_connection);
+	nm_connection_replace_settings (wrapped_connection, new_settings);
+	g_object_unref (gconf_connection);
+
+	fill_vpn_user_name (wrapped_connection);
+
+	utils_fill_connection_certs (wrapped_connection);
+	settings = nm_connection_to_hash (wrapped_connection);
+	utils_clear_filled_connection_certs (wrapped_connection);
+
+	nm_exported_connection_signal_updated (NM_EXPORTED_CONNECTION (self), settings);
+	g_hash_table_destroy (settings);
+	return TRUE;
+
+invalid:
+	nm_exported_connection_signal_removed (NM_EXPORTED_CONNECTION (self));
+	return FALSE;
+}
+
+
+static GHashTable *
+get_settings (NMExportedConnection *exported)
+{
+	NMConnection *connection;
+	GHashTable *settings;
+
+	connection = nm_exported_connection_get_connection (exported);
+
+	utils_fill_connection_certs (connection);
+	settings = nm_connection_to_hash (connection);
+	utils_clear_filled_connection_certs (connection);
+
+	return settings;
+}
+
+static void
+get_secrets (NMExportedConnection *exported,
+		   const gchar *setting_name,
+		   const gchar **hints,
+		   gboolean request_new,
+		   DBusGMethodInvocation *context)
+{
+	NMConnection *connection;
+	GError *error = NULL;
+	GHashTable *settings = NULL;
+	GHashTable *secrets = NULL;
+	NMSettingConnection *s_con;
+	NMSetting *setting;
+	const char *id;
+
+	connection = nm_exported_connection_get_connection (exported);
+
+	setting = nm_connection_get_setting_by_name (connection, setting_name);
+	if (!setting) {
+		g_set_error (&error, NM_SETTINGS_ERROR, 1,
+		             "%s.%d - Connection didn't have requested setting '%s'.",
+		             __FILE__, __LINE__, setting_name);
+		nm_warning ("%s", error->message);
+		dbus_g_method_return_error (context, error);
+		g_error_free (error);
+		return;
+	}
+
+	s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
+	if (!s_con || !s_con->id || !strlen (s_con->id) || !s_con->type) {
+		g_set_error (&error, NM_SETTINGS_ERROR, 1,
+		             "%s.%d - Connection didn't have required '"
+		             NM_SETTING_CONNECTION_SETTING_NAME
+		             "' setting , or the connection name was invalid.",
+		             __FILE__, __LINE__);
+		nm_warning ("%s", error->message);
+		dbus_g_method_return_error (context, error);
+		g_error_free (error);
+		return;
+	}
+
+	/* VPN passwords are handled by the VPN plugin's auth dialog */
+	if (!strcmp (s_con->type, NM_SETTING_VPN_SETTING_NAME))
+		goto get_secrets;
+
+	if (request_new) {
+		nm_info ("New secrets for %s/%s requested; ask the user",
+		         s_con->id, setting_name);
+		nm_connection_clear_secrets (connection);
+		goto get_secrets;
+	}
+
+	/* Returned secrets are a{sa{sv}}; this is the outer a{s...} hash that
+	 * will contain all the individual settings hashes.
+	 */
+	settings = g_hash_table_new_full (g_str_hash, g_str_equal,
+	                                  g_free, (GDestroyNotify) g_hash_table_destroy);
+
+	id = nm_exported_connection_get_id (exported);
+	secrets = nm_gconf_get_keyring_items (connection, id, setting_name, FALSE, &error);
+	if (!secrets) {
+		if (error) {
+			nm_warning ("Error getting secrets: %s", error->message);
+			dbus_g_method_return_error (context, error);
+			g_error_free (error);
+		} else {
+			nm_info ("No keyring secrets found for %s/%s; asking user.",
+			         s_con->id, setting_name);
+			goto get_secrets;
+		}
+	} else {
+		if (g_hash_table_size (secrets) == 0) {
+			g_hash_table_destroy (secrets);
+			nm_warning ("%s.%d - Secrets were found for setting '%s' but none"
+					  " were valid.", __FILE__, __LINE__, setting_name);
+			goto get_secrets;
+		} else {
+			g_hash_table_insert (settings, g_strdup (setting_name), secrets);
+			dbus_g_method_return (context, settings);
+		}
+	}
+
+	g_hash_table_destroy (settings);
+	return;
+
+get_secrets:
+	g_signal_emit (exported,
+	               signals[NEW_SECRETS_REQUESTED],
+	               0,
+	               setting_name,
+	               hints,
+	               request_new,
+	               context);
+}
+
+static const char *
+get_id (NMExportedConnection *self)
+{
+	return NMA_GCONF_CONNECTION_GET_PRIVATE (self)->id;
+}
+
+static void
+update (NMExportedConnection *exported, GHashTable *new_settings)
+{
+	NMAGConfConnectionPrivate *priv = NMA_GCONF_CONNECTION_GET_PRIVATE (exported);
+
+	nm_gconf_write_connection (nm_exported_connection_get_connection (exported),
+	                           priv->client,
+	                           priv->dir,
+	                           priv->id);
+	gconf_client_notify (priv->client, priv->dir);
+	gconf_client_suggest_sync (priv->client, NULL);
+}
+
+static void
+delete (NMExportedConnection *exported)
+{
+	NMAGConfConnectionPrivate *priv = NMA_GCONF_CONNECTION_GET_PRIVATE (exported);
+	GError *err = NULL;
+
+	if (!gconf_client_recursive_unset (priv->client, priv->dir, 0, &err)) {
+		g_warning ("Can not delete GConf connection: %s", err->message);
+		g_error_free (err);
+	}
+}
+
+/* GObject */
+
+static void
+nma_gconf_connection_init (NMAGConfConnection *connection)
+{
+}
+
+static GObject *
+constructor (GType type,
+		   guint n_construct_params,
+		   GObjectConstructParam *construct_params)
+{
+	GObject *object;
+	NMAGConfConnectionPrivate *priv;
+	NMConnection *connection;
+	DBusGConnection *bus;
+	GError *err = NULL;
+
+	object = G_OBJECT_CLASS (nma_gconf_connection_parent_class)->constructor (type, n_construct_params, construct_params);
+
+	if (!object)
+		return NULL;
+
+	priv = NMA_GCONF_CONNECTION_GET_PRIVATE (object);
+
+	if (!priv->client) {
+		nm_warning ("GConfClient not provided.");
+		goto err;
+	}
+
+	if (!priv->dir) {
+		nm_warning ("GConf directory not provided.");
+		goto err;
+	}
+
+	connection = nm_exported_connection_get_connection (NM_EXPORTED_CONNECTION (object));
+
+	priv->id = g_path_get_basename (priv->dir);
+	g_object_set_data (G_OBJECT (connection), NMA_CONNECTION_ID_TAG, priv->id);
+
+	utils_fill_connection_certs (connection);
+	if (!nm_connection_verify (connection)) {
+		utils_clear_filled_connection_certs (connection);
+		nm_warning ("Invalid connection read from GConf at %s.", priv->dir);
+		goto err;
+	}
+	utils_clear_filled_connection_certs (connection);
+
+	fill_vpn_user_name (connection);
+
+	bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &err);
+	if (!bus) {
+		nm_warning ("Could not get the system bus: %s", err->message);
+		g_error_free (err);
+		goto err;
+	}
+
+	nm_exported_connection_register_object (NM_EXPORTED_CONNECTION (object),
+	                                        NM_CONNECTION_SCOPE_USER,
+	                                        bus);
+	dbus_g_connection_unref (bus);
+
+	return object;
+
+ err:
+	g_object_unref (object);
+
+	return NULL;
+}
+
+static void
+dispose (GObject *object)
+{
+	NMAGConfConnectionPrivate *priv = NMA_GCONF_CONNECTION_GET_PRIVATE (object);
+	NMConnection *connection;
+
+	if (priv->disposed)
+		return;
+
+	priv->disposed = TRUE;
+
+	connection = nm_exported_connection_get_connection (NM_EXPORTED_CONNECTION (object));
+	if (connection)
+		g_object_set_data (G_OBJECT (connection), NMA_CONNECTION_ID_TAG, NULL);
+
+	g_object_unref (priv->client);
+
+	G_OBJECT_CLASS (nma_gconf_connection_parent_class)->dispose (object);
+}
+
+static void
+finalize (GObject *object)
+{
+	NMAGConfConnectionPrivate *priv = NMA_GCONF_CONNECTION_GET_PRIVATE (object);
+
+	g_free (priv->id);
+	g_free (priv->dir);
+
+	G_OBJECT_CLASS (nma_gconf_connection_parent_class)->finalize (object);
+}
+
+static void
+set_property (GObject *object, guint prop_id,
+		    const GValue *value, GParamSpec *pspec)
+{
+	NMAGConfConnectionPrivate *priv = NMA_GCONF_CONNECTION_GET_PRIVATE (object);
+
+	switch (prop_id) {
+	case PROP_CLIENT:
+		/* Construct only */
+		priv->client = g_value_dup_object (value);
+		break;
+	case PROP_DIR:
+		/* Construct only */
+		priv->dir = g_value_dup_string (value);
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+get_property (GObject *object, guint prop_id,
+		    GValue *value, GParamSpec *pspec)
+{
+	NMAGConfConnectionPrivate *priv = NMA_GCONF_CONNECTION_GET_PRIVATE (object);
+
+	switch (prop_id) {
+	case PROP_CLIENT:
+		g_value_set_object (value, priv->client);
+		break;
+	case PROP_DIR:
+		g_value_set_string (value, priv->dir);
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+nma_gconf_connection_class_init (NMAGConfConnectionClass *gconf_connection_class)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (gconf_connection_class);
+	NMExportedConnectionClass *connection_class = NM_EXPORTED_CONNECTION_CLASS (gconf_connection_class);
+
+	g_type_class_add_private (gconf_connection_class, sizeof (NMAGConfConnectionPrivate));
+
+	/* Virtual methods */
+	object_class->constructor  = constructor;
+	object_class->set_property = set_property;
+	object_class->get_property = get_property;
+	object_class->dispose      = dispose;
+	object_class->finalize     = finalize;
+
+	connection_class->get_settings = get_settings;
+	connection_class->get_secrets  = get_secrets;
+	connection_class->get_id       = get_id;
+	connection_class->update       = update;
+	connection_class->delete       = delete;
+
+	/* Properties */
+	g_object_class_install_property
+		(object_class, PROP_CLIENT,
+		 g_param_spec_object (NMA_GCONF_CONNECTION_CLIENT,
+						  "GConfClient",
+						  "GConfClient",
+						  GCONF_TYPE_CLIENT,
+						  G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+	g_object_class_install_property
+		(object_class, PROP_DIR,
+		 g_param_spec_string (NMA_GCONF_CONNECTION_DIR,
+						  "GConf directory",
+						  "GConf directory",
+						  NULL,
+						  G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+	/* Signals */
+	signals[NEW_SECRETS_REQUESTED] =
+		g_signal_new ("new-secrets-requested",
+				    G_OBJECT_CLASS_TYPE (object_class),
+				    G_SIGNAL_RUN_FIRST,
+				    G_STRUCT_OFFSET (NMAGConfConnectionClass, new_secrets_requested),
+				    NULL, NULL,
+				    nma_marshal_VOID__STRING_POINTER_BOOLEAN_POINTER,
+				    G_TYPE_NONE, 4,
+				    G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_BOOLEAN, G_TYPE_POINTER);
+}

Added: trunk/src/gconf-helpers/nma-gconf-connection.h
==============================================================================
--- (empty file)
+++ trunk/src/gconf-helpers/nma-gconf-connection.h	Mon May  5 07:17:15 2008
@@ -0,0 +1,55 @@
+/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
+
+#ifndef NMA_GCONF_CONNECTION_H
+#define NMA_GCONF_CONNECTION_H
+
+#include <gconf/gconf-client.h>
+#include <dbus/dbus-glib.h>
+#include <nm-settings.h>
+
+G_BEGIN_DECLS
+
+#define NMA_TYPE_GCONF_CONNECTION            (nma_gconf_connection_get_type ())
+#define NMA_GCONF_CONNECTION(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), NMA_TYPE_GCONF_CONNECTION, NMAGConfConnection))
+#define NMA_GCONF_CONNECTION_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), NMA_TYPE_GCONF_CONNECTION, NMAGConfConnectionClass))
+#define NMA_IS_GCONF_CONNECTION(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NMA_TYPE_GCONF_CONNECTION))
+#define NMA_IS_GCONF_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), NMA_TYPE_GCONF_CONNECTION))
+#define NMA_GCONF_CONNECTION_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), NMA_TYPE_GCONF_CONNECTION, NMAGConfConnectionClass))
+
+#define NMA_GCONF_CONNECTION_CLIENT "client"
+#define NMA_GCONF_CONNECTION_DIR    "dir"
+
+typedef struct {
+	NMExportedConnection parent;
+} NMAGConfConnection;
+
+typedef struct {
+	NMExportedConnectionClass parent;
+
+	/* Signals */
+	void (*new_secrets_requested)  (NMAGConfConnection *self,
+	                                const char *setting_name,
+	                                const char **hints,
+	                                gboolean ask_user,
+	                                DBusGMethodInvocation *context);
+} NMAGConfConnectionClass;
+
+GType nma_gconf_connection_get_type (void);
+
+NMAGConfConnection *nma_gconf_connection_new  (GConfClient *client,
+									  const char *conf_dir);
+
+NMAGConfConnection *nma_gconf_connection_new_from_connection (GConfClient *client,
+												  const char *conf_dir,
+												  NMConnection *connection);
+
+const char         *nma_gconf_connection_get_path (NMAGConfConnection *self);
+
+void                nma_gconf_connection_save (NMAGConfConnection *self);
+
+gboolean            nma_gconf_connection_changed (NMAGConfConnection *self,
+										GConfEntry *entry);
+
+G_END_DECLS
+
+#endif /* NMA_GCONF_CONNECTION_H */

Added: trunk/src/gconf-helpers/nma-gconf-settings.c
==============================================================================
--- (empty file)
+++ trunk/src/gconf-helpers/nma-gconf-settings.c	Mon May  5 07:17:15 2008
@@ -0,0 +1,381 @@
+/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
+
+#include <string.h>
+#include <stdio.h>
+#include "nma-gconf-settings.h"
+#include "gconf-helpers.h"
+#include "nma-marshal.h"
+#include "nm-utils.h"
+
+G_DEFINE_TYPE (NMAGConfSettings, nma_gconf_settings, NM_TYPE_SETTINGS)
+
+#define NMA_GCONF_SETTINGS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NMA_TYPE_GCONF_SETTINGS, NMAGConfSettingsPrivate))
+
+typedef struct {
+	GConfClient *client;
+	guint conf_notify_id;
+	GSList *connections;
+	guint read_connections_id;
+
+	gboolean disposed;
+} NMAGConfSettingsPrivate;
+
+enum {
+	NEW_SECRETS_REQUESTED,
+
+	LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+
+NMAGConfSettings *
+nma_gconf_settings_new (void)
+{
+	return (NMAGConfSettings *) g_object_new (NMA_TYPE_GCONF_SETTINGS, NULL);
+}
+
+static void
+connection_new_secrets_requested_cb (NMAGConfConnection *connection,
+                                     const char *setting_name,
+                                     const char **hints,
+                                     gboolean ask_user,
+                                     DBusGMethodInvocation *context,
+                                     gpointer user_data)
+{
+	NMAGConfSettings *self = NMA_GCONF_SETTINGS (user_data);
+
+	/* Re-emit the signal to listeners so they don't have to know about
+	 * every single connection
+	 */
+	g_signal_emit (self,
+	               signals[NEW_SECRETS_REQUESTED],
+	               0,
+	               connection,
+	               setting_name,
+	               hints,
+	               ask_user,
+	               context);
+}
+
+static void
+add_connection_real (NMAGConfSettings *self, NMAGConfConnection *connection)
+{
+	NMAGConfSettingsPrivate *priv = NMA_GCONF_SETTINGS_GET_PRIVATE (self);
+
+	if (connection) {
+		priv->connections = g_slist_prepend (priv->connections, connection);
+		g_signal_connect (connection, "new-secrets-requested",
+					   G_CALLBACK (connection_new_secrets_requested_cb),
+					   self);
+
+		nm_settings_signal_new_connection (NM_SETTINGS (self),
+									NM_EXPORTED_CONNECTION (connection));
+	}
+}
+
+NMAGConfConnection *
+nma_gconf_settings_add_connection (NMAGConfSettings *self, NMConnection *connection)
+{
+	NMAGConfSettingsPrivate *priv;
+	NMAGConfConnection *exported;
+	guint32 i = 0;
+	char *path = NULL;
+
+	g_return_val_if_fail (NMA_IS_GCONF_SETTINGS (self), NULL);
+	g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
+
+	priv = NMA_GCONF_SETTINGS_GET_PRIVATE (self);
+
+	/* Find free GConf directory */
+	while (i++ < G_MAXUINT32) {
+		char buf[255];
+
+		snprintf (&buf[0], 255, GCONF_PATH_CONNECTIONS"/%d", i);
+		if (!gconf_client_dir_exists (priv->client, buf, NULL)) {
+			path = g_strdup_printf (buf);
+			break;
+		}
+	}
+
+	if (path == NULL) {
+		nm_warning ("Couldn't find free GConf directory for new connection.");
+		return NULL;
+	}
+
+	exported = nma_gconf_connection_new_from_connection (priv->client, path, connection);
+	g_free (path);
+	if (!exported)
+		return NULL;
+
+	add_connection_real (self, exported);
+
+	/* Must save connection to GConf _after_ adding it to the connections
+	 * list to avoid races with GConf notifications.
+	 */
+	nma_gconf_connection_save (exported);
+
+	return exported;
+}
+
+NMAGConfConnection *
+nma_gconf_settings_get_by_path (NMAGConfSettings *self, const char *path)
+{
+	NMAGConfSettingsPrivate *priv;
+	GSList *iter;
+
+	g_return_val_if_fail (NMA_IS_GCONF_SETTINGS (self), NULL);
+	g_return_val_if_fail (path != NULL, NULL);
+
+	priv = NMA_GCONF_SETTINGS_GET_PRIVATE (self);
+	for (iter = priv->connections; iter; iter = iter->next) {
+		NMAGConfConnection *connection = NMA_GCONF_CONNECTION (iter->data);
+		const char *gconf_path;
+
+		gconf_path = nma_gconf_connection_get_path (connection);
+		if (gconf_path && !strcmp (gconf_path, path))
+			return connection;
+	}
+
+	return NULL;
+}
+
+NMAGConfConnection *
+nma_gconf_settings_get_by_dbus_path (NMAGConfSettings *self,
+							  const char *path)
+{
+	NMAGConfSettingsPrivate *priv;
+	GSList *iter;
+
+	g_return_val_if_fail (NMA_IS_GCONF_SETTINGS (self), NULL);
+	g_return_val_if_fail (path != NULL, NULL);
+
+	priv = NMA_GCONF_SETTINGS_GET_PRIVATE (self);
+	for (iter = priv->connections; iter; iter = iter->next) {
+		NMAGConfConnection *connection = NMA_GCONF_CONNECTION (iter->data);
+		NMConnection *wrapped;
+		const char *sc_path;
+
+		wrapped = nm_exported_connection_get_connection (NM_EXPORTED_CONNECTION (connection));
+		sc_path = nm_connection_get_path (wrapped);
+
+		if (sc_path && !strcmp (sc_path, path))
+			return connection;
+	}
+
+	return NULL;
+}
+
+NMAGConfConnection *
+nma_gconf_settings_get_by_connection (NMAGConfSettings *self,
+							   NMConnection *connection)
+{
+	NMAGConfSettingsPrivate *priv;
+	GSList *iter;
+
+	g_return_val_if_fail (NMA_IS_GCONF_SETTINGS (self), NULL);
+	g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
+
+	priv = NMA_GCONF_SETTINGS_GET_PRIVATE (self);
+
+	for (iter = priv->connections; iter; iter = iter->next) {
+		NMConnection *wrapped;
+
+		wrapped = nm_exported_connection_get_connection (NM_EXPORTED_CONNECTION (iter->data));
+		if (connection == wrapped)
+			return NMA_GCONF_CONNECTION (iter->data);
+	}
+
+	return NULL;
+}
+
+static void
+read_connections (NMAGConfSettings *settings)
+{
+	NMAGConfSettingsPrivate *priv = NMA_GCONF_SETTINGS_GET_PRIVATE (settings);
+	GSList *dir_list;
+	GSList *iter;
+
+	dir_list = nm_gconf_get_all_connections (priv->client);
+	if (!dir_list) {
+		g_warning ("No connections defined");
+		return;
+	}
+
+	for (iter = dir_list; iter; iter = iter->next) {
+		char *dir = (char *) iter->data;
+
+		add_connection_real (settings, nma_gconf_connection_new (priv->client, dir));
+		g_free (dir);
+	}
+
+	g_slist_free (dir_list);
+	priv->connections = g_slist_reverse (priv->connections);
+}
+
+static gboolean
+read_connections_cb (gpointer data)
+{
+	NMA_GCONF_SETTINGS_GET_PRIVATE (data)->read_connections_id = 0;
+	read_connections (NMA_GCONF_SETTINGS (data));
+
+	return FALSE;
+}
+
+static GSList *
+list_connections (NMSettings *settings)
+{
+	NMAGConfSettingsPrivate *priv = NMA_GCONF_SETTINGS_GET_PRIVATE (settings);
+
+	if (priv->read_connections_id) {
+		g_source_remove (priv->read_connections_id);
+		priv->read_connections_id = 0;
+
+		read_connections (NMA_GCONF_SETTINGS (settings));
+	}
+
+	return g_slist_copy (priv->connections);
+}
+
+static void
+connections_changed_cb (GConfClient *conf_client,
+                        guint cnxn_id,
+                        GConfEntry *entry,
+                        gpointer user_data)
+{
+	NMAGConfSettings *self = NMA_GCONF_SETTINGS (user_data);
+	NMAGConfSettingsPrivate *priv = NMA_GCONF_SETTINGS_GET_PRIVATE (self);
+	char **dirs = NULL;
+	guint len;
+	char *path = NULL;
+	NMAGConfConnection *connection;
+	gboolean valid = FALSE;
+
+	dirs = g_strsplit (gconf_entry_get_key (entry), "/", -1);
+	len = g_strv_length (dirs);
+	if (len < 5)
+		goto out;
+
+	if (   strcmp (dirs[0], "")
+	    || strcmp (dirs[1], "system")
+	    || strcmp (dirs[2], "networking")
+	    || strcmp (dirs[3], "connections"))
+		goto out;
+
+	path = g_strconcat ("/", dirs[1], "/", dirs[2], "/", dirs[3], "/", dirs[4], NULL);
+	connection = nma_gconf_settings_get_by_path (self, path);
+	if (!connection) {
+		/* New connection */
+		connection = nma_gconf_connection_new (priv->client, path);
+		if (connection) {
+			g_signal_connect (connection, "new-secrets-requested",
+						   G_CALLBACK (connection_new_secrets_requested_cb),
+						   self);
+			priv->connections = g_slist_append (priv->connections, connection);
+			nm_settings_signal_new_connection (NM_SETTINGS (self),
+										NM_EXPORTED_CONNECTION (connection));
+		}
+	} else {
+		/* Updated or removed connection */
+		valid = nma_gconf_connection_changed (connection, entry);
+		if (!valid)
+			priv->connections = g_slist_remove (priv->connections, connection);
+	}
+
+out:
+	g_free (path);
+	g_strfreev (dirs);
+}
+
+/* GObject */
+
+static void
+nma_gconf_settings_init (NMAGConfSettings *settings)
+{
+	NMAGConfSettingsPrivate *priv = NMA_GCONF_SETTINGS_GET_PRIVATE (settings);
+
+	priv->client = gconf_client_get_default ();
+
+	gconf_client_add_dir (priv->client,
+	                      GCONF_PATH_CONNECTIONS,
+	                      GCONF_CLIENT_PRELOAD_NONE,
+	                      NULL);
+
+	priv->conf_notify_id = gconf_client_notify_add (priv->client,
+										   GCONF_PATH_CONNECTIONS,
+										   (GConfClientNotifyFunc) connections_changed_cb,
+										   settings,
+										   NULL, NULL);
+}
+
+static GObject *
+constructor (GType type,
+		   guint n_construct_params,
+		   GObjectConstructParam *construct_params)
+{
+	GObject *object;
+	NMAGConfSettingsPrivate *priv;
+
+	object = G_OBJECT_CLASS (nma_gconf_settings_parent_class)->constructor (type, n_construct_params, construct_params);
+
+	if (!object)
+		return NULL;
+
+	priv = NMA_GCONF_SETTINGS_GET_PRIVATE (object);
+
+	priv->read_connections_id = g_idle_add (read_connections_cb, object);
+
+	return object;
+}
+
+static void
+dispose (GObject *object)
+{
+	NMAGConfSettingsPrivate *priv = NMA_GCONF_SETTINGS_GET_PRIVATE (object);
+
+	if (priv->disposed)
+		return;
+
+	priv->disposed = TRUE;
+
+	if (priv->read_connections_id) {
+		g_source_remove (priv->read_connections_id);
+		priv->read_connections_id = 0;
+	}
+
+	gconf_client_notify_remove (priv->client, priv->conf_notify_id);
+	gconf_client_remove_dir (priv->client, GCONF_PATH_CONNECTIONS, NULL);
+
+	g_slist_foreach (priv->connections, (GFunc) g_object_unref, NULL);
+	g_slist_free (priv->connections);
+
+	g_object_unref (priv->client);
+
+	G_OBJECT_CLASS (nma_gconf_settings_parent_class)->dispose (object);
+}
+
+static void
+nma_gconf_settings_class_init (NMAGConfSettingsClass *gconf_settings_class)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (gconf_settings_class);
+	NMSettingsClass *settings_class = NM_SETTINGS_CLASS (gconf_settings_class);
+
+	g_type_class_add_private (gconf_settings_class, sizeof (NMAGConfSettingsPrivate));
+
+	/* Virtual methods */
+	object_class->constructor = constructor;
+	object_class->dispose = dispose;
+
+	settings_class->list_connections = list_connections;
+
+	/* Signals */
+	signals[NEW_SECRETS_REQUESTED] =
+		g_signal_new ("new-secrets-requested",
+				    G_OBJECT_CLASS_TYPE (object_class),
+				    G_SIGNAL_RUN_FIRST,
+				    G_STRUCT_OFFSET (NMAGConfSettingsClass, new_secrets_requested),
+				    NULL, NULL,
+				    nma_marshal_VOID__OBJECT_STRING_POINTER_BOOLEAN_POINTER,
+				    G_TYPE_NONE, 5,
+				    G_TYPE_OBJECT, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_BOOLEAN, G_TYPE_POINTER);
+}

Added: trunk/src/gconf-helpers/nma-gconf-settings.h
==============================================================================
--- (empty file)
+++ trunk/src/gconf-helpers/nma-gconf-settings.h	Mon May  5 07:17:15 2008
@@ -0,0 +1,54 @@
+/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
+
+#ifndef NMA_GCONF_SETTINGS_H
+#define NMA_GCONF_SETTINGS_H
+
+#include <dbus/dbus-glib.h>
+#include <nm-connection.h>
+#include <nm-settings.h>
+#include "nma-gconf-connection.h"
+
+G_BEGIN_DECLS
+
+#define NMA_TYPE_GCONF_SETTINGS            (nma_gconf_settings_get_type ())
+#define NMA_GCONF_SETTINGS(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), NMA_TYPE_GCONF_SETTINGS, NMAGConfSettings))
+#define NMA_GCONF_SETTINGS_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), NMA_TYPE_GCONF_SETTINGS, NMAGConfSettingsClass))
+#define NMA_IS_GCONF_SETTINGS(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NMA_TYPE_GCONF_SETTINGS))
+#define NMA_IS_GCONF_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), NMA_TYPE_GCONF_SETTINGS))
+#define NMA_GCONF_SETTINGS_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), NMA_TYPE_GCONF_SETTINGS, NMAGConfSettingsClass))
+
+typedef struct {
+	NMSettings parent;
+} NMAGConfSettings;
+
+typedef struct {
+	NMSettingsClass parent;
+
+	/* Signals */
+	void (*new_secrets_requested) (NMAGConfSettings *self,
+							 NMAGConfConnection *exported,
+							 const char *setting_name,
+							 const char **hints,
+							 gboolean ask_user,
+							 DBusGMethodInvocation *context);
+} NMAGConfSettingsClass;
+
+GType nma_gconf_settings_get_type (void);
+
+NMAGConfSettings *nma_gconf_settings_new (void);
+
+NMAGConfConnection *nma_gconf_settings_add_connection (NMAGConfSettings *self,
+											NMConnection *connection);
+
+NMAGConfConnection *nma_gconf_settings_get_by_path (NMAGConfSettings *self,
+										  const char *path);
+
+NMAGConfConnection *nma_gconf_settings_get_by_dbus_path (NMAGConfSettings *self,
+											  const char *path);
+
+NMAGConfConnection *nma_gconf_settings_get_by_connection (NMAGConfSettings *self,
+											   NMConnection *connection);
+
+G_END_DECLS
+
+#endif /* NMA_GCONF_SETTINGS_H */

Added: trunk/src/marshallers/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/src/marshallers/Makefile.am	Mon May  5 07:17:15 2008
@@ -0,0 +1,35 @@
+noinst_LTLIBRARIES = libmarshallers.la
+
+BUILT_SOURCES = \
+	nma-marshal.h \
+	nma-marshal.c
+
+libmarshallers_la_SOURCES = \
+	nma-marshal-main.c
+
+libmarshallers_la_CPPFLAGS = \
+	$(GOBJECT_CFLAGS) \
+	-g \
+	-Wall \
+	-DG_DISABLE_DEPRECATED
+
+
+libmarshallers_la_LIBADD = $(GOBJECT_LIBS)
+
+EXTRA_DIST = nma-marshal.list
+CLEANFILES = $(BUILT_SOURCES)
+
+nma-marshal.h: nma-marshal.list
+	$(GLIB_GENMARSHAL) --prefix=nma_marshal $(srcdir)/nma-marshal.list --header > \
+		xgen-gmh \
+	&& (cmp -s xgen-gmh nma-marshal.h || cp xgen-gmh nma-marshal.h) \
+	&& rm -f xgen-gmh xgen-gmh~
+
+nma-marshal.c: nma-marshal.list
+	$(GLIB_GENMARSHAL) --prefix=nma_marshal $(srcdir)/nma-marshal.list --body > \
+		xgen-gmc \
+	&& cp xgen-gmc nma-marshal.c \
+	&& rm -f xgen-gmc xgen-gmc~
+
+nma-marshal-main.c: nma-marshal.c nma-marshal.h
+

Added: trunk/src/marshallers/nma-marshal-main.c
==============================================================================
--- (empty file)
+++ trunk/src/marshallers/nma-marshal-main.c	Mon May  5 07:17:15 2008
@@ -0,0 +1,2 @@
+#include "nma-marshal.h"
+#include "nma-marshal.c"

Copied: trunk/src/marshallers/nma-marshal.list (from r710, /trunk/src/applet-marshal.list)
==============================================================================



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