diff --git a/ChangeLog b/ChangeLog index a93bcb5c5..6eed4c58e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-09-20 Dan Williams + + * src/nm-manager.h + src/nm-device.c + - (nm_device_activate): actually check if a given connection + exists before assuming it doesn't + 2007-09-20 Tambet Ingo * libnm-util/nm-connection.c (register_default_creators): Use defined diff --git a/src/nm-device.c b/src/nm-device.c index eb1640d99..70c099b22 100644 --- a/src/nm-device.c +++ b/src/nm-device.c @@ -1221,6 +1221,21 @@ nm_device_activate (NMDeviceInterface *device, g_return_if_fail (connection_path == NULL); } + if (!connection) { + NMManager *mgr = nm_manager_get (); + NMConnectionType type = NM_CONNECTION_TYPE_UNKNOWN; + + if (!strcmp (service_name, NM_DBUS_SERVICE_USER_SETTINGS)) + type = NM_CONNECTION_TYPE_USER; + else if (!strcmp (service_name, NM_DBUS_SERVICE_SYSTEM_SETTINGS)) + type = NM_CONNECTION_TYPE_SYSTEM; + + if (type != NM_CONNECTION_TYPE_UNKNOWN) + connection = nm_manager_get_connection_by_object_path (mgr, type, connection_path); + + g_object_unref (mgr); + } + nm_info ("Activating device %s", nm_device_get_iface (self)); if (connection) { if (device_activation_precheck (self, connection) == FALSE) diff --git a/src/nm-manager.h b/src/nm-manager.h index e548ff727..8f1415eaf 100644 --- a/src/nm-manager.h +++ b/src/nm-manager.h @@ -55,7 +55,8 @@ void nm_manager_sleep (NMManager *manager, gboolean sleep); /* Connections */ typedef enum { - NM_CONNECTION_TYPE_SYSTEM = 0, + NM_CONNECTION_TYPE_UNKNOWN = 0, + NM_CONNECTION_TYPE_SYSTEM, NM_CONNECTION_TYPE_USER, } NMConnectionType;