[network-manager-applet/polkit1] settings: fixups for latest libnm-glib changes
- From: Dan Williams <dcbw src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [network-manager-applet/polkit1] settings: fixups for latest libnm-glib changes
- Date: Tue, 11 Aug 2009 05:04:31 +0000 (UTC)
commit 6828805e982d1dd98261df17be0c2f2a08a0a57e
Author: Dan Williams <dcbw redhat com>
Date: Mon Aug 10 23:39:40 2009 -0500
settings: fixups for latest libnm-glib changes
src/gconf-helpers/nma-gconf-connection.c | 20 ------------------
src/gconf-helpers/nma-gconf-settings.c | 33 +++++++++++++----------------
2 files changed, 15 insertions(+), 38 deletions(-)
---
diff --git a/src/gconf-helpers/nma-gconf-connection.c b/src/gconf-helpers/nma-gconf-connection.c
index e74e248..9837663 100644
--- a/src/gconf-helpers/nma-gconf-connection.c
+++ b/src/gconf-helpers/nma-gconf-connection.c
@@ -112,12 +112,9 @@ nma_gconf_connection_new_from_connection (GConfClient *client,
{
GObject *object;
NMAGConfConnection *self;
- static guint32 ec_counter = 0;
- DBusGConnection *bus;
GError *error = NULL;
gboolean success;
GHashTable *settings;
- char *path;
g_return_val_if_fail (GCONF_IS_CLIENT (client), NULL);
g_return_val_if_fail (conf_dir != NULL, NULL);
@@ -156,23 +153,6 @@ nma_gconf_connection_new_from_connection (GConfClient *client,
fill_vpn_user_name (NM_CONNECTION (self));
- bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
- if (!bus) {
- nm_warning ("Could not get the system bus: (%d) %s",
- error ? error->code : -1,
- (error && error->message) ? error->message : "(unknown)");
- g_error_free (error);
- g_object_unref (object);
- return NULL;
- }
-
- /* Export the object over D-Bus */
- path = g_strdup_printf ("%s/%u", NM_DBUS_PATH_SETTINGS, ec_counter++);
- nm_connection_set_path (NM_CONNECTION (self), path);
- dbus_g_connection_register_g_object (bus, path, G_OBJECT (self));
- g_free (path);
- dbus_g_connection_unref (bus);
-
return self;
}
diff --git a/src/gconf-helpers/nma-gconf-settings.c b/src/gconf-helpers/nma-gconf-settings.c
index d213dd5..2aabe58 100644
--- a/src/gconf-helpers/nma-gconf-settings.c
+++ b/src/gconf-helpers/nma-gconf-settings.c
@@ -100,6 +100,7 @@ static void
internal_add_connection (NMAGConfSettings *self, NMAGConfConnection *connection)
{
NMAGConfSettingsPrivate *priv = NMA_GCONF_SETTINGS_GET_PRIVATE (self);
+ DBusGConnection *bus = NULL;
g_return_if_fail (connection != NULL);
@@ -109,6 +110,14 @@ internal_add_connection (NMAGConfSettings *self, NMAGConfConnection *connection)
self);
g_signal_connect (connection, "removed", G_CALLBACK (connection_removed), self);
+
+ g_object_get (G_OBJECT (self), NM_SETTINGS_SERVICE_BUS, &bus, NULL);
+ if (bus) {
+ nm_settings_service_export_connection (NM_SETTINGS_SERVICE (self),
+ NM_SETTINGS_CONNECTION_INTERFACE (connection));
+ dbus_g_connection_unref (bus);
+ }
+
g_signal_emit_by_name (self, NM_SETTINGS_INTERFACE_NEW_CONNECTION, NM_CONNECTION (connection));
}
@@ -191,21 +200,6 @@ get_connection_by_gconf_path (NMAGConfSettings *self, const char *path)
return NULL;
}
-static NMExportedConnection *
-get_connection_by_path (NMSettingsService *settings, const char *path)
-{
- NMAGConfSettingsPrivate *priv = NMA_GCONF_SETTINGS_GET_PRIVATE (settings);
- GSList *iter;
-
- for (iter = priv->connections; iter; iter = iter->next) {
- NMConnection *connection = NM_CONNECTION (iter->data);
-
- if (!strcmp (nm_connection_get_path (connection), path))
- return NM_EXPORTED_CONNECTION (connection);
- }
- return NULL;
-}
-
static void
read_connections (NMAGConfSettings *settings)
{
@@ -219,8 +213,11 @@ read_connections (NMAGConfSettings *settings)
for (iter = dir_list; iter; iter = iter->next) {
char *dir = (char *) iter->data;
+ NMAGConfConnection *connection;
- internal_add_connection (settings, nma_gconf_connection_new (priv->client, dir));
+ connection = nma_gconf_connection_new (priv->client, dir);
+ if (connection)
+ internal_add_connection (settings, connection);
g_free (dir);
}
@@ -277,7 +274,8 @@ connection_changes_done (gpointer data)
if (!connection) {
/* New connection */
connection = nma_gconf_connection_new (priv->client, info->path);
- internal_add_connection (info->settings, connection);
+ if (connection)
+ internal_add_connection (info->settings, connection);
} else {
if (gconf_client_dir_exists (priv->client, info->path, NULL)) {
/* Updated connection */
@@ -417,7 +415,6 @@ nma_gconf_settings_class_init (NMAGConfSettingsClass *class)
object_class->dispose = dispose;
settings_class->list_connections = list_connections;
- settings_class->get_connection_by_path = get_connection_by_path;
/* Signals */
signals[NEW_SECRETS_REQUESTED] =
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]