diff options
| author | Michael Biebl <biebl@debian.org> | 2019-03-26 23:25:23 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2019-03-26 23:25:23 +0100 |
| commit | 9a6dcbf895f9da01768e64b73cec88c16157d91e (patch) | |
| tree | a359958930d731e9f1b59344642e10754419fe84 /libnm-core/nm-setting-connection.c | |
| parent | 964ae8cc391520440cf5aa13e2b9cc34850ea6c2 (diff) | |
New upstream version 1.16.0 upstream/1.16.0
Diffstat (limited to 'libnm-core/nm-setting-connection.c')
| -rw-r--r-- | libnm-core/nm-setting-connection.c | 652 |
1 files changed, 317 insertions, 335 deletions
diff --git a/libnm-core/nm-setting-connection.c b/libnm-core/nm-setting-connection.c index 44021b9c..e8d008e3 100644 --- a/libnm-core/nm-setting-connection.c +++ b/libnm-core/nm-setting-connection.c @@ -24,8 +24,6 @@ #include "nm-setting-connection.h" -#include <string.h> - #include "nm-utils.h" #include "nm-utils-private.h" #include "nm-core-enum-types.h" @@ -45,9 +43,7 @@ * a #NMSettingConnection setting. **/ -G_DEFINE_TYPE (NMSettingConnection, nm_setting_connection, NM_TYPE_SETTING) - -#define NM_SETTING_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_SETTING_CONNECTION, NMSettingConnectionPrivate)) +/*****************************************************************************/ typedef enum { PERM_TYPE_USER = 0, @@ -58,6 +54,32 @@ typedef struct { char *item; } Permission; +NM_GOBJECT_PROPERTIES_DEFINE (NMSettingConnection, + PROP_ID, + PROP_UUID, + PROP_INTERFACE_NAME, + PROP_TYPE, + PROP_PERMISSIONS, + PROP_AUTOCONNECT, + PROP_AUTOCONNECT_PRIORITY, + PROP_AUTOCONNECT_RETRIES, + PROP_MULTI_CONNECT, + PROP_TIMESTAMP, + PROP_READ_ONLY, + PROP_ZONE, + PROP_MASTER, + PROP_SLAVE_TYPE, + PROP_AUTOCONNECT_SLAVES, + PROP_SECONDARIES, + PROP_GATEWAY_PING_TIMEOUT, + PROP_METERED, + PROP_LLDP, + PROP_MDNS, + PROP_LLMNR, + PROP_STABLE_ID, + PROP_AUTH_RETRIES, +); + typedef struct { char *id; char *uuid; @@ -84,34 +106,9 @@ typedef struct { int llmnr; } NMSettingConnectionPrivate; -enum { - PROP_0, - PROP_ID, - PROP_UUID, - PROP_INTERFACE_NAME, - PROP_TYPE, - PROP_PERMISSIONS, - PROP_AUTOCONNECT, - PROP_AUTOCONNECT_PRIORITY, - PROP_AUTOCONNECT_RETRIES, - PROP_MULTI_CONNECT, - PROP_TIMESTAMP, - PROP_READ_ONLY, - PROP_ZONE, - PROP_MASTER, - PROP_SLAVE_TYPE, - PROP_AUTOCONNECT_SLAVES, - PROP_SECONDARIES, - PROP_GATEWAY_PING_TIMEOUT, - PROP_METERED, - PROP_LLDP, - PROP_MDNS, - PROP_LLMNR, - PROP_STABLE_ID, - PROP_AUTH_RETRIES, +G_DEFINE_TYPE (NMSettingConnection, nm_setting_connection, NM_TYPE_SETTING) - LAST_PROP -}; +#define NM_SETTING_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_SETTING_CONNECTION, NMSettingConnectionPrivate)) /*****************************************************************************/ @@ -197,18 +194,6 @@ permission_free (Permission *p) /*****************************************************************************/ /** - * nm_setting_connection_new: - * - * Creates a new #NMSettingConnection object with default values. - * - * Returns: the new empty #NMSettingConnection object - **/ -NMSetting *nm_setting_connection_new (void) -{ - return (NMSetting *) g_object_new (NM_TYPE_SETTING_CONNECTION, NULL); -} - -/** * nm_setting_connection_get_id: * @setting: the #NMSettingConnection * @@ -312,7 +297,7 @@ nm_setting_connection_get_num_permissions (NMSettingConnection *setting) * @setting: the #NMSettingConnection * @idx: the zero-based index of the permissions entry * @out_ptype: on return, the permission type (at this time, always "user") - * @out_pitem: on return, the permission item (formatted accoring to @ptype, see + * @out_pitem: on return, the permission item (formatted according to @ptype, see * #NMSettingConnection:permissions for more detail * @out_detail: on return, the permission detail (at this time, always %NULL) * @@ -431,7 +416,7 @@ nm_setting_connection_add_permission (NMSettingConnection *setting, p = permission_new (pitem); g_return_val_if_fail (p != NULL, FALSE); priv->permissions = g_slist_append (priv->permissions, p); - g_object_notify (G_OBJECT (setting), NM_SETTING_CONNECTION_PERMISSIONS); + _notify (setting, PROP_PERMISSIONS); return TRUE; } @@ -458,7 +443,7 @@ nm_setting_connection_remove_permission (NMSettingConnection *setting, permission_free ((Permission *) iter->data); priv->permissions = g_slist_delete_link (priv->permissions, iter); - g_object_notify (G_OBJECT (setting), NM_SETTING_CONNECTION_PERMISSIONS); + _notify (setting, PROP_PERMISSIONS); } /** @@ -498,7 +483,7 @@ nm_setting_connection_remove_permission_by_value (NMSettingConnection *setting, if (strcmp (pitem, p->item) == 0) { permission_free ((Permission *) iter->data); priv->permissions = g_slist_delete_link (priv->permissions, iter); - g_object_notify (G_OBJECT (setting), NM_SETTING_CONNECTION_PERMISSIONS); + _notify (setting, PROP_PERMISSIONS); return TRUE; } } @@ -748,7 +733,7 @@ nm_setting_connection_get_secondary (NMSettingConnection *setting, guint32 idx) * @setting: the #NMSettingConnection * @sec_uuid: the secondary connection UUID to add * - * Adds a new secondary connetion UUID to the setting. + * Adds a new secondary connection UUID to the setting. * * Returns: %TRUE if the secondary connection UUID was added; %FALSE if the UUID * was already present @@ -771,7 +756,7 @@ nm_setting_connection_add_secondary (NMSettingConnection *setting, } priv->secondaries = g_slist_append (priv->secondaries, g_strdup (sec_uuid)); - g_object_notify (G_OBJECT (setting), NM_SETTING_CONNECTION_SECONDARIES); + _notify (setting, PROP_SECONDARIES); return TRUE; } @@ -796,7 +781,7 @@ nm_setting_connection_remove_secondary (NMSettingConnection *setting, guint32 id g_free (elt->data); priv->secondaries = g_slist_delete_link (priv->secondaries, elt); - g_object_notify (G_OBJECT (setting), NM_SETTING_CONNECTION_SECONDARIES); + _notify (setting, PROP_SECONDARIES); } /** @@ -823,7 +808,7 @@ nm_setting_connection_remove_secondary_by_value (NMSettingConnection *setting, for (iter = priv->secondaries; iter; iter = g_slist_next (iter)) { if (!strcmp (sec_uuid, (char *) iter->data)) { priv->secondaries = g_slist_delete_link (priv->secondaries, iter); - g_object_notify (G_OBJECT (setting), NM_SETTING_CONNECTION_SECONDARIES); + _notify (setting, PROP_SECONDARIES); return TRUE; } } @@ -1281,51 +1266,26 @@ nm_setting_connection_no_interface_name (NMSetting *setting, return TRUE; } -static gboolean -compare_property (NMSetting *setting, +static NMTernary +compare_property (const NMSettInfoSetting *sett_info, + guint property_idx, + NMSetting *setting, NMSetting *other, - const GParamSpec *prop_spec, NMSettingCompareFlags flags) { - /* Handle ignore ID */ - if ( (flags & NM_SETTING_COMPARE_FLAG_IGNORE_ID) - && g_strcmp0 (prop_spec->name, NM_SETTING_CONNECTION_ID) == 0) - return TRUE; - - /* Handle ignore timestamp */ - if ( (flags & NM_SETTING_COMPARE_FLAG_IGNORE_TIMESTAMP) - && g_strcmp0 (prop_spec->name, NM_SETTING_CONNECTION_TIMESTAMP) == 0) - return TRUE; - - return NM_SETTING_CLASS (nm_setting_connection_parent_class)->compare_property (setting, other, prop_spec, flags); -} - -static void -nm_setting_connection_init (NMSettingConnection *setting) -{ - NMSettingConnectionPrivate *priv = NM_SETTING_CONNECTION_GET_PRIVATE (setting); - - priv->mdns = NM_SETTING_CONNECTION_MDNS_DEFAULT; - priv->llmnr = NM_SETTING_CONNECTION_LLMNR_DEFAULT; -} - -static void -finalize (GObject *object) -{ - NMSettingConnectionPrivate *priv = NM_SETTING_CONNECTION_GET_PRIVATE (object); - - g_free (priv->id); - g_free (priv->uuid); - g_free (priv->stable_id); - g_free (priv->interface_name); - g_free (priv->type); - g_free (priv->zone); - g_free (priv->master); - g_free (priv->slave_type); - g_slist_free_full (priv->permissions, (GDestroyNotify) permission_free); - g_slist_free_full (priv->secondaries, g_free); - - G_OBJECT_CLASS (nm_setting_connection_parent_class)->finalize (object); + if ( NM_FLAGS_HAS (flags, NM_SETTING_COMPARE_FLAG_IGNORE_ID) + && nm_streq (sett_info->property_infos[property_idx].name, NM_SETTING_CONNECTION_ID)) + return NM_TERNARY_DEFAULT; + + if ( NM_FLAGS_HAS(flags, NM_SETTING_COMPARE_FLAG_IGNORE_TIMESTAMP) + && nm_streq (sett_info->property_infos[property_idx].name, NM_SETTING_CONNECTION_TIMESTAMP)) + return NM_TERNARY_DEFAULT; + + return NM_SETTING_CLASS (nm_setting_connection_parent_class)->compare_property (sett_info, + property_idx, + setting, + other, + flags); } static GSList * @@ -1348,91 +1308,98 @@ perm_strv_to_permlist (char **strv) return list; } +static char ** +perm_permlist_to_strv (GSList *permlist) +{ + GPtrArray *strings; + GSList *iter; + + strings = g_ptr_array_new (); + for (iter = permlist; iter; iter = g_slist_next (iter)) + g_ptr_array_add (strings, permission_to_string ((Permission *) iter->data)); + g_ptr_array_add (strings, NULL); + + return (char **) g_ptr_array_free (strings, FALSE); +} + +/*****************************************************************************/ + static void -set_property (GObject *object, guint prop_id, - const GValue *value, GParamSpec *pspec) +get_property (GObject *object, guint prop_id, + GValue *value, GParamSpec *pspec) { - NMSettingConnectionPrivate *priv = NM_SETTING_CONNECTION_GET_PRIVATE (object); + NMSettingConnection *setting = NM_SETTING_CONNECTION (object); + NMSettingConnectionPrivate *priv = NM_SETTING_CONNECTION_GET_PRIVATE (setting); switch (prop_id) { case PROP_ID: - g_free (priv->id); - priv->id = g_value_dup_string (value); + g_value_set_string (value, nm_setting_connection_get_id (setting)); break; case PROP_UUID: - g_free (priv->uuid); - priv->uuid = g_value_dup_string (value); + g_value_set_string (value, nm_setting_connection_get_uuid (setting)); break; case PROP_STABLE_ID: - g_free (priv->stable_id); - priv->stable_id = g_value_dup_string (value); + g_value_set_string (value, nm_setting_connection_get_stable_id (setting)); break; case PROP_INTERFACE_NAME: - g_free (priv->interface_name); - priv->interface_name = g_value_dup_string (value); + g_value_set_string (value, nm_setting_connection_get_interface_name (setting)); break; case PROP_TYPE: - g_free (priv->type); - priv->type = g_value_dup_string (value); + g_value_set_string (value, nm_setting_connection_get_connection_type (setting)); break; case PROP_PERMISSIONS: - g_slist_free_full (priv->permissions, (GDestroyNotify) permission_free); - priv->permissions = perm_strv_to_permlist (g_value_get_boxed (value)); + g_value_take_boxed (value, perm_permlist_to_strv (priv->permissions)); break; case PROP_AUTOCONNECT: - priv->autoconnect = g_value_get_boolean (value); + g_value_set_boolean (value, nm_setting_connection_get_autoconnect (setting)); break; case PROP_AUTOCONNECT_PRIORITY: - priv->autoconnect_priority = g_value_get_int (value); + g_value_set_int (value, nm_setting_connection_get_autoconnect_priority (setting)); break; case PROP_AUTOCONNECT_RETRIES: - priv->autoconnect_retries = g_value_get_int (value); + g_value_set_int (value, nm_setting_connection_get_autoconnect_retries (setting)); break; case PROP_MULTI_CONNECT: - priv->multi_connect = g_value_get_int (value); + g_value_set_int (value, priv->multi_connect); break; case PROP_TIMESTAMP: - priv->timestamp = g_value_get_uint64 (value); + g_value_set_uint64 (value, nm_setting_connection_get_timestamp (setting)); break; case PROP_READ_ONLY: - priv->read_only = g_value_get_boolean (value); + g_value_set_boolean (value, nm_setting_connection_get_read_only (setting)); break; case PROP_ZONE: - g_free (priv->zone); - priv->zone = g_value_dup_string (value); + g_value_set_string (value, nm_setting_connection_get_zone (setting)); break; case PROP_MASTER: - g_free (priv->master); - priv->master = g_value_dup_string (value); + g_value_set_string (value, nm_setting_connection_get_master (setting)); break; case PROP_SLAVE_TYPE: - g_free (priv->slave_type); - priv->slave_type = g_value_dup_string (value); + g_value_set_string (value, nm_setting_connection_get_slave_type (setting)); break; case PROP_AUTOCONNECT_SLAVES: - priv->autoconnect_slaves = g_value_get_enum (value); + g_value_set_enum (value, nm_setting_connection_get_autoconnect_slaves (setting)); break; case PROP_SECONDARIES: - g_slist_free_full (priv->secondaries, g_free); - priv->secondaries = _nm_utils_strv_to_slist (g_value_get_boxed (value), TRUE); + g_value_take_boxed (value, _nm_utils_slist_to_strv (priv->secondaries, TRUE)); break; case PROP_GATEWAY_PING_TIMEOUT: - priv->gateway_ping_timeout = g_value_get_uint (value); + g_value_set_uint (value, priv->gateway_ping_timeout); break; case PROP_METERED: - priv->metered = g_value_get_enum (value); + g_value_set_enum (value, priv->metered); break; case PROP_LLDP: - priv->lldp = g_value_get_int (value); + g_value_set_int (value, priv->lldp); break; case PROP_AUTH_RETRIES: - priv->auth_retries = g_value_get_int (value); + g_value_set_int (value, priv->auth_retries); break; case PROP_MDNS: - priv->mdns = g_value_get_int (value); + g_value_set_int (value, priv->mdns); break; case PROP_LLMNR: - priv->llmnr = g_value_get_int (value); + g_value_set_int (value, priv->llmnr); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -1440,96 +1407,91 @@ set_property (GObject *object, guint prop_id, } } -static char ** -perm_permlist_to_strv (GSList *permlist) -{ - GPtrArray *strings; - GSList *iter; - - strings = g_ptr_array_new (); - for (iter = permlist; iter; iter = g_slist_next (iter)) - g_ptr_array_add (strings, permission_to_string ((Permission *) iter->data)); - g_ptr_array_add (strings, NULL); - - return (char **) g_ptr_array_free (strings, FALSE); -} - static void -get_property (GObject *object, guint prop_id, - GValue *value, GParamSpec *pspec) +set_property (GObject *object, guint prop_id, + const GValue *value, GParamSpec *pspec) { - NMSettingConnection *setting = NM_SETTING_CONNECTION (object); - NMSettingConnectionPrivate *priv = NM_SETTING_CONNECTION_GET_PRIVATE (setting); + NMSettingConnectionPrivate *priv = NM_SETTING_CONNECTION_GET_PRIVATE (object); switch (prop_id) { case PROP_ID: - g_value_set_string (value, nm_setting_connection_get_id (setting)); + g_free (priv->id); + priv->id = g_value_dup_string (value); break; case PROP_UUID: - g_value_set_string (value, nm_setting_connection_get_uuid (setting)); + g_free (priv->uuid); + priv->uuid = g_value_dup_string (value); break; case PROP_STABLE_ID: - g_value_set_string (value, nm_setting_connection_get_stable_id (setting)); + g_free (priv->stable_id); + priv->stable_id = g_value_dup_string (value); break; case PROP_INTERFACE_NAME: - g_value_set_string (value, nm_setting_connection_get_interface_name (setting)); + g_free (priv->interface_name); + priv->interface_name = g_value_dup_string (value); break; case PROP_TYPE: - g_value_set_string (value, nm_setting_connection_get_connection_type (setting)); + g_free (priv->type); + priv->type = g_value_dup_string (value); break; case PROP_PERMISSIONS: - g_value_take_boxed (value, perm_permlist_to_strv (priv->permissions)); + g_slist_free_full (priv->permissions, (GDestroyNotify) permission_free); + priv->permissions = perm_strv_to_permlist (g_value_get_boxed (value)); break; case PROP_AUTOCONNECT: - g_value_set_boolean (value, nm_setting_connection_get_autoconnect (setting)); + priv->autoconnect = g_value_get_boolean (value); break; case PROP_AUTOCONNECT_PRIORITY: - g_value_set_int (value, nm_setting_connection_get_autoconnect_priority (setting)); + priv->autoconnect_priority = g_value_get_int (value); break; case PROP_AUTOCONNECT_RETRIES: - g_value_set_int (value, nm_setting_connection_get_autoconnect_retries (setting)); + priv->autoconnect_retries = g_value_get_int (value); break; case PROP_MULTI_CONNECT: - g_value_set_int (value, priv->multi_connect); + priv->multi_connect = g_value_get_int (value); break; case PROP_TIMESTAMP: - g_value_set_uint64 (value, nm_setting_connection_get_timestamp (setting)); + priv->timestamp = g_value_get_uint64 (value); break; case PROP_READ_ONLY: - g_value_set_boolean (value, nm_setting_connection_get_read_only (setting)); + priv->read_only = g_value_get_boolean (value); break; case PROP_ZONE: - g_value_set_string (value, nm_setting_connection_get_zone (setting)); + g_free (priv->zone); + priv->zone = g_value_dup_string (value); break; case PROP_MASTER: - g_value_set_string (value, nm_setting_connection_get_master (setting)); + g_free (priv->master); + priv->master = g_value_dup_string (value); break; case PROP_SLAVE_TYPE: - g_value_set_string (value, nm_setting_connection_get_slave_type (setting)); + g_free (priv->slave_type); + priv->slave_type = g_value_dup_string (value); break; case PROP_AUTOCONNECT_SLAVES: - g_value_set_enum (value, nm_setting_connection_get_autoconnect_slaves (setting)); + priv->autoconnect_slaves = g_value_get_enum (value); break; case PROP_SECONDARIES: - g_value_take_boxed (value, _nm_utils_slist_to_strv (priv->secondaries, TRUE)); + g_slist_free_full (priv->secondaries, g_free); + priv->secondaries = _nm_utils_strv_to_slist (g_value_get_boxed (value), TRUE); break; case PROP_GATEWAY_PING_TIMEOUT: - g_value_set_uint (value, priv->gateway_ping_timeout); + priv->gateway_ping_timeout = g_value_get_uint (value); break; case PROP_METERED: - g_value_set_enum (value, priv->metered); + priv->metered = g_value_get_enum (value); break; case PROP_LLDP: - g_value_set_int (value, priv->lldp); + priv->lldp = g_value_get_int (value); break; case PROP_AUTH_RETRIES: - g_value_set_int (value, priv->auth_retries); + priv->auth_retries = g_value_get_int (value); break; case PROP_MDNS: - g_value_set_int (value, priv->mdns); + priv->mdns = g_value_get_int (value); break; case PROP_LLMNR: - g_value_set_int (value, priv->llmnr); + priv->llmnr = g_value_get_int (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -1537,6 +1499,48 @@ get_property (GObject *object, guint prop_id, } } +/*****************************************************************************/ + +static void +nm_setting_connection_init (NMSettingConnection *setting) +{ + NMSettingConnectionPrivate *priv = NM_SETTING_CONNECTION_GET_PRIVATE (setting); + + priv->mdns = NM_SETTING_CONNECTION_MDNS_DEFAULT; + priv->llmnr = NM_SETTING_CONNECTION_LLMNR_DEFAULT; +} + +/** + * nm_setting_connection_new: + * + * Creates a new #NMSettingConnection object with default values. + * + * Returns: the new empty #NMSettingConnection object + **/ +NMSetting *nm_setting_connection_new (void) +{ + return (NMSetting *) g_object_new (NM_TYPE_SETTING_CONNECTION, NULL); +} + +static void +finalize (GObject *object) +{ + NMSettingConnectionPrivate *priv = NM_SETTING_CONNECTION_GET_PRIVATE (object); + + g_free (priv->id); + g_free (priv->uuid); + g_free (priv->stable_id); + g_free (priv->interface_name); + g_free (priv->type); + g_free (priv->zone); + g_free (priv->master); + g_free (priv->slave_type); + g_slist_free_full (priv->permissions, (GDestroyNotify) permission_free); + g_slist_free_full (priv->secondaries, g_free); + + G_OBJECT_CLASS (nm_setting_connection_parent_class)->finalize (object); +} + static void nm_setting_connection_class_init (NMSettingConnectionClass *klass) { @@ -1546,8 +1550,8 @@ nm_setting_connection_class_init (NMSettingConnectionClass *klass) g_type_class_add_private (klass, sizeof (NMSettingConnectionPrivate)); - object_class->set_property = set_property; object_class->get_property = get_property; + object_class->set_property = set_property; object_class->finalize = finalize; setting_class->verify = verify; @@ -1565,13 +1569,12 @@ nm_setting_connection_class_init (NMSettingConnectionClass *klass) * description: User friendly name for the connection profile. * ---end--- */ - g_object_class_install_property - (object_class, PROP_ID, - g_param_spec_string (NM_SETTING_CONNECTION_ID, "", "", - NULL, - G_PARAM_READWRITE | - NM_SETTING_PARAM_FUZZY_IGNORE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_ID] = + g_param_spec_string (NM_SETTING_CONNECTION_ID, "", "", + NULL, + G_PARAM_READWRITE | + NM_SETTING_PARAM_FUZZY_IGNORE | + G_PARAM_STATIC_STRINGS); /** * NMSettingConnection:uuid: @@ -1596,13 +1599,12 @@ nm_setting_connection_class_init (NMSettingConnectionClass *klass) * creates the UUID itself (by hashing the filename). * ---end--- */ - g_object_class_install_property - (object_class, PROP_UUID, - g_param_spec_string (NM_SETTING_CONNECTION_UUID, "", "", - NULL, - G_PARAM_READWRITE | - NM_SETTING_PARAM_FUZZY_IGNORE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_UUID] = + g_param_spec_string (NM_SETTING_CONNECTION_UUID, "", "", + NULL, + G_PARAM_READWRITE | + NM_SETTING_PARAM_FUZZY_IGNORE | + G_PARAM_STATIC_STRINGS); /** * NMSettingConnection:stable-id: @@ -1629,7 +1631,7 @@ nm_setting_connection_class_init (NMSettingConnectionClass *klass) * at runtime. Currently supported are "${CONNECTION}", "${DEVICE}", "${MAC}", * "${BOOT}", "${RANDOM}". * These effectively create unique IDs per-connection, per-device, per-boot, - * or every time. Note that "${DEVICE}" corresponds the the interface name of the + * or every time. Note that "${DEVICE}" corresponds to the interface name of the * device and "${MAC}" is the permanent MAC address of the device. * Any unrecognized patterns following '$' are treated verbatim, however * are reserved for future use. You are thus advised to avoid '$' or @@ -1650,13 +1652,12 @@ nm_setting_connection_class_init (NMSettingConnectionClass *klass) * description: Token to generate stable IDs. * ---end--- */ - g_object_class_install_property - (object_class, PROP_STABLE_ID, - g_param_spec_string (NM_SETTING_CONNECTION_STABLE_ID, "", "", - NULL, - G_PARAM_READWRITE | - NM_SETTING_PARAM_FUZZY_IGNORE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_STABLE_ID] = + g_param_spec_string (NM_SETTING_CONNECTION_STABLE_ID, "", "", + NULL, + G_PARAM_READWRITE | + NM_SETTING_PARAM_FUZZY_IGNORE | + G_PARAM_STATIC_STRINGS); /** * NMSettingConnection:interface-name: @@ -1681,17 +1682,15 @@ nm_setting_connection_class_init (NMSettingConnectionClass *klass) * can be required for some connection types. * ---end--- */ - g_object_class_install_property - (object_class, PROP_INTERFACE_NAME, - g_param_spec_string (NM_SETTING_CONNECTION_INTERFACE_NAME, "", "", - NULL, - G_PARAM_READWRITE | - NM_SETTING_PARAM_INFERRABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_INTERFACE_NAME] = + g_param_spec_string (NM_SETTING_CONNECTION_INTERFACE_NAME, "", "", + NULL, + G_PARAM_READWRITE | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS); _properties_override_add_override (properties_override, - g_object_class_find_property (G_OBJECT_CLASS (setting_class), - NM_SETTING_CONNECTION_INTERFACE_NAME), + obj_properties[PROP_INTERFACE_NAME], G_VARIANT_TYPE_STRING, NULL, nm_setting_connection_set_interface_name, @@ -1715,13 +1714,12 @@ nm_setting_connection_class_init (NMSettingConnectionClass *klass) * example: TYPE=Ethernet; TYPE=Bond; TYPE=Bridge; DEVICETYPE=TeamPort * ---end--- */ - g_object_class_install_property - (object_class, PROP_TYPE, - g_param_spec_string (NM_SETTING_CONNECTION_TYPE, "", "", - NULL, - G_PARAM_READWRITE | - NM_SETTING_PARAM_INFERRABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_TYPE] = + g_param_spec_string (NM_SETTING_CONNECTION_TYPE, "", "", + NULL, + G_PARAM_READWRITE | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS); /** * NMSettingConnection:permissions: @@ -1748,12 +1746,11 @@ nm_setting_connection_class_init (NMSettingConnectionClass *klass) * example: USERS="joe bob" * ---end--- */ - g_object_class_install_property - (object_class, PROP_PERMISSIONS, - g_param_spec_boxed (NM_SETTING_CONNECTION_PERMISSIONS, "", "", - G_TYPE_STRV, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_PERMISSIONS] = + g_param_spec_boxed (NM_SETTING_CONNECTION_PERMISSIONS, "", "", + G_TYPE_STRV, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS); /** * NMSettingConnection:autoconnect: @@ -1774,14 +1771,13 @@ nm_setting_connection_class_init (NMSettingConnectionClass *klass) * description: Whether the connection should be autoconnected (not only while booting). * ---end--- */ - g_object_class_install_property - (object_class, PROP_AUTOCONNECT, - g_param_spec_boolean (NM_SETTING_CONNECTION_AUTOCONNECT, "", "", - TRUE, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT | - NM_SETTING_PARAM_FUZZY_IGNORE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_AUTOCONNECT] = + g_param_spec_boolean (NM_SETTING_CONNECTION_AUTOCONNECT, "", "", + TRUE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_FUZZY_IGNORE | + G_PARAM_STATIC_STRINGS); /** * NMSettingConnection:autoconnect-priority: @@ -1800,8 +1796,7 @@ nm_setting_connection_class_init (NMSettingConnectionClass *klass) * example: AUTOCONNECT_PRIORITY=20 * ---end--- */ - g_object_class_install_property - (object_class, PROP_AUTOCONNECT_PRIORITY, + obj_properties[PROP_AUTOCONNECT_PRIORITY] = g_param_spec_int (NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY, "", "", NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY_MIN, NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY_MAX, @@ -1809,7 +1804,7 @@ nm_setting_connection_class_init (NMSettingConnectionClass *klass) G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_FUZZY_IGNORE | - G_PARAM_STATIC_STRINGS)); + G_PARAM_STATIC_STRINGS); /** * NMSettingConnection:autoconnect-retries: @@ -1829,14 +1824,13 @@ nm_setting_connection_class_init (NMSettingConnectionClass *klass) * example: AUTOCONNECT_RETRIES=1 * ---end--- */ - g_object_class_install_property - (object_class, PROP_AUTOCONNECT_RETRIES, + obj_properties[PROP_AUTOCONNECT_RETRIES] = g_param_spec_int (NM_SETTING_CONNECTION_AUTOCONNECT_RETRIES, "", "", -1, G_MAXINT32, -1, G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_FUZZY_IGNORE | - G_PARAM_STATIC_STRINGS)); + G_PARAM_STATIC_STRINGS); /** * NMSettingConnection:multi-connect: @@ -1854,13 +1848,12 @@ nm_setting_connection_class_init (NMSettingConnectionClass *klass) * example: ZONE=3 * ---end--- */ - g_object_class_install_property - (object_class, PROP_MULTI_CONNECT, + obj_properties[PROP_MULTI_CONNECT] = g_param_spec_int (NM_SETTING_CONNECTION_MULTI_CONNECT, "", "", G_MININT32, G_MAXINT32, NM_CONNECTION_MULTI_CONNECT_DEFAULT, G_PARAM_READWRITE | NM_SETTING_PARAM_FUZZY_IGNORE | - G_PARAM_STATIC_STRINGS)); + G_PARAM_STATIC_STRINGS); /** * NMSettingConnection:timestamp: @@ -1873,14 +1866,13 @@ nm_setting_connection_class_init (NMSettingConnectionClass *klass) * timestamp. The property is only meant for reading (changes to this * property will not be preserved). **/ - g_object_class_install_property - (object_class, PROP_TIMESTAMP, - g_param_spec_uint64 (NM_SETTING_CONNECTION_TIMESTAMP, "", "", - 0, G_MAXUINT64, 0, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT | - NM_SETTING_PARAM_FUZZY_IGNORE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_TIMESTAMP] = + g_param_spec_uint64 (NM_SETTING_CONNECTION_TIMESTAMP, "", "", + 0, G_MAXUINT64, 0, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_FUZZY_IGNORE | + G_PARAM_STATIC_STRINGS); /** * NMSettingConnection:read-only: @@ -1889,14 +1881,13 @@ nm_setting_connection_class_init (NMSettingConnectionClass *klass) * service's D-Bus interface with the right privileges, or %TRUE if the * connection is read-only and cannot be modified. **/ - g_object_class_install_property - (object_class, PROP_READ_ONLY, - g_param_spec_boolean (NM_SETTING_CONNECTION_READ_ONLY, "", "", - FALSE, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT | - NM_SETTING_PARAM_FUZZY_IGNORE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_READ_ONLY] = + g_param_spec_boolean (NM_SETTING_CONNECTION_READ_ONLY, "", "", + FALSE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_FUZZY_IGNORE | + G_PARAM_STATIC_STRINGS); /** * NMSettingConnection:zone: @@ -1917,15 +1908,14 @@ nm_setting_connection_class_init (NMSettingConnectionClass *klass) * example: ZONE=Work * ---end--- */ - g_object_class_install_property - (object_class, PROP_ZONE, - g_param_spec_string (NM_SETTING_CONNECTION_ZONE, "", "", - NULL, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT | - NM_SETTING_PARAM_FUZZY_IGNORE | - NM_SETTING_PARAM_REAPPLY_IMMEDIATELY | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_ZONE] = + g_param_spec_string (NM_SETTING_CONNECTION_ZONE, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_FUZZY_IGNORE | + NM_SETTING_PARAM_REAPPLY_IMMEDIATELY | + G_PARAM_STATIC_STRINGS); /** * NMSettingConnection:master: @@ -1941,14 +1931,13 @@ nm_setting_connection_class_init (NMSettingConnectionClass *klass) * for compatibility with legacy tooling. * ---end--- */ - g_object_class_install_property - (object_class, PROP_MASTER, - g_param_spec_string (NM_SETTING_CONNECTION_MASTER, "", "", - NULL, - G_PARAM_READWRITE | - NM_SETTING_PARAM_FUZZY_IGNORE | - NM_SETTING_PARAM_INFERRABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_MASTER] = + g_param_spec_string (NM_SETTING_CONNECTION_MASTER, "", "", + NULL, + G_PARAM_READWRITE | + NM_SETTING_PARAM_FUZZY_IGNORE | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS); /** * NMSettingConnection:slave-type: @@ -1967,14 +1956,13 @@ nm_setting_connection_class_init (NMSettingConnectionClass *klass) * and BRIDGE_UUID for bridging. * ---end--- */ - g_object_class_install_property - (object_class, PROP_SLAVE_TYPE, - g_param_spec_string (NM_SETTING_CONNECTION_SLAVE_TYPE, "", "", - NULL, - G_PARAM_READWRITE | - NM_SETTING_PARAM_FUZZY_IGNORE | - NM_SETTING_PARAM_INFERRABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_SLAVE_TYPE] = + g_param_spec_string (NM_SETTING_CONNECTION_SLAVE_TYPE, "", "", + NULL, + G_PARAM_READWRITE | + NM_SETTING_PARAM_FUZZY_IGNORE | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS); /** * NMSettingConnection:autoconnect-slaves: @@ -1999,15 +1987,14 @@ nm_setting_connection_class_init (NMSettingConnectionClass *klass) * when this connection is activated. * ---end--- */ - g_object_class_install_property - (object_class, PROP_AUTOCONNECT_SLAVES, - g_param_spec_enum (NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES, "", "", - NM_TYPE_SETTING_CONNECTION_AUTOCONNECT_SLAVES, - NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_DEFAULT, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT | - NM_SETTING_PARAM_FUZZY_IGNORE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_AUTOCONNECT_SLAVES] = + g_param_spec_enum (NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES, "", "", + NM_TYPE_SETTING_CONNECTION_AUTOCONNECT_SLAVES, + NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_DEFAULT, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_FUZZY_IGNORE | + G_PARAM_STATIC_STRINGS); /** * NMSettingConnection:secondaries: @@ -2023,13 +2010,12 @@ nm_setting_connection_class_init (NMSettingConnectionClass *klass) * together with this connection. * ---end--- */ - g_object_class_install_property - (object_class, PROP_SECONDARIES, - g_param_spec_boxed (NM_SETTING_CONNECTION_SECONDARIES, "", "", - G_TYPE_STRV, - G_PARAM_READWRITE | - NM_SETTING_PARAM_FUZZY_IGNORE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_SECONDARIES] = + g_param_spec_boxed (NM_SETTING_CONNECTION_SECONDARIES, "", "", + G_TYPE_STRV, + G_PARAM_READWRITE | + NM_SETTING_PARAM_FUZZY_IGNORE | + G_PARAM_STATIC_STRINGS); /** * NMSettingConnection:gateway-ping-timeout: @@ -2046,13 +2032,12 @@ nm_setting_connection_class_init (NMSettingConnectionClass *klass) * example: GATEWAY_PING_TIMEOUT=5 * ---end--- */ - g_object_class_install_property - (object_class, PROP_GATEWAY_PING_TIMEOUT, - g_param_spec_uint (NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT, "", "", - 0, 600, 0, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_GATEWAY_PING_TIMEOUT] = + g_param_spec_uint (NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT, "", "", + 0, 600, 0, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS); /** * NMSettingConnection:metered: @@ -2072,14 +2057,13 @@ nm_setting_connection_class_init (NMSettingConnectionClass *klass) * example: CONNECTION_METERED=yes * ---end--- */ - g_object_class_install_property - (object_class, PROP_METERED, - g_param_spec_enum (NM_SETTING_CONNECTION_METERED, "", "", - NM_TYPE_METERED, - NM_METERED_UNKNOWN, - G_PARAM_READWRITE | - NM_SETTING_PARAM_REAPPLY_IMMEDIATELY | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_METERED] = + g_param_spec_enum (NM_SETTING_CONNECTION_METERED, "", "", + NM_TYPE_METERED, + NM_METERED_UNKNOWN, + G_PARAM_READWRITE | + NM_SETTING_PARAM_REAPPLY_IMMEDIATELY | + G_PARAM_STATIC_STRINGS); /** * NMSettingConnection:lldp: @@ -2097,14 +2081,13 @@ nm_setting_connection_class_init (NMSettingConnectionClass *klass) * example: LLDP=no * ---end--- */ - g_object_class_install_property - (object_class, PROP_LLDP, - g_param_spec_int (NM_SETTING_CONNECTION_LLDP, "", "", - G_MININT32, G_MAXINT32, NM_SETTING_CONNECTION_LLDP_DEFAULT, - NM_SETTING_PARAM_FUZZY_IGNORE | - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_LLDP] = + g_param_spec_int (NM_SETTING_CONNECTION_LLDP, "", "", + G_MININT32, G_MAXINT32, NM_SETTING_CONNECTION_LLDP_DEFAULT, + NM_SETTING_PARAM_FUZZY_IGNORE | + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS); /** * NMSettingConnection:auth-retries: @@ -2124,14 +2107,13 @@ nm_setting_connection_class_init (NMSettingConnectionClass *klass) * description: Number of retries for authentication. * ---end--- */ - g_object_class_install_property - (object_class, PROP_AUTH_RETRIES, - g_param_spec_int (NM_SETTING_CONNECTION_AUTH_RETRIES, "", "", - -1, G_MAXINT32, -1, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT | - NM_SETTING_PARAM_FUZZY_IGNORE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_AUTH_RETRIES] = + g_param_spec_int (NM_SETTING_CONNECTION_AUTH_RETRIES, "", "", + -1, G_MAXINT32, -1, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_FUZZY_IGNORE | + G_PARAM_STATIC_STRINGS); /** * NMSettingConnection:mdns: @@ -2156,13 +2138,12 @@ nm_setting_connection_class_init (NMSettingConnectionClass *klass) * example: MDNS=yes * ---end--- */ - g_object_class_install_property - (object_class, PROP_MDNS, - g_param_spec_int (NM_SETTING_CONNECTION_MDNS, "", "", - G_MININT32, G_MAXINT32, - NM_SETTING_CONNECTION_MDNS_DEFAULT, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_MDNS] = + g_param_spec_int (NM_SETTING_CONNECTION_MDNS, "", "", + G_MININT32, G_MAXINT32, + NM_SETTING_CONNECTION_MDNS_DEFAULT, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS); /** * NMSettingConnection:llmnr: @@ -2190,13 +2171,14 @@ nm_setting_connection_class_init (NMSettingConnectionClass *klass) * example: LLMNR=yes * ---end--- */ - g_object_class_install_property - (object_class, PROP_LLMNR, - g_param_spec_int (NM_SETTING_CONNECTION_LLMNR, "", "", - G_MININT32, G_MAXINT32, - NM_SETTING_CONNECTION_LLMNR_DEFAULT, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_LLMNR] = + g_param_spec_int (NM_SETTING_CONNECTION_LLMNR, "", "", + G_MININT32, G_MAXINT32, + NM_SETTING_CONNECTION_LLMNR_DEFAULT, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); _nm_setting_class_commit_full (setting_class, NM_META_SETTING_TYPE_CONNECTION, NULL, properties_override); |