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); }