mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-14 23:00:36 +01:00
core: add nm_connection_provider_get_connection_by_uuid()
This commit is contained in:
parent
c23e1bbb44
commit
12fb2519af
3 changed files with 33 additions and 0 deletions
|
|
@ -14,6 +14,7 @@
|
|||
*/
|
||||
|
||||
#include "nm-connection-provider.h"
|
||||
#include "nm-utils.h"
|
||||
|
||||
GSList *
|
||||
nm_connection_provider_get_best_connections (NMConnectionProvider *self,
|
||||
|
|
@ -75,6 +76,25 @@ nm_connection_provider_add_connection (NMConnectionProvider *self,
|
|||
return NM_CONNECTION_PROVIDER_GET_INTERFACE (self)->add_connection (self, connection, save_to_disk, error);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_connection_provider_get_connection_by_uuid:
|
||||
* @self: the #NMConnectionProvider
|
||||
* @uuid: the UUID to search for
|
||||
*
|
||||
* Returns: the connection with the given @uuid, or %NULL
|
||||
*/
|
||||
NMConnection *
|
||||
nm_connection_provider_get_connection_by_uuid (NMConnectionProvider *self,
|
||||
const char *uuid)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_CONNECTION_PROVIDER (self), NULL);
|
||||
g_return_val_if_fail (uuid != NULL, NULL);
|
||||
g_return_val_if_fail (nm_utils_is_uuid (uuid), NULL);
|
||||
|
||||
g_assert (NM_CONNECTION_PROVIDER_GET_INTERFACE (self)->get_connection_by_uuid);
|
||||
return NM_CONNECTION_PROVIDER_GET_INTERFACE (self)->get_connection_by_uuid (self, uuid);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -65,6 +65,9 @@ struct _NMConnectionProvider {
|
|||
gboolean save_to_disk,
|
||||
GError **error);
|
||||
|
||||
NMConnection * (*get_connection_by_uuid) (NMConnectionProvider *self,
|
||||
const char *uuid);
|
||||
|
||||
/* Signals */
|
||||
void (*connection_added) (NMConnectionProvider *self, NMConnection *connection);
|
||||
|
||||
|
|
@ -137,4 +140,7 @@ NMConnection *nm_connection_provider_add_connection (NMConnectionProvider *self,
|
|||
gboolean save_to_disk,
|
||||
GError **error);
|
||||
|
||||
NMConnection *nm_connection_provider_get_connection_by_uuid (NMConnectionProvider *self,
|
||||
const char *uuid);
|
||||
|
||||
#endif /* NM_CONNECTION_PROVIDER_H */
|
||||
|
|
|
|||
|
|
@ -1730,6 +1730,12 @@ has_connections_loaded (NMConnectionProvider *provider)
|
|||
return priv->connections_loaded;
|
||||
}
|
||||
|
||||
static NMConnection *
|
||||
cp_get_connection_by_uuid (NMConnectionProvider *provider, const char *uuid)
|
||||
{
|
||||
return NM_CONNECTION (nm_settings_get_connection_by_uuid (NM_SETTINGS (provider), uuid));
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
|
||||
NMSettings *
|
||||
|
|
@ -1765,6 +1771,7 @@ connection_provider_init (NMConnectionProvider *cp_class)
|
|||
cp_class->get_connections = get_connections;
|
||||
cp_class->has_connections_loaded = has_connections_loaded;
|
||||
cp_class->add_connection = _nm_connection_provider_add_connection;
|
||||
cp_class->get_connection_by_uuid = cp_get_connection_by_uuid;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue