- available = nm_device_get_available_connections (device, specific_object_path);
- for (i = 0; available && i < available->len; i++) {
- NMSettingsConnection *candidate = g_ptr_array_index (available, i);
- guint64 candidate_timestamp = 0;
-
- nm_settings_connection_get_timestamp (candidate, &candidate_timestamp);
- if (!connection_path || (candidate_timestamp > best_timestamp)) {
- connection_path = nm_connection_get_path (NM_CONNECTION (candidate));
- best_timestamp = candidate_timestamp;
- }
- }
-
- if (available)
- g_ptr_array_free (available, TRUE);
-
- if (!connection_path) {
- error = g_error_new_literal (NM_MANAGER_ERROR,
- NM_MANAGER_ERROR_UNKNOWN_CONNECTION,
- "The device has no connections available.");