mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-05 08:00:15 +01:00
libnm-core-aux-intern: Add helper function _nm_connection_ensure_setting()
Introduce internal function `_nm_connection_ensure_setting()` to `libnm-core-aux-intern` and add specified setting to connection if not found. Signed-off-by: Gris Ge <fge@redhat.com>
This commit is contained in:
parent
bbb7eb1767
commit
c265096d66
2 changed files with 16 additions and 0 deletions
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "nm-common-macros.h"
|
||||
#include "nm-errors.h"
|
||||
#include "libnm-core-public/nm-connection.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
@ -358,3 +359,16 @@ nm_settings_connection_validate_permission_user(const char *item, gssize len)
|
|||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gpointer
|
||||
_nm_connection_ensure_setting(NMConnection *connection, GType gtype)
|
||||
{
|
||||
NMSetting *setting;
|
||||
|
||||
setting = (gpointer) nm_connection_get_setting(connection, gtype);
|
||||
if (!setting) {
|
||||
setting = g_object_new(gtype, NULL);
|
||||
nm_connection_add_setting(connection, setting);
|
||||
}
|
||||
return setting;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -166,4 +166,6 @@ gboolean nm_utils_validate_dhcp4_vendor_class_id(const char *vci, GError **error
|
|||
|
||||
gboolean nm_settings_connection_validate_permission_user(const char *item, gssize len);
|
||||
|
||||
gpointer _nm_connection_ensure_setting(NMConnection *connection, GType gtype);
|
||||
|
||||
#endif /* __NM_LIBNM_SHARED_UTILS_H__ */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue