diff options
author | Thomas Haller <thaller@redhat.com> | 2019-10-10 17:57:30 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-10-18 22:09:18 +0200 |
commit | e761d230c3b47e3acfed01c2e013e52b4321363e (patch) | |
tree | dc84735cf7be6874a415e23ae066774663f661c8 | |
parent | aa00469e8062c15e22b985366cd03a04b07000c6 (diff) | |
download | NetworkManager-e761d230c3b47e3acfed01c2e013e52b4321363e.tar.gz |
libnm: use obj_properties array in libnm and cleanup
This is not merely cosmetic. I will need the obj_properties
array to lookup GParamSpec by their PROP_* enum value. The
alternative would be lookup by name, which is more expensive.
37 files changed, 1823 insertions, 2200 deletions
diff --git a/libnm/nm-access-point.c b/libnm/nm-access-point.c index a3c2dacaf2..1ca50a6d13 100644 --- a/libnm/nm-access-point.c +++ b/libnm/nm-access-point.c @@ -34,8 +34,7 @@ typedef struct { int last_seen; } NMAccessPointPrivate; -enum { - PROP_0, +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( PROP_FLAGS, PROP_WPA_FLAGS, PROP_RSN_FLAGS, @@ -47,9 +46,7 @@ enum { PROP_STRENGTH, PROP_BSSID, PROP_LAST_SEEN, - - LAST_PROP -}; +); /** * nm_access_point_get_flags: @@ -474,88 +471,79 @@ nm_access_point_class_init (NMAccessPointClass *ap_class) g_type_class_add_private (ap_class, sizeof (NMAccessPointPrivate)); - /* virtual methods */ object_class->get_property = get_property; - object_class->finalize = finalize; + object_class->finalize = finalize; nm_object_class->init_dbus = init_dbus; - /* properties */ - /** * NMAccessPoint:flags: * * The flags of the access point. **/ - g_object_class_install_property - (object_class, PROP_FLAGS, - g_param_spec_flags (NM_ACCESS_POINT_FLAGS, "", "", - NM_TYPE_802_11_AP_FLAGS, - NM_802_11_AP_FLAGS_NONE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_FLAGS] = + g_param_spec_flags (NM_ACCESS_POINT_FLAGS, "", "", + NM_TYPE_802_11_AP_FLAGS, + NM_802_11_AP_FLAGS_NONE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMAccessPoint:wpa-flags: * * The WPA flags of the access point. **/ - g_object_class_install_property - (object_class, PROP_WPA_FLAGS, - g_param_spec_flags (NM_ACCESS_POINT_WPA_FLAGS, "", "", - NM_TYPE_802_11_AP_SECURITY_FLAGS, - NM_802_11_AP_SEC_NONE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_WPA_FLAGS] = + g_param_spec_flags (NM_ACCESS_POINT_WPA_FLAGS, "", "", + NM_TYPE_802_11_AP_SECURITY_FLAGS, + NM_802_11_AP_SEC_NONE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMAccessPoint:rsn-flags: * * The RSN flags of the access point. **/ - g_object_class_install_property - (object_class, PROP_RSN_FLAGS, - g_param_spec_flags (NM_ACCESS_POINT_RSN_FLAGS, "", "", - NM_TYPE_802_11_AP_SECURITY_FLAGS, - NM_802_11_AP_SEC_NONE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_RSN_FLAGS] = + g_param_spec_flags (NM_ACCESS_POINT_RSN_FLAGS, "", "", + NM_TYPE_802_11_AP_SECURITY_FLAGS, + NM_802_11_AP_SEC_NONE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMAccessPoint:ssid: * * The SSID of the access point, or %NULL if it is not known. **/ - g_object_class_install_property - (object_class, PROP_SSID, - g_param_spec_boxed (NM_ACCESS_POINT_SSID, "", "", - G_TYPE_BYTES, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_SSID] = + g_param_spec_boxed (NM_ACCESS_POINT_SSID, "", "", + G_TYPE_BYTES, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMAccessPoint:frequency: * * The frequency of the access point. **/ - g_object_class_install_property - (object_class, PROP_FREQUENCY, - g_param_spec_uint (NM_ACCESS_POINT_FREQUENCY, "", "", - 0, 10000, 0, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_FREQUENCY] = + g_param_spec_uint (NM_ACCESS_POINT_FREQUENCY, "", "", + 0, 10000, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMAccessPoint:bssid: * * The BSSID of the access point. **/ - g_object_class_install_property - (object_class, PROP_BSSID, - g_param_spec_string (NM_ACCESS_POINT_BSSID, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_BSSID] = + g_param_spec_string (NM_ACCESS_POINT_BSSID, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMAccessPoint:hw-address: @@ -564,12 +552,11 @@ nm_access_point_class_init (NMAccessPointClass *ap_class) * * Deprecated: 1.0: use #NMAccessPoint:bssid. **/ - g_object_class_install_property - (object_class, PROP_HW_ADDRESS, - g_param_spec_string (NM_ACCESS_POINT_HW_ADDRESS, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_HW_ADDRESS] = + g_param_spec_string (NM_ACCESS_POINT_HW_ADDRESS, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMAccessPoint:mode: @@ -578,37 +565,34 @@ nm_access_point_class_init (NMAccessPointClass *ap_class) * coordinator of the wireless network allowing clients to connect) or * "ad-hoc" (a network with no central controller). **/ - g_object_class_install_property - (object_class, PROP_MODE, - g_param_spec_enum (NM_ACCESS_POINT_MODE, "", "", - NM_TYPE_802_11_MODE, - NM_802_11_MODE_INFRA, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_MODE] = + g_param_spec_enum (NM_ACCESS_POINT_MODE, "", "", + NM_TYPE_802_11_MODE, + NM_802_11_MODE_INFRA, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMAccessPoint:max-bitrate: * * The maximum bit rate of the access point in kbit/s. **/ - g_object_class_install_property - (object_class, PROP_MAX_BITRATE, - g_param_spec_uint (NM_ACCESS_POINT_MAX_BITRATE, "", "", - 0, G_MAXUINT32, 0, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_MAX_BITRATE] = + g_param_spec_uint (NM_ACCESS_POINT_MAX_BITRATE, "", "", + 0, G_MAXUINT32, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMAccessPoint:strength: * * The current signal strength of the access point. **/ - g_object_class_install_property - (object_class, PROP_STRENGTH, - g_param_spec_uchar (NM_ACCESS_POINT_STRENGTH, "", "", - 0, G_MAXUINT8, 0, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_STRENGTH] = + g_param_spec_uchar (NM_ACCESS_POINT_STRENGTH, "", "", + 0, G_MAXUINT8, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMAccessPoint:last-seen: @@ -619,10 +603,11 @@ nm_access_point_class_init (NMAccessPointClass *ap_class) * * Since: 1.2 **/ - g_object_class_install_property - (object_class, PROP_LAST_SEEN, - g_param_spec_int (NM_ACCESS_POINT_LAST_SEEN, "", "", - -1, G_MAXINT, -1, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_LAST_SEEN] = + g_param_spec_int (NM_ACCESS_POINT_LAST_SEEN, "", "", + -1, G_MAXINT, -1, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); } diff --git a/libnm/nm-active-connection.c b/libnm/nm-active-connection.c index 92557be36b..5909c11604 100644 --- a/libnm/nm-active-connection.c +++ b/libnm/nm-active-connection.c @@ -47,8 +47,7 @@ typedef struct { NMActiveConnectionStateReason reason; } NMActiveConnectionPrivate; -enum { - PROP_0, +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( PROP_CONNECTION, PROP_ID, PROP_UUID, @@ -65,9 +64,7 @@ enum { PROP_DHCP6_CONFIG, PROP_VPN, PROP_MASTER, - - LAST_PROP -}; +); enum { STATE_CHANGED, @@ -572,63 +569,56 @@ nm_active_connection_class_init (NMActiveConnectionClass *ap_class) g_type_class_add_private (ap_class, sizeof (NMActiveConnectionPrivate)); - /* virtual methods */ object_class->get_property = get_property; - object_class->constructed = constructed; - object_class->dispose = dispose; - object_class->finalize = finalize; + object_class->constructed = constructed; + object_class->dispose = dispose; + object_class->finalize = finalize; nm_object_class->init_dbus = init_dbus; - /* properties */ - /** * NMActiveConnection:connection: * * The connection that this is an active instance of. **/ - g_object_class_install_property - (object_class, PROP_CONNECTION, - g_param_spec_object (NM_ACTIVE_CONNECTION_CONNECTION, "", "", - NM_TYPE_REMOTE_CONNECTION, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_CONNECTION] = + g_param_spec_object (NM_ACTIVE_CONNECTION_CONNECTION, "", "", + NM_TYPE_REMOTE_CONNECTION, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMActiveConnection:id: * * The active connection's ID **/ - g_object_class_install_property - (object_class, PROP_ID, - g_param_spec_string (NM_ACTIVE_CONNECTION_ID, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_ID] = + g_param_spec_string (NM_ACTIVE_CONNECTION_ID, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMActiveConnection:uuid: * * The active connection's UUID **/ - g_object_class_install_property - (object_class, PROP_UUID, - g_param_spec_string (NM_ACTIVE_CONNECTION_UUID, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_UUID] = + g_param_spec_string (NM_ACTIVE_CONNECTION_UUID, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMActiveConnection:type: * * The active connection's type **/ - g_object_class_install_property - (object_class, PROP_TYPE, - g_param_spec_string (NM_ACTIVE_CONNECTION_TYPE, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_TYPE] = + g_param_spec_string (NM_ACTIVE_CONNECTION_TYPE, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMActiveConnection:specific-object-path: @@ -636,37 +626,34 @@ nm_active_connection_class_init (NMActiveConnectionClass *ap_class) * The path to the "specific object" of the active connection; see * nm_active_connection_get_specific_object_path() for more details. **/ - g_object_class_install_property - (object_class, PROP_SPECIFIC_OBJECT_PATH, - g_param_spec_string (NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT_PATH, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_SPECIFIC_OBJECT_PATH] = + g_param_spec_string (NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT_PATH, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMActiveConnection:devices: (type GPtrArray(NMDevice)) * * The devices of the active connection. **/ - g_object_class_install_property - (object_class, PROP_DEVICES, - g_param_spec_boxed (NM_ACTIVE_CONNECTION_DEVICES, "", "", - G_TYPE_PTR_ARRAY, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_DEVICES] = + g_param_spec_boxed (NM_ACTIVE_CONNECTION_DEVICES, "", "", + G_TYPE_PTR_ARRAY, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMActiveConnection:state: * * The state of the active connection. **/ - g_object_class_install_property - (object_class, PROP_STATE, - g_param_spec_enum (NM_ACTIVE_CONNECTION_STATE, "", "", - NM_TYPE_ACTIVE_CONNECTION_STATE, - NM_ACTIVE_CONNECTION_STATE_UNKNOWN, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_STATE] = + g_param_spec_enum (NM_ACTIVE_CONNECTION_STATE, "", "", + NM_TYPE_ACTIVE_CONNECTION_STATE, + NM_ACTIVE_CONNECTION_STATE_UNKNOWN, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMActiveConnection:state-flags: @@ -675,109 +662,102 @@ nm_active_connection_class_init (NMActiveConnectionClass *ap_class) * * Since: 1.10 **/ - g_object_class_install_property - (object_class, PROP_STATE_FLAGS, - g_param_spec_uint (NM_ACTIVE_CONNECTION_STATE_FLAGS, "", "", - 0, G_MAXUINT32, - NM_ACTIVATION_STATE_FLAG_NONE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_STATE_FLAGS] = + g_param_spec_uint (NM_ACTIVE_CONNECTION_STATE_FLAGS, "", "", + 0, G_MAXUINT32, + NM_ACTIVATION_STATE_FLAG_NONE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMActiveConnection:default: * * Whether the active connection is the default IPv4 one. **/ - g_object_class_install_property - (object_class, PROP_DEFAULT, - g_param_spec_boolean (NM_ACTIVE_CONNECTION_DEFAULT, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_DEFAULT] = + g_param_spec_boolean (NM_ACTIVE_CONNECTION_DEFAULT, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMActiveConnection:ip4-config: * * The IPv4 #NMIPConfig of the connection. **/ - g_object_class_install_property - (object_class, PROP_IP4_CONFIG, - g_param_spec_object (NM_ACTIVE_CONNECTION_IP4_CONFIG, "", "", - NM_TYPE_IP_CONFIG, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_IP4_CONFIG] = + g_param_spec_object (NM_ACTIVE_CONNECTION_IP4_CONFIG, "", "", + NM_TYPE_IP_CONFIG, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMActiveConnection:dhcp4-config: * * The IPv4 #NMDhcpConfig of the connection. **/ - g_object_class_install_property - (object_class, PROP_DHCP4_CONFIG, - g_param_spec_object (NM_ACTIVE_CONNECTION_DHCP4_CONFIG, "", "", - NM_TYPE_DHCP_CONFIG, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_DHCP4_CONFIG] = + g_param_spec_object (NM_ACTIVE_CONNECTION_DHCP4_CONFIG, "", "", + NM_TYPE_DHCP_CONFIG, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMActiveConnection:default6: * * Whether the active connection is the default IPv6 one. **/ - g_object_class_install_property - (object_class, PROP_DEFAULT6, - g_param_spec_boolean (NM_ACTIVE_CONNECTION_DEFAULT6, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_DEFAULT6] = + g_param_spec_boolean (NM_ACTIVE_CONNECTION_DEFAULT6, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMActiveConnection:ip6-config: * * The IPv6 #NMIPConfig of the connection. **/ - g_object_class_install_property - (object_class, PROP_IP6_CONFIG, - g_param_spec_object (NM_ACTIVE_CONNECTION_IP6_CONFIG, "", "", - NM_TYPE_IP_CONFIG, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_IP6_CONFIG] = + g_param_spec_object (NM_ACTIVE_CONNECTION_IP6_CONFIG, "", "", + NM_TYPE_IP_CONFIG, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMActiveConnection:dhcp6-config: * * The IPv6 #NMDhcpConfig of the connection. **/ - g_object_class_install_property - (object_class, PROP_DHCP6_CONFIG, - g_param_spec_object (NM_ACTIVE_CONNECTION_DHCP6_CONFIG, "", "", - NM_TYPE_DHCP_CONFIG, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_DHCP6_CONFIG] = + g_param_spec_object (NM_ACTIVE_CONNECTION_DHCP6_CONFIG, "", "", + NM_TYPE_DHCP_CONFIG, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMActiveConnection:vpn: * * Whether the active connection is a VPN connection. **/ - g_object_class_install_property - (object_class, PROP_VPN, - g_param_spec_boolean (NM_ACTIVE_CONNECTION_VPN, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_VPN] = + g_param_spec_boolean (NM_ACTIVE_CONNECTION_VPN, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMActiveConnection:master: * * The master device if one exists. **/ - g_object_class_install_property - (object_class, PROP_MASTER, - g_param_spec_object (NM_ACTIVE_CONNECTION_MASTER, "", "", - NM_TYPE_DEVICE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_MASTER] = + g_param_spec_object (NM_ACTIVE_CONNECTION_MASTER, "", "", + NM_TYPE_DEVICE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); /** * NMActiveConnection::state-changed: @@ -786,10 +766,10 @@ nm_active_connection_class_init (NMActiveConnectionClass *ap_class) * @reason: the state change reason (#NMActiveConnectionStateReason) */ signals[STATE_CHANGED] = - g_signal_new ("state-changed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - 0, NULL, NULL, NULL, - G_TYPE_NONE, 2, - G_TYPE_UINT, G_TYPE_UINT); + g_signal_new ("state-changed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + 0, NULL, NULL, NULL, + G_TYPE_NONE, 2, + G_TYPE_UINT, G_TYPE_UINT); } diff --git a/libnm/nm-checkpoint.c b/libnm/nm-checkpoint.c index 43ce0fd32f..8f9a54e7fa 100644 --- a/libnm/nm-checkpoint.c +++ b/libnm/nm-checkpoint.c @@ -30,14 +30,11 @@ G_DEFINE_TYPE (NMCheckpoint, nm_checkpoint, NM_TYPE_OBJECT) #define NM_CHECKPOINT_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMCheckpoint, NM_IS_CHECKPOINT) -enum { - PROP_0, +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( PROP_DEVICES, PROP_CREATED, PROP_ROLLBACK_TIMEOUT, - - LAST_PROP -}; +); /** * nm_checkpoint_get_devices: @@ -163,7 +160,7 @@ nm_checkpoint_class_init (NMCheckpointClass *checkpoint_class) NMObjectClass *nm_object_class = NM_OBJECT_CLASS (checkpoint_class); object_class->get_property = get_property; - object_class->finalize = finalize; + object_class->finalize = finalize; nm_object_class->init_dbus = init_dbus; @@ -174,12 +171,11 @@ nm_checkpoint_class_init (NMCheckpointClass *checkpoint_class) * * Since: 1.12 **/ - g_object_class_install_property - (object_class, PROP_DEVICES, - g_param_spec_boxed (NM_CHECKPOINT_DEVICES, "", "", - G_TYPE_PTR_ARRAY, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_DEVICES] = + g_param_spec_boxed (NM_CHECKPOINT_DEVICES, "", "", + G_TYPE_PTR_ARRAY, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMCheckpoint:created: @@ -188,12 +184,11 @@ nm_checkpoint_class_init (NMCheckpointClass *checkpoint_class) * * Since: 1.12 **/ - g_object_class_install_property - (object_class, PROP_CREATED, - g_param_spec_int64 (NM_CHECKPOINT_CREATED, "", "", - G_MININT64, G_MAXINT64, 0, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_CREATED] = + g_param_spec_int64 (NM_CHECKPOINT_CREATED, "", "", + G_MININT64, G_MAXINT64, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMCheckpoint:rollback-timeout: @@ -202,10 +197,11 @@ nm_checkpoint_class_init (NMCheckpointClass *checkpoint_class) * * Since: 1.12 **/ - g_object_class_install_property - (object_class, PROP_ROLLBACK_TIMEOUT, - g_param_spec_uint (NM_CHECKPOINT_ROLLBACK_TIMEOUT, "", "", - 0, G_MAXUINT32, 0, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_ROLLBACK_TIMEOUT] = + g_param_spec_uint (NM_CHECKPOINT_ROLLBACK_TIMEOUT, "", "", + 0, G_MAXUINT32, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); } diff --git a/libnm/nm-client.c b/libnm/nm-client.c index 5189d67a53..a915c718f0 100644 --- a/libnm/nm-client.c +++ b/libnm/nm-client.c @@ -106,8 +106,7 @@ typedef struct { bool udev_inited:1; } NMClientPrivate; -enum { - PROP_0, +NM_GOBJECT_PROPERTIES_DEFINE (NMClient, PROP_VERSION, PROP_STATE, PROP_STARTUP, @@ -135,9 +134,7 @@ enum { PROP_DNS_RC_MANAGER, PROP_DNS_CONFIGURATION, PROP_CHECKPOINTS, - - LAST_PROP -}; +); enum { DEVICE_ADDED, @@ -3429,8 +3426,8 @@ unhook_om (NMClient *self) g_signal_handlers_disconnect_by_data (priv->manager, self); g_clear_object (&priv->manager); - g_object_notify (G_OBJECT (self), NM_CLIENT_ACTIVE_CONNECTIONS); - g_object_notify (G_OBJECT (self), NM_CLIENT_NM_RUNNING); + _notify (self, PROP_ACTIVE_CONNECTIONS); + _notify (self, PROP_NM_RUNNING); } if (priv->settings) { const GPtrArray *connections; @@ -3442,9 +3439,9 @@ unhook_om (NMClient *self) g_signal_handlers_disconnect_by_data (priv->settings, self); g_clear_object (&priv->settings); - g_object_notify (G_OBJECT (self), NM_CLIENT_CONNECTIONS); - g_object_notify (G_OBJECT (self), NM_CLIENT_HOSTNAME); - g_object_notify (G_OBJECT (self), NM_CLIENT_CAN_MODIFY); + _notify (self, PROP_CONNECTIONS); + _notify (self, PROP_HOSTNAME); + _notify (self, PROP_CAN_MODIFY); } if (priv->dns_manager) { g_signal_handlers_disconnect_by_data (priv->dns_manager, self); @@ -3791,61 +3788,54 @@ nm_client_class_init (NMClientClass *client_class) g_type_class_add_private (client_class, sizeof (NMClientPrivate)); - /* virtual methods */ - object_class->set_property = set_property; object_class->get_property = get_property; - object_class->dispose = dispose; - - /* properties */ + object_class->set_property = set_property; + object_class->dispose = dispose; /** * NMClient:version: * * The NetworkManager version. **/ - g_object_class_install_property - (object_class, PROP_VERSION, - g_param_spec_string (NM_CLIENT_VERSION, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_VERSION] = + g_param_spec_string (NM_CLIENT_VERSION, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMClient:state: * * The current daemon state. **/ - g_object_class_install_property - (object_class, PROP_STATE, - g_param_spec_enum (NM_CLIENT_STATE, "", "", - NM_TYPE_STATE, - NM_STATE_UNKNOWN, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_STATE] = + g_param_spec_enum (NM_CLIENT_STATE, "", "", + NM_TYPE_STATE, + NM_STATE_UNKNOWN, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMClient:startup: * * Whether the daemon is still starting up. **/ - g_object_class_install_property - (object_class, PROP_STARTUP, - g_param_spec_boolean (NM_CLIENT_STARTUP, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_STARTUP] = + g_param_spec_boolean (NM_CLIENT_STARTUP, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMClient:nm-running: * * Whether the daemon is running. **/ - g_object_class_install_property - (object_class, PROP_NM_RUNNING, - g_param_spec_boolean (NM_CLIENT_NM_RUNNING, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_NM_RUNNING] = + g_param_spec_boolean (NM_CLIENT_NM_RUNNING, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMClient:networking-enabled: @@ -3854,12 +3844,11 @@ nm_client_class_init (NMClientClass *client_class) * * The property setter is a synchronous D-Bus call. This is deprecated since 1.22. */ - g_object_class_install_property - (object_class, PROP_NETWORKING_ENABLED, - g_param_spec_boolean (NM_CLIENT_NETWORKING_ENABLED, "", "", - TRUE, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_NETWORKING_ENABLED] = + g_param_spec_boolean (NM_CLIENT_NETWORKING_ENABLED, "", "", + TRUE, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS); /** * NMClient:wireless-enabled: @@ -3868,24 +3857,22 @@ nm_client_class_init (NMClientClass *client_class) * * The property setter is a synchronous D-Bus call. This is deprecated since 1.22. **/ - g_object_class_install_property - (object_class, PROP_WIRELESS_ENABLED, - g_param_spec_boolean (NM_CLIENT_WIRELESS_ENABLED, "", "", - FALSE, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_WIRELESS_ENABLED] = + g_param_spec_boolean (NM_CLIENT_WIRELESS_ENABLED, "", "", + FALSE, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS); /** * NMClient:wireless-hardware-enabled: * * Whether the wireless hardware is enabled. **/ - g_object_class_install_property - (object_class, PROP_WIRELESS_HARDWARE_ENABLED, - g_param_spec_boolean (NM_CLIENT_WIRELESS_HARDWARE_ENABLED, "", "", - TRUE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_WIRELESS_HARDWARE_ENABLED] = + g_param_spec_boolean (NM_CLIENT_WIRELESS_HARDWARE_ENABLED, "", "", + TRUE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMClient:wwan-enabled: @@ -3894,24 +3881,22 @@ nm_client_class_init (NMClientClass *client_class) * * The property setter is a synchronous D-Bus call. This is deprecated since 1.22. */ - g_object_class_install_property - (object_class, PROP_WWAN_ENABLED, - g_param_spec_boolean (NM_CLIENT_WWAN_ENABLED, "", "", - FALSE, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_WWAN_ENABLED] = + g_param_spec_boolean (NM_CLIENT_WWAN_ENABLED, "", "", + FALSE, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS); /** * NMClient:wwan-hardware-enabled: * * Whether the WWAN hardware is enabled. **/ - g_object_class_install_property - (object_class, PROP_WWAN_HARDWARE_ENABLED, - g_param_spec_boolean (NM_CLIENT_WWAN_HARDWARE_ENABLED, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_WWAN_HARDWARE_ENABLED] = + g_param_spec_boolean (NM_CLIENT_WWAN_HARDWARE_ENABLED, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMClient:wimax-enabled: @@ -3920,49 +3905,45 @@ nm_client_class_init (NMClientClass *client_class) * * The property setter is a synchronous D-Bus call. This is deprecated since 1.22. */ - g_object_class_install_property - (object_class, PROP_WIMAX_ENABLED, - g_param_spec_boolean (NM_CLIENT_WIMAX_ENABLED, "", "", - FALSE, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_WIMAX_ENABLED] = + g_param_spec_boolean (NM_CLIENT_WIMAX_ENABLED, "", "", + FALSE, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS); /** * NMClient:wimax-hardware-enabled: * * Whether the WiMAX hardware is enabled. **/ - g_object_class_install_property - (object_class, PROP_WIMAX_HARDWARE_ENABLED, - g_param_spec_boolean (NM_CLIENT_WIMAX_HARDWARE_ENABLED, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_WIMAX_HARDWARE_ENABLED] = + g_param_spec_boolean (NM_CLIENT_WIMAX_HARDWARE_ENABLED, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMClient:active-connections: (type GPtrArray(NMActiveConnection)) * * The active connections. **/ - g_object_class_install_property - (object_class, PROP_ACTIVE_CONNECTIONS, - g_param_spec_boxed (NM_CLIENT_ACTIVE_CONNECTIONS, "", "", - G_TYPE_PTR_ARRAY, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_ACTIVE_CONNECTIONS] = + g_param_spec_boxed (NM_CLIENT_ACTIVE_CONNECTIONS, "", "", + G_TYPE_PTR_ARRAY, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMClient:connectivity: * * The network connectivity state. */ - g_object_class_install_property - (object_class, PROP_CONNECTIVITY, - g_param_spec_enum (NM_CLIENT_CONNECTIVITY, "", "", - NM_TYPE_CONNECTIVITY_STATE, - NM_CONNECTIVITY_UNKNOWN, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_CONNECTIVITY] = + g_param_spec_enum (NM_CLIENT_CONNECTIVITY, "", "", + NM_TYPE_CONNECTIVITY_STATE, + NM_CONNECTIVITY_UNKNOWN, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMClient::connectivity-check-available @@ -3971,12 +3952,11 @@ nm_client_class_init (NMClientClass *client_class) * * Since: 1.10 */ - g_object_class_install_property - (object_class, PROP_CONNECTIVITY_CHECK_AVAILABLE, - g_param_spec_boolean (NM_CLIENT_CONNECTIVITY_CHECK_AVAILABLE, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_CONNECTIVITY_CHECK_AVAILABLE] = + g_param_spec_boolean (NM_CLIENT_CONNECTIVITY_CHECK_AVAILABLE, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMClient::connectivity-check-enabled @@ -3987,12 +3967,11 @@ nm_client_class_init (NMClientClass *client_class) * * The property setter is a synchronous D-Bus call. This is deprecated since 1.22. */ - g_object_class_install_property - (object_class, PROP_CONNECTIVITY_CHECK_ENABLED, - g_param_spec_boolean (NM_CLIENT_CONNECTIVITY_CHECK_ENABLED, "", "", - FALSE, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_CONNECTIVITY_CHECK_ENABLED] = + g_param_spec_boolean (NM_CLIENT_CONNECTIVITY_CHECK_ENABLED, "", "", + FALSE, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS); /** * NMClient:primary-connection: @@ -4000,12 +3979,11 @@ nm_client_class_init (NMClientClass *client_class) * The #NMActiveConnection of the device with the default route; * see nm_client_get_primary_connection() for more details. **/ - g_object_class_install_property - (object_class, PROP_PRIMARY_CONNECTION, - g_param_spec_object (NM_CLIENT_PRIMARY_CONNECTION, "", "", - NM_TYPE_ACTIVE_CONNECTION, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_PRIMARY_CONNECTION] = + g_param_spec_object (NM_CLIENT_PRIMARY_CONNECTION, "", "", + NM_TYPE_ACTIVE_CONNECTION, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMClient:activating-connection: @@ -4013,24 +3991,22 @@ nm_client_class_init (NMClientClass *client_class) * The #NMActiveConnection of the activating connection that is * likely to become the new #NMClient:primary-connection. **/ - g_object_class_install_property - (object_class, PROP_ACTIVATING_CONNECTION, - g_param_spec_object (NM_CLIENT_ACTIVATING_CONNECTION, "", "", - NM_TYPE_ACTIVE_CONNECTION, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_ACTIVATING_CONNECTION] = + g_param_spec_object (NM_CLIENT_ACTIVATING_CONNECTION, "", "", + NM_TYPE_ACTIVE_CONNECTION, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMClient:devices: (type GPtrArray(NMDevice)) * * List of real network devices. Does not include placeholder devices. **/ - g_object_class_install_property - (object_class, PROP_DEVICES, - g_param_spec_boxed (NM_CLIENT_DEVICES, "", "", - G_TYPE_PTR_ARRAY, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_DEVICES] = + g_param_spec_boxed (NM_CLIENT_DEVICES, "", "", + G_TYPE_PTR_ARRAY, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMClient:all-devices: (type GPtrArray(NMDevice)) @@ -4038,12 +4014,11 @@ nm_client_class_init (NMClientClass *client_class) * List of both real devices and device placeholders. * Since: 1.2 **/ - g_object_class_install_property - (object_class, PROP_ALL_DEVICES, - g_param_spec_boxed (NM_CLIENT_ALL_DEVICES, "", "", - G_TYPE_PTR_ARRAY, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_ALL_DEVICES] = + g_param_spec_boxed (NM_CLIENT_ALL_DEVICES, "", "", + G_TYPE_PTR_ARRAY, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMClient:connections: (type GPtrArray(NMRemoteConnection)) @@ -4053,12 +4028,11 @@ nm_client_class_init (NMClientClass *client_class) * contain the object paths of connections that the user does not have * permission to read the details of.) */ - g_object_class_install_property - (object_class, PROP_CONNECTIONS, - g_param_spec_boxed (NM_CLIENT_CONNECTIONS, "", "", - G_TYPE_PTR_ARRAY, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_CONNECTIONS] = + g_param_spec_boxed (NM_CLIENT_CONNECTIONS, "", "", + G_TYPE_PTR_ARRAY, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMClient:hostname: @@ -4066,24 +4040,22 @@ nm_client_class_init (NMClientClass *client_class) * The machine hostname stored in persistent configuration. This can be * modified by calling nm_client_save_hostname(). */ - g_object_class_install_property - (object_class, PROP_HOSTNAME, - g_param_spec_string (NM_CLIENT_HOSTNAME, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_HOSTNAME] = + g_param_spec_string (NM_CLIENT_HOSTNAME, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMClient:can-modify: * * If %TRUE, adding and modifying connections is supported. */ - g_object_class_install_property - (object_class, PROP_CAN_MODIFY, - g_param_spec_boolean (NM_CLIENT_CAN_MODIFY, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_CAN_MODIFY] = + g_param_spec_boolean (NM_CLIENT_CAN_MODIFY, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMClient:metered: @@ -4092,12 +4064,11 @@ nm_client_class_init (NMClientClass *client_class) * * Since: 1.2 **/ - g_object_class_install_property - (object_class, PROP_METERED, - g_param_spec_uint (NM_CLIENT_METERED, "", "", - 0, G_MAXUINT32, NM_METERED_UNKNOWN, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_METERED] = + g_param_spec_uint (NM_CLIENT_METERED, "", "", + 0, G_MAXUINT32, NM_METERED_UNKNOWN, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMClient:dns-mode: @@ -4106,12 +4077,11 @@ nm_client_class_init (NMClientClass *client_class) * * Since: 1.6 **/ - g_object_class_install_property - (object_class, PROP_DNS_MODE, - g_param_spec_string (NM_CLIENT_DNS_MODE, "", "", - "", - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_DNS_MODE] = + g_param_spec_string (NM_CLIENT_DNS_MODE, "", "", + "", + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMClient:dns-rc-manager: @@ -4120,12 +4090,11 @@ nm_client_class_init (NMClientClass *client_class) * * Since: 1.6 **/ - g_object_class_install_property - (object_class, PROP_DNS_RC_MANAGER, - g_param_spec_string (NM_CLIENT_DNS_RC_MANAGER, "", "", - "", - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_DNS_RC_MANAGER] = + g_param_spec_string (NM_CLIENT_DNS_RC_MANAGER, "", "", + "", + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMClient:dns-configuration: (type GPtrArray(NMDnsEntry)) @@ -4135,12 +4104,11 @@ nm_client_class_init (NMClientClass *client_class) * * Since: 1.6 **/ - g_object_class_install_property - (object_class, PROP_DNS_CONFIGURATION, - g_param_spec_boxed (NM_CLIENT_DNS_CONFIGURATION, "", "", - G_TYPE_PTR_ARRAY, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_DNS_CONFIGURATION] = + g_param_spec_boxed (NM_CLIENT_DNS_CONFIGURATION, "", "", + G_TYPE_PTR_ARRAY, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMClient:checkpoints: (type GPtrArray(NMCheckpoint)) @@ -4149,14 +4117,13 @@ nm_client_class_init (NMClientClass *client_class) * * Since: 1.12 */ - g_object_class_install_property - (object_class, PROP_CHECKPOINTS, - g_param_spec_boxed (NM_MANAGER_CHECKPOINTS, "", "", - G_TYPE_PTR_ARRAY, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_CHECKPOINTS] = + g_param_spec_boxed (NM_MANAGER_CHECKPOINTS, "", "", + G_TYPE_PTR_ARRAY, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); - /* signals */ + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); /** * NMClient::device-added: @@ -4167,13 +4134,13 @@ nm_client_class_init (NMClientClass *client_class) * placeholder devices. **/ signals[DEVICE_ADDED] = - g_signal_new (NM_CLIENT_DEVICE_ADDED, - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMClientClass, device_added), - NULL, NULL, NULL, - G_TYPE_NONE, 1, - G_TYPE_OBJECT); + g_signal_new (NM_CLIENT_DEVICE_ADDED, + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMClientClass, device_added), + NULL, NULL, NULL, + G_TYPE_NONE, 1, + G_TYPE_OBJECT); /** * NMClient::device-removed: @@ -4184,13 +4151,13 @@ nm_client_class_init (NMClientClass *client_class) * placeholder devices. **/ signals[DEVICE_REMOVED] = - g_signal_new (NM_CLIENT_DEVICE_REMOVED, - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMClientClass, device_removed), - NULL, NULL, NULL, - G_TYPE_NONE, 1, - G_TYPE_OBJECT); + g_signal_new (NM_CLIENT_DEVICE_REMOVED, + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMClientClass, device_removed), + NULL, NULL, NULL, + G_TYPE_NONE, 1, + G_TYPE_OBJECT); /** * NMClient::any-device-added: @@ -4201,13 +4168,13 @@ nm_client_class_init (NMClientClass *client_class) * regular devices and placeholder devices. **/ signals[ANY_DEVICE_ADDED] = - g_signal_new (NM_CLIENT_ANY_DEVICE_ADDED, - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMClientClass, any_device_added), - NULL, NULL, NULL, - G_TYPE_NONE, 1, - G_TYPE_OBJECT); + g_signal_new (NM_CLIENT_ANY_DEVICE_ADDED, + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMClientClass, any_device_added), + NULL, NULL, NULL, + G_TYPE_NONE, 1, + G_TYPE_OBJECT); /** * NMClient::any-device-removed: @@ -4218,13 +4185,13 @@ nm_client_class_init (NMClientClass *client_class) * regular devices and placeholder devices. **/ signals[ANY_DEVICE_REMOVED] = - g_signal_new (NM_CLIENT_ANY_DEVICE_REMOVED, - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMClientClass, any_device_removed), - NULL, NULL, NULL, - G_TYPE_NONE, 1, - G_TYPE_OBJECT); + g_signal_new (NM_CLIENT_ANY_DEVICE_REMOVED, + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMClientClass, any_device_removed), + NULL, NULL, NULL, + G_TYPE_NONE, 1, + G_TYPE_OBJECT); /** * NMClient::permission-changed: @@ -4235,11 +4202,11 @@ nm_client_class_init (NMClientClass *client_class) * Notifies that a permission has changed **/ signals[PERMISSION_CHANGED] = - g_signal_new (NM_CLIENT_PERMISSION_CHANGED, - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - 0, NULL, NULL, NULL, - G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT); + g_signal_new (NM_CLIENT_PERMISSION_CHANGED, + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + 0, NULL, NULL, NULL, + G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT); /** * NMClient::connection-added: * @client: the settings object that received the signal @@ -4248,13 +4215,13 @@ nm_client_class_init (NMClientClass *client_class) * Notifies that a #NMConnection has been added. **/ signals[CONNECTION_ADDED] = - g_signal_new (NM_CLIENT_CONNECTION_ADDED, - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMClientClass, connection_added), - NULL, NULL, NULL, - G_TYPE_NONE, 1, - NM_TYPE_REMOTE_CONNECTION); + g_signal_new (NM_CLIENT_CONNECTION_ADDED, + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMClientClass, connection_added), + NULL, NULL, NULL, + G_TYPE_NONE, 1, + NM_TYPE_REMOTE_CONNECTION); /** * NMClient::connection-removed: @@ -4264,13 +4231,13 @@ nm_client_class_init (NMClientClass *client_class) * Notifies that a #NMConnection has been removed. **/ signals[CONNECTION_REMOVED] = - g_signal_new (NM_CLIENT_CONNECTION_REMOVED, - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMClientClass, connection_removed), - NULL, NULL, NULL, - G_TYPE_NONE, 1, - NM_TYPE_REMOTE_CONNECTION); + g_signal_new (NM_CLIENT_CONNECTION_REMOVED, + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMClientClass, connection_removed), + NULL, NULL, NULL, + G_TYPE_NONE, 1, + NM_TYPE_REMOTE_CONNECTION); /** * NMClient::active-connection-added: @@ -4280,12 +4247,12 @@ nm_client_class_init (NMClientClass *client_class) * Notifies that a #NMActiveConnection has been added. **/ signals[ACTIVE_CONNECTION_ADDED] = - g_signal_new (NM_CLIENT_ACTIVE_CONNECTION_ADDED, - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - 0, NULL, NULL, NULL, - G_TYPE_NONE, 1, - NM_TYPE_ACTIVE_CONNECTION); + g_signal_new (NM_CLIENT_ACTIVE_CONNECTION_ADDED, + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + 0, NULL, NULL, NULL, + G_TYPE_NONE, 1, + NM_TYPE_ACTIVE_CONNECTION); /** * NMClient::active-connection-removed: @@ -4295,12 +4262,12 @@ nm_client_class_init (NMClientClass *client_class) * Notifies that a #NMActiveConnection has been removed. **/ signals[ACTIVE_CONNECTION_REMOVED] = - g_signal_new (NM_CLIENT_ACTIVE_CONNECTION_REMOVED, - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - 0, NULL, NULL, NULL, - G_TYPE_NONE, 1, - NM_TYPE_ACTIVE_CONNECTION); + g_signal_new (NM_CLIENT_ACTIVE_CONNECTION_REMOVED, + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + 0, NULL, NULL, NULL, + G_TYPE_NONE, 1, + NM_TYPE_ACTIVE_CONNECTION); } static void diff --git a/libnm/nm-device-6lowpan.c b/libnm/nm-device-6lowpan.c index 7dd4e88e07..b67fad141d 100644 --- a/libnm/nm-device-6lowpan.c +++ b/libnm/nm-device-6lowpan.c @@ -142,8 +142,8 @@ nm_device_6lowpan_class_init (NMDevice6LowpanClass *klass) g_type_class_add_private (klass, sizeof (NMDevice6LowpanPrivate)); - object_class->finalize = finalize; object_class->get_property = get_property; + object_class->finalize = finalize; nm_object_class->init_dbus = init_dbus; @@ -157,10 +157,10 @@ nm_device_6lowpan_class_init (NMDevice6LowpanClass *klass) * Since: 1.14 **/ obj_properties[PROP_PARENT] = - g_param_spec_object (NM_DEVICE_6LOWPAN_PARENT, "", "", - NM_TYPE_DEVICE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS); + g_param_spec_object (NM_DEVICE_6LOWPAN_PARENT, "", "", + NM_TYPE_DEVICE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDevice6Lowpan:hw-address: @@ -170,10 +170,10 @@ nm_device_6lowpan_class_init (NMDevice6LowpanClass *klass) * Since: 1.14 **/ obj_properties[PROP_HW_ADDRESS] = - g_param_spec_string (NM_DEVICE_6LOWPAN_HW_ADDRESS, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS); + g_param_spec_string (NM_DEVICE_6LOWPAN_HW_ADDRESS, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); } diff --git a/libnm/nm-device-adsl.c b/libnm/nm-device-adsl.c index 985892b97c..8fe10d52c8 100644 --- a/libnm/nm-device-adsl.c +++ b/libnm/nm-device-adsl.c @@ -21,11 +21,9 @@ typedef struct { } NMDeviceAdslPrivate; -enum { - PROP_0, +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( PROP_CARRIER, - LAST_PROP -}; +); /** * nm_device_adsl_get_carrier: @@ -114,24 +112,23 @@ nm_device_adsl_class_init (NMDeviceAdslClass *adsl_class) g_type_class_add_private (object_class, sizeof (NMDeviceAdslPrivate)); - /* virtual methods */ object_class->get_property = get_property; nm_object_class->init_dbus = init_dbus; device_class->connection_compatible = connection_compatible; - device_class->get_setting_type = get_setting_type; + device_class->get_setting_type = get_setting_type; - /* properties */ /** * NMDeviceAdsl:carrier: * * Whether the device has carrier. **/ - g_object_class_install_property - (object_class, PROP_CARRIER, - g_param_spec_boolean (NM_DEVICE_ADSL_CARRIER, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_CARRIER] = + g_param_spec_boolean (NM_DEVICE_ADSL_CARRIER, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); } diff --git a/libnm/nm-device-bond.c b/libnm/nm-device-bond.c index bc4bd18039..0ef32aab5a 100644 --- a/libnm/nm-device-bond.c +++ b/libnm/nm-device-bond.c @@ -23,14 +23,11 @@ typedef struct { GPtrArray *slaves; } NMDeviceBondPrivate; -enum { - PROP_0, +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( PROP_HW_ADDRESS, PROP_CARRIER, PROP_SLAVES, - - LAST_PROP -}; +); /** * nm_device_bond_get_hw_address: @@ -193,52 +190,48 @@ nm_device_bond_class_init (NMDeviceBondClass *bond_class) g_type_class_add_private (bond_class, sizeof (NMDeviceBondPrivate)); - /* virtual methods */ - object_class->dispose = dispose; - object_class->finalize = finalize; object_class->get_property = get_property; + object_class->dispose = dispose; + object_class->finalize = finalize; nm_object_class->init_dbus = init_dbus; device_class->connection_compatible = connection_compatible; - device_class->get_setting_type = get_setting_type; - device_class->get_hw_address = get_hw_address; - - /* properties */ + device_class->get_setting_type = get_setting_type; + device_class->get_hw_address = get_hw_address; /** * NMDeviceBond:hw-address: * * The hardware (MAC) address of the device. **/ - g_object_class_install_property - (object_class, PROP_HW_ADDRESS, - g_param_spec_string (NM_DEVICE_BOND_HW_ADDRESS, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_HW_ADDRESS] = + g_param_spec_string (NM_DEVICE_BOND_HW_ADDRESS, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceBond:carrier: * * Whether the device has carrier. **/ - g_object_class_install_property - (object_class, PROP_CARRIER, - g_param_spec_boolean (NM_DEVICE_BOND_CARRIER, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_CARRIER] = + g_param_spec_boolean (NM_DEVICE_BOND_CARRIER, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceBond:slaves: (type GPtrArray(NMDevice)) * * The devices enslaved to the bond device. **/ - g_object_class_install_property - (object_class, PROP_SLAVES, - g_param_spec_boxed (NM_DEVICE_BOND_SLAVES, "", "", - G_TYPE_PTR_ARRAY, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_SLAVES] = + g_param_spec_boxed (NM_DEVICE_BOND_SLAVES, "", "", + G_TYPE_PTR_ARRAY, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); } diff --git a/libnm/nm-device-bridge.c b/libnm/nm-device-bridge.c index 3a419978e8..c41af835cc 100644 --- a/libnm/nm-device-bridge.c +++ b/libnm/nm-device-bridge.c @@ -23,14 +23,11 @@ typedef struct { GPtrArray *slaves; } NMDeviceBridgePrivate; -enum { - PROP_0, +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( PROP_HW_ADDRESS, PROP_CARRIER, PROP_SLAVES, - - LAST_PROP -}; +); /** * nm_device_bridge_get_hw_address: @@ -198,52 +195,48 @@ nm_device_bridge_class_init (NMDeviceBridgeClass *bridge_class) g_type_class_add_private (bridge_class, sizeof (NMDeviceBridgePrivate)); - /* virtual methods */ - object_class->dispose = dispose; - object_class->finalize = finalize; + object_class->dispose = dispose; + object_class->finalize = finalize; object_class->get_property = get_property; nm_object_class->init_dbus = init_dbus; device_class->connection_compatible = connection_compatible; - device_class->get_setting_type = get_setting_type; - device_class->get_hw_address = get_hw_address; - - /* properties */ + device_class->get_setting_type = get_setting_type; + device_class->get_hw_address = get_hw_address; /** * NMDeviceBridge:hw-address: * * The hardware (MAC) address of the device. **/ - g_object_class_install_property - (object_class, PROP_HW_ADDRESS, - g_param_spec_string (NM_DEVICE_BRIDGE_HW_ADDRESS, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_HW_ADDRESS] = + g_param_spec_string (NM_DEVICE_BRIDGE_HW_ADDRESS, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceBridge:carrier: * * Whether the device has carrier. **/ - g_object_class_install_property - (object_class, PROP_CARRIER, - g_param_spec_boolean (NM_DEVICE_BRIDGE_CARRIER, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_CARRIER] = + g_param_spec_boolean (NM_DEVICE_BRIDGE_CARRIER, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceBridge:slaves: (type GPtrArray(NMDevice)) * * The devices enslaved to the bridge device. **/ - g_object_class_install_property - (object_class, PROP_SLAVES, - g_param_spec_boxed (NM_DEVICE_BRIDGE_SLAVES, "", "", - G_TYPE_PTR_ARRAY, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_SLAVES] = + g_param_spec_boxed (NM_DEVICE_BRIDGE_SLAVES, "", "", + G_TYPE_PTR_ARRAY, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); } diff --git a/libnm/nm-device-bt.c b/libnm/nm-device-bt.c index 0c92a1266f..f44b86c4f9 100644 --- a/libnm/nm-device-bt.c +++ b/libnm/nm-device-bt.c @@ -24,14 +24,11 @@ typedef struct { guint32 bt_capabilities; } NMDeviceBtPrivate; -enum { - PROP_0, +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( PROP_HW_ADDRESS, PROP_NAME, PROP_BT_CAPABILITIES, - - LAST_PROP -}; +); /** * nm_device_bt_get_hw_address: @@ -235,53 +232,48 @@ nm_device_bt_class_init (NMDeviceBtClass *bt_class) g_type_class_add_private (bt_class, sizeof (NMDeviceBtPrivate)); - /* virtual methods */ - object_class->finalize = finalize; object_class->get_property = get_property; + object_class->finalize = finalize; nm_object_class->init_dbus = init_dbus; device_class->connection_compatible = connection_compatible; - device_class->get_setting_type = get_setting_type; - device_class->get_hw_address = get_hw_address; - - /* properties */ + device_class->get_setting_type = get_setting_type; + device_class->get_hw_address = get_hw_address; /** * NMDeviceBt:hw-address: * * The hardware (MAC) address of the device. **/ - g_object_class_install_property - (object_class, PROP_HW_ADDRESS, - g_param_spec_string (NM_DEVICE_BT_HW_ADDRESS, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_HW_ADDRESS] = + g_param_spec_string (NM_DEVICE_BT_HW_ADDRESS, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceBt:name: * * The name of the bluetooth device. **/ - g_object_class_install_property - (object_class, PROP_NAME, - g_param_spec_string (NM_DEVICE_BT_NAME, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_NAME] = + g_param_spec_string (NM_DEVICE_BT_NAME, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceBt:bt-capabilities: * * The device's bluetooth capabilities, a combination of #NMBluetoothCapabilities. **/ - g_object_class_install_property - (object_class, PROP_BT_CAPABILITIES, - g_param_spec_flags (NM_DEVICE_BT_CAPABILITIES, "", "", - NM_TYPE_BLUETOOTH_CAPABILITIES, - NM_BT_CAPABILITY_NONE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); - + obj_properties[PROP_BT_CAPABILITIES] = + g_param_spec_flags (NM_DEVICE_BT_CAPABILITIES, "", "", + NM_TYPE_BLUETOOTH_CAPABILITIES, + NM_BT_CAPABILITY_NONE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); } diff --git a/libnm/nm-device-dummy.c b/libnm/nm-device-dummy.c index f7c378d716..e1577cbfbf 100644 --- a/libnm/nm-device-dummy.c +++ b/libnm/nm-device-dummy.c @@ -19,12 +19,9 @@ typedef struct { char *hw_address; } NMDeviceDummyPrivate; -enum { - PROP_0, +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( PROP_HW_ADDRESS, - - LAST_PROP -}; +); /*****************************************************************************/ @@ -143,14 +140,14 @@ nm_device_dummy_class_init (NMDeviceDummyClass *dummy_class) g_type_class_add_private (dummy_class, sizeof (NMDeviceDummyPrivate)); - object_class->dispose = dispose; object_class->get_property = get_property; + object_class->dispose = dispose; nm_object_class->init_dbus = init_dbus; device_class->connection_compatible = connection_compatible; - device_class->get_hw_address = get_hw_address; - device_class->get_setting_type = get_setting_type; + device_class->get_hw_address = get_hw_address; + device_class->get_setting_type = get_setting_type; /** * NMDeviceDummy:hw-address: @@ -159,10 +156,11 @@ nm_device_dummy_class_init (NMDeviceDummyClass *dummy_class) * * Since: 1.10 **/ - g_object_class_install_property - (object_class, PROP_HW_ADDRESS, - g_param_spec_string (NM_DEVICE_DUMMY_HW_ADDRESS, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_HW_ADDRESS] = + g_param_spec_string (NM_DEVICE_DUMMY_HW_ADDRESS, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); } diff --git a/libnm/nm-device-ethernet.c b/libnm/nm-device-ethernet.c index 33403606b3..72b3559a77 100644 --- a/libnm/nm-device-ethernet.c +++ b/libnm/nm-device-ethernet.c @@ -26,16 +26,13 @@ typedef struct { char **s390_subchannels; } NMDeviceEthernetPrivate; -enum { - PROP_0, +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( PROP_HW_ADDRESS, PROP_PERM_HW_ADDRESS, PROP_SPEED, PROP_CARRIER, PROP_S390_SUBCHANNELS, - - LAST_PROP -}; +); /** * nm_device_ethernet_get_hw_address: @@ -338,65 +335,58 @@ nm_device_ethernet_class_init (NMDeviceEthernetClass *eth_class) g_type_class_add_private (eth_class, sizeof (NMDeviceEthernetPrivate)); - /* virtual methods */ - object_class->finalize = finalize; object_class->get_property = get_property; + object_class->finalize = finalize; nm_object_class->init_dbus = init_dbus; device_class->connection_compatible = connection_compatible; - device_class->get_setting_type = get_setting_type; - device_class->get_hw_address = get_hw_address; - - /* properties */ + device_class->get_setting_type = get_setting_type; + device_class->get_hw_address = get_hw_address; /** * NMDeviceEthernet:hw-address: * * The active hardware (MAC) address of the device. **/ - g_object_class_install_property - (object_class, PROP_HW_ADDRESS, - g_param_spec_string (NM_DEVICE_ETHERNET_HW_ADDRESS, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_HW_ADDRESS] = + g_param_spec_string (NM_DEVICE_ETHERNET_HW_ADDRESS, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceEthernet:perm-hw-address: * * The permanent hardware (MAC) address of the device. **/ - g_object_class_install_property - (object_class, PROP_PERM_HW_ADDRESS, - g_param_spec_string (NM_DEVICE_ETHERNET_PERMANENT_HW_ADDRESS, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_PERM_HW_ADDRESS] = + g_param_spec_string (NM_DEVICE_ETHERNET_PERMANENT_HW_ADDRESS, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceEthernet:speed: * * The speed of the device. **/ - g_object_class_install_property - (object_class, PROP_SPEED, - g_param_spec_uint (NM_DEVICE_ETHERNET_SPEED, "", "", - 0, G_MAXUINT32, 0, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_SPEED] = + g_param_spec_uint (NM_DEVICE_ETHERNET_SPEED, "", "", + 0, G_MAXUINT32, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceEthernet:carrier: * * Whether the device has carrier. **/ - g_object_class_install_property - (object_class, PROP_CARRIER, - g_param_spec_boolean (NM_DEVICE_ETHERNET_CARRIER, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_CARRIER] = + g_param_spec_boolean (NM_DEVICE_ETHERNET_CARRIER, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceEthernet:s390-subchannels: @@ -406,10 +396,11 @@ nm_device_ethernet_class_init (NMDeviceEthernetClass *eth_class) * * Since: 1.2 **/ - g_object_class_install_property - (object_class, PROP_S390_SUBCHANNELS, - g_param_spec_boxed (NM_DEVICE_ETHERNET_S390_SUBCHANNELS, "", "", - G_TYPE_STRV, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_S390_SUBCHANNELS] = + g_param_spec_boxed (NM_DEVICE_ETHERNET_S390_SUBCHANNELS, "", "", + G_TYPE_STRV, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); } diff --git a/libnm/nm-device-generic.c b/libnm/nm-device-generic.c index dde19dd589..5a2c6d6feb 100644 --- a/libnm/nm-device-generic.c +++ b/libnm/nm-device-generic.c @@ -20,13 +20,10 @@ typedef struct { char *type_description; } NMDeviceGenericPrivate; -enum { - PROP_0, +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( PROP_HW_ADDRESS, PROP_TYPE_DESCRIPTION, - - LAST_PROP -}; +); /** * nm_device_generic_get_hw_address: @@ -157,27 +154,26 @@ nm_device_generic_class_init (NMDeviceGenericClass *klass) g_type_class_add_private (klass, sizeof (NMDeviceGenericPrivate)); - object_class->finalize = finalize; object_class->get_property = get_property; + object_class->finalize = finalize; nm_object_class->init_dbus = init_dbus; - device_class->get_type_description = get_type_description; - device_class->get_hw_address = get_hw_address; + device_class->get_type_description = get_type_description; + device_class->get_hw_address = get_hw_address; device_class->connection_compatible = connection_compatible; - device_class->get_setting_type = get_setting_type; + device_class->get_setting_type = get_setting_type; /** * NMDeviceGeneric:hw-address: * * The hardware address of the device. **/ - g_object_class_install_property - (object_class, PROP_HW_ADDRESS, - g_param_spec_string (NM_DEVICE_GENERIC_HW_ADDRESS, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_HW_ADDRESS] = + g_param_spec_string (NM_DEVICE_GENERIC_HW_ADDRESS, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceGeneric:type-description: @@ -185,10 +181,11 @@ nm_device_generic_class_init (NMDeviceGenericClass *klass) * A description of the specific type of device this is, or %NULL * if not known. **/ - g_object_class_install_property - (object_class, PROP_TYPE_DESCRIPTION, - g_param_spec_string (NM_DEVICE_GENERIC_TYPE_DESCRIPTION, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_TYPE_DESCRIPTION] = + g_param_spec_string (NM_DEVICE_GENERIC_TYPE_DESCRIPTION, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); } diff --git a/libnm/nm-device-infiniband.c b/libnm/nm-device-infiniband.c index b205628f07..a297b870fa 100644 --- a/libnm/nm-device-infiniband.c +++ b/libnm/nm-device-infiniband.c @@ -21,13 +21,10 @@ typedef struct { gboolean carrier; } NMDeviceInfinibandPrivate; -enum { - PROP_0, +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( PROP_HW_ADDRESS, PROP_CARRIER, - - LAST_PROP -}; +); /** * nm_device_infiniband_get_hw_address: @@ -173,40 +170,36 @@ nm_device_infiniband_class_init (NMDeviceInfinibandClass *ib_class) g_type_class_add_private (ib_class, sizeof (NMDeviceInfinibandPrivate)); - /* virtual methods */ - object_class->finalize = finalize; object_class->get_property = get_property; + object_class->finalize = finalize; nm_object_class->init_dbus = init_dbus; device_class->connection_compatible = connection_compatible; - device_class->get_setting_type = get_setting_type; - device_class->get_hw_address = get_hw_address; - - /* properties */ + device_class->get_setting_type = get_setting_type; + device_class->get_hw_address = get_hw_address; /** * NMDeviceInfiniband:hw-address: * * The hardware (MAC) address of the device. **/ - g_object_class_install_property - (object_class, PROP_HW_ADDRESS, - g_param_spec_string (NM_DEVICE_INFINIBAND_HW_ADDRESS, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_HW_ADDRESS] = + g_param_spec_string (NM_DEVICE_INFINIBAND_HW_ADDRESS, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceInfiniband:carrier: * * Whether the device has carrier. **/ - g_object_class_install_property - (object_class, PROP_CARRIER, - g_param_spec_boolean (NM_DEVICE_INFINIBAND_CARRIER, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_CARRIER] = + g_param_spec_boolean (NM_DEVICE_INFINIBAND_CARRIER, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); } diff --git a/libnm/nm-device-ip-tunnel.c b/libnm/nm-device-ip-tunnel.c index 49e04de8bf..3dc5fe3ec3 100644 --- a/libnm/nm-device-ip-tunnel.c +++ b/libnm/nm-device-ip-tunnel.c @@ -32,8 +32,7 @@ typedef struct { guint32 flags; } NMDeviceIPTunnelPrivate; -enum { - PROP_0, +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( PROP_MODE, PROP_PARENT, PROP_LOCAL, @@ -46,9 +45,7 @@ enum { PROP_ENCAPSULATION_LIMIT, PROP_FLOW_LABEL, PROP_FLAGS, - - LAST_PROP -}; +); /** * nm_device_ip_tunnel_get_mode: @@ -372,16 +369,13 @@ nm_device_ip_tunnel_class_init (NMDeviceIPTunnelClass *bond_class) g_type_class_add_private (bond_class, sizeof (NMDeviceIPTunnelPrivate)); - /* virtual methods */ - object_class->finalize = finalize; object_class->get_property = get_property; + object_class->finalize = finalize; nm_object_class->init_dbus = init_dbus; device_class->connection_compatible = connection_compatible; - device_class->get_setting_type = get_setting_type; - - /* properties */ + device_class->get_setting_type = get_setting_type; /** * NMDeviceIPTunnel:mode: @@ -390,12 +384,11 @@ nm_device_ip_tunnel_class_init (NMDeviceIPTunnelClass *bond_class) * * Since: 1.2 **/ - g_object_class_install_property - (object_class, PROP_MODE, - g_param_spec_uint (NM_DEVICE_IP_TUNNEL_MODE, "", "", - 0, G_MAXUINT, 0, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_MODE] = + g_param_spec_uint (NM_DEVICE_IP_TUNNEL_MODE, "", "", + 0, G_MAXUINT, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceIPTunnel:parent: @@ -404,12 +397,11 @@ nm_device_ip_tunnel_class_init (NMDeviceIPTunnelClass *bond_class) * * Since: 1.2 **/ - g_object_class_install_property - (object_class, PROP_PARENT, - g_param_spec_object (NM_DEVICE_IP_TUNNEL_PARENT, "", "", - NM_TYPE_DEVICE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_PARENT] = + g_param_spec_object (NM_DEVICE_IP_TUNNEL_PARENT, "", "", + NM_TYPE_DEVICE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceIPTunnel:local: @@ -418,12 +410,11 @@ nm_device_ip_tunnel_class_init (NMDeviceIPTunnelClass *bond_class) * * Since: 1.2 **/ - g_object_class_install_property - (object_class, PROP_LOCAL, - g_param_spec_string (NM_DEVICE_IP_TUNNEL_LOCAL, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_LOCAL] = + g_param_spec_string (NM_DEVICE_IP_TUNNEL_LOCAL, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceIPTunnel:remote: @@ -432,12 +423,11 @@ nm_device_ip_tunnel_class_init (NMDeviceIPTunnelClass *bond_class) * * Since: 1.2 **/ - g_object_class_install_property - (object_class, PROP_REMOTE, - g_param_spec_string (NM_DEVICE_IP_TUNNEL_REMOTE, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_REMOTE] = + g_param_spec_string (NM_DEVICE_IP_TUNNEL_REMOTE, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceIPTunnel:ttl: @@ -447,12 +437,11 @@ nm_device_ip_tunnel_class_init (NMDeviceIPTunnelClass *bond_class) * * Since: 1.2 **/ - g_object_class_install_property - (object_class, PROP_TTL, - g_param_spec_uchar (NM_DEVICE_IP_TUNNEL_TTL, "", "", - 0, 255, 0, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_TTL] = + g_param_spec_uchar (NM_DEVICE_IP_TUNNEL_TTL, "", "", + 0, 255, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceIPTunnel:tos: @@ -462,12 +451,11 @@ nm_device_ip_tunnel_class_init (NMDeviceIPTunnelClass *bond_class) * * Since: 1.2 **/ - g_object_class_install_property - (object_class, PROP_TOS, - g_param_spec_uchar (NM_DEVICE_IP_TUNNEL_TOS, "", "", - 0, 255, 0, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_TOS] = + g_param_spec_uchar (NM_DEVICE_IP_TUNNEL_TOS, "", "", + 0, 255, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceIPTunnel:path-mtu-discovery: @@ -476,12 +464,11 @@ nm_device_ip_tunnel_class_init (NMDeviceIPTunnelClass *bond_class) * * Since: 1.2 **/ - g_object_class_install_property - (object_class, PROP_PATH_MTU_DISCOVERY, - g_param_spec_boolean (NM_DEVICE_IP_TUNNEL_PATH_MTU_DISCOVERY, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_PATH_MTU_DISCOVERY] = + g_param_spec_boolean (NM_DEVICE_IP_TUNNEL_PATH_MTU_DISCOVERY, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceIPTunnel:input-key: @@ -490,12 +477,11 @@ nm_device_ip_tunnel_class_init (NMDeviceIPTunnelClass *bond_class) * * Since: 1.2 **/ - g_object_class_install_property - (object_class, PROP_INPUT_KEY, - g_param_spec_string (NM_DEVICE_IP_TUNNEL_INPUT_KEY, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_INPUT_KEY] = + g_param_spec_string (NM_DEVICE_IP_TUNNEL_INPUT_KEY, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceIPTunnel:output-key: @@ -504,12 +490,11 @@ nm_device_ip_tunnel_class_init (NMDeviceIPTunnelClass *bond_class) * * Since: 1.2 **/ - g_object_class_install_property - (object_class, PROP_OUTPUT_KEY, - g_param_spec_string (NM_DEVICE_IP_TUNNEL_OUTPUT_KEY, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_OUTPUT_KEY] = + g_param_spec_string (NM_DEVICE_IP_TUNNEL_OUTPUT_KEY, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceIPTunnel:encapsulation-limit: @@ -520,12 +505,11 @@ nm_device_ip_tunnel_class_init (NMDeviceIPTunnelClass *bond_class) * * Since: 1.2 **/ - g_object_class_install_property - (object_class, PROP_ENCAPSULATION_LIMIT, - g_param_spec_uchar (NM_DEVICE_IP_TUNNEL_ENCAPSULATION_LIMIT, "", "", - 0, 255, 0, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_ENCAPSULATION_LIMIT] = + g_param_spec_uchar (NM_DEVICE_IP_TUNNEL_ENCAPSULATION_LIMIT, "", "", + 0, 255, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceIPTunnel:flow-label: @@ -535,12 +519,11 @@ nm_device_ip_tunnel_class_init (NMDeviceIPTunnelClass *bond_class) * * Since: 1.2 **/ - g_object_class_install_property - (object_class, PROP_FLOW_LABEL, - g_param_spec_uint (NM_DEVICE_IP_TUNNEL_FLOW_LABEL, "", "", - 0, (1 << 20) - 1, 0, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_FLOW_LABEL] = + g_param_spec_uint (NM_DEVICE_IP_TUNNEL_FLOW_LABEL, "", "", + 0, (1 << 20) - 1, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceIPTunnel:flags: @@ -549,10 +532,11 @@ nm_device_ip_tunnel_class_init (NMDeviceIPTunnelClass *bond_class) * * Since: 1.12 **/ - g_object_class_install_property - (object_class, PROP_FLAGS, - g_param_spec_uint (NM_DEVICE_IP_TUNNEL_FLAGS, "", "", - 0, G_MAXUINT32, 0, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_FLAGS] = + g_param_spec_uint (NM_DEVICE_IP_TUNNEL_FLAGS, "", "", + 0, G_MAXUINT32, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); } diff --git a/libnm/nm-device-macsec.c b/libnm/nm-device-macsec.c index 27fc05ab72..84d2a687b9 100644 --- a/libnm/nm-device-macsec.c +++ b/libnm/nm-device-macsec.c @@ -425,8 +425,8 @@ nm_device_macsec_class_init (NMDeviceMacsecClass *macsec_class) g_type_class_add_private (macsec_class, sizeof (NMDeviceMacsecPrivate)); - object_class->finalize = finalize; object_class->get_property = get_property; + object_class->finalize = finalize; nm_object_class->init_dbus = init_dbus; @@ -440,10 +440,10 @@ nm_device_macsec_class_init (NMDeviceMacsecClass *macsec_class) * Since: 1.6 **/ obj_properties[PROP_PARENT] = - g_param_spec_object (NM_DEVICE_MACSEC_PARENT, "", "", - NM_TYPE_DEVICE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS); + g_param_spec_object (NM_DEVICE_MACSEC_PARENT, "", "", + NM_TYPE_DEVICE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceMacsec:hw-address: @@ -453,10 +453,10 @@ nm_device_macsec_class_init (NMDeviceMacsecClass *macsec_class) * Since: 1.6 **/ obj_properties[PROP_HW_ADDRESS] = - g_param_spec_string (NM_DEVICE_MACSEC_HW_ADDRESS, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS); + g_param_spec_string (NM_DEVICE_MACSEC_HW_ADDRESS, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceMacsec:sci: @@ -466,10 +466,10 @@ nm_device_macsec_class_init (NMDeviceMacsecClass *macsec_class) * Since: 1.6 **/ obj_properties[PROP_SCI] = - g_param_spec_uint64 (NM_DEVICE_MACSEC_SCI, "", "", - 0, G_MAXUINT64, 0, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS); + g_param_spec_uint64 (NM_DEVICE_MACSEC_SCI, "", "", + 0, G_MAXUINT64, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceMacsec:icv-length: @@ -479,10 +479,10 @@ nm_device_macsec_class_init (NMDeviceMacsecClass *macsec_class) * Since: 1.6 **/ obj_properties[PROP_ICV_LENGTH] = - g_param_spec_uchar (NM_DEVICE_MACSEC_ICV_LENGTH, "", "", - 0, G_MAXUINT8, 0, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS); + g_param_spec_uchar (NM_DEVICE_MACSEC_ICV_LENGTH, "", "", + 0, G_MAXUINT8, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceMacsec:cipher-suite: @@ -492,10 +492,10 @@ nm_device_macsec_class_init (NMDeviceMacsecClass *macsec_class) * Since: 1.6 **/ obj_properties[PROP_CIPHER_SUITE] = - g_param_spec_uint64 (NM_DEVICE_MACSEC_CIPHER_SUITE, "", "", - 0, G_MAXUINT64, 0, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS); + g_param_spec_uint64 (NM_DEVICE_MACSEC_CIPHER_SUITE, "", "", + 0, G_MAXUINT64, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceMacsec:window: @@ -505,10 +505,10 @@ nm_device_macsec_class_init (NMDeviceMacsecClass *macsec_class) * Since: 1.6 **/ obj_properties[PROP_WINDOW] = - g_param_spec_uint (NM_DEVICE_MACSEC_WINDOW, "", "", - 0, G_MAXUINT32, 0, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS); + g_param_spec_uint (NM_DEVICE_MACSEC_WINDOW, "", "", + 0, G_MAXUINT32, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceMacsec:encoding-sa: @@ -519,10 +519,10 @@ nm_device_macsec_class_init (NMDeviceMacsecClass *macsec_class) * Since: 1.6 **/ obj_properties[PROP_ENCODING_SA] = - g_param_spec_uchar (NM_DEVICE_MACSEC_ENCODING_SA, "", "", - 0, G_MAXUINT8, 0, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS); + g_param_spec_uchar (NM_DEVICE_MACSEC_ENCODING_SA, "", "", + 0, G_MAXUINT8, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceMacsec:validation: @@ -533,10 +533,10 @@ nm_device_macsec_class_init (NMDeviceMacsecClass *macsec_class) * Since: 1.6 **/ obj_properties[PROP_VALIDATION] = - g_param_spec_string (NM_DEVICE_MACSEC_VALIDATION, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS); + g_param_spec_string (NM_DEVICE_MACSEC_VALIDATION, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceMacsec:encrypt: @@ -546,10 +546,10 @@ nm_device_macsec_class_init (NMDeviceMacsecClass *macsec_class) * Since: 1.6 **/ obj_properties[PROP_ENCRYPT] = - g_param_spec_boolean (NM_DEVICE_MACSEC_ENCRYPT, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS); + g_param_spec_boolean (NM_DEVICE_MACSEC_ENCRYPT, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceMacsec:protect: @@ -559,10 +559,10 @@ nm_device_macsec_class_init (NMDeviceMacsecClass *macsec_class) * Since: 1.6 **/ obj_properties[PROP_PROTECT] = - g_param_spec_boolean (NM_DEVICE_MACSEC_PROTECT, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS); + g_param_spec_boolean (NM_DEVICE_MACSEC_PROTECT, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceMacsec:include-sci: @@ -573,10 +573,10 @@ nm_device_macsec_class_init (NMDeviceMacsecClass *macsec_class) * Since: 1.6 **/ obj_properties[PROP_INCLUDE_SCI] = - g_param_spec_boolean (NM_DEVICE_MACSEC_INCLUDE_SCI, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS); + g_param_spec_boolean (NM_DEVICE_MACSEC_INCLUDE_SCI, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceMacsec:es: @@ -587,10 +587,10 @@ nm_device_macsec_class_init (NMDeviceMacsecClass *macsec_class) * Since: 1.6 **/ obj_properties[PROP_ES] = - g_param_spec_boolean (NM_DEVICE_MACSEC_ES, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS); + g_param_spec_boolean (NM_DEVICE_MACSEC_ES, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceMacsec:scb: @@ -601,10 +601,10 @@ nm_device_macsec_class_init (NMDeviceMacsecClass *macsec_class) * Since: 1.6 **/ obj_properties[PROP_SCB] = - g_param_spec_boolean (NM_DEVICE_MACSEC_SCB, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS); + g_param_spec_boolean (NM_DEVICE_MACSEC_SCB, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceMacsec:replay-protect: @@ -614,10 +614,10 @@ nm_device_macsec_class_init (NMDeviceMacsecClass *macsec_class) * Since: 1.6 **/ obj_properties[PROP_REPLAY_PROTECT] = - g_param_spec_boolean (NM_DEVICE_MACSEC_REPLAY_PROTECT, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS); + g_param_spec_boolean (NM_DEVICE_MACSEC_REPLAY_PROTECT, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); } diff --git a/libnm/nm-device-macvlan.c b/libnm/nm-device-macvlan.c index 3c08d6131a..967e380be9 100644 --- a/libnm/nm-device-macvlan.c +++ b/libnm/nm-device-macvlan.c @@ -25,16 +25,13 @@ typedef struct { char *hw_address; } NMDeviceMacvlanPrivate; -enum { - PROP_0, +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( PROP_PARENT, PROP_MODE, PROP_NO_PROMISC, PROP_TAP, PROP_HW_ADDRESS, - - LAST_PROP -}; +); /** * nm_device_macvlan_get_parent: @@ -240,17 +237,14 @@ nm_device_macvlan_class_init (NMDeviceMacvlanClass *gre_class) g_type_class_add_private (gre_class, sizeof (NMDeviceMacvlanPrivate)); - /* virtual methods */ - object_class->finalize = finalize; object_class->get_property = get_property; + object_class->finalize = finalize; nm_object_class->init_dbus = init_dbus; device_class->connection_compatible = connection_compatible; - device_class->get_setting_type = get_setting_type; - device_class->get_hw_address = get_hw_address; - - /* properties */ + device_class->get_setting_type = get_setting_type; + device_class->get_hw_address = get_hw_address; /** * NMDeviceMacvlan:parent: @@ -259,12 +253,11 @@ nm_device_macvlan_class_init (NMDeviceMacvlanClass *gre_class) * * Since: 1.2 **/ - g_object_class_install_property - (object_class, PROP_PARENT, - g_param_spec_object (NM_DEVICE_MACVLAN_PARENT, "", "", - NM_TYPE_DEVICE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_PARENT] = + g_param_spec_object (NM_DEVICE_MACVLAN_PARENT, "", "", + NM_TYPE_DEVICE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceMacvlan:mode: @@ -273,12 +266,11 @@ nm_device_macvlan_class_init (NMDeviceMacvlanClass *gre_class) * * Since: 1.2 **/ - g_object_class_install_property - (object_class, PROP_MODE, - g_param_spec_string (NM_DEVICE_MACVLAN_MODE, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_MODE] = + g_param_spec_string (NM_DEVICE_MACVLAN_MODE, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceMacvlan:no-promisc: @@ -287,12 +279,11 @@ nm_device_macvlan_class_init (NMDeviceMacvlanClass *gre_class) * * Since: 1.2 **/ - g_object_class_install_property - (object_class, PROP_NO_PROMISC, - g_param_spec_boolean (NM_DEVICE_MACVLAN_NO_PROMISC, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_NO_PROMISC] = + g_param_spec_boolean (NM_DEVICE_MACVLAN_NO_PROMISC, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceMacvlan:tap: @@ -301,12 +292,11 @@ nm_device_macvlan_class_init (NMDeviceMacvlanClass *gre_class) * * Since: 1.2 **/ - g_object_class_install_property - (object_class, PROP_TAP, - g_param_spec_boolean (NM_DEVICE_MACVLAN_TAP, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_TAP] = + g_param_spec_boolean (NM_DEVICE_MACVLAN_TAP, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceMacvlan:hw-address: @@ -315,10 +305,11 @@ nm_device_macvlan_class_init (NMDeviceMacvlanClass *gre_class) * * Since: 1.2 **/ - g_object_class_install_property - (object_class, PROP_HW_ADDRESS, - g_param_spec_string (NM_DEVICE_MACVLAN_HW_ADDRESS, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_HW_ADDRESS] = + g_param_spec_string (NM_DEVICE_MACVLAN_HW_ADDRESS, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); } diff --git a/libnm/nm-device-modem.c b/libnm/nm-device-modem.c index a007e43e63..10262878de 100644 --- a/libnm/nm-device-modem.c +++ b/libnm/nm-device-modem.c @@ -26,15 +26,13 @@ typedef struct { char *apn; } NMDeviceModemPrivate; -enum { - PROP_0, +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( PROP_MODEM_CAPABILITIES, PROP_CURRENT_CAPABILITIES, PROP_DEVICE_ID, PROP_OPERATOR_CODE, PROP_APN, - LAST_PROP -}; +); /** * nm_device_modem_get_modem_capabilities: @@ -275,15 +273,14 @@ nm_device_modem_class_init (NMDeviceModemClass *modem_class) g_type_class_add_private (modem_class, sizeof (NMDeviceModemPrivate)); - /* virtual methods */ - object_class->finalize = finalize; object_class->get_property = get_property; + object_class->finalize = finalize; nm_object_class->init_dbus = init_dbus; - device_class->get_type_description = get_type_description; + device_class->get_type_description = get_type_description; device_class->connection_compatible = connection_compatible; - device_class->get_setting_type = get_setting_type; + device_class->get_setting_type = get_setting_type; /** * NMDeviceModem:modem-capabilities: @@ -293,13 +290,12 @@ nm_device_modem_class_init (NMDeviceModemClass *modem_class) * a firmware reload or other reinitialization to switch between eg * CDMA/EVDO and GSM/UMTS. **/ - g_object_class_install_property - (object_class, PROP_MODEM_CAPABILITIES, - g_param_spec_flags (NM_DEVICE_MODEM_MODEM_CAPABILITIES, "", "", - NM_TYPE_DEVICE_MODEM_CAPABILITIES, - NM_DEVICE_MODEM_CAPABILITY_NONE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_MODEM_CAPABILITIES] = + g_param_spec_flags (NM_DEVICE_MODEM_MODEM_CAPABILITIES, "", "", + NM_TYPE_DEVICE_MODEM_CAPABILITIES, + NM_DEVICE_MODEM_CAPABILITY_NONE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceModem:current-capabilities: @@ -307,47 +303,45 @@ nm_device_modem_class_init (NMDeviceModemClass *modem_class) * The generic family of access technologies the modem currently supports * without a firmware reload or reinitialization. **/ - g_object_class_install_property - (object_class, PROP_CURRENT_CAPABILITIES, - g_param_spec_flags (NM_DEVICE_MODEM_CURRENT_CAPABILITIES, "", "", - NM_TYPE_DEVICE_MODEM_CAPABILITIES, - NM_DEVICE_MODEM_CAPABILITY_NONE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_CURRENT_CAPABILITIES] = + g_param_spec_flags (NM_DEVICE_MODEM_CURRENT_CAPABILITIES, "", "", + NM_TYPE_DEVICE_MODEM_CAPABILITIES, + NM_DEVICE_MODEM_CAPABILITY_NONE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceModem:device-id: * * Since: 1.20 **/ - g_object_class_install_property - (object_class, PROP_DEVICE_ID, - g_param_spec_string (NM_DEVICE_MODEM_DEVICE_ID, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_DEVICE_ID] = + g_param_spec_string (NM_DEVICE_MODEM_DEVICE_ID, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceModem:operator-code: * * Since: 1.20 **/ - g_object_class_install_property - (object_class, PROP_OPERATOR_CODE, - g_param_spec_string (NM_DEVICE_MODEM_OPERATOR_CODE, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_OPERATOR_CODE] = + g_param_spec_string (NM_DEVICE_MODEM_OPERATOR_CODE, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceModem:apn: * * Since: 1.20 **/ - g_object_class_install_property - (object_class, PROP_APN, - g_param_spec_string (NM_DEVICE_MODEM_APN, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_APN] = + g_param_spec_string (NM_DEVICE_MODEM_APN, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); } diff --git a/libnm/nm-device-olpc-mesh.c b/libnm/nm-device-olpc-mesh.c index 491e22606e..c5f1b998a8 100644 --- a/libnm/nm-device-olpc-mesh.c +++ b/libnm/nm-device-olpc-mesh.c @@ -22,14 +22,11 @@ typedef struct { guint32 active_channel; } NMDeviceOlpcMeshPrivate; -enum { - PROP_0, +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( PROP_HW_ADDRESS, PROP_COMPANION, PROP_ACTIVE_CHANNEL, - - LAST_PROP -}; +); /** * nm_device_olpc_mesh_get_hw_address: @@ -185,53 +182,48 @@ nm_device_olpc_mesh_class_init (NMDeviceOlpcMeshClass *olpc_mesh_class) g_type_class_add_private (olpc_mesh_class, sizeof (NMDeviceOlpcMeshPrivate)); - /* virtual methods */ - object_class->dispose = dispose; - object_class->finalize = finalize; object_class->get_property = get_property; + object_class->dispose = dispose; + object_class->finalize = finalize; nm_object_class->init_dbus = init_dbus; device_class->connection_compatible = connection_compatible; - device_class->get_setting_type = get_setting_type; - device_class->get_hw_address = get_hw_address; - - /* properties */ + device_class->get_setting_type = get_setting_type; + device_class->get_hw_address = get_hw_address; /** * NMDeviceOlpcMesh:hw-address: * * The hardware (MAC) address of the device. **/ - g_object_class_install_property - (object_class, PROP_HW_ADDRESS, - g_param_spec_string (NM_DEVICE_OLPC_MESH_HW_ADDRESS, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_HW_ADDRESS] = + g_param_spec_string (NM_DEVICE_OLPC_MESH_HW_ADDRESS, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceOlpcMesh:companion: * * The companion device. **/ - g_object_class_install_property - (object_class, PROP_COMPANION, - g_param_spec_object (NM_DEVICE_OLPC_MESH_COMPANION, "", "", - NM_TYPE_DEVICE_WIFI, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_COMPANION] = + g_param_spec_object (NM_DEVICE_OLPC_MESH_COMPANION, "", "", + NM_TYPE_DEVICE_WIFI, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceOlpcMesh:active-channel: * * The device's active channel. **/ - g_object_class_install_property - (object_class, PROP_ACTIVE_CHANNEL, - g_param_spec_uint (NM_DEVICE_OLPC_MESH_ACTIVE_CHANNEL, "", "", - 0, G_MAXUINT32, 0, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_ACTIVE_CHANNEL] = + g_param_spec_uint (NM_DEVICE_OLPC_MESH_ACTIVE_CHANNEL, "", "", + 0, G_MAXUINT32, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); } diff --git a/libnm/nm-device-team.c b/libnm/nm-device-team.c index 7b2a45042d..e50b3e1de8 100644 --- a/libnm/nm-device-team.c +++ b/libnm/nm-device-team.c @@ -24,15 +24,12 @@ typedef struct { char *config; } NMDeviceTeamPrivate; -enum { - PROP_0, +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( PROP_HW_ADDRESS, PROP_CARRIER, PROP_SLAVES, PROP_CONFIG, - - LAST_PROP -}; +); /** * nm_device_team_get_hw_address: @@ -219,54 +216,48 @@ nm_device_team_class_init (NMDeviceTeamClass *team_class) g_type_class_add_private (team_class, sizeof (NMDeviceTeamPrivate)); - /* virtual methods */ - object_class->dispose = dispose; - object_class->finalize = finalize; object_class->get_property = get_property; + object_class->dispose = dispose; + object_class->finalize = finalize; nm_object_class->init_dbus = init_dbus; device_class->connection_compatible = connection_compatible; - device_class->get_setting_type = get_setting_type; - device_class->get_hw_address = get_hw_address; - - /* properties */ + device_class->get_setting_type = get_setting_type; + device_class->get_hw_address = get_hw_address; /** * NMDeviceTeam:hw-address: * * The hardware (MAC) address of the device. **/ - g_object_class_install_property - (object_class, PROP_HW_ADDRESS, - g_param_spec_string (NM_DEVICE_TEAM_HW_ADDRESS, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_HW_ADDRESS] = + g_param_spec_string (NM_DEVICE_TEAM_HW_ADDRESS, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceTeam:carrier: * * Whether the device has carrier. **/ - g_object_class_install_property - (object_class, PROP_CARRIER, - g_param_spec_boolean (NM_DEVICE_TEAM_CARRIER, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_CARRIER] = + g_param_spec_boolean (NM_DEVICE_TEAM_CARRIER, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceTeam:slaves: (type GPtrArray(NMDevice)) * * The devices enslaved to the team device. **/ - g_object_class_install_property - (object_class, PROP_SLAVES, - g_param_spec_boxed (NM_DEVICE_TEAM_SLAVES, "", "", - G_TYPE_PTR_ARRAY, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_SLAVES] = + g_param_spec_boxed (NM_DEVICE_TEAM_SLAVES, "", "", + G_TYPE_PTR_ARRAY, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceTeam:config: @@ -275,10 +266,11 @@ nm_device_team_class_init (NMDeviceTeamClass *team_class) * * Since: 1.4 **/ - g_object_class_install_property - (object_class, PROP_CONFIG, - g_param_spec_string (NM_DEVICE_TEAM_CONFIG, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_CONFIG] = + g_param_spec_string (NM_DEVICE_TEAM_CONFIG, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); } diff --git a/libnm/nm-device-tun.c b/libnm/nm-device-tun.c index e18a775742..a9a1cdf3bf 100644 --- a/libnm/nm-device-tun.c +++ b/libnm/nm-device-tun.c @@ -28,8 +28,7 @@ typedef struct { gboolean multi_queue; } NMDeviceTunPrivate; -enum { - PROP_0, +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( PROP_HW_ADDRESS, PROP_MODE, PROP_OWNER, @@ -37,9 +36,7 @@ enum { PROP_NO_PI, PROP_VNET_HDR, PROP_MULTI_QUEUE, - - LAST_PROP -}; +); /** * nm_device_tun_get_hw_address: @@ -303,17 +300,14 @@ nm_device_tun_class_init (NMDeviceTunClass *gre_class) g_type_class_add_private (gre_class, sizeof (NMDeviceTunPrivate)); - /* virtual methods */ - object_class->finalize = finalize; object_class->get_property = get_property; + object_class->finalize = finalize; nm_object_class->init_dbus = init_dbus; device_class->connection_compatible = connection_compatible; - device_class->get_setting_type = get_setting_type; - device_class->get_hw_address = get_hw_address; - - /* properties */ + device_class->get_setting_type = get_setting_type; + device_class->get_hw_address = get_hw_address; /** * NMDeviceTun:hw-address: @@ -322,12 +316,11 @@ nm_device_tun_class_init (NMDeviceTunClass *gre_class) * * Since: 1.2 **/ - g_object_class_install_property - (object_class, PROP_HW_ADDRESS, - g_param_spec_string (NM_DEVICE_TUN_HW_ADDRESS, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_HW_ADDRESS] = + g_param_spec_string (NM_DEVICE_TUN_HW_ADDRESS, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceTun:mode: @@ -336,12 +329,11 @@ nm_device_tun_class_init (NMDeviceTunClass *gre_class) * * Since: 1.2 **/ - g_object_class_install_property - (object_class, PROP_MODE, - g_param_spec_string (NM_DEVICE_TUN_MODE, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_MODE] = + g_param_spec_string (NM_DEVICE_TUN_MODE, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceTun:owner: @@ -350,12 +342,11 @@ nm_device_tun_class_init (NMDeviceTunClass *gre_class) * * Since: 1.2 **/ - g_object_class_install_property - (object_class, PROP_OWNER, - g_param_spec_int64 (NM_DEVICE_TUN_OWNER, "", "", - -1, G_MAXUINT32, -1, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_OWNER] = + g_param_spec_int64 (NM_DEVICE_TUN_OWNER, "", "", + -1, G_MAXUINT32, -1, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceTun:group: @@ -364,12 +355,11 @@ nm_device_tun_class_init (NMDeviceTunClass *gre_class) * * Since: 1.2 **/ - g_object_class_install_property - (object_class, PROP_GROUP, - g_param_spec_int64 (NM_DEVICE_TUN_GROUP, "", "", - -1, G_MAXUINT32, -1, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_GROUP] = + g_param_spec_int64 (NM_DEVICE_TUN_GROUP, "", "", + -1, G_MAXUINT32, -1, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceTun:no-pi: @@ -379,12 +369,11 @@ nm_device_tun_class_init (NMDeviceTunClass *gre_class) * * Since: 1.2 **/ - g_object_class_install_property - (object_class, PROP_NO_PI, - g_param_spec_boolean (NM_DEVICE_TUN_NO_PI, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_NO_PI] = + g_param_spec_boolean (NM_DEVICE_TUN_NO_PI, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceTun:vnet-hdr: @@ -394,12 +383,11 @@ nm_device_tun_class_init (NMDeviceTunClass *gre_class) * * Since: 1.2 **/ - g_object_class_install_property - (object_class, PROP_VNET_HDR, - g_param_spec_boolean (NM_DEVICE_TUN_VNET_HDR, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_VNET_HDR] = + g_param_spec_boolean (NM_DEVICE_TUN_VNET_HDR, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceTun:multi-queue: @@ -410,10 +398,11 @@ nm_device_tun_class_init (NMDeviceTunClass *gre_class) * * Since: 1.2 **/ - g_object_class_install_property - (object_class, PROP_MULTI_QUEUE, - g_param_spec_boolean (NM_DEVICE_TUN_MULTI_QUEUE, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_MULTI_QUEUE] = + g_param_spec_boolean (NM_DEVICE_TUN_MULTI_QUEUE, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); } diff --git a/libnm/nm-device-vlan.c b/libnm/nm-device-vlan.c index 05b02179c8..c2da173c13 100644 --- a/libnm/nm-device-vlan.c +++ b/libnm/nm-device-vlan.c @@ -24,15 +24,12 @@ typedef struct { guint vlan_id; } NMDeviceVlanPrivate; -enum { - PROP_0, +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( PROP_HW_ADDRESS, PROP_CARRIER, PROP_PARENT, PROP_VLAN_ID, - - LAST_PROP -}; +); /** * nm_device_vlan_get_hw_address: @@ -222,63 +219,58 @@ nm_device_vlan_class_init (NMDeviceVlanClass *vlan_class) g_type_class_add_private (vlan_class, sizeof (NMDeviceVlanPrivate)); - /* virtual methods */ - object_class->finalize = finalize; object_class->get_property = get_property; + object_class->finalize = finalize; nm_object_class->init_dbus = init_dbus; device_class->connection_compatible = connection_compatible; - device_class->get_setting_type = get_setting_type; - device_class->get_hw_address = get_hw_address; - - /* properties */ + device_class->get_setting_type = get_setting_type; + device_class->get_hw_address = get_hw_address; /** * NMDeviceVlan:hw-address: * * The hardware (MAC) address of the device. **/ - g_object_class_install_property - (object_class, PROP_HW_ADDRESS, - g_param_spec_string (NM_DEVICE_VLAN_HW_ADDRESS, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_HW_ADDRESS] = + g_param_spec_string (NM_DEVICE_VLAN_HW_ADDRESS, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceVlan:carrier: * * Whether the device has carrier. **/ - g_object_class_install_property - (object_class, PROP_CARRIER, - g_param_spec_boolean (NM_DEVICE_VLAN_CARRIER, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_CARRIER] = + g_param_spec_boolean (NM_DEVICE_VLAN_CARRIER, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceVlan:parent: * * The devices's parent device. **/ - g_object_class_install_property - (object_class, PROP_PARENT, - g_param_spec_object (NM_DEVICE_VLAN_PARENT, "", "", - NM_TYPE_DEVICE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_PARENT] = + g_param_spec_object (NM_DEVICE_VLAN_PARENT, "", "", + NM_TYPE_DEVICE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceVlan:vlan-id: * * The device's VLAN ID. **/ - g_object_class_install_property - (object_class, PROP_VLAN_ID, - g_param_spec_uint (NM_DEVICE_VLAN_VLAN_ID, "", "", - 0, 4095, 0, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_VLAN_ID] = + g_param_spec_uint (NM_DEVICE_VLAN_VLAN_ID, "", "", + 0, 4095, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); } diff --git a/libnm/nm-device-vxlan.c b/libnm/nm-device-vxlan.c index 5b93a7efbc..10b5ac71da 100644 --- a/libnm/nm-device-vxlan.c +++ b/libnm/nm-device-vxlan.c @@ -37,8 +37,7 @@ typedef struct { gboolean l3miss; } NMDeviceVxlanPrivate; -enum { - PROP_0, +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( PROP_HW_ADDRESS, PROP_CARRIER, PROP_PARENT, @@ -57,9 +56,7 @@ enum { PROP_RSC, PROP_L2MISS, PROP_L3MISS, - - LAST_PROP -}; +); /** * nm_device_vxlan_get_hw_address: @@ -523,17 +520,14 @@ nm_device_vxlan_class_init (NMDeviceVxlanClass *vxlan_class) g_type_class_add_private (vxlan_class, sizeof (NMDeviceVxlanPrivate)); - /* virtual methods */ - object_class->finalize = finalize; object_class->get_property = get_property; + object_class->finalize = finalize; nm_object_class->init_dbus = init_dbus; device_class->connection_compatible = connection_compatible; - device_class->get_setting_type = get_setting_type; - device_class->get_hw_address = get_hw_address; - - /* properties */ + device_class->get_setting_type = get_setting_type; + device_class->get_hw_address = get_hw_address; /** * NMDeviceVxlan:hw-address: @@ -542,12 +536,11 @@ nm_device_vxlan_class_init (NMDeviceVxlanClass *vxlan_class) * * Since: 1.2 **/ - g_object_class_install_property - (object_class, PROP_HW_ADDRESS, - g_param_spec_string (NM_DEVICE_VXLAN_HW_ADDRESS, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_HW_ADDRESS] = + g_param_spec_string (NM_DEVICE_VXLAN_HW_ADDRESS, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceVxlan:carrier: @@ -556,12 +549,11 @@ nm_device_vxlan_class_init (NMDeviceVxlanClass *vxlan_class) * * Since: 1.2 **/ - g_object_class_install_property - (object_class, PROP_CARRIER, - g_param_spec_boolean (NM_DEVICE_VXLAN_CARRIER, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_CARRIER] = + g_param_spec_boolean (NM_DEVICE_VXLAN_CARRIER, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceVxlan:parent: @@ -570,12 +562,11 @@ nm_device_vxlan_class_init (NMDeviceVxlanClass *vxlan_class) * * Since: 1.2 **/ - g_object_class_install_property - (object_class, PROP_PARENT, - g_param_spec_object (NM_DEVICE_VXLAN_PARENT, "", "", - NM_TYPE_DEVICE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_PARENT] = + g_param_spec_object (NM_DEVICE_VXLAN_PARENT, "", "", + NM_TYPE_DEVICE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceVxlan:id: @@ -584,12 +575,11 @@ nm_device_vxlan_class_init (NMDeviceVxlanClass *vxlan_class) * * Since: 1.2 **/ - g_object_class_install_property - (object_class, PROP_ID, - g_param_spec_uint (NM_DEVICE_VXLAN_ID, "", "", - 0, (1 << 24) - 1, 0, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_ID] = + g_param_spec_uint (NM_DEVICE_VXLAN_ID, "", "", + 0, (1 << 24) - 1, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceVxlan:group: @@ -600,12 +590,11 @@ nm_device_vxlan_class_init (NMDeviceVxlanClass *vxlan_class) * * Since: 1.2 */ - g_object_class_install_property - (object_class, PROP_GROUP, - g_param_spec_string (NM_DEVICE_VXLAN_GROUP, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_GROUP] = + g_param_spec_string (NM_DEVICE_VXLAN_GROUP, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceVxlan:local: @@ -614,12 +603,11 @@ nm_device_vxlan_class_init (NMDeviceVxlanClass *vxlan_class) * * Since: 1.2 */ - g_object_class_install_property - (object_class, PROP_LOCAL, - g_param_spec_string (NM_DEVICE_VXLAN_LOCAL, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_LOCAL] = + g_param_spec_string (NM_DEVICE_VXLAN_LOCAL, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceVxlan:tos: @@ -628,12 +616,11 @@ nm_device_vxlan_class_init (NMDeviceVxlanClass *vxlan_class) * * Since: 1.2 */ - g_object_class_install_property - (object_class, PROP_TOS, - g_param_spec_uchar (NM_DEVICE_VXLAN_TOS, "", "", - 0, 255, 0, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_TOS] = + g_param_spec_uchar (NM_DEVICE_VXLAN_TOS, "", "", + 0, 255, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceVxlan:ttl: @@ -642,12 +629,11 @@ nm_device_vxlan_class_init (NMDeviceVxlanClass *vxlan_class) * * Since: 1.2 */ - g_object_class_install_property - (object_class, PROP_TTL, - g_param_spec_uchar (NM_DEVICE_VXLAN_TTL, "", "", - 0, 255, 0, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_TTL] = + g_param_spec_uchar (NM_DEVICE_VXLAN_TTL, "", "", + 0, 255, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceVxlan:learning: @@ -657,12 +643,11 @@ nm_device_vxlan_class_init (NMDeviceVxlanClass *vxlan_class) * * Since: 1.2 */ - g_object_class_install_property - (object_class, PROP_LEARNING, - g_param_spec_boolean (NM_DEVICE_VXLAN_LEARNING, "", "", - TRUE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_LEARNING] = + g_param_spec_boolean (NM_DEVICE_VXLAN_LEARNING, "", "", + TRUE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceVxlan:ageing: @@ -671,12 +656,11 @@ nm_device_vxlan_class_init (NMDeviceVxlanClass *vxlan_class) * * Since: 1.2 */ - g_object_class_install_property - (object_class, PROP_AGEING, - g_param_spec_uint (NM_DEVICE_VXLAN_AGEING, "", "", - 0, G_MAXUINT32, 0, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_AGEING] = + g_param_spec_uint (NM_DEVICE_VXLAN_AGEING, "", "", + 0, G_MAXUINT32, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceVxlan:limit: @@ -685,12 +669,11 @@ nm_device_vxlan_class_init (NMDeviceVxlanClass *vxlan_class) * * Since: 1.2 */ - g_object_class_install_property - (object_class, PROP_LIMIT, - g_param_spec_uint (NM_DEVICE_VXLAN_LIMIT, "", "", - 0, G_MAXUINT32, 0, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_LIMIT] = + g_param_spec_uint (NM_DEVICE_VXLAN_LIMIT, "", "", + 0, G_MAXUINT32, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceVxlan:dst-port: @@ -700,12 +683,11 @@ nm_device_vxlan_class_init (NMDeviceVxlanClass *vxlan_class) * * Since: 1.2 */ - g_object_class_install_property - (object_class, PROP_DST_PORT, - g_param_spec_uint (NM_DEVICE_VXLAN_DST_PORT, "", "", - 0, 65535, 0, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_DST_PORT] = + g_param_spec_uint (NM_DEVICE_VXLAN_DST_PORT, "", "", + 0, 65535, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceVxlan:src-port-min: @@ -715,12 +697,11 @@ nm_device_vxlan_class_init (NMDeviceVxlanClass *vxlan_class) * * Since: 1.2 */ - g_object_class_install_property - (object_class, PROP_SRC_PORT_MIN, - g_param_spec_uint (NM_DEVICE_VXLAN_SRC_PORT_MIN, "", "", - 0, 65535, 0, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_SRC_PORT_MIN] = + g_param_spec_uint (NM_DEVICE_VXLAN_SRC_PORT_MIN, "", "", + 0, 65535, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceVxlan:src-port-max: @@ -730,12 +711,11 @@ nm_device_vxlan_class_init (NMDeviceVxlanClass *vxlan_class) * * Since: 1.2 */ - g_object_class_install_property - (object_class, PROP_SRC_PORT_MAX, - g_param_spec_uint (NM_DEVICE_VXLAN_SRC_PORT_MAX, "", "", - 0, 65535, 0, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_SRC_PORT_MAX] = + g_param_spec_uint (NM_DEVICE_VXLAN_SRC_PORT_MAX, "", "", + 0, 65535, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceVxlan:proxy: @@ -744,12 +724,11 @@ nm_device_vxlan_class_init (NMDeviceVxlanClass *vxlan_class) * * Since: 1.2 */ - g_object_class_install_property - (object_class, PROP_PROXY, - g_param_spec_boolean (NM_DEVICE_VXLAN_PROXY, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_PROXY] = + g_param_spec_boolean (NM_DEVICE_VXLAN_PROXY, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceVxlan:rsc: @@ -758,12 +737,11 @@ nm_device_vxlan_class_init (NMDeviceVxlanClass *vxlan_class) * * Since: 1.2 */ - g_object_class_install_property - (object_class, PROP_RSC, - g_param_spec_boolean (NM_DEVICE_VXLAN_RSC, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_RSC] = + g_param_spec_boolean (NM_DEVICE_VXLAN_RSC, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceVxlan:l2miss: @@ -772,12 +750,11 @@ nm_device_vxlan_class_init (NMDeviceVxlanClass *vxlan_class) * * Since: 1.2 */ - g_object_class_install_property - (object_class, PROP_L2MISS, - g_param_spec_boolean (NM_DEVICE_VXLAN_L2MISS, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_L2MISS] = + g_param_spec_boolean (NM_DEVICE_VXLAN_L2MISS, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceVxlan:l3miss: @@ -786,10 +763,11 @@ nm_device_vxlan_class_init (NMDeviceVxlanClass *vxlan_class) * * Since: 1.2 */ - g_object_class_install_property - (object_class, PROP_L3MISS, - g_param_spec_boolean (NM_DEVICE_VXLAN_L3MISS, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_L3MISS] = + g_param_spec_boolean (NM_DEVICE_VXLAN_L3MISS, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); } diff --git a/libnm/nm-device-wifi.c b/libnm/nm-device-wifi.c index a2920e8156..0436afc6cb 100644 --- a/libnm/nm-device-wifi.c +++ b/libnm/nm-device-wifi.c @@ -40,8 +40,7 @@ typedef struct { gint64 last_scan; } NMDeviceWifiPrivate; -enum { - PROP_0, +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( PROP_HW_ADDRESS, PROP_PERM_HW_ADDRESS, PROP_MODE, @@ -50,9 +49,7 @@ enum { PROP_WIRELESS_CAPABILITIES, PROP_ACCESS_POINTS, PROP_LAST_SCAN, - - LAST_PROP -}; +); enum { ACCESS_POINT_ADDED, @@ -730,106 +727,96 @@ nm_device_wifi_class_init (NMDeviceWifiClass *wifi_class) g_type_class_add_private (wifi_class, sizeof (NMDeviceWifiPrivate)); - /* virtual methods */ object_class->get_property = get_property; - object_class->dispose = dispose; - object_class->finalize = finalize; + object_class->dispose = dispose; + object_class->finalize = finalize; nm_object_class->init_dbus = init_dbus; device_class->connection_compatible = connection_compatible; - device_class->get_setting_type = get_setting_type; - device_class->get_hw_address = get_hw_address; + device_class->get_setting_type = get_setting_type; + device_class->get_hw_address = get_hw_address; wifi_class->access_point_removed = access_point_removed; - /* properties */ - /** * NMDeviceWifi:hw-address: * * The hardware (MAC) address of the device. **/ - g_object_class_install_property - (object_class, PROP_HW_ADDRESS, - g_param_spec_string (NM_DEVICE_WIFI_HW_ADDRESS, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_HW_ADDRESS] = + g_param_spec_string (NM_DEVICE_WIFI_HW_ADDRESS, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceWifi:perm-hw-address: * * The hardware (MAC) address of the device. **/ - g_object_class_install_property - (object_class, PROP_PERM_HW_ADDRESS, - g_param_spec_string (NM_DEVICE_WIFI_PERMANENT_HW_ADDRESS, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_PERM_HW_ADDRESS] = + g_param_spec_string (NM_DEVICE_WIFI_PERMANENT_HW_ADDRESS, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceWifi:mode: * * The mode of the device. **/ - g_object_class_install_property - (object_class, PROP_MODE, - g_param_spec_enum (NM_DEVICE_WIFI_MODE, "", "", - NM_TYPE_802_11_MODE, - NM_802_11_MODE_UNKNOWN, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_MODE] = + g_param_spec_enum (NM_DEVICE_WIFI_MODE, "", "", + NM_TYPE_802_11_MODE, + NM_802_11_MODE_UNKNOWN, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceWifi:bitrate: * * The bit rate of the device in kbit/s. **/ - g_object_class_install_property - (object_class, PROP_BITRATE, - g_param_spec_uint (NM_DEVICE_WIFI_BITRATE, "", "", - 0, G_MAXUINT32, 0, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_BITRATE] = + g_param_spec_uint (NM_DEVICE_WIFI_BITRATE, "", "", + 0, G_MAXUINT32, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceWifi:active-access-point: * * The active #NMAccessPoint of the device. **/ - g_object_class_install_property - (object_class, PROP_ACTIVE_ACCESS_POINT, - g_param_spec_object (NM_DEVICE_WIFI_ACTIVE_ACCESS_POINT, "", "", - NM_TYPE_ACCESS_POINT, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_ACTIVE_ACCESS_POINT] = + g_param_spec_object (NM_DEVICE_WIFI_ACTIVE_ACCESS_POINT, "", "", + NM_TYPE_ACCESS_POINT, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceWifi:wireless-capabilities: * * The wireless capabilities of the device. **/ - g_object_class_install_property - (object_class, PROP_WIRELESS_CAPABILITIES, - g_param_spec_flags (NM_DEVICE_WIFI_CAPABILITIES, "", "", - NM_TYPE_DEVICE_WIFI_CAPABILITIES, - NM_WIFI_DEVICE_CAP_NONE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_WIRELESS_CAPABILITIES] = + g_param_spec_flags (NM_DEVICE_WIFI_CAPABILITIES, "", "", + NM_TYPE_DEVICE_WIFI_CAPABILITIES, + NM_WIFI_DEVICE_CAP_NONE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceWifi:access-points: (type GPtrArray(NMAccessPoint)) * * List of all Wi-Fi access points the device can see. **/ - g_object_class_install_property - (object_class, PROP_ACCESS_POINTS, - g_param_spec_boxed (NM_DEVICE_WIFI_ACCESS_POINTS, "", "", - G_TYPE_PTR_ARRAY, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_ACCESS_POINTS] = + g_param_spec_boxed (NM_DEVICE_WIFI_ACCESS_POINTS, "", "", + G_TYPE_PTR_ARRAY, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceWifi:last-scan: @@ -840,14 +827,13 @@ nm_device_wifi_class_init (NMDeviceWifiClass *wifi_class) * * Since: 1.12 **/ - g_object_class_install_property - (object_class, PROP_LAST_SCAN, - g_param_spec_int64 (NM_DEVICE_WIFI_LAST_SCAN, "", "", - -1, G_MAXINT64, -1, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_LAST_SCAN] = + g_param_spec_int64 (NM_DEVICE_WIFI_LAST_SCAN, "", "", + -1, G_MAXINT64, -1, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); - /* signals */ + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); /** * NMDeviceWifi::access-point-added: @@ -857,14 +843,14 @@ nm_device_wifi_class_init (NMDeviceWifiClass *wifi_class) * Notifies that a #NMAccessPoint is added to the Wi-Fi device. **/ signals[ACCESS_POINT_ADDED] = - g_signal_new ("access-point-added", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMDeviceWifiClass, access_point_added), - NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, - G_TYPE_NONE, 1, - G_TYPE_OBJECT); + g_signal_new ("access-point-added", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMDeviceWifiClass, access_point_added), + NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, + G_TYPE_OBJECT); /** * NMDeviceWifi::access-point-removed: @@ -874,12 +860,12 @@ nm_device_wifi_class_init (NMDeviceWifiClass *wifi_class) * Notifies that a #NMAccessPoint is removed from the Wi-Fi device. **/ signals[ACCESS_POINT_REMOVED] = - g_signal_new ("access-point-removed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMDeviceWifiClass, access_point_removed), - NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, - G_TYPE_NONE, 1, - G_TYPE_OBJECT); + g_signal_new ("access-point-removed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMDeviceWifiClass, access_point_removed), + NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, + G_TYPE_OBJECT); } diff --git a/libnm/nm-device-wimax.c b/libnm/nm-device-wimax.c index 8b6bd9099c..db99a3c0a0 100644 --- a/libnm/nm-device-wimax.c +++ b/libnm/nm-device-wimax.c @@ -34,8 +34,7 @@ typedef struct { char *bsid; } NMDeviceWimaxPrivate; -enum { - PROP_0, +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( PROP_HW_ADDRESS, PROP_ACTIVE_NSP, PROP_CENTER_FREQ, @@ -44,9 +43,7 @@ enum { PROP_TX_POWER, PROP_BSID, PROP_NSPS, - - LAST_PROP -}; +); enum { NSP_ADDED, @@ -510,20 +507,17 @@ nm_device_wimax_class_init (NMDeviceWimaxClass *wimax_class) g_type_class_add_private (wimax_class, sizeof (NMDeviceWimaxPrivate)); - /* virtual methods */ object_class->get_property = get_property; - object_class->dispose = dispose; + object_class->dispose = dispose; nm_object_class->init_dbus = init_dbus; device_class->connection_compatible = connection_compatible; - device_class->get_setting_type = get_setting_type; - device_class->get_hw_address = get_hw_address; + device_class->get_setting_type = get_setting_type; + device_class->get_hw_address = get_hw_address; wimax_class->nsp_removed = nsp_removed; - /* properties */ - /** * NMDeviceWimax:hw-address: * @@ -531,12 +525,11 @@ nm_device_wimax_class_init (NMDeviceWimaxClass *wimax_class) * * Deprecated: 1.2: WiMAX is no longer supported. **/ - g_object_class_install_property - (object_class, PROP_HW_ADDRESS, - g_param_spec_string (NM_DEVICE_WIMAX_HW_ADDRESS, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_HW_ADDRESS] = + g_param_spec_string (NM_DEVICE_WIMAX_HW_ADDRESS, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceWimax:active-nsp: @@ -545,12 +538,11 @@ nm_device_wimax_class_init (NMDeviceWimaxClass *wimax_class) * * Deprecated: 1.2: WiMAX is no longer supported. **/ - g_object_class_install_property - (object_class, PROP_ACTIVE_NSP, - g_param_spec_object (NM_DEVICE_WIMAX_ACTIVE_NSP, "", "", - NM_TYPE_WIMAX_NSP, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_ACTIVE_NSP] = + g_param_spec_object (NM_DEVICE_WIMAX_ACTIVE_NSP, "", "", + NM_TYPE_WIMAX_NSP, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceWimax:center-frequency: @@ -561,12 +553,11 @@ nm_device_wimax_class_init (NMDeviceWimaxClass *wimax_class) * * Deprecated: 1.2: WiMAX is no longer supported. **/ - g_object_class_install_property - (object_class, PROP_CENTER_FREQ, - g_param_spec_uint (NM_DEVICE_WIMAX_CENTER_FREQUENCY, "", "", - 0, G_MAXUINT, 0, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_CENTER_FREQ] = + g_param_spec_uint (NM_DEVICE_WIMAX_CENTER_FREQUENCY, "", "", + 0, G_MAXUINT, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceWimax:rssi: @@ -578,12 +569,11 @@ nm_device_wimax_class_init (NMDeviceWimaxClass *wimax_class) * * Deprecated: 1.2: WiMAX is no longer supported. **/ - g_object_class_install_property - (object_class, PROP_RSSI, - g_param_spec_int (NM_DEVICE_WIMAX_RSSI, "", "", - G_MININT, G_MAXINT, 0, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_RSSI] = + g_param_spec_int (NM_DEVICE_WIMAX_RSSI, "", "", + G_MININT, G_MAXINT, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceWimax:cinr: @@ -594,12 +584,11 @@ nm_device_wimax_class_init (NMDeviceWimaxClass *wimax_class) * * Deprecated: 1.2: WiMAX is no longer supported. **/ - g_object_class_install_property - (object_class, PROP_CINR, - g_param_spec_int (NM_DEVICE_WIMAX_CINR, "", "", - G_MININT, G_MAXINT, 0, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_CINR] = + g_param_spec_int (NM_DEVICE_WIMAX_CINR, "", "", + G_MININT, G_MAXINT, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceWimax:tx-power: @@ -610,12 +599,11 @@ nm_device_wimax_class_init (NMDeviceWimaxClass *wimax_class) * * Deprecated: 1.2: WiMAX is no longer supported. **/ - g_object_class_install_property - (object_class, PROP_TX_POWER, - g_param_spec_int (NM_DEVICE_WIMAX_TX_POWER, "", "", - G_MININT, G_MAXINT, 0, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_TX_POWER] = + g_param_spec_int (NM_DEVICE_WIMAX_TX_POWER, "", "", + G_MININT, G_MAXINT, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceWimax:bsid: @@ -625,26 +613,24 @@ nm_device_wimax_class_init (NMDeviceWimaxClass *wimax_class) * * Deprecated: 1.2: WiMAX is no longer supported. **/ - g_object_class_install_property - (object_class, PROP_BSID, - g_param_spec_string (NM_DEVICE_WIMAX_BSID, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_BSID] = + g_param_spec_string (NM_DEVICE_WIMAX_BSID, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDeviceWimax:nsps: (type GPtrArray(NMWimaxNsp)) * * List of all WiMAX Network Service Providers the device can see. **/ - g_object_class_install_property - (object_class, PROP_NSPS, - g_param_spec_boxed (NM_DEVICE_WIMAX_NSPS, "", "", - G_TYPE_PTR_ARRAY, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_NSPS] = + g_param_spec_boxed (NM_DEVICE_WIMAX_NSPS, "", "", + G_TYPE_PTR_ARRAY, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); - /* signals */ + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); /** * NMDeviceWimax::nsp-added: @@ -656,14 +642,14 @@ nm_device_wimax_class_init (NMDeviceWimaxClass *wimax_class) * Deprecated: 1.2: WiMAX is no longer supported. **/ signals[NSP_ADDED] = - g_signal_new ("nsp-added", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMDeviceWimaxClass, nsp_added), - NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, - G_TYPE_NONE, 1, - G_TYPE_OBJECT); + g_signal_new ("nsp-added", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMDeviceWimaxClass, nsp_added), + NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, + G_TYPE_OBJECT); /** * NMDeviceWimax::nsp-removed: @@ -675,12 +661,12 @@ nm_device_wimax_class_init (NMDeviceWimaxClass *wimax_class) * Deprecated: 1.2: WiMAX is no longer supported. **/ signals[NSP_REMOVED] = - g_signal_new ("nsp-removed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMDeviceWimaxClass, nsp_removed), - NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, - G_TYPE_NONE, 1, - G_TYPE_OBJECT); + g_signal_new ("nsp-removed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMDeviceWimaxClass, nsp_removed), + NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, + G_TYPE_OBJECT); } diff --git a/libnm/nm-device-wpan.c b/libnm/nm-device-wpan.c index c65fff5702..45595c0083 100644 --- a/libnm/nm-device-wpan.c +++ b/libnm/nm-device-wpan.c @@ -11,12 +11,9 @@ #include "nm-setting-wpan.h" #include "nm-setting-connection.h" -enum { - PROP_0, - PROP_HW_ADDRESS, - - LAST_PROP -}; +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( + PROP_HW_ADDRESS, +); typedef struct { char *hw_address; @@ -138,27 +135,25 @@ nm_device_wpan_class_init (NMDeviceWpanClass *wpan_class) g_type_class_add_private (wpan_class, sizeof (NMDeviceWpanPrivate)); - /* virtual methods */ - object_class->finalize = finalize; object_class->get_property = get_property; + object_class->finalize = finalize; nm_object_class->init_dbus = init_dbus; device_class->connection_compatible = connection_compatible; - device_class->get_setting_type = get_setting_type; - device_class->get_hw_address = get_hw_address; - - /* properties */ + device_class->get_setting_type = get_setting_type; + device_class->get_hw_address = get_hw_address; /** * NMDeviceWpan:hw-address: * * The active hardware (MAC) address of the device. **/ - g_object_class_install_property - (object_class, PROP_HW_ADDRESS, - g_param_spec_string (NM_DEVICE_WPAN_HW_ADDRESS, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_HW_ADDRESS] = + g_param_spec_string (NM_DEVICE_WPAN_HW_ADDRESS, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); } diff --git a/libnm/nm-device.c b/libnm/nm-device.c index 2ee83cf56b..d0f89ca3cb 100644 --- a/libnm/nm-device.c +++ b/libnm/nm-device.c @@ -78,8 +78,7 @@ typedef struct { GPtrArray *lldp_neighbors; } NMDevicePrivate; -enum { - PROP_0, +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( PROP_INTERFACE, PROP_UDI, PROP_DRIVER, @@ -109,9 +108,7 @@ enum { PROP_LLDP_NEIGHBORS, PROP_IP4_CONNECTIVITY, PROP_IP6_CONNECTIVITY, - - LAST_PROP -}; +); enum { STATE_CHANGED, @@ -464,29 +461,25 @@ nm_device_class_init (NMDeviceClass *device_class) g_type_class_add_private (device_class, sizeof (NMDevicePrivate)); - /* virtual methods */ object_class->get_property = get_property; object_class->set_property = set_property; - object_class->dispose = dispose; - object_class->finalize = finalize; + object_class->dispose = dispose; + object_class->finalize = finalize; nm_object_class->init_dbus = init_dbus; device_class->connection_compatible = connection_compatible; - /* properties */ - /** * NMDevice:interface: * * The interface of the device. **/ - g_object_class_install_property - (object_class, PROP_INTERFACE, - g_param_spec_string (NM_DEVICE_INTERFACE, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_INTERFACE] = + g_param_spec_string (NM_DEVICE_INTERFACE, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDevice:ip-interface: @@ -494,25 +487,23 @@ nm_device_class_init (NMDeviceClass *device_class) * The IP interface of the device which should be used for all IP-related * operations like addressing and routing. **/ - g_object_class_install_property - (object_class, PROP_IP_INTERFACE, - g_param_spec_string (NM_DEVICE_IP_INTERFACE, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_IP_INTERFACE] = + g_param_spec_string (NM_DEVICE_IP_INTERFACE, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDevice:device-type: * * The numeric type of the device. **/ - g_object_class_install_property - (object_class, PROP_DEVICE_TYPE, - g_param_spec_enum (NM_DEVICE_DEVICE_TYPE, "", "", - NM_TYPE_DEVICE_TYPE, - NM_DEVICE_TYPE_UNKNOWN, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_DEVICE_TYPE] = + g_param_spec_enum (NM_DEVICE_DEVICE_TYPE, "", "", + NM_TYPE_DEVICE_TYPE, + NM_DEVICE_TYPE_UNKNOWN, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDevice:udi: * @@ -523,61 +514,56 @@ nm_device_class_init (NMDeviceClass *device_class) * such as Bluez or ModemManager, and clients can use this property to * request more information about the device from those services. **/ - g_object_class_install_property - (object_class, PROP_UDI, - g_param_spec_string (NM_DEVICE_UDI, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_UDI] = + g_param_spec_string (NM_DEVICE_UDI, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDevice:driver: * * The driver of the device. **/ - g_object_class_install_property - (object_class, PROP_DRIVER, - g_param_spec_string (NM_DEVICE_DRIVER, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_DRIVER] = + g_param_spec_string (NM_DEVICE_DRIVER, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDevice:driver-version: * * The version of the device driver. **/ - g_object_class_install_property - (object_class, PROP_DRIVER_VERSION, - g_param_spec_string (NM_DEVICE_DRIVER_VERSION, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_DRIVER_VERSION] = + g_param_spec_string (NM_DEVICE_DRIVER_VERSION, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDevice:firmware-version: * * The firmware version of the device. **/ - g_object_class_install_property - (object_class, PROP_FIRMWARE_VERSION, - g_param_spec_string (NM_DEVICE_FIRMWARE_VERSION, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_FIRMWARE_VERSION] = + g_param_spec_string (NM_DEVICE_FIRMWARE_VERSION, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDevice:capabilities: * * The capabilities of the device. **/ - g_object_class_install_property - (object_class, PROP_CAPABILITIES, - g_param_spec_flags (NM_DEVICE_CAPABILITIES, "", "", - NM_TYPE_DEVICE_CAPABILITIES, - NM_DEVICE_CAP_NONE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_CAPABILITIES] = + g_param_spec_flags (NM_DEVICE_CAPABILITIES, "", "", + NM_TYPE_DEVICE_CAPABILITIES, + NM_DEVICE_CAP_NONE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDevice:real: @@ -588,24 +574,22 @@ nm_device_class_init (NMDeviceClass *device_class) * * Since: 1.2 **/ - g_object_class_install_property - (object_class, PROP_REAL, - g_param_spec_boolean (NM_DEVICE_REAL, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_REAL] = + g_param_spec_boolean (NM_DEVICE_REAL, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDevice:managed: * * Whether the device is managed by NetworkManager. **/ - g_object_class_install_property - (object_class, PROP_MANAGED, - g_param_spec_boolean (NM_DEVICE_MANAGED, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_MANAGED] = + g_param_spec_boolean (NM_DEVICE_MANAGED, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDevice:autoconnect: @@ -614,12 +598,11 @@ nm_device_class_init (NMDeviceClass *device_class) * * The property setter is a synchronous D-Bus call. This is deprecated since 1.22. **/ - g_object_class_install_property - (object_class, PROP_AUTOCONNECT, - g_param_spec_boolean (NM_DEVICE_AUTOCONNECT, "", "", - TRUE, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_AUTOCONNECT] = + g_param_spec_boolean (NM_DEVICE_AUTOCONNECT, "", "", + TRUE, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS); /** * NMDevice:firmware-missing: @@ -627,12 +610,11 @@ nm_device_class_init (NMDeviceClass *device_class) * When %TRUE indicates the device is likely missing firmware required * for its operation. **/ - g_object_class_install_property - (object_class, PROP_FIRMWARE_MISSING, - g_param_spec_boolean (NM_DEVICE_FIRMWARE_MISSING, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_FIRMWARE_MISSING] = + g_param_spec_boolean (NM_DEVICE_FIRMWARE_MISSING, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDevice:nm-plugin-missing: @@ -642,60 +624,55 @@ nm_device_class_init (NMDeviceClass *device_class) * * Since: 1.2 **/ - g_object_class_install_property - (object_class, PROP_NM_PLUGIN_MISSING, - g_param_spec_boolean (NM_DEVICE_NM_PLUGIN_MISSING, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_NM_PLUGIN_MISSING] = + g_param_spec_boolean (NM_DEVICE_NM_PLUGIN_MISSING, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDevice:ip4-config: * * The #NMIP4Config of the device. **/ - g_object_class_install_property - (object_class, PROP_IP4_CONFIG, - g_param_spec_object (NM_DEVICE_IP4_CONFIG, "", "", - NM_TYPE_IP_CONFIG, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_IP4_CONFIG] = + g_param_spec_object (NM_DEVICE_IP4_CONFIG, "", "", + NM_TYPE_IP_CONFIG, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDevice:dhcp4-config: * * The IPv4 #NMDhcpConfig of the device. **/ - g_object_class_install_property - (object_class, PROP_DHCP4_CONFIG, - g_param_spec_object (NM_DEVICE_DHCP4_CONFIG, "", "", - NM_TYPE_DHCP_CONFIG, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_DHCP4_CONFIG] = + g_param_spec_object (NM_DEVICE_DHCP4_CONFIG, "", "", + NM_TYPE_DHCP_CONFIG, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDevice:ip6-config: * * The IPv6 #NMIPConfig of the device. **/ - g_object_class_install_property - (object_class, PROP_IP6_CONFIG, - g_param_spec_object (NM_DEVICE_IP6_CONFIG, "", "", - NM_TYPE_IP_CONFIG, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_IP6_CONFIG] = + g_param_spec_object (NM_DEVICE_IP6_CONFIG, "", "", + NM_TYPE_IP_CONFIG, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDevice:dhcp6-config: * * The IPv6 #NMDhcpConfig of the device. **/ - g_object_class_install_property - (object_class, PROP_DHCP6_CONFIG, - g_param_spec_object (NM_DEVICE_DHCP6_CONFIG, "", "", - NM_TYPE_DHCP_CONFIG, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_DHCP6_CONFIG] = + g_param_spec_object (NM_DEVICE_DHCP6_CONFIG, "", "", + NM_TYPE_DHCP_CONFIG, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDevice:ip4-connectivity: @@ -704,13 +681,12 @@ nm_device_class_init (NMDeviceClass *device_class) * * Since: 1.16 **/ - g_object_class_install_property - (object_class, PROP_IP4_CONNECTIVITY, - g_param_spec_enum (NM_DEVICE_IP4_CONNECTIVITY, "", "", - NM_TYPE_CONNECTIVITY_STATE, - NM_CONNECTIVITY_UNKNOWN, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_IP4_CONNECTIVITY] = + g_param_spec_enum (NM_DEVICE_IP4_CONNECTIVITY, "", "", + NM_TYPE_CONNECTIVITY_STATE, + NM_CONNECTIVITY_UNKNOWN, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDevice:ip6-connectivity: @@ -719,86 +695,79 @@ nm_device_class_init (NMDeviceClass *device_class) * * Since: 1.16 **/ - g_object_class_install_property - (object_class, PROP_IP6_CONNECTIVITY, - g_param_spec_enum (NM_DEVICE_IP6_CONNECTIVITY, "", "", - NM_TYPE_CONNECTIVITY_STATE, - NM_CONNECTIVITY_UNKNOWN, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_IP6_CONNECTIVITY] = + g_param_spec_enum (NM_DEVICE_IP6_CONNECTIVITY, "", "", + NM_TYPE_CONNECTIVITY_STATE, + NM_CONNECTIVITY_UNKNOWN, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDevice:state: * * The state of the device. **/ - g_object_class_install_property - (object_class, PROP_STATE, - g_param_spec_enum (NM_DEVICE_STATE, "", "", - NM_TYPE_DEVICE_STATE, - NM_DEVICE_STATE_UNKNOWN, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_STATE] = + g_param_spec_enum (NM_DEVICE_STATE, "", "", + NM_TYPE_DEVICE_STATE, + NM_DEVICE_STATE_UNKNOWN, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDevice:state-reason: * * The reason for the device state. **/ - g_object_class_install_property - (object_class, PROP_STATE_REASON, - g_param_spec_uint (NM_DEVICE_STATE_REASON, "", "", - 0, G_MAXUINT32, 0, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_STATE_REASON] = + g_param_spec_uint (NM_DEVICE_STATE_REASON, "", "", + 0, G_MAXUINT32, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDevice:active-connection: * * The #NMActiveConnection object that "owns" this device during activation. **/ - g_object_class_install_property - (object_class, PROP_ACTIVE_CONNECTION, - g_param_spec_object (NM_DEVICE_ACTIVE_CONNECTION, "", "", - NM_TYPE_ACTIVE_CONNECTION, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_ACTIVE_CONNECTION] = + g_param_spec_object (NM_DEVICE_ACTIVE_CONNECTION, "", "", + NM_TYPE_ACTIVE_CONNECTION, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDevice:available-connections: (type GPtrArray(NMRemoteConnection)) * * The available connections of the device **/ - g_object_class_install_property - (object_class, PROP_AVAILABLE_CONNECTIONS, - g_param_spec_boxed (NM_DEVICE_AVAILABLE_CONNECTIONS, "", "", - G_TYPE_PTR_ARRAY, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_AVAILABLE_CONNECTIONS] = + g_param_spec_boxed (NM_DEVICE_AVAILABLE_CONNECTIONS, "", "", + G_TYPE_PTR_ARRAY, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDevice:vendor: * * The vendor string of the device. **/ - g_object_class_install_property - (object_class, PROP_VENDOR, - g_param_spec_string (NM_DEVICE_VENDOR, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_VENDOR] = + g_param_spec_string (NM_DEVICE_VENDOR, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDevice:product: * * The product string of the device. **/ - g_object_class_install_property - (object_class, PROP_PRODUCT, - g_param_spec_string (NM_DEVICE_PRODUCT, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_PRODUCT] = + g_param_spec_string (NM_DEVICE_PRODUCT, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDevice:physical-port-id: @@ -806,24 +775,22 @@ nm_device_class_init (NMDeviceClass *device_class) * The physical port ID of the device. (See * nm_device_get_physical_port_id().) **/ - g_object_class_install_property - (object_class, PROP_PHYSICAL_PORT_ID, - g_param_spec_string (NM_DEVICE_PHYSICAL_PORT_ID, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_PHYSICAL_PORT_ID] = + g_param_spec_string (NM_DEVICE_PHYSICAL_PORT_ID, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDevice:mtu: * * The MTU of the device. **/ - g_object_class_install_property - (object_class, PROP_MTU, - g_param_spec_uint (NM_DEVICE_MTU, "", "", - 0, G_MAXUINT32, 1500, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_MTU] = + g_param_spec_uint (NM_DEVICE_MTU, "", "", + 0, G_MAXUINT32, 1500, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDevice:metered: @@ -832,26 +799,24 @@ nm_device_class_init (NMDeviceClass *device_class) * * Since: 1.2 **/ - g_object_class_install_property - (object_class, PROP_METERED, - g_param_spec_uint (NM_DEVICE_METERED, "", "", - 0, G_MAXUINT32, NM_METERED_UNKNOWN, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_METERED] = + g_param_spec_uint (NM_DEVICE_METERED, "", "", + 0, G_MAXUINT32, NM_METERED_UNKNOWN, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDevice:lldp-neighbors: * * The LLDP neighbors. **/ - g_object_class_install_property - (object_class, PROP_LLDP_NEIGHBORS, - g_param_spec_boxed (NM_DEVICE_LLDP_NEIGHBORS, "", "", - G_TYPE_PTR_ARRAY, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_LLDP_NEIGHBORS] = + g_param_spec_boxed (NM_DEVICE_LLDP_NEIGHBORS, "", "", + G_TYPE_PTR_ARRAY, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); - /* signals */ + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); /** * NMDevice::state-changed: @@ -863,13 +828,13 @@ nm_device_class_init (NMDeviceClass *device_class) * Notifies the state change of a #NMDevice. **/ signals[STATE_CHANGED] = - g_signal_new ("state-changed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMDeviceClass, state_changed), - NULL, NULL, NULL, - G_TYPE_NONE, 3, - G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT); + g_signal_new ("state-changed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMDeviceClass, state_changed), + NULL, NULL, NULL, + G_TYPE_NONE, 3, + G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT); } /** diff --git a/libnm/nm-dhcp-config.c b/libnm/nm-dhcp-config.c index fd17923c66..f92ca200ba 100644 --- a/libnm/nm-dhcp-config.c +++ b/libnm/nm-dhcp-config.c @@ -22,13 +22,10 @@ typedef struct { GHashTable *options; } NMDhcpConfigPrivate; -enum { - PROP_0, +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( PROP_FAMILY, PROP_OPTIONS, - - LAST_PROP -}; +); static void nm_dhcp_config_init (NMDhcpConfig *config) @@ -116,38 +113,35 @@ nm_dhcp_config_class_init (NMDhcpConfigClass *config_class) g_type_class_add_private (config_class, sizeof (NMDhcpConfigPrivate)); - /* virtual methods */ object_class->get_property = get_property; - object_class->finalize = finalize; + object_class->finalize = finalize; nm_object_class->init_dbus = init_dbus; - /* properties */ - /** * NMDhcpConfig:family: * * The IP address family of the configuration; either * <literal>AF_INET</literal> or <literal>AF_INET6</literal>. **/ - g_object_class_install_property - (object_class, PROP_FAMILY, - g_param_spec_int (NM_DHCP_CONFIG_FAMILY, "", "", - 0, 255, AF_UNSPEC, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_FAMILY] = + g_param_spec_int (NM_DHCP_CONFIG_FAMILY, "", "", + 0, 255, AF_UNSPEC, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMDhcpConfig:options: (type GHashTable(utf8,utf8)): * * The #GHashTable containing options of the configuration. **/ - g_object_class_install_property - (object_class, PROP_OPTIONS, - g_param_spec_boxed (NM_DHCP_CONFIG_OPTIONS, "", "", - G_TYPE_HASH_TABLE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_OPTIONS] = + g_param_spec_boxed (NM_DHCP_CONFIG_OPTIONS, "", "", + G_TYPE_HASH_TABLE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); } /** diff --git a/libnm/nm-dns-manager.c b/libnm/nm-dns-manager.c index 978778ad2f..4204cd138b 100644 --- a/libnm/nm-dns-manager.c +++ b/libnm/nm-dns-manager.c @@ -27,14 +27,11 @@ typedef struct { GPtrArray *configuration; } NMDnsManagerPrivate; -enum { - PROP_0, +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( PROP_MODE, PROP_RC_MANAGER, PROP_CONFIGURATION, - - LAST_PROP -}; +); /***************************************************************************** * NMDnsEntry @@ -401,32 +398,28 @@ nm_dns_manager_class_init (NMDnsManagerClass *class) g_type_class_add_private (class, sizeof (NMDnsManagerPrivate)); - /* Virtual methods */ object_class->get_property = get_property; - object_class->dispose = dispose; + object_class->dispose = dispose; nm_object_class->init_dbus = init_dbus; - /* Properties */ - - g_object_class_install_property - (object_class, PROP_MODE, - g_param_spec_string (NM_DNS_MANAGER_MODE, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property - (object_class, PROP_RC_MANAGER, - g_param_spec_string (NM_DNS_MANAGER_RC_MANAGER, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property - (object_class, PROP_CONFIGURATION, - g_param_spec_boxed (NM_DNS_MANAGER_CONFIGURATION, "", "", - G_TYPE_PTR_ARRAY, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_MODE] = + g_param_spec_string (NM_DNS_MANAGER_MODE, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + obj_properties[PROP_RC_MANAGER] = + g_param_spec_string (NM_DNS_MANAGER_RC_MANAGER, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + obj_properties[PROP_CONFIGURATION] = + g_param_spec_boxed (NM_DNS_MANAGER_CONFIGURATION, "", "", + G_TYPE_PTR_ARRAY, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); } diff --git a/libnm/nm-ip-config.c b/libnm/nm-ip-config.c index ae7686d9d3..dd5e5d7a47 100644 --- a/libnm/nm-ip-config.c +++ b/libnm/nm-ip-config.c @@ -32,8 +32,7 @@ typedef struct { gboolean new_style_data; } NMIPConfigPrivate; -enum { - PROP_0, +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( PROP_FAMILY, PROP_GATEWAY, PROP_ADDRESSES, @@ -42,9 +41,7 @@ enum { PROP_DOMAINS, PROP_SEARCHES, PROP_WINS_SERVERS, - - LAST_PROP -}; +); static void nm_ip_config_init (NMIPConfig *config) @@ -244,98 +241,88 @@ nm_ip_config_class_init (NMIPConfigClass *config_class) g_type_class_add_private (config_class, sizeof (NMIPConfigPrivate)); - /* virtual methods */ object_class->get_property = get_property; - object_class->finalize = finalize; + object_class->finalize = finalize; nm_object_class->init_dbus = init_dbus; - /* properties */ - /** * NMIPConfig:family: * * The IP address family of the configuration; either * <literal>AF_INET</literal> or <literal>AF_INET6</literal>. **/ - g_object_class_install_property - (object_class, PROP_FAMILY, - g_param_spec_int (NM_IP_CONFIG_FAMILY, "", "", - 0, 255, AF_UNSPEC, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_FAMILY] = + g_param_spec_int (NM_IP_CONFIG_FAMILY, "", "", + 0, 255, AF_UNSPEC, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMIPConfig:gateway: * * The IP gateway address of the configuration as string. **/ - g_object_class_install_property - (object_class, PROP_GATEWAY, - g_param_spec_string (NM_IP_CONFIG_GATEWAY, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_GATEWAY] = + g_param_spec_string (NM_IP_CONFIG_GATEWAY, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMIPConfig:addresses: * * A #GPtrArray containing the addresses (#NMIPAddress) of the configuration. **/ - g_object_class_install_property - (object_class, PROP_ADDRESSES, - g_param_spec_boxed (NM_IP_CONFIG_ADDRESSES, "", "", - G_TYPE_PTR_ARRAY, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_ADDRESSES] = + g_param_spec_boxed (NM_IP_CONFIG_ADDRESSES, "", "", + G_TYPE_PTR_ARRAY, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMIPConfig:routes: (type GPtrArray(NMIPRoute)) * * A #GPtrArray containing the routes (#NMIPRoute) of the configuration. **/ - g_object_class_install_property - (object_class, PROP_ROUTES, - g_param_spec_boxed (NM_IP_CONFIG_ROUTES, "", "", - G_TYPE_PTR_ARRAY, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_ROUTES] = + g_param_spec_boxed (NM_IP_CONFIG_ROUTES, "", "", + G_TYPE_PTR_ARRAY, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMIPConfig:nameservers: * * The array containing name server IP addresses of the configuration. **/ - g_object_class_install_property - (object_class, PROP_NAMESERVERS, - g_param_spec_boxed (NM_IP_CONFIG_NAMESERVERS, "", "", - G_TYPE_STRV, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_NAMESERVERS] = + g_param_spec_boxed (NM_IP_CONFIG_NAMESERVERS, "", "", + G_TYPE_STRV, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMIPConfig:domains: * * The array containing domain strings of the configuration. **/ - g_object_class_install_property - (object_class, PROP_DOMAINS, - g_param_spec_boxed (NM_IP_CONFIG_DOMAINS, "", "", - G_TYPE_STRV, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_DOMAINS] = + g_param_spec_boxed (NM_IP_CONFIG_DOMAINS, "", "", + G_TYPE_STRV, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMIPConfig:searches: * * The array containing DNS search strings of the configuration. **/ - g_object_class_install_property - (object_class, PROP_SEARCHES, - g_param_spec_boxed (NM_IP_CONFIG_SEARCHES, "", "", - G_TYPE_STRV, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_SEARCHES] = + g_param_spec_boxed (NM_IP_CONFIG_SEARCHES, "", "", + G_TYPE_STRV, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMIPConfig:wins-servers: @@ -343,12 +330,13 @@ nm_ip_config_class_init (NMIPConfigClass *config_class) * The array containing WINS server IP addresses of the configuration. * (This will always be empty for IPv6 configurations.) **/ - g_object_class_install_property - (object_class, PROP_WINS_SERVERS, - g_param_spec_boxed (NM_IP_CONFIG_WINS_SERVERS, "", "", - G_TYPE_STRV, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_WINS_SERVERS] = + g_param_spec_boxed (NM_IP_CONFIG_WINS_SERVERS, "", "", + G_TYPE_STRV, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); } /** diff --git a/libnm/nm-manager.c b/libnm/nm-manager.c index 1b7449e3ad..ca60d81a89 100644 --- a/libnm/nm-manager.c +++ b/libnm/nm-manager.c @@ -75,8 +75,7 @@ typedef struct { gboolean connectivity_check_enabled; } NMManagerPrivate; -enum { - PROP_0, +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( PROP_VERSION, PROP_STATE, PROP_STARTUP, @@ -97,9 +96,7 @@ enum { PROP_CHECKPOINTS, PROP_METERED, PROP_ALL_DEVICES, - - LAST_PROP -}; +); enum { DEVICE_ADDED, @@ -1369,134 +1366,113 @@ nm_manager_class_init (NMManagerClass *manager_class) g_type_class_add_private (manager_class, sizeof (NMManagerPrivate)); - /* virtual methods */ - object_class->constructed = constructed; + object_class->constructed = constructed; object_class->set_property = set_property; object_class->get_property = get_property; - object_class->dispose = dispose; - object_class->finalize = finalize; + object_class->dispose = dispose; + object_class->finalize = finalize; - nm_object_class->init_dbus = init_dbus; + nm_object_class->init_dbus = init_dbus; nm_object_class->object_creation_failed = object_creation_failed; - manager_class->device_added = device_added; - manager_class->device_removed = device_removed; - manager_class->active_connection_added = active_connection_added; + manager_class->device_added = device_added; + manager_class->device_removed = device_removed; + manager_class->active_connection_added = active_connection_added; manager_class->active_connection_removed = active_connection_removed; - manager_class->checkpoint_added = checkpoint_added; - - /* properties */ - - g_object_class_install_property - (object_class, PROP_VERSION, - g_param_spec_string (NM_MANAGER_VERSION, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); - g_object_class_install_property - (object_class, PROP_STATE, - g_param_spec_enum (NM_CLIENT_STATE, "", "", - NM_TYPE_STATE, - NM_STATE_UNKNOWN, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); - g_object_class_install_property - (object_class, PROP_STARTUP, - g_param_spec_boolean (NM_MANAGER_STARTUP, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); - g_object_class_install_property - (object_class, PROP_NETWORKING_ENABLED, - g_param_spec_boolean (NM_MANAGER_NETWORKING_ENABLED, "", "", - TRUE, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - g_object_class_install_property - (object_class, PROP_WIRELESS_ENABLED, - g_param_spec_boolean (NM_MANAGER_WIRELESS_ENABLED, "", "", - FALSE, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - g_object_class_install_property - (object_class, PROP_WIRELESS_HARDWARE_ENABLED, - g_param_spec_boolean (NM_MANAGER_WIRELESS_HARDWARE_ENABLED, "", "", - TRUE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); - g_object_class_install_property - (object_class, PROP_WWAN_ENABLED, - g_param_spec_boolean (NM_MANAGER_WWAN_ENABLED, "", "", - FALSE, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - g_object_class_install_property - (object_class, PROP_WWAN_HARDWARE_ENABLED, - g_param_spec_boolean (NM_MANAGER_WWAN_HARDWARE_ENABLED, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); - g_object_class_install_property - (object_class, PROP_WIMAX_ENABLED, - g_param_spec_boolean (NM_MANAGER_WIMAX_ENABLED, "", "", - FALSE, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - g_object_class_install_property - (object_class, PROP_WIMAX_HARDWARE_ENABLED, - g_param_spec_boolean (NM_MANAGER_WIMAX_HARDWARE_ENABLED, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); - g_object_class_install_property - (object_class, PROP_ACTIVE_CONNECTIONS, - g_param_spec_boxed (NM_MANAGER_ACTIVE_CONNECTIONS, "", "", - G_TYPE_PTR_ARRAY, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); - g_object_class_install_property - (object_class, PROP_CONNECTIVITY, - g_param_spec_enum (NM_CLIENT_CONNECTIVITY, "", "", - NM_TYPE_CONNECTIVITY_STATE, - NM_CONNECTIVITY_UNKNOWN, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); - g_object_class_install_property - (object_class, PROP_CONNECTIVITY_CHECK_AVAILABLE, - g_param_spec_boolean (NM_MANAGER_CONNECTIVITY_CHECK_AVAILABLE, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); - g_object_class_install_property - (object_class, PROP_CONNECTIVITY_CHECK_ENABLED, - g_param_spec_boolean (NM_MANAGER_CONNECTIVITY_CHECK_ENABLED, "", "", - FALSE, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - g_object_class_install_property - (object_class, PROP_PRIMARY_CONNECTION, - g_param_spec_object (NM_MANAGER_PRIMARY_CONNECTION, "", "", - NM_TYPE_ACTIVE_CONNECTION, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); - g_object_class_install_property - (object_class, PROP_ACTIVATING_CONNECTION, - g_param_spec_object (NM_MANAGER_ACTIVATING_CONNECTION, "", "", - NM_TYPE_ACTIVE_CONNECTION, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); - g_object_class_install_property - (object_class, PROP_DEVICES, - g_param_spec_boxed (NM_MANAGER_DEVICES, "", "", - G_TYPE_PTR_ARRAY, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); - g_object_class_install_property - (object_class, PROP_CHECKPOINTS, - g_param_spec_boxed (NM_MANAGER_CHECKPOINTS, "", "", - G_TYPE_PTR_ARRAY, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + manager_class->checkpoint_added = checkpoint_added; + + obj_properties[PROP_VERSION] = + g_param_spec_string (NM_MANAGER_VERSION, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + obj_properties[PROP_STATE] = + g_param_spec_enum (NM_CLIENT_STATE, "", "", + NM_TYPE_STATE, + NM_STATE_UNKNOWN, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + obj_properties[PROP_STARTUP] = + g_param_spec_boolean (NM_MANAGER_STARTUP, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + obj_properties[PROP_NETWORKING_ENABLED] = + g_param_spec_boolean (NM_MANAGER_NETWORKING_ENABLED, "", "", + TRUE, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS); + obj_properties[PROP_WIRELESS_ENABLED] = + g_param_spec_boolean (NM_MANAGER_WIRELESS_ENABLED, "", "", + FALSE, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS); + obj_properties[PROP_WIRELESS_HARDWARE_ENABLED] = + g_param_spec_boolean (NM_MANAGER_WIRELESS_HARDWARE_ENABLED, "", "", + TRUE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + obj_properties[PROP_WWAN_ENABLED] = + g_param_spec_boolean (NM_MANAGER_WWAN_ENABLED, "", "", + FALSE, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS); + obj_properties[PROP_WWAN_HARDWARE_ENABLED] = + g_param_spec_boolean (NM_MANAGER_WWAN_HARDWARE_ENABLED, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + obj_properties[PROP_WIMAX_ENABLED] = + g_param_spec_boolean (NM_MANAGER_WIMAX_ENABLED, "", "", + FALSE, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS); + obj_properties[PROP_WIMAX_HARDWARE_ENABLED] = + g_param_spec_boolean (NM_MANAGER_WIMAX_HARDWARE_ENABLED, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + obj_properties[PROP_ACTIVE_CONNECTIONS] = + g_param_spec_boxed (NM_MANAGER_ACTIVE_CONNECTIONS, "", "", + G_TYPE_PTR_ARRAY, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + obj_properties[PROP_CONNECTIVITY] = + g_param_spec_enum (NM_CLIENT_CONNECTIVITY, "", "", + NM_TYPE_CONNECTIVITY_STATE, + NM_CONNECTIVITY_UNKNOWN, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + obj_properties[PROP_CONNECTIVITY_CHECK_AVAILABLE] = + g_param_spec_boolean (NM_MANAGER_CONNECTIVITY_CHECK_AVAILABLE, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + obj_properties[PROP_CONNECTIVITY_CHECK_ENABLED] = + g_param_spec_boolean (NM_MANAGER_CONNECTIVITY_CHECK_ENABLED, "", "", + FALSE, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS); + obj_properties[PROP_PRIMARY_CONNECTION] = + g_param_spec_object (NM_MANAGER_PRIMARY_CONNECTION, "", "", + NM_TYPE_ACTIVE_CONNECTION, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + obj_properties[PROP_ACTIVATING_CONNECTION] = + g_param_spec_object (NM_MANAGER_ACTIVATING_CONNECTION, "", "", + NM_TYPE_ACTIVE_CONNECTION, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + obj_properties[PROP_DEVICES] = + g_param_spec_boxed (NM_MANAGER_DEVICES, "", "", + G_TYPE_PTR_ARRAY, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + obj_properties[PROP_CHECKPOINTS] = + g_param_spec_boxed (NM_MANAGER_CHECKPOINTS, "", "", + G_TYPE_PTR_ARRAY, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMManager:metered: * @@ -1504,93 +1480,91 @@ nm_manager_class_init (NMManagerClass *manager_class) * * Since: 1.2 **/ - g_object_class_install_property - (object_class, PROP_METERED, - g_param_spec_uint (NM_MANAGER_METERED, "", "", - 0, G_MAXUINT32, NM_METERED_UNKNOWN, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property - (object_class, PROP_ALL_DEVICES, - g_param_spec_boxed (NM_MANAGER_ALL_DEVICES, "", "", - G_TYPE_PTR_ARRAY, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); - - /* signals */ + obj_properties[PROP_METERED] = + g_param_spec_uint (NM_MANAGER_METERED, "", "", + 0, G_MAXUINT32, NM_METERED_UNKNOWN, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + obj_properties[PROP_ALL_DEVICES] = + g_param_spec_boxed (NM_MANAGER_ALL_DEVICES, "", "", + G_TYPE_PTR_ARRAY, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); signals[DEVICE_ADDED] = - g_signal_new ("device-added", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMManagerClass, device_added), - NULL, NULL, NULL, - G_TYPE_NONE, 1, - G_TYPE_OBJECT); + g_signal_new ("device-added", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMManagerClass, device_added), + NULL, NULL, NULL, + G_TYPE_NONE, 1, + G_TYPE_OBJECT); signals[DEVICE_REMOVED] = - g_signal_new ("device-removed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMManagerClass, device_removed), - NULL, NULL, NULL, - G_TYPE_NONE, 1, - G_TYPE_OBJECT); + g_signal_new ("device-removed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMManagerClass, device_removed), + NULL, NULL, NULL, + G_TYPE_NONE, 1, + G_TYPE_OBJECT); signals[ANY_DEVICE_ADDED] = - g_signal_new ("any-device-added", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - 0, - NULL, NULL, NULL, - G_TYPE_NONE, 1, - G_TYPE_OBJECT); + g_signal_new ("any-device-added", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + 0, + NULL, NULL, NULL, + G_TYPE_NONE, 1, + G_TYPE_OBJECT); signals[ANY_DEVICE_REMOVED] = - g_signal_new ("any-device-removed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - 0, - NULL, NULL, NULL, - G_TYPE_NONE, 1, - G_TYPE_OBJECT); + g_signal_new ("any-device-removed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + 0, + NULL, NULL, NULL, + G_TYPE_NONE, 1, + G_TYPE_OBJECT); signals[ACTIVE_CONNECTION_ADDED] = - g_signal_new ("active-connection-added", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMManagerClass, active_connection_added), - NULL, NULL, NULL, - G_TYPE_NONE, 1, - G_TYPE_OBJECT); + g_signal_new ("active-connection-added", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMManagerClass, active_connection_added), + NULL, NULL, NULL, + G_TYPE_NONE, 1, + G_TYPE_OBJECT); signals[ACTIVE_CONNECTION_REMOVED] = - g_signal_new ("active-connection-removed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMManagerClass, active_connection_removed), - NULL, NULL, NULL, - G_TYPE_NONE, 1, - G_TYPE_OBJECT); + g_signal_new ("active-connection-removed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMManagerClass, active_connection_removed), + NULL, NULL, NULL, + G_TYPE_NONE, 1, + G_TYPE_OBJECT); signals[CHECKPOINT_ADDED] = - g_signal_new ("checkpoint-added", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMManagerClass, checkpoint_added), - NULL, NULL, NULL, - G_TYPE_NONE, 1, - G_TYPE_OBJECT); + g_signal_new ("checkpoint-added", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMManagerClass, checkpoint_added), + NULL, NULL, NULL, + G_TYPE_NONE, 1, + G_TYPE_OBJECT); signals[CHECKPOINT_REMOVED] = - g_signal_new ("checkpoint-removed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMManagerClass, checkpoint_removed), - NULL, NULL, NULL, - G_TYPE_NONE, 1, - G_TYPE_OBJECT); + g_signal_new ("checkpoint-removed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMManagerClass, checkpoint_removed), + NULL, NULL, NULL, + G_TYPE_NONE, 1, + G_TYPE_OBJECT); signals[PERMISSION_CHANGED] = - g_signal_new ("permission-changed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - 0, NULL, NULL, NULL, - G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT); + g_signal_new ("permission-changed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + 0, NULL, NULL, NULL, + G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT); } static void diff --git a/libnm/nm-object.c b/libnm/nm-object.c index 2b9e52e5cf..dce7a0f74f 100644 --- a/libnm/nm-object.c +++ b/libnm/nm-object.c @@ -73,15 +73,12 @@ typedef struct { char *name_owner_cached; } NMObjectPrivate; -enum { - PROP_0, +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( PROP_PATH, PROP_DBUS_CONNECTION, PROP_DBUS_OBJECT, PROP_DBUS_OBJECT_MANAGER, - - LAST_PROP -}; +); /** * nm_object_get_path: @@ -1469,63 +1466,58 @@ nm_object_class_init (NMObjectClass *nm_object_class) g_type_class_add_private (nm_object_class, sizeof (NMObjectPrivate)); - /* virtual methods */ - object_class->set_property = set_property; object_class->get_property = get_property; - object_class->dispose = dispose; - object_class->finalize = finalize; + object_class->set_property = set_property; + object_class->dispose = dispose; + object_class->finalize = finalize; nm_object_class->init_dbus = init_dbus; - /* Properties */ - /** * NMObject:path: * * The D-Bus object path. **/ - g_object_class_install_property - (object_class, PROP_PATH, - g_param_spec_string (NM_OBJECT_PATH, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_PATH] = + g_param_spec_string (NM_OBJECT_PATH, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMObject:dbus-connection: (skip) * * The #GDBusConnection of the object. **/ - g_object_class_install_property - (object_class, PROP_DBUS_CONNECTION, - g_param_spec_object (NM_OBJECT_DBUS_CONNECTION, "", "", - G_TYPE_DBUS_CONNECTION, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_DBUS_CONNECTION] = + g_param_spec_object (NM_OBJECT_DBUS_CONNECTION, "", "", + G_TYPE_DBUS_CONNECTION, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMObject:dbus-object: (skip) * * The #GDBusObject of the object. **/ - g_object_class_install_property - (object_class, PROP_DBUS_OBJECT, - g_param_spec_object (NM_OBJECT_DBUS_OBJECT, "", "", - G_TYPE_DBUS_OBJECT, - G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_DBUS_OBJECT] = + g_param_spec_object (NM_OBJECT_DBUS_OBJECT, "", "", + G_TYPE_DBUS_OBJECT, + G_PARAM_WRITABLE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); /** * NMObject:dbus-object-manager: (skip) * * The #GDBusObjectManager of the object. **/ - g_object_class_install_property - (object_class, PROP_DBUS_OBJECT_MANAGER, - g_param_spec_object (NM_OBJECT_DBUS_OBJECT_MANAGER, "", "", - G_TYPE_DBUS_OBJECT_MANAGER, - G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_DBUS_OBJECT_MANAGER] = + g_param_spec_object (NM_OBJECT_DBUS_OBJECT_MANAGER, "", "", + G_TYPE_DBUS_OBJECT_MANAGER, + G_PARAM_WRITABLE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); } diff --git a/libnm/nm-remote-connection.c b/libnm/nm-remote-connection.c index 4fd7146891..785e5f7f28 100644 --- a/libnm/nm-remote-connection.c +++ b/libnm/nm-remote-connection.c @@ -39,15 +39,12 @@ G_DEFINE_TYPE_WITH_CODE (NMRemoteConnection, nm_remote_connection, NM_TYPE_OBJEC G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, nm_remote_connection_async_initable_iface_init); ) -enum { - PROP_0, +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( PROP_UNSAVED, PROP_FLAGS, PROP_FILENAME, PROP_VISIBLE, - - LAST_PROP -}; +); typedef struct { NMDBusSettingsConnection *proxy; @@ -862,26 +859,23 @@ nm_remote_connection_class_init (NMRemoteConnectionClass *remote_class) g_type_class_add_private (object_class, sizeof (NMRemoteConnectionPrivate)); - /* virtual methods */ - object_class->constructed = constructed; object_class->get_property = get_property; - object_class->dispose = dispose; + object_class->constructed = constructed; + object_class->dispose = dispose; nm_object_class->init_dbus = init_dbus; - /* Properties */ /** * NMRemoteConnection:unsaved: * * %TRUE if the remote connection contains changes that have not been saved * to disk, %FALSE if the connection is the same as its on-disk representation. **/ - g_object_class_install_property - (object_class, PROP_UNSAVED, - g_param_spec_boolean (NM_REMOTE_CONNECTION_UNSAVED, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_UNSAVED] = + g_param_spec_boolean (NM_REMOTE_CONNECTION_UNSAVED, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMRemoteConnection:flags: @@ -891,12 +885,11 @@ nm_remote_connection_class_init (NMRemoteConnectionClass *remote_class) * * Since: 1.12 **/ - g_object_class_install_property - (object_class, PROP_FLAGS, - g_param_spec_uint (NM_REMOTE_CONNECTION_FLAGS, "", "", - 0, G_MAXUINT32, 0, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_FLAGS] = + g_param_spec_uint (NM_REMOTE_CONNECTION_FLAGS, "", "", + 0, G_MAXUINT32, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMRemoteConnection:filename: @@ -906,12 +899,11 @@ nm_remote_connection_class_init (NMRemoteConnectionClass *remote_class) * * Since: 1.12 **/ - g_object_class_install_property - (object_class, PROP_FILENAME, - g_param_spec_string (NM_REMOTE_CONNECTION_FILENAME, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_FILENAME] = + g_param_spec_string (NM_REMOTE_CONNECTION_FILENAME, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMRemoteConnection:visible: @@ -924,12 +916,13 @@ nm_remote_connection_class_init (NMRemoteConnectionClass *remote_class) * to callers, but it is possible for a connection's visibility to change * after you already have a reference to it.) **/ - g_object_class_install_property - (object_class, PROP_VISIBLE, - g_param_spec_boolean (NM_REMOTE_CONNECTION_VISIBLE, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_VISIBLE] = + g_param_spec_boolean (NM_REMOTE_CONNECTION_VISIBLE, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); } static void diff --git a/libnm/nm-remote-settings.c b/libnm/nm-remote-settings.c index 0a95ce3050..7e46cf98d3 100644 --- a/libnm/nm-remote-settings.c +++ b/libnm/nm-remote-settings.c @@ -36,14 +36,11 @@ typedef struct { gboolean can_modify; } NMRemoteSettingsPrivate; -enum { - PROP_0, +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( PROP_CONNECTIONS, PROP_HOSTNAME, PROP_CAN_MODIFY, - - LAST_PROP -}; +); /* Signals */ enum { @@ -432,56 +429,51 @@ nm_remote_settings_class_init (NMRemoteSettingsClass *class) g_type_class_add_private (class, sizeof (NMRemoteSettingsPrivate)); - /* Virtual methods */ - object_class->constructor = constructor; object_class->get_property = get_property; - object_class->dispose = dispose; + object_class->constructor = constructor; + object_class->dispose = dispose; - nm_object_class->init_dbus = init_dbus; + nm_object_class->init_dbus = init_dbus; nm_object_class->object_creation_failed = object_creation_failed; - class->connection_added = connection_added; + class->connection_added = connection_added; class->connection_removed = connection_removed; - /* Properties */ - - g_object_class_install_property - (object_class, PROP_CONNECTIONS, - g_param_spec_boxed (NM_REMOTE_SETTINGS_CONNECTIONS, "", "", - G_TYPE_PTR_ARRAY, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property - (object_class, PROP_HOSTNAME, - g_param_spec_string (NM_REMOTE_SETTINGS_HOSTNAME, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property - (object_class, PROP_CAN_MODIFY, - g_param_spec_boolean (NM_REMOTE_SETTINGS_CAN_MODIFY, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); - - /* Signals */ + obj_properties[PROP_CONNECTIONS] = + g_param_spec_boxed (NM_REMOTE_SETTINGS_CONNECTIONS, "", "", + G_TYPE_PTR_ARRAY, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + obj_properties[PROP_HOSTNAME] = + g_param_spec_string (NM_REMOTE_SETTINGS_HOSTNAME, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + obj_properties[PROP_CAN_MODIFY] = + g_param_spec_boolean (NM_REMOTE_SETTINGS_CAN_MODIFY, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); + signals[CONNECTION_ADDED] = - g_signal_new (NM_REMOTE_SETTINGS_CONNECTION_ADDED, - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMRemoteSettingsClass, connection_added), - NULL, NULL, NULL, - G_TYPE_NONE, 1, - NM_TYPE_REMOTE_CONNECTION); + g_signal_new (NM_REMOTE_SETTINGS_CONNECTION_ADDED, + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMRemoteSettingsClass, connection_added), + NULL, NULL, NULL, + G_TYPE_NONE, 1, + NM_TYPE_REMOTE_CONNECTION); signals[CONNECTION_REMOVED] = - g_signal_new (NM_REMOTE_SETTINGS_CONNECTION_REMOVED, - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMRemoteSettingsClass, connection_removed), - NULL, NULL, NULL, - G_TYPE_NONE, 1, - NM_TYPE_REMOTE_CONNECTION); + g_signal_new (NM_REMOTE_SETTINGS_CONNECTION_REMOVED, + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMRemoteSettingsClass, connection_removed), + NULL, NULL, NULL, + G_TYPE_NONE, 1, + NM_TYPE_REMOTE_CONNECTION); } diff --git a/libnm/nm-vpn-connection.c b/libnm/nm-vpn-connection.c index 5bb882c96e..6c8576c1fc 100644 --- a/libnm/nm-vpn-connection.c +++ b/libnm/nm-vpn-connection.c @@ -27,13 +27,10 @@ typedef struct { NMVpnConnectionState vpn_state; } NMVpnConnectionPrivate; -enum { - PROP_0, +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( PROP_VPN_STATE, PROP_BANNER, - - LAST_PROP -}; +); enum { VPN_STATE_CHANGED, @@ -164,48 +161,44 @@ nm_vpn_connection_class_init (NMVpnConnectionClass *connection_class) g_type_class_add_private (connection_class, sizeof (NMVpnConnectionPrivate)); - /* virtual methods */ object_class->get_property = get_property; - object_class->finalize = finalize; + object_class->finalize = finalize; nm_object_class->init_dbus = init_dbus; - /* properties */ - /** * NMVpnConnection:vpn-state: * * The VPN state of the active VPN connection. **/ - g_object_class_install_property - (object_class, PROP_VPN_STATE, - g_param_spec_enum (NM_VPN_CONNECTION_VPN_STATE, "", "", - NM_TYPE_VPN_CONNECTION_STATE, - NM_VPN_CONNECTION_STATE_UNKNOWN, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_VPN_STATE] = + g_param_spec_enum (NM_VPN_CONNECTION_VPN_STATE, "", "", + NM_TYPE_VPN_CONNECTION_STATE, + NM_VPN_CONNECTION_STATE_UNKNOWN, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMVpnConnection:banner: * * The VPN login banner of the active VPN connection. **/ - g_object_class_install_property - (object_class, PROP_BANNER, - g_param_spec_string (NM_VPN_CONNECTION_BANNER, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); - - /* signals */ + obj_properties[PROP_BANNER] = + g_param_spec_string (NM_VPN_CONNECTION_BANNER, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); + G_GNUC_BEGIN_IGNORE_DEPRECATIONS signals[VPN_STATE_CHANGED] = - g_signal_new ("vpn-state-changed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMVpnConnectionClass, vpn_state_changed), - NULL, NULL, NULL, - G_TYPE_NONE, 2, - G_TYPE_UINT, G_TYPE_UINT); + g_signal_new ("vpn-state-changed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMVpnConnectionClass, vpn_state_changed), + NULL, NULL, NULL, + G_TYPE_NONE, 2, + G_TYPE_UINT, G_TYPE_UINT); G_GNUC_END_IGNORE_DEPRECATIONS } diff --git a/libnm/nm-vpn-plugin-old.c b/libnm/nm-vpn-plugin-old.c index 22ffa4d3b9..782fd80dc0 100644 --- a/libnm/nm-vpn-plugin-old.c +++ b/libnm/nm-vpn-plugin-old.c @@ -68,13 +68,10 @@ enum { static guint signals[LAST_SIGNAL] = { 0 }; -enum { - PROP_0, +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( PROP_DBUS_SERVICE_NAME, PROP_STATE, - - LAST_PROP -}; +); static GSList *active_plugins = NULL; @@ -1003,16 +1000,13 @@ nm_vpn_plugin_old_class_init (NMVpnPluginOldClass *plugin_class) g_type_class_add_private (object_class, sizeof (NMVpnPluginOldPrivate)); - /* virtual methods */ - object_class->set_property = set_property; object_class->get_property = get_property; + object_class->set_property = set_property; object_class->dispose = dispose; object_class->finalize = finalize; plugin_class->state_changed = state_changed; - /* properties */ - /** * NMVpnPluginOld:service-name: * @@ -1020,13 +1014,12 @@ nm_vpn_plugin_old_class_init (NMVpnPluginOldClass *plugin_class) * * Deprecated: 1.2: replaced by NMVpnServicePlugin */ - g_object_class_install_property - (object_class, PROP_DBUS_SERVICE_NAME, - g_param_spec_string (NM_VPN_PLUGIN_OLD_DBUS_SERVICE_NAME, "", "", - NULL, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_DBUS_SERVICE_NAME] = + g_param_spec_string (NM_VPN_PLUGIN_OLD_DBUS_SERVICE_NAME, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); /** * NMVpnPluginOld:state: @@ -1035,92 +1028,92 @@ nm_vpn_plugin_old_class_init (NMVpnPluginOldClass *plugin_class) * * Deprecated: 1.2: replaced by NMVpnServicePlugin */ - g_object_class_install_property - (object_class, PROP_STATE, - g_param_spec_enum (NM_VPN_PLUGIN_OLD_STATE, "", "", - NM_TYPE_VPN_SERVICE_STATE, - NM_VPN_SERVICE_STATE_INIT, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - - /* signals */ + obj_properties[PROP_STATE] = + g_param_spec_enum (NM_VPN_PLUGIN_OLD_STATE, "", "", + NM_TYPE_VPN_SERVICE_STATE, + NM_VPN_SERVICE_STATE_INIT, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); + signals[STATE_CHANGED] = - g_signal_new ("state-changed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMVpnPluginOldClass, state_changed), - NULL, NULL, - NULL, - G_TYPE_NONE, 1, - G_TYPE_UINT); + g_signal_new ("state-changed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMVpnPluginOldClass, state_changed), + NULL, NULL, + NULL, + G_TYPE_NONE, 1, + G_TYPE_UINT); signals[SECRETS_REQUIRED] = - g_signal_new ("secrets-required", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - 0, NULL, NULL, - NULL, - G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRV); + g_signal_new ("secrets-required", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + 0, NULL, NULL, + NULL, + G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRV); signals[CONFIG] = - g_signal_new ("config", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMVpnPluginOldClass, config), - NULL, NULL, - NULL, - G_TYPE_NONE, 1, - G_TYPE_VARIANT); + g_signal_new ("config", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMVpnPluginOldClass, config), + NULL, NULL, + NULL, + G_TYPE_NONE, 1, + G_TYPE_VARIANT); signals[IP4_CONFIG] = - g_signal_new ("ip4-config", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMVpnPluginOldClass, ip4_config), - NULL, NULL, - NULL, - G_TYPE_NONE, 1, - G_TYPE_VARIANT); + g_signal_new ("ip4-config", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMVpnPluginOldClass, ip4_config), + NULL, NULL, + NULL, + G_TYPE_NONE, 1, + G_TYPE_VARIANT); signals[IP6_CONFIG] = - g_signal_new ("ip6-config", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMVpnPluginOldClass, ip6_config), - NULL, NULL, - NULL, - G_TYPE_NONE, 1, - G_TYPE_VARIANT); + g_signal_new ("ip6-config", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMVpnPluginOldClass, ip6_config), + NULL, NULL, + NULL, + G_TYPE_NONE, 1, + G_TYPE_VARIANT); signals[LOGIN_BANNER] = - g_signal_new ("login-banner", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMVpnPluginOldClass, login_banner), - NULL, NULL, - NULL, - G_TYPE_NONE, 1, - G_TYPE_STRING); + g_signal_new ("login-banner", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMVpnPluginOldClass, login_banner), + NULL, NULL, + NULL, + G_TYPE_NONE, 1, + G_TYPE_STRING); signals[FAILURE] = - g_signal_new ("failure", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMVpnPluginOldClass, failure), - NULL, NULL, - NULL, - G_TYPE_NONE, 1, - G_TYPE_UINT); + g_signal_new ("failure", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMVpnPluginOldClass, failure), + NULL, NULL, + NULL, + G_TYPE_NONE, 1, + G_TYPE_UINT); signals[QUIT] = - g_signal_new ("quit", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMVpnPluginOldClass, quit), - NULL, NULL, - NULL, - G_TYPE_NONE, 0, - G_TYPE_NONE); + g_signal_new ("quit", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMVpnPluginOldClass, quit), + NULL, NULL, + NULL, + G_TYPE_NONE, 0, + G_TYPE_NONE); setup_unix_signal_handler (); } diff --git a/libnm/nm-vpn-service-plugin.c b/libnm/nm-vpn-service-plugin.c index 95172f7bbf..9ebcfd6461 100644 --- a/libnm/nm-vpn-service-plugin.c +++ b/libnm/nm-vpn-service-plugin.c @@ -71,14 +71,11 @@ enum { static guint signals[LAST_SIGNAL] = { 0 }; -enum { - PROP_0, +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( PROP_DBUS_SERVICE_NAME, PROP_DBUS_WATCH_PEER, PROP_STATE, - - LAST_PROP -}; +); static GSList *active_plugins = NULL; @@ -1190,16 +1187,13 @@ nm_vpn_service_plugin_class_init (NMVpnServicePluginClass *plugin_class) g_type_class_add_private (object_class, sizeof (NMVpnServicePluginPrivate)); - /* virtual methods */ - object_class->set_property = set_property; object_class->get_property = get_property; + object_class->set_property = set_property; object_class->dispose = dispose; object_class->finalize = finalize; plugin_class->state_changed = state_changed; - /* properties */ - /** * NMVpnServicePlugin:service-name: * @@ -1207,13 +1201,12 @@ nm_vpn_service_plugin_class_init (NMVpnServicePluginClass *plugin_class) * * Since: 1.2 */ - g_object_class_install_property - (object_class, PROP_DBUS_SERVICE_NAME, - g_param_spec_string (NM_VPN_SERVICE_PLUGIN_DBUS_SERVICE_NAME, "", "", - NULL, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_DBUS_SERVICE_NAME] = + g_param_spec_string (NM_VPN_SERVICE_PLUGIN_DBUS_SERVICE_NAME, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); /** * NMVpnServicePlugin:watch-peer: @@ -1222,13 +1215,12 @@ nm_vpn_service_plugin_class_init (NMVpnServicePluginClass *plugin_class) * * Since: 1.2 */ - g_object_class_install_property - (object_class, PROP_DBUS_WATCH_PEER, - g_param_spec_boolean (NM_VPN_SERVICE_PLUGIN_DBUS_WATCH_PEER, "", "", - FALSE, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_DBUS_WATCH_PEER] = + g_param_spec_boolean (NM_VPN_SERVICE_PLUGIN_DBUS_WATCH_PEER, "", "", + FALSE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); /** * NMVpnServicePlugin:state: @@ -1237,92 +1229,92 @@ nm_vpn_service_plugin_class_init (NMVpnServicePluginClass *plugin_class) * * Since: 1.2 */ - g_object_class_install_property - (object_class, PROP_STATE, - g_param_spec_enum (NM_VPN_SERVICE_PLUGIN_STATE, "", "", - NM_TYPE_VPN_SERVICE_STATE, - NM_VPN_SERVICE_STATE_INIT, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - - /* signals */ + obj_properties[PROP_STATE] = + g_param_spec_enum (NM_VPN_SERVICE_PLUGIN_STATE, "", "", + NM_TYPE_VPN_SERVICE_STATE, + NM_VPN_SERVICE_STATE_INIT, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); + signals[STATE_CHANGED] = - g_signal_new ("state-changed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMVpnServicePluginClass, state_changed), - NULL, NULL, - NULL, - G_TYPE_NONE, 1, - G_TYPE_UINT); + g_signal_new ("state-changed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMVpnServicePluginClass, state_changed), + NULL, NULL, + NULL, + G_TYPE_NONE, 1, + G_TYPE_UINT); signals[SECRETS_REQUIRED] = - g_signal_new ("secrets-required", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - 0, NULL, NULL, - NULL, - G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRV); + g_signal_new ("secrets-required", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + 0, NULL, NULL, + NULL, + G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRV); signals[CONFIG] = - g_signal_new ("config", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMVpnServicePluginClass, config), - NULL, NULL, - NULL, - G_TYPE_NONE, 1, - G_TYPE_VARIANT); + g_signal_new ("config", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMVpnServicePluginClass, config), + NULL, NULL, + NULL, + G_TYPE_NONE, 1, + G_TYPE_VARIANT); signals[IP4_CONFIG] = - g_signal_new ("ip4-config", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMVpnServicePluginClass, ip4_config), - NULL, NULL, - NULL, - G_TYPE_NONE, 1, - G_TYPE_VARIANT); + g_signal_new ("ip4-config", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMVpnServicePluginClass, ip4_config), + NULL, NULL, + NULL, + G_TYPE_NONE, 1, + G_TYPE_VARIANT); signals[IP6_CONFIG] = - g_signal_new ("ip6-config", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMVpnServicePluginClass, ip6_config), - NULL, NULL, - NULL, - G_TYPE_NONE, 1, - G_TYPE_VARIANT); + g_signal_new ("ip6-config", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMVpnServicePluginClass, ip6_config), + NULL, NULL, + NULL, + G_TYPE_NONE, 1, + G_TYPE_VARIANT); signals[LOGIN_BANNER] = - g_signal_new ("login-banner", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMVpnServicePluginClass, login_banner), - NULL, NULL, - NULL, - G_TYPE_NONE, 1, - G_TYPE_STRING); + g_signal_new ("login-banner", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMVpnServicePluginClass, login_banner), + NULL, NULL, + NULL, + G_TYPE_NONE, 1, + G_TYPE_STRING); signals[FAILURE] = - g_signal_new ("failure", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMVpnServicePluginClass, failure), - NULL, NULL, - NULL, - G_TYPE_NONE, 1, - G_TYPE_UINT); + g_signal_new ("failure", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMVpnServicePluginClass, failure), + NULL, NULL, + NULL, + G_TYPE_NONE, 1, + G_TYPE_UINT); signals[QUIT] = - g_signal_new ("quit", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMVpnServicePluginClass, quit), - NULL, NULL, - NULL, - G_TYPE_NONE, 0, - G_TYPE_NONE); + g_signal_new ("quit", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMVpnServicePluginClass, quit), + NULL, NULL, + NULL, + G_TYPE_NONE, 0, + G_TYPE_NONE); setup_unix_signal_handler (); } diff --git a/libnm/nm-wimax-nsp.c b/libnm/nm-wimax-nsp.c index 9a6a154d7a..91dc5dae23 100644 --- a/libnm/nm-wimax-nsp.c +++ b/libnm/nm-wimax-nsp.c @@ -24,14 +24,11 @@ typedef struct { NMWimaxNspNetworkType network_type; } NMWimaxNspPrivate; -enum { - PROP_0, +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( PROP_NAME, PROP_SIGNAL_QUALITY, PROP_NETWORK_TYPE, - - LAST_PROP -}; +); /** * nm_wimax_nsp_get_name: @@ -222,48 +219,44 @@ nm_wimax_nsp_class_init (NMWimaxNspClass *nsp_class) g_type_class_add_private (nsp_class, sizeof (NMWimaxNspPrivate)); - /* virtual methods */ object_class->get_property = get_property; - object_class->finalize = finalize; + object_class->finalize = finalize; nm_object_class->init_dbus = init_dbus; - /* properties */ - /** * NMWimaxNsp:name: * * The name of the WiMAX NSP. **/ - g_object_class_install_property - (object_class, PROP_NAME, - g_param_spec_string (NM_WIMAX_NSP_NAME, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_NAME] = + g_param_spec_string (NM_WIMAX_NSP_NAME, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMWimaxNsp:signal-quality: * * The signal quality of the WiMAX NSP. **/ - g_object_class_install_property - (object_class, PROP_SIGNAL_QUALITY, - g_param_spec_uint (NM_WIMAX_NSP_SIGNAL_QUALITY, "", "", - 0, 100, 0, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_SIGNAL_QUALITY] = + g_param_spec_uint (NM_WIMAX_NSP_SIGNAL_QUALITY, "", "", + 0, 100, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /** * NMWimaxNsp:network-type: * * The network type of the WiMAX NSP. **/ - g_object_class_install_property - (object_class, PROP_NETWORK_TYPE, - g_param_spec_enum (NM_WIMAX_NSP_NETWORK_TYPE, "", "", - NM_TYPE_WIMAX_NSP_NETWORK_TYPE, - NM_WIMAX_NSP_NETWORK_TYPE_UNKNOWN, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_NETWORK_TYPE] = + g_param_spec_enum (NM_WIMAX_NSP_NETWORK_TYPE, "", "", + NM_TYPE_WIMAX_NSP_NETWORK_TYPE, + NM_WIMAX_NSP_NETWORK_TYPE_UNKNOWN, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); } |