From c5a9312e24e18bd4090d772bc0c26920e65409c8 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Mon, 24 Mar 2008 19:30:11 +0000 Subject: [PATCH] 2008-03-24 Dan Williams * libnm-glib/nm-client.c - (client_device_added_proxy): add new devices to the internal device list so they appear to clients git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3496 4912f4e0-d625-0410-9fb7-b9a5a253dbdc --- ChangeLog | 6 ++++++ libnm-glib/nm-client.c | 18 ++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a27f26dd24..4005e3f891 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-03-24 Dan Williams + + * libnm-glib/nm-client.c + - (client_device_added_proxy): add new devices to the internal device + list so they appear to clients + 2008-03-24 Dan Williams Massive fixup of libnm-glib to: diff --git a/libnm-glib/nm-client.c b/libnm-glib/nm-client.c index 6229b53806..02f29856ff 100644 --- a/libnm-glib/nm-client.c +++ b/libnm-glib/nm-client.c @@ -426,9 +426,23 @@ static void client_device_added_proxy (DBusGProxy *proxy, char *path, gpointer user_data) { NMClient *client = NM_CLIENT (user_data); - NMDevice *device; + NMClientPrivate *priv = NM_CLIENT_GET_PRIVATE (client); + GObject *device; + + device = G_OBJECT (nm_client_get_device_by_path (client, path)); + if (!device) { + DBusGConnection *connection = nm_object_get_connection (NM_OBJECT (client)); + + device = G_OBJECT (nm_object_cache_get (path)); + if (device) { + g_ptr_array_add (priv->devices, g_object_ref (device)); + } else { + device = G_OBJECT (nm_device_new (connection, path)); + if (device) + g_ptr_array_add (priv->devices, device); + } + } - device = nm_client_get_device_by_path (client, path); if (device) g_signal_emit (client, signals[DEVICE_ADDED], 0, device); }