diff options
author | Thomas Haller <thaller@redhat.com> | 2016-04-14 12:31:25 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-04-14 12:31:25 +0200 |
commit | de2fa9b6479b3ae993ed33cd5114f71fa64a4774 (patch) | |
tree | 5f4a0b992847dc7f59ba13b1422dfe0260467615 | |
parent | d0ed5f83ceb59dc87d590cd3f3a61ab86a355e7b (diff) | |
parent | 18019d55a1c588a03efb3f354029e6c6759ea78e (diff) | |
download | NetworkManager-de2fa9b6479b3ae993ed33cd5114f71fa64a4774.tar.gz |
core: merge branch 'th/settings-cleanup-bgo765000'
https://bugzilla.gnome.org/show_bug.cgi?id=765000
-rw-r--r-- | src/devices/bluetooth/nm-bluez-device.c | 88 | ||||
-rw-r--r-- | src/devices/nm-device.c | 14 | ||||
-rw-r--r-- | src/nm-active-connection.c | 383 | ||||
-rw-r--r-- | src/nm-connection-provider.c | 9 | ||||
-rw-r--r-- | src/nm-connection-provider.h | 8 | ||||
-rw-r--r-- | src/nm-manager.c | 54 | ||||
-rw-r--r-- | src/nm-policy.c | 67 | ||||
-rw-r--r-- | src/settings/nm-settings-connection.c | 173 | ||||
-rw-r--r-- | src/settings/nm-settings-connection.h | 4 | ||||
-rw-r--r-- | src/settings/nm-settings.c | 217 | ||||
-rw-r--r-- | src/settings/nm-settings.h | 16 |
11 files changed, 510 insertions, 523 deletions
diff --git a/src/devices/bluetooth/nm-bluez-device.c b/src/devices/bluetooth/nm-bluez-device.c index a009746d02..b61d5efec2 100644 --- a/src/devices/bluetooth/nm-bluez-device.c +++ b/src/devices/bluetooth/nm-bluez-device.c @@ -54,6 +54,8 @@ typedef struct { gboolean usable; NMBluetoothCapabilities connection_bt_type; + guint check_emit_usable_id; + char *adapter_address; char *address; char *name; @@ -257,14 +259,14 @@ pan_connection_check_create (NMBluezDevice *self) g_free (uuid); } -static void +static gboolean check_emit_usable (NMBluezDevice *self) { NMBluezDevicePrivate *priv = NM_BLUEZ_DEVICE_GET_PRIVATE (self); gboolean new_usable; /* only expect the supported capabilities set. */ - g_assert ((priv->capabilities & ~(NM_BT_CAPABILITY_NAP | NM_BT_CAPABILITY_DUN)) == NM_BT_CAPABILITY_NONE ); + nm_assert ((priv->capabilities & ~(NM_BT_CAPABILITY_NAP | NM_BT_CAPABILITY_DUN)) == NM_BT_CAPABILITY_NONE ); new_usable = (priv->initialized && priv->capabilities && priv->name && ((priv->bluez_version == 4) || @@ -291,6 +293,17 @@ END: priv->usable = new_usable; g_object_notify (G_OBJECT (self), NM_BLUEZ_DEVICE_USABLE); } + + return G_SOURCE_REMOVE; +} + +static void +check_emit_usable_schedule (NMBluezDevice *self) +{ + NMBluezDevicePrivate *priv = NM_BLUEZ_DEVICE_GET_PRIVATE (self); + + if (priv->check_emit_usable_id == 0) + priv->check_emit_usable_id = g_idle_add ((GSourceFunc) check_emit_usable, self); } /********************************************************************/ @@ -331,15 +344,26 @@ connection_compatible (NMBluezDevice *self, NMConnection *connection) return TRUE; } -static void -_internal_add_connection (NMBluezDevice *self, NMConnection *connection) +static gboolean +_internal_track_connection (NMBluezDevice *self, NMConnection *connection, gboolean tracked) { NMBluezDevicePrivate *priv = NM_BLUEZ_DEVICE_GET_PRIVATE (self); + gboolean was_tracked; + + was_tracked = !!g_slist_find (priv->connections, connection); + if (was_tracked == !!tracked) + return FALSE; - if (!g_slist_find (priv->connections, connection)) { + if (tracked) priv->connections = g_slist_prepend (priv->connections, g_object_ref (connection)); - check_emit_usable (self); + else { + priv->connections = g_slist_remove (priv->connections, connection); + if (priv->pan_connection == connection) + priv->pan_connection = NULL; + g_object_unref (connection); } + + return TRUE; } static void @@ -347,8 +371,10 @@ cp_connection_added (NMConnectionProvider *provider, NMConnection *connection, NMBluezDevice *self) { - if (connection_compatible (self, connection)) - _internal_add_connection (self, connection); + if (connection_compatible (self, connection)) { + if (_internal_track_connection (self, connection, TRUE)) + check_emit_usable (self); + } } static void @@ -356,15 +382,8 @@ cp_connection_removed (NMConnectionProvider *provider, NMConnection *connection, NMBluezDevice *self) { - NMBluezDevicePrivate *priv = NM_BLUEZ_DEVICE_GET_PRIVATE (self); - - if (g_slist_find (priv->connections, connection)) { - priv->connections = g_slist_remove (priv->connections, connection); - if (priv->pan_connection == connection) - priv->pan_connection = NULL; - g_object_unref (connection); + if (_internal_track_connection (self, connection, FALSE)) check_emit_usable (self); - } } static void @@ -372,10 +391,9 @@ cp_connection_updated (NMConnectionProvider *provider, NMConnection *connection, NMBluezDevice *self) { - if (connection_compatible (self, connection)) - _internal_add_connection (self, connection); - else - cp_connection_removed (provider, connection, self); + if (_internal_track_connection (self, connection, + connection_compatible (self, connection))) + check_emit_usable_schedule (self); } static void @@ -383,10 +401,17 @@ load_connections (NMBluezDevice *self) { NMBluezDevicePrivate *priv = NM_BLUEZ_DEVICE_GET_PRIVATE (self); const GSList *connections, *iter; + gboolean changed = FALSE; connections = nm_connection_provider_get_connections (priv->provider); - for (iter = connections; iter; iter = g_slist_next (iter)) - cp_connection_added (priv->provider, NM_CONNECTION (iter->data), self); + for (iter = connections; iter; iter = g_slist_next (iter)) { + NMConnection *connection = iter->data; + + if (connection_compatible (self, connection)) + changed |= _internal_track_connection (self, connection, TRUE); + } + if (changed) + check_emit_usable (self); } /***********************************************************/ @@ -1031,20 +1056,9 @@ nm_bluez_device_new (const char *path, if (adapter_address) set_adapter_address (self, adapter_address); - g_signal_connect (priv->provider, - NM_CP_SIGNAL_CONNECTION_ADDED, - G_CALLBACK (cp_connection_added), - self); - - g_signal_connect (priv->provider, - NM_CP_SIGNAL_CONNECTION_REMOVED, - G_CALLBACK (cp_connection_removed), - self); - - g_signal_connect (priv->provider, - NM_CP_SIGNAL_CONNECTION_UPDATED, - G_CALLBACK (cp_connection_updated), - self); + g_signal_connect (priv->provider, NM_CP_SIGNAL_CONNECTION_ADDED, G_CALLBACK (cp_connection_added), self); + g_signal_connect (priv->provider, NM_CP_SIGNAL_CONNECTION_REMOVED, G_CALLBACK (cp_connection_removed), self); + g_signal_connect (priv->provider, NM_CP_SIGNAL_CONNECTION_UPDATED, G_CALLBACK (cp_connection_updated), self); g_bus_get (G_BUS_TYPE_SYSTEM, NULL, @@ -1084,6 +1098,8 @@ dispose (GObject *object) NMBluezDevicePrivate *priv = NM_BLUEZ_DEVICE_GET_PRIVATE (self); NMConnection *to_delete = NULL; + nm_clear_g_source (&priv->check_emit_usable_id); + if (priv->pan_connection) { /* Check whether we want to remove the created connection. If so, we take a reference * and delete it at the end of dispose(). */ diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 0a577e55f7..ae1711df17 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -9643,12 +9643,6 @@ nm_device_check_connection_available (NMDevice *self, return available; } -static void -available_connections_notify (NMDevice *self) -{ - _notify (self, PROP_AVAILABLE_CONNECTIONS); -} - static gboolean available_connections_del_all (NMDevice *self) { @@ -9748,7 +9742,7 @@ nm_device_recheck_available_connections (NMDevice *self) } if (changed) - available_connections_notify (self); + _notify (self, PROP_AVAILABLE_CONNECTIONS); available_connections_check_delete_unrealized (self); } @@ -9822,7 +9816,7 @@ cp_connection_added_or_updated (NMConnectionProvider *cp, NMConnection *connecti changed = available_connections_del (self, connection); if (changed) { - available_connections_notify (self); + _notify (self, PROP_AVAILABLE_CONNECTIONS); available_connections_check_delete_unrealized (self); } } @@ -9835,7 +9829,7 @@ cp_connection_removed (NMConnectionProvider *cp, NMConnection *connection, gpoin g_return_if_fail (NM_IS_DEVICE (self)); if (available_connections_del (self, connection)) { - available_connections_notify (self); + _notify (self, PROP_AVAILABLE_CONNECTIONS); available_connections_check_delete_unrealized (self); } } @@ -10462,7 +10456,7 @@ _set_state_full (NMDevice *self, if (state <= NM_DEVICE_STATE_UNAVAILABLE) { if (available_connections_del_all (self)) - available_connections_notify (self); + _notify (self, PROP_AVAILABLE_CONNECTIONS); if (old_state > NM_DEVICE_STATE_UNAVAILABLE) _clear_queued_act_request (priv); } diff --git a/src/nm-active-connection.c b/src/nm-active-connection.c index e907613662..7f84fe4d64 100644 --- a/src/nm-active-connection.c +++ b/src/nm-active-connection.c @@ -70,8 +70,7 @@ typedef struct { gpointer user_data2; } NMActiveConnectionPrivate; -enum { - PROP_0, +NM_GOBJECT_PROPERTIES_DEFINE (NMActiveConnection, PROP_CONNECTION, PROP_ID, PROP_UUID, @@ -93,9 +92,7 @@ enum { PROP_INT_SUBJECT, PROP_INT_MASTER, PROP_INT_MASTER_READY, - - LAST_PROP -}; +); enum { DEVICE_CHANGED, @@ -137,6 +134,45 @@ NM_UTILS_LOOKUP_STR_DEFINE_STATIC (_state_to_string, NMActiveConnectionState, /****************************************************************/ +static void +_settings_connection_updated (NMSettingsConnection *connection, + gboolean by_user, + gpointer user_data) +{ + NMActiveConnection *self = user_data; + + /* we don't know which properties actually changed. Just to be sure, + * notify about all possible properties. After all, an update of a + * connection is a rare event. */ + + _notify (self, PROP_ID); + + /* it's a bit odd to update the TYPE of an active connection. But the alternative + * is unexpected too. */ + _notify (self, PROP_TYPE); + + /* currently, the UUID and the exported CONNECTION path cannot change. Later, we might + * want to support a re-link operation, which associates an active-connection with a different + * settings-connection. */ +} + +static void +_set_settings_connection (NMActiveConnection *self, NMSettingsConnection *connection) +{ + NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (self); + + if (priv->settings_connection == connection) + return; + if (priv->settings_connection) { + g_signal_handlers_disconnect_by_func (priv->settings_connection, _settings_connection_updated, self); + g_clear_object (&priv->settings_connection); + } + if (connection) { + priv->settings_connection = g_object_ref (connection); + g_signal_connect (connection, NM_SETTINGS_CONNECTION_UPDATED_INTERNAL, (GCallback) _settings_connection_updated, self); + } +} + NMActiveConnectionState nm_active_connection_get_state (NMActiveConnection *self) { @@ -164,7 +200,7 @@ nm_active_connection_set_state (NMActiveConnection *self, old_state = priv->state; priv->state = new_state; priv->state_set = TRUE; - g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_STATE); + _notify (self, PROP_STATE); check_master_ready (self); @@ -186,10 +222,10 @@ nm_active_connection_set_state (NMActiveConnection *self, if ( new_state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED || old_state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) { - g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_IP4_CONFIG); - g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_DHCP4_CONFIG); - g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_IP6_CONFIG); - g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_DHCP6_CONFIG); + _notify (self, PROP_IP4_CONFIG); + _notify (self, PROP_DHCP4_CONFIG); + _notify (self, PROP_IP6_CONFIG); + _notify (self, PROP_DHCP6_CONFIG); } if (priv->state == NM_ACTIVE_CONNECTION_STATE_DEACTIVATED) { @@ -198,7 +234,7 @@ nm_active_connection_set_state (NMActiveConnection *self, * which will be NULL due to conditions in get_property(). */ _device_cleanup (self); - g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_DEVICES); + _notify (self, PROP_DEVICES); } } @@ -276,7 +312,7 @@ nm_active_connection_set_settings_connection (NMActiveConnection *self, * For example, we'd have to cancel all pending seret requests. */ g_return_if_fail (!nm_exported_object_is_exported (NM_EXPORTED_OBJECT (self))); - priv->settings_connection = g_object_ref (connection); + _set_settings_connection (self, connection); priv->applied_connection = nm_simple_connection_new_clone (NM_CONNECTION (priv->settings_connection)); nm_connection_clear_secrets (priv->applied_connection); } @@ -339,7 +375,7 @@ nm_active_connection_set_specific_object (NMActiveConnection *self, g_free (priv->specific_object); priv->specific_object = g_strdup (specific_object); - g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT); + _notify (self, PROP_SPECIFIC_OBJECT); } void @@ -356,7 +392,7 @@ nm_active_connection_set_default (NMActiveConnection *self, gboolean is_default) return; priv->is_default = is_default; - g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_DEFAULT); + _notify (self, PROP_DEFAULT); } gboolean @@ -381,7 +417,7 @@ nm_active_connection_set_default6 (NMActiveConnection *self, gboolean is_default return; priv->is_default6 = is_default6; - g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_DEFAULT6); + _notify (self, PROP_DEFAULT6); } gboolean @@ -524,11 +560,11 @@ nm_active_connection_set_device (NMActiveConnection *self, NMDevice *device) g_warn_if_fail (priv->state > NM_ACTIVE_CONNECTION_STATE_UNKNOWN); priv->device = NULL; } - g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_INT_DEVICE); + _notify (self, PROP_INT_DEVICE); g_signal_emit (self, signals[DEVICE_CHANGED], 0, priv->device, old_device); - g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_DEVICES); + _notify (self, PROP_DEVICES); return TRUE; } @@ -589,13 +625,13 @@ check_master_ready (NMActiveConnection *self) if (signalling) { priv->master_ready = TRUE; - g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_INT_MASTER_READY); + _notify (self, PROP_INT_MASTER_READY); /* Also notify clients to recheck the exported 'master' property to * ensure that if the master connection was created without a device * that we notify clients when the master device is known. */ - g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_MASTER); + _notify (self, PROP_MASTER); } } @@ -921,7 +957,8 @@ static void set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { - NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (object); + NMActiveConnection *self = (NMActiveConnection *) object; + NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (self); const char *tmp; NMSettingsConnection *con; @@ -930,20 +967,20 @@ set_property (GObject *object, guint prop_id, /* construct-only */ con = g_value_get_object (value); if (con) { - priv->settings_connection = g_object_ref (con); - priv->applied_connection = nm_simple_connection_new_clone (NM_CONNECTION (con)); + _set_settings_connection (self, con); + priv->applied_connection = nm_simple_connection_new_clone ((NMConnection *) priv->settings_connection); nm_connection_clear_secrets (priv->applied_connection); } break; case PROP_INT_DEVICE: /* construct-only */ - nm_active_connection_set_device (NM_ACTIVE_CONNECTION (object), g_value_get_object (value)); + nm_active_connection_set_device (self, g_value_get_object (value)); break; case PROP_INT_SUBJECT: priv->subject = g_value_dup_object (value); break; case PROP_INT_MASTER: - nm_active_connection_set_master (NM_ACTIVE_CONNECTION (object), g_value_get_object (value)); + nm_active_connection_set_master (self, g_value_get_object (value)); break; case PROP_SPECIFIC_OBJECT: tmp = g_value_get_string (value); @@ -1083,7 +1120,7 @@ dispose (GObject *object) g_free (priv->specific_object); priv->specific_object = NULL; - g_clear_object (&priv->settings_connection); + _set_settings_connection (self, NULL); g_clear_object (&priv->applied_connection); _device_cleanup (self); @@ -1120,171 +1157,153 @@ nm_active_connection_class_init (NMActiveConnectionClass *ac_class) object_class->dispose = dispose; /* D-Bus exported properties */ - g_object_class_install_property - (object_class, PROP_CONNECTION, - g_param_spec_string (NM_ACTIVE_CONNECTION_CONNECTION, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); - - 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)); - - 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)); - - 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)); - - g_object_class_install_property - (object_class, PROP_SPECIFIC_OBJECT, - g_param_spec_string (NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT, "", "", - NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property - (object_class, PROP_DEVICES, - g_param_spec_boxed (NM_ACTIVE_CONNECTION_DEVICES, "", "", - G_TYPE_STRV, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property - (object_class, PROP_STATE, - g_param_spec_uint (NM_ACTIVE_CONNECTION_STATE, "", "", - NM_ACTIVE_CONNECTION_STATE_UNKNOWN, - NM_ACTIVE_CONNECTION_STATE_DEACTIVATING, - NM_ACTIVE_CONNECTION_STATE_UNKNOWN, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property - (object_class, PROP_DEFAULT, - g_param_spec_boolean (NM_ACTIVE_CONNECTION_DEFAULT, "", "", - FALSE, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property - (object_class, PROP_IP4_CONFIG, - g_param_spec_string (NM_ACTIVE_CONNECTION_IP4_CONFIG, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property - (object_class, PROP_DHCP4_CONFIG, - g_param_spec_string (NM_ACTIVE_CONNECTION_DHCP4_CONFIG, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property - (object_class, PROP_DEFAULT6, - g_param_spec_boolean (NM_ACTIVE_CONNECTION_DEFAULT6, "", "", - FALSE, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property - (object_class, PROP_IP6_CONFIG, - g_param_spec_string (NM_ACTIVE_CONNECTION_IP6_CONFIG, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property - (object_class, PROP_DHCP6_CONFIG, - g_param_spec_string (NM_ACTIVE_CONNECTION_DHCP6_CONFIG, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property - (object_class, PROP_VPN, - g_param_spec_boolean (NM_ACTIVE_CONNECTION_VPN, "", "", - FALSE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property - (object_class, PROP_MASTER, - g_param_spec_string (NM_ACTIVE_CONNECTION_MASTER, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_CONNECTION] = + g_param_spec_string (NM_ACTIVE_CONNECTION_CONNECTION, "", "", + 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); + + obj_properties[PROP_UUID] = + g_param_spec_string (NM_ACTIVE_CONNECTION_UUID, "", "", + 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); + + obj_properties[PROP_SPECIFIC_OBJECT] = + g_param_spec_string (NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT, "", "", + NULL, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); + + obj_properties[PROP_DEVICES] = + g_param_spec_boxed (NM_ACTIVE_CONNECTION_DEVICES, "", "", + G_TYPE_STRV, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + obj_properties[PROP_STATE] = + g_param_spec_uint (NM_ACTIVE_CONNECTION_STATE, "", "", + NM_ACTIVE_CONNECTION_STATE_UNKNOWN, + NM_ACTIVE_CONNECTION_STATE_DEACTIVATING, + NM_ACTIVE_CONNECTION_STATE_UNKNOWN, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + obj_properties[PROP_DEFAULT] = + g_param_spec_boolean (NM_ACTIVE_CONNECTION_DEFAULT, "", "", + FALSE, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS); + + obj_properties[PROP_IP4_CONFIG] = + g_param_spec_string (NM_ACTIVE_CONNECTION_IP4_CONFIG, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + obj_properties[PROP_DHCP4_CONFIG] = + g_param_spec_string (NM_ACTIVE_CONNECTION_DHCP4_CONFIG, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + obj_properties[PROP_DEFAULT6] = + g_param_spec_boolean (NM_ACTIVE_CONNECTION_DEFAULT6, "", "", + FALSE, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS); + + obj_properties[PROP_IP6_CONFIG] = + g_param_spec_string (NM_ACTIVE_CONNECTION_IP6_CONFIG, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + obj_properties[PROP_DHCP6_CONFIG] = + g_param_spec_string (NM_ACTIVE_CONNECTION_DHCP6_CONFIG, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + obj_properties[PROP_VPN] = + g_param_spec_boolean (NM_ACTIVE_CONNECTION_VPN, "", "", + FALSE, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); + + obj_properties[PROP_MASTER] = + g_param_spec_string (NM_ACTIVE_CONNECTION_MASTER, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); /* Internal properties */ - g_object_class_install_property - (object_class, PROP_INT_SETTINGS_CONNECTION, - g_param_spec_object (NM_ACTIVE_CONNECTION_INT_SETTINGS_CONNECTION, "", "", - NM_TYPE_SETTINGS_CONNECTION, - G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property - (object_class, PROP_INT_DEVICE, - g_param_spec_object (NM_ACTIVE_CONNECTION_INT_DEVICE, "", "", - NM_TYPE_DEVICE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property - (object_class, PROP_INT_SUBJECT, - g_param_spec_object (NM_ACTIVE_CONNECTION_INT_SUBJECT, "", "", - NM_TYPE_AUTH_SUBJECT, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property - (object_class, PROP_INT_MASTER, - g_param_spec_object (NM_ACTIVE_CONNECTION_INT_MASTER, "", "", - NM_TYPE_ACTIVE_CONNECTION, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property - (object_class, PROP_INT_MASTER_READY, - g_param_spec_boolean (NM_ACTIVE_CONNECTION_INT_MASTER_READY, "", "", - FALSE, G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_INT_SETTINGS_CONNECTION] = + g_param_spec_object (NM_ACTIVE_CONNECTION_INT_SETTINGS_CONNECTION, "", "", + NM_TYPE_SETTINGS_CONNECTION, + G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); + + obj_properties[PROP_INT_DEVICE] = + g_param_spec_object (NM_ACTIVE_CONNECTION_INT_DEVICE, "", "", + NM_TYPE_DEVICE, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); + + obj_properties[PROP_INT_SUBJECT] = + g_param_spec_object (NM_ACTIVE_CONNECTION_INT_SUBJECT, "", "", + NM_TYPE_AUTH_SUBJECT, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); + + obj_properties[PROP_INT_MASTER] = + g_param_spec_object (NM_ACTIVE_CONNECTION_INT_MASTER, "", "", + NM_TYPE_ACTIVE_CONNECTION, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS); + + obj_properties[PROP_INT_MASTER_READY] = + g_param_spec_boolean (NM_ACTIVE_CONNECTION_INT_MASTER_READY, "", "", + FALSE, G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); signals[DEVICE_CHANGED] = - g_signal_new (NM_ACTIVE_CONNECTION_DEVICE_CHANGED, - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMActiveConnectionClass, device_changed), - NULL, NULL, NULL, - G_TYPE_NONE, 2, NM_TYPE_DEVICE, NM_TYPE_DEVICE); + g_signal_new (NM_ACTIVE_CONNECTION_DEVICE_CHANGED, + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMActiveConnectionClass, device_changed), + NULL, NULL, NULL, + G_TYPE_NONE, 2, NM_TYPE_DEVICE, NM_TYPE_DEVICE); signals[DEVICE_METERED_CHANGED] = - g_signal_new (NM_ACTIVE_CONNECTION_DEVICE_METERED_CHANGED, - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMActiveConnectionClass, device_metered_changed), - NULL, NULL, NULL, - G_TYPE_NONE, 1, G_TYPE_UINT); + g_signal_new (NM_ACTIVE_CONNECTION_DEVICE_METERED_CHANGED, + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMActiveConnectionClass, device_metered_changed), + NULL, NULL, NULL, + G_TYPE_NONE, 1, G_TYPE_UINT); signals[PARENT_ACTIVE] = - g_signal_new (NM_ACTIVE_CONNECTION_PARENT_ACTIVE, - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMActiveConnectionClass, parent_active), - NULL, NULL, NULL, - G_TYPE_NONE, 1, NM_TYPE_ACTIVE_CONNECTION); + g_signal_new (NM_ACTIVE_CONNECTION_PARENT_ACTIVE, + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMActiveConnectionClass, parent_active), + NULL, NULL, NULL, + G_TYPE_NONE, 1, NM_TYPE_ACTIVE_CONNECTION); nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (ac_class), NMDBUS_TYPE_ACTIVE_CONNECTION_SKELETON, diff --git a/src/nm-connection-provider.c b/src/nm-connection-provider.c index 2e258bd5b1..e04cab928e 100644 --- a/src/nm-connection-provider.c +++ b/src/nm-connection-provider.c @@ -106,24 +106,21 @@ nm_connection_provider_default_init (NMConnectionProviderInterface *g_iface) g_signal_new (NM_CP_SIGNAL_CONNECTION_ADDED, iface_type, G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMConnectionProviderInterface, connection_added), - NULL, NULL, + 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, G_TYPE_OBJECT); g_signal_new (NM_CP_SIGNAL_CONNECTION_UPDATED, iface_type, G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMConnectionProviderInterface, connection_updated), - NULL, NULL, + 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, G_TYPE_OBJECT); g_signal_new (NM_CP_SIGNAL_CONNECTION_REMOVED, iface_type, G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMConnectionProviderInterface, connection_removed), - NULL, NULL, + 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, G_TYPE_OBJECT); } diff --git a/src/nm-connection-provider.h b/src/nm-connection-provider.h index 2485c56f4f..b31af05fbe 100644 --- a/src/nm-connection-provider.h +++ b/src/nm-connection-provider.h @@ -63,14 +63,6 @@ typedef struct { NMConnection * (*get_connection_by_uuid) (NMConnectionProvider *self, const char *uuid); - - /* Signals */ - void (*connection_added) (NMConnectionProvider *self, NMConnection *connection); - - void (*connection_updated) (NMConnectionProvider *self, NMConnection *connection); - - void (*connection_removed) (NMConnectionProvider *self, NMConnection *connection); - } NMConnectionProviderInterface; GType nm_connection_provider_get_type (void); diff --git a/src/nm-manager.c b/src/nm-manager.c index 7f838387c4..245bef882b 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -80,8 +80,7 @@ static gboolean find_master (NMManager *self, static void nm_manager_update_state (NMManager *manager); -static void connection_changed (NMSettings *settings, NMConnection *connection, - NMManager *manager); +static void connection_changed (NMManager *self, NMConnection *connection); #define TAG_ACTIVE_CONNETION_ADD_AND_ACTIVATE "act-con-add-and-activate" @@ -1148,7 +1147,7 @@ retry_connections_for_parent_device (NMManager *self, NMDevice *device) ifname = nm_manager_get_connection_iface (self, candidate, &parent, &error); if (ifname) { if (!nm_platform_link_get_by_ifname (NM_PLATFORM_GET, ifname)) - connection_changed (priv->settings, candidate, self); + connection_changed (self, candidate); } } } @@ -1157,34 +1156,40 @@ retry_connections_for_parent_device (NMManager *self, NMDevice *device) } static void -connection_changed (NMSettings *settings, - NMConnection *connection, - NMManager *manager) +connection_changed (NMManager *self, + NMConnection *connection) { NMDevice *device; if (!nm_connection_is_virtual (connection)) return; - device = system_create_virtual_device (manager, connection); + device = system_create_virtual_device (self, connection); if (!device) return; /* Maybe the device that was created was needed by some other * connection's device (parent of a VLAN). Let the connections * can use the newly created device as a parent know. */ - retry_connections_for_parent_device (manager, device); + retry_connections_for_parent_device (self, device); } static void -connection_removed (NMSettings *settings, - NMSettingsConnection *connection, - NMManager *manager) +connection_added_cb (NMSettings *settings, + NMConnection *connection, + NMManager *self) { - /* - * Do not delete existing virtual devices to keep connectivity up. - * Virtual devices are reused when NetworkManager is restarted. - */ + connection_changed (self, connection); +} + +static void +connection_updated_cb (NMSettings *settings, + NMConnection *connection, + gboolean by_user, + NMManager *self) +{ + if (by_user) + connection_changed (self, connection); } static void @@ -4403,7 +4408,7 @@ nm_manager_start (NMManager *self, GError **error) _LOGD (LOGD_CORE, "creating virtual devices..."); connections = nm_settings_get_connections (priv->settings); for (iter = connections; iter; iter = iter->next) - connection_changed (priv->settings, NM_CONNECTION (iter->data), self); + connection_changed (self, NM_CONNECTION (iter->data)); g_slist_free (connections); priv->devices_inited = TRUE; @@ -5080,11 +5085,14 @@ constructed (GObject *object) g_signal_connect (priv->settings, "notify::" NM_SETTINGS_HOSTNAME, G_CALLBACK (system_hostname_changed_cb), self); g_signal_connect (priv->settings, NM_SETTINGS_SIGNAL_CONNECTION_ADDED, - G_CALLBACK (connection_changed), self); - g_signal_connect (priv->settings, NM_SETTINGS_SIGNAL_CONNECTION_UPDATED_BY_USER, - G_CALLBACK (connection_changed), self); - g_signal_connect (priv->settings, NM_SETTINGS_SIGNAL_CONNECTION_REMOVED, - G_CALLBACK (connection_removed), self); + G_CALLBACK (connection_added_cb), self); + g_signal_connect (priv->settings, NM_SETTINGS_SIGNAL_CONNECTION_UPDATED, + G_CALLBACK (connection_updated_cb), self); + /* + * Do not delete existing virtual devices to keep connectivity up. + * Virtual devices are reused when NetworkManager is restarted. + * Hence, don't react on NM_SETTINGS_SIGNAL_CONNECTION_REMOVED. + */ priv->policy = nm_policy_new (self, priv->settings); g_signal_connect (priv->policy, "notify::" NM_POLICY_DEFAULT_IP4_DEVICE, @@ -5394,8 +5402,8 @@ dispose (GObject *object) g_signal_handlers_disconnect_by_func (priv->settings, settings_startup_complete_changed, manager); g_signal_handlers_disconnect_by_func (priv->settings, system_unmanaged_devices_changed_cb, manager); g_signal_handlers_disconnect_by_func (priv->settings, system_hostname_changed_cb, manager); - g_signal_handlers_disconnect_by_func (priv->settings, connection_changed, manager); - g_signal_handlers_disconnect_by_func (priv->settings, connection_removed, manager); + g_signal_handlers_disconnect_by_func (priv->settings, connection_added_cb, manager); + g_signal_handlers_disconnect_by_func (priv->settings, connection_updated_cb, manager); g_clear_object (&priv->settings); } diff --git a/src/nm-policy.c b/src/nm-policy.c index 07bcce89ec..7af311270d 100644 --- a/src/nm-policy.c +++ b/src/nm-policy.c @@ -83,6 +83,8 @@ struct _NMPolicyPrivate { guint reset_retries_id; /* idle handler for resetting the retries count */ + guint schedule_activate_all_id; /* idle handler for schedule_activate_all(). */ + char *orig_hostname; /* hostname at NM start time */ char *cur_hostname; /* hostname we want to assign */ gboolean hostname_changed; /* TRUE if NM ever set the hostname */ @@ -1015,8 +1017,6 @@ reset_connections_retries (gpointer user_data) return FALSE; } -static void schedule_activate_all (NMPolicy *self); - static void activate_slave_connections (NMPolicy *self, NMDevice *device) { @@ -1579,14 +1579,30 @@ active_connection_removed (NMManager *manager, /**************************************************************************/ -static void -schedule_activate_all (NMPolicy *self) +static gboolean +schedule_activate_all_cb (gpointer user_data) { + NMPolicy *self = user_data; NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE (self); const GSList *iter; + priv->schedule_activate_all_id = 0; + for (iter = nm_manager_get_devices (priv->manager); iter; iter = g_slist_next (iter)) - schedule_activate_check (self, NM_DEVICE (iter->data)); + schedule_activate_check (self, iter->data); + + return G_SOURCE_REMOVE; +} + +static void +schedule_activate_all (NMPolicy *self) +{ + NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE (self); + + /* always restart the idle handler. That way, we settle + * all other events before restarting to activate them. */ + nm_clear_g_source (&priv->schedule_activate_all_id); + priv->schedule_activate_all_id = g_idle_add (schedule_activate_all_cb, self); } static void @@ -1648,39 +1664,34 @@ dns_config_changed (NMDnsManager *dns_manager, gpointer user_data) static void connection_updated (NMSettings *settings, - NMConnection *connection, + NMSettingsConnection *connection, + gboolean by_user, gpointer user_data) { NMPolicyPrivate *priv = user_data; NMPolicy *self = priv->self; - - schedule_activate_all (self); -} - -static void -connection_updated_by_user (NMSettings *settings, - NMSettingsConnection *connection, - gpointer user_data) -{ - NMPolicyPrivate *priv = user_data; const GSList *iter; NMDevice *device = NULL; - /* find device with given connection */ - for (iter = nm_manager_get_devices (priv->manager); iter; iter = g_slist_next (iter)) { - NMDevice *dev = NM_DEVICE (iter->data); + if (by_user) { + /* find device with given connection */ + for (iter = nm_manager_get_devices (priv->manager); iter; iter = g_slist_next (iter)) { + NMDevice *dev = NM_DEVICE (iter->data); - if (nm_device_get_settings_connection (dev) == connection) { - device = dev; - break; + if (nm_device_get_settings_connection (dev) == connection) { + device = dev; + break; + } } - } - if (device) - nm_device_reapply_settings_immediately (device); + if (device) + nm_device_reapply_settings_immediately (device); + + /* Reset auto retries back to default since connection was updated */ + nm_settings_connection_reset_autoconnect_retries (connection); + } - /* Reset auto retries back to default since connection was updated */ - nm_settings_connection_reset_autoconnect_retries (connection); + schedule_activate_all (self); } static void @@ -1876,7 +1887,6 @@ constructed (GObject *object) g_signal_connect (priv->settings, NM_SETTINGS_SIGNAL_CONNECTION_ADDED, (GCallback) connection_added, priv); g_signal_connect (priv->settings, NM_SETTINGS_SIGNAL_CONNECTION_UPDATED, (GCallback) connection_updated, priv); - g_signal_connect (priv->settings, NM_SETTINGS_SIGNAL_CONNECTION_UPDATED_BY_USER, (GCallback) connection_updated_by_user, priv); g_signal_connect (priv->settings, NM_SETTINGS_SIGNAL_CONNECTION_REMOVED, (GCallback) connection_removed, priv); g_signal_connect (priv->settings, NM_SETTINGS_SIGNAL_CONNECTION_VISIBILITY_CHANGED, (GCallback) connection_visibility_changed, priv); g_signal_connect (priv->settings, NM_SETTINGS_SIGNAL_AGENT_REGISTERED, (GCallback) secret_agent_registered, priv); @@ -1941,6 +1951,7 @@ dispose (GObject *object) g_assert (connections == NULL); nm_clear_g_source (&priv->reset_retries_id); + nm_clear_g_source (&priv->schedule_activate_all_id); g_clear_pointer (&priv->orig_hostname, g_free); g_clear_pointer (&priv->cur_hostname, g_free); diff --git a/src/settings/nm-settings-connection.c b/src/settings/nm-settings-connection.c index 6bed3fe5f2..26d1be63cb 100644 --- a/src/settings/nm-settings-connection.c +++ b/src/settings/nm-settings-connection.c @@ -70,19 +70,18 @@ G_DEFINE_TYPE_WITH_CODE (NMSettingsConnection, nm_settings_connection, NM_TYPE_E NM_TYPE_SETTINGS_CONNECTION, \ NMSettingsConnectionPrivate)) -enum { - PROP_0 = 0, +NM_GOBJECT_PROPERTIES_DEFINE (NMSettingsConnection, PROP_VISIBLE, PROP_UNSAVED, PROP_READY, PROP_FLAGS, PROP_FILENAME, -}; +); enum { UPDATED, REMOVED, - UPDATED_BY_USER, + UPDATED_INTERNAL, LAST_SIGNAL }; static guint signals[LAST_SIGNAL] = { 0 }; @@ -97,8 +96,6 @@ typedef struct { NMSettingsConnectionFlags flags; gboolean ready; - guint updated_idle_id; - GSList *pending_auths; /* List of pending authentication requests */ gboolean visible; /* Is this connection is visible by some session? */ @@ -133,6 +130,15 @@ typedef struct { /*******************************************************************/ +static void +_emit_updated (NMSettingsConnection *self, gboolean by_user) +{ + g_signal_emit (self, signals[UPDATED], 0); + g_signal_emit (self, signals[UPDATED_INTERNAL], 0, by_user); +} + +/*******************************************************************/ + gboolean nm_settings_connection_has_unmodified_applied_connection (NMSettingsConnection *self, NMConnection *applied_connection, @@ -292,7 +298,7 @@ set_visible (NMSettingsConnection *self, gboolean new_visible) if (new_visible == priv->visible) return; priv->visible = new_visible; - g_object_notify (G_OBJECT (self), NM_SETTINGS_CONNECTION_VISIBLE); + _notify (self, PROP_VISIBLE); } gboolean @@ -465,14 +471,6 @@ secrets_cleared_cb (NMSettingsConnection *self) priv->agent_secrets = NULL; } -static gboolean -emit_updated (NMSettingsConnection *self) -{ - NM_SETTINGS_CONNECTION_GET_PRIVATE (self)->updated_idle_id = 0; - g_signal_emit (self, signals[UPDATED], 0); - return FALSE; -} - static void set_unsaved (NMSettingsConnection *self, gboolean now_unsaved) { @@ -491,16 +489,10 @@ set_unsaved (NMSettingsConnection *self, gboolean now_unsaved) } static void -changed_cb (NMSettingsConnection *self, gpointer user_data) +connection_changed_cb (NMSettingsConnection *self, gpointer unused) { - gboolean update_unsaved = !!user_data; - - NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self); - - if (update_unsaved) - set_unsaved (self, TRUE); - if (priv->updated_idle_id == 0) - priv->updated_idle_id = g_idle_add ((GSourceFunc) emit_updated, self); + set_unsaved (self, TRUE); + _emit_updated (self, FALSE); } /* Update the settings of this connection to match that of 'new_connection', @@ -543,7 +535,7 @@ nm_settings_connection_replace_settings (NMSettingsConnection *self, /* Disconnect the changed signal to ensure we don't set Unsaved when * it's not required. */ - g_signal_handlers_block_by_func (self, G_CALLBACK (changed_cb), GUINT_TO_POINTER (TRUE)); + g_signal_handlers_block_by_func (self, G_CALLBACK (connection_changed_cb), NULL); if (log_diff_name) nm_utils_log_connection_diff (new_connection, NM_CONNECTION (self), LOGL_DEBUG, LOGD_CORE, log_diff_name, "++ "); @@ -580,11 +572,12 @@ nm_settings_connection_replace_settings (NMSettingsConnection *self, /* Manually emit changed signal since we disconnected the handler, but * only update Unsaved if the caller wanted us to. */ - changed_cb (self, GUINT_TO_POINTER (update_unsaved)); + if (update_unsaved) + set_unsaved (self, TRUE); - g_signal_emit (self, signals[UPDATED_BY_USER], 0); + g_signal_handlers_unblock_by_func (self, G_CALLBACK (connection_changed_cb), NULL); - g_signal_handlers_unblock_by_func (self, G_CALLBACK (changed_cb), GUINT_TO_POINTER (TRUE)); + _emit_updated (self, TRUE); return success; } @@ -2099,9 +2092,9 @@ nm_settings_connection_set_flags_all (NMSettingsConnection *self, NMSettingsConn old_flags = priv->flags; if (old_flags != flags) { priv->flags = flags; - g_object_notify (G_OBJECT (self), NM_SETTINGS_CONNECTION_FLAGS); + _notify (self, PROP_FLAGS); if (NM_FLAGS_HAS (old_flags, NM_SETTINGS_CONNECTION_FLAGS_UNSAVED) != NM_FLAGS_HAS (flags, NM_SETTINGS_CONNECTION_FLAGS_UNSAVED)) - g_object_notify (G_OBJECT (self), NM_SETTINGS_CONNECTION_UNSAVED); + _notify (self, PROP_UNSAVED); } return old_flags; } @@ -2506,7 +2499,7 @@ nm_settings_connection_set_ready (NMSettingsConnection *self, ready = !!ready; if (priv->ready != ready) { priv->ready = ready; - g_object_notify (G_OBJECT (self), NM_SETTINGS_CONNECTION_READY); + _notify (self, PROP_READY); } } @@ -2527,7 +2520,7 @@ nm_settings_connection_set_filename (NMSettingsConnection *self, if (g_strcmp0 (filename, priv->filename) != 0) { g_free (priv->filename); priv->filename = g_strdup (filename); - g_object_notify (G_OBJECT (self), NM_SETTINGS_CONNECTION_FILENAME); + _notify (self, PROP_FILENAME); } } @@ -2582,7 +2575,7 @@ nm_settings_connection_init (NMSettingsConnection *self) priv->autoconnect_blocked_reason = NM_DEVICE_STATE_REASON_NONE; g_signal_connect (self, NM_CONNECTION_SECRETS_CLEARED, G_CALLBACK (secrets_cleared_cb), NULL); - g_signal_connect (self, NM_CONNECTION_CHANGED, G_CALLBACK (changed_cb), GUINT_TO_POINTER (TRUE)); + g_signal_connect (self, NM_CONNECTION_CHANGED, G_CALLBACK (connection_changed_cb), NULL); } static void @@ -2613,14 +2606,12 @@ dispose (GObject *object) } } - nm_clear_g_source (&priv->updated_idle_id); - /* Disconnect handlers. - * changed_cb() has to be disconnected *before* nm_connection_clear_secrets(), + * connection_changed_cb() has to be disconnected *before* nm_connection_clear_secrets(), * because nm_connection_clear_secrets() emits NM_CONNECTION_CHANGED signal. */ g_signal_handlers_disconnect_by_func (self, G_CALLBACK (secrets_cleared_cb), NULL); - g_signal_handlers_disconnect_by_func (self, G_CALLBACK (changed_cb), GUINT_TO_POINTER (TRUE)); + g_signal_handlers_disconnect_by_func (self, G_CALLBACK (connection_changed_cb), NULL); nm_connection_clear_secrets (NM_CONNECTION (self)); g_clear_object (&priv->system_secrets); @@ -2719,72 +2710,68 @@ nm_settings_connection_class_init (NMSettingsConnectionClass *class) class->supports_secrets = supports_secrets; /* Properties */ - g_object_class_install_property - (object_class, PROP_VISIBLE, - g_param_spec_boolean (NM_SETTINGS_CONNECTION_VISIBLE, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property - (object_class, PROP_UNSAVED, - g_param_spec_boolean (NM_SETTINGS_CONNECTION_UNSAVED, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property - (object_class, PROP_READY, - g_param_spec_boolean (NM_SETTINGS_CONNECTION_READY, "", "", - TRUE, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property - (object_class, PROP_FLAGS, + obj_properties[PROP_VISIBLE] = + g_param_spec_boolean (NM_SETTINGS_CONNECTION_VISIBLE, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + obj_properties[PROP_UNSAVED] = + g_param_spec_boolean (NM_SETTINGS_CONNECTION_UNSAVED, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + obj_properties[PROP_READY] = + g_param_spec_boolean (NM_SETTINGS_CONNECTION_READY, "", "", + TRUE, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS); + + obj_properties[PROP_FLAGS] = g_param_spec_uint (NM_SETTINGS_CONNECTION_FLAGS, "", "", NM_SETTINGS_CONNECTION_FLAGS_NONE, NM_SETTINGS_CONNECTION_FLAGS_ALL, NM_SETTINGS_CONNECTION_FLAGS_NONE, G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); + G_PARAM_STATIC_STRINGS); + + obj_properties[PROP_FILENAME] = + g_param_spec_string (NM_SETTINGS_CONNECTION_FILENAME, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS); - g_object_class_install_property - (object_class, PROP_FILENAME, - g_param_spec_string (NM_SETTINGS_CONNECTION_FILENAME, "", "", - NULL, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); /* Signals */ - /* Emitted when the connection is changed for any reason */ signals[UPDATED] = - g_signal_new (NM_SETTINGS_CONNECTION_UPDATED, - G_TYPE_FROM_CLASS (class), - G_SIGNAL_RUN_FIRST, - 0, - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - /* Emitted when connection is changed from D-Bus */ - signals[UPDATED_BY_USER] = - g_signal_new (NM_SETTINGS_CONNECTION_UPDATED_BY_USER, - G_TYPE_FROM_CLASS (class), - G_SIGNAL_RUN_FIRST, - 0, NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - signals[REMOVED] = - g_signal_new (NM_SETTINGS_CONNECTION_REMOVED, - G_TYPE_FROM_CLASS (class), - G_SIGNAL_RUN_FIRST, - 0, - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); + g_signal_new (NM_SETTINGS_CONNECTION_UPDATED, + G_TYPE_FROM_CLASS (class), + G_SIGNAL_RUN_FIRST, + 0, + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + /* internal signal, with an argument (gboolean by_user). */ + signals[UPDATED_INTERNAL] = + g_signal_new (NM_SETTINGS_CONNECTION_UPDATED_INTERNAL, + G_TYPE_FROM_CLASS (class), + G_SIGNAL_RUN_FIRST, + 0, NULL, NULL, + g_cclosure_marshal_VOID__BOOLEAN, + G_TYPE_NONE, 1, G_TYPE_BOOLEAN); + + signals[REMOVED] = + g_signal_new (NM_SETTINGS_CONNECTION_REMOVED, + G_TYPE_FROM_CLASS (class), + G_SIGNAL_RUN_FIRST, + 0, + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (class), NMDBUS_TYPE_SETTINGS_CONNECTION_SKELETON, diff --git a/src/settings/nm-settings-connection.h b/src/settings/nm-settings-connection.h index 5c12a8aca7..c45505d9f0 100644 --- a/src/settings/nm-settings-connection.h +++ b/src/settings/nm-settings-connection.h @@ -43,8 +43,8 @@ G_BEGIN_DECLS #define NM_SETTINGS_CONNECTION_GET_SECRETS "get-secrets" #define NM_SETTINGS_CONNECTION_CANCEL_SECRETS "cancel-secrets" -/* Emitted when connection is changed by a user action */ -#define NM_SETTINGS_CONNECTION_UPDATED_BY_USER "updated-by-user" +/* Internal signals */ +#define NM_SETTINGS_CONNECTION_UPDATED_INTERNAL "updated-internal" /* Properties */ #define NM_SETTINGS_CONNECTION_VISIBLE "visible" diff --git a/src/settings/nm-settings.c b/src/settings/nm-settings.c index 4ad395a10b..758a6c02d6 100644 --- a/src/settings/nm-settings.c +++ b/src/settings/nm-settings.c @@ -167,7 +167,6 @@ typedef struct { enum { CONNECTION_ADDED, CONNECTION_UPDATED, - CONNECTION_UPDATED_BY_USER, CONNECTION_REMOVED, CONNECTION_VISIBILITY_CHANGED, AGENT_REGISTERED, @@ -177,16 +176,13 @@ enum { }; static guint signals[LAST_SIGNAL] = { 0 }; -enum { - PROP_0, +NM_GOBJECT_PROPERTIES_DEFINE (NMSettings, PROP_UNMANAGED_SPECS, PROP_HOSTNAME, PROP_CAN_MODIFY, PROP_CONNECTIONS, PROP_STARTUP_COMPLETE, - - LAST_PROP -}; +); static void check_startup_complete (NMSettings *self) @@ -205,7 +201,7 @@ check_startup_complete (NMSettings *self) } priv->startup_complete = TRUE; - g_object_notify (G_OBJECT (self), NM_SETTINGS_STARTUP_COMPLETE); + _notify (self, PROP_STARTUP_COMPLETE); } static void @@ -615,7 +611,7 @@ unmanaged_specs_changed (NMSettingsPlugin *config, update_specs (self, &priv->unmanaged_specs, nm_settings_plugin_get_unmanaged_specs); - g_object_notify (G_OBJECT (self), NM_SETTINGS_UNMANAGED_SPECS); + _notify (self, PROP_UNMANAGED_SPECS); } static void @@ -845,27 +841,17 @@ next: } static void -connection_updated (NMSettingsConnection *connection, gpointer user_data) +connection_updated (NMSettingsConnection *connection, gboolean by_user, gpointer user_data) { - /* Re-emit for listeners like NMPolicy */ g_signal_emit (NM_SETTINGS (user_data), signals[CONNECTION_UPDATED], 0, - connection); + connection, + by_user); g_signal_emit_by_name (NM_SETTINGS (user_data), NM_CP_SIGNAL_CONNECTION_UPDATED, connection); } static void -connection_updated_by_user (NMSettingsConnection *connection, gpointer user_data) -{ - /* Re-emit for listeners like NMPolicy */ - g_signal_emit (NM_SETTINGS (user_data), - signals[CONNECTION_UPDATED_BY_USER], - 0, - connection); -} - -static void connection_visibility_changed (NMSettingsConnection *connection, GParamSpec *pspec, gpointer user_data) @@ -895,7 +881,6 @@ connection_removed (NMSettingsConnection *connection, gpointer user_data) g_signal_handlers_disconnect_by_func (connection, G_CALLBACK (connection_removed), self); g_signal_handlers_disconnect_by_func (connection, G_CALLBACK (connection_updated), self); - g_signal_handlers_disconnect_by_func (connection, G_CALLBACK (connection_updated_by_user), self); g_signal_handlers_disconnect_by_func (connection, G_CALLBACK (connection_visibility_changed), self); g_signal_handlers_disconnect_by_func (connection, G_CALLBACK (connection_ready_changed), self); g_object_unref (self); @@ -908,7 +893,7 @@ connection_removed (NMSettingsConnection *connection, gpointer user_data) /* Re-emit for listeners like NMPolicy */ g_signal_emit_by_name (self, NM_CP_SIGNAL_CONNECTION_REMOVED, connection); - g_object_notify (G_OBJECT (self), NM_SETTINGS_CONNECTIONS); + _notify (self, PROP_CONNECTIONS); if (nm_exported_object_is_exported (NM_EXPORTED_OBJECT (connection))) nm_exported_object_unexport (NM_EXPORTED_OBJECT (connection)); @@ -1027,10 +1012,8 @@ claim_connection (NMSettings *self, NMSettingsConnection *connection) g_object_ref (self); g_signal_connect (connection, NM_SETTINGS_CONNECTION_REMOVED, G_CALLBACK (connection_removed), self); - g_signal_connect (connection, NM_SETTINGS_CONNECTION_UPDATED, + g_signal_connect (connection, NM_SETTINGS_CONNECTION_UPDATED_INTERNAL, G_CALLBACK (connection_updated), self); - g_signal_connect (connection, NM_SETTINGS_CONNECTION_UPDATED_BY_USER, - G_CALLBACK (connection_updated_by_user), self); g_signal_connect (connection, "notify::" NM_SETTINGS_CONNECTION_VISIBLE, G_CALLBACK (connection_visibility_changed), self); @@ -1058,7 +1041,7 @@ claim_connection (NMSettings *self, NMSettingsConnection *connection) /* Internal added signal */ g_signal_emit (self, signals[CONNECTION_ADDED], 0, connection); g_signal_emit_by_name (self, NM_CP_SIGNAL_CONNECTION_ADDED, connection); - g_object_notify (G_OBJECT (self), NM_SETTINGS_CONNECTIONS); + _notify (self, PROP_CONNECTIONS); /* Exported D-Bus signal */ g_signal_emit (self, signals[NEW_CONNECTION], 0, connection); @@ -1073,7 +1056,7 @@ claim_connection (NMSettings *self, NMSettingsConnection *connection) * not save to disk * @error: on return, a location to store any errors that may occur * - * Creates a new #NMSettingsConnection for the given source @connection. + * Creates a new #NMSettingsConnection for the given source @connection. * The returned object is owned by @self and the caller must reference * the object to continue using it. * @@ -1792,7 +1775,7 @@ hostname_maybe_changed (NMSettings *settings) NM_PRINT_FMT_QUOTED (new_hostname, "\"", new_hostname, "\"", "(none)")); g_free (priv->hostname.value); priv->hostname.value = new_hostname; - g_object_notify (G_OBJECT (settings), NM_SETTINGS_HOSTNAME); + _notify (settings, PROP_HOSTNAME); } else g_free (new_hostname); } @@ -1894,10 +1877,13 @@ default_wired_connection_removed_cb (NMSettingsConnection *connection, NMSetting } static void -default_wired_connection_updated_by_user_cb (NMSettingsConnection *connection, NMSettings *self) +default_wired_connection_updated_by_user_cb (NMSettingsConnection *connection, gboolean by_user, NMSettings *self) { NMDevice *device; + if (!by_user) + return; + /* The connection has been changed by the user, it should no longer be * considered a default wired connection, and should no longer affect * the no-auto-default configuration option. @@ -1970,7 +1956,7 @@ device_realized (NMDevice *device, GParamSpec *pspec, NMSettings *self) g_object_set_data (G_OBJECT (added), DEFAULT_WIRED_DEVICE_TAG, device); g_object_set_data (G_OBJECT (device), DEFAULT_WIRED_CONNECTION_TAG, added); - g_signal_connect (added, NM_SETTINGS_CONNECTION_UPDATED_BY_USER, + g_signal_connect (added, NM_SETTINGS_CONNECTION_UPDATED_INTERNAL, G_CALLBACK (default_wired_connection_updated_by_user_cb), self); g_signal_connect (added, NM_SETTINGS_CONNECTION_REMOVED, G_CALLBACK (default_wired_connection_removed_cb), self); @@ -2134,7 +2120,8 @@ hostnamed_properties_changed (GDBusProxy *proxy, char **invalidated_properties, gpointer user_data) { - NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (user_data); + NMSettings *self = user_data; + NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self); GVariant *v_hostname; const char *hostname; @@ -2151,7 +2138,7 @@ hostnamed_properties_changed (GDBusProxy *proxy, NM_PRINT_FMT_QUOTED (hostname, "\"", hostname, "\"", "(none)")); g_free (priv->hostname.value); priv->hostname.value = g_strdup (hostname); - g_object_notify (G_OBJECT (user_data), NM_SETTINGS_HOSTNAME); + _notify (self, PROP_HOSTNAME); nm_dispatcher_call (DISPATCHER_ACTION_HOSTNAME, NULL, NULL, NULL, NULL, NULL, NULL); } @@ -2256,7 +2243,7 @@ nm_settings_start (NMSettings *self, GError **error) setup_hostname_file_monitors (self); priv->started = TRUE; - g_object_notify (G_OBJECT (self), NM_SETTINGS_HOSTNAME); + _notify (self, PROP_HOSTNAME); return TRUE; } @@ -2407,96 +2394,86 @@ nm_settings_class_init (NMSettingsClass *class) /* properties */ - g_object_class_install_property - (object_class, PROP_UNMANAGED_SPECS, - g_param_spec_boxed (NM_SETTINGS_UNMANAGED_SPECS, "", "", - G_TYPE_STRV, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property - (object_class, PROP_HOSTNAME, - g_param_spec_string (NM_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_SETTINGS_CAN_MODIFY, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property - (object_class, PROP_CONNECTIONS, - g_param_spec_boxed (NM_SETTINGS_CONNECTIONS, "", "", - G_TYPE_STRV, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_UNMANAGED_SPECS] = + g_param_spec_boxed (NM_SETTINGS_UNMANAGED_SPECS, "", "", + G_TYPE_STRV, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + obj_properties[PROP_HOSTNAME] = + g_param_spec_string (NM_SETTINGS_HOSTNAME, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + obj_properties[PROP_CAN_MODIFY] = + g_param_spec_boolean (NM_SETTINGS_CAN_MODIFY, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + obj_properties[PROP_CONNECTIONS] = + g_param_spec_boxed (NM_SETTINGS_CONNECTIONS, "", "", + G_TYPE_STRV, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + obj_properties[PROP_STARTUP_COMPLETE] = + g_param_spec_boolean (NM_SETTINGS_STARTUP_COMPLETE, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); /* signals */ - signals[CONNECTION_ADDED] = - g_signal_new (NM_SETTINGS_SIGNAL_CONNECTION_ADDED, - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMSettingsClass, connection_added), - NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, - G_TYPE_NONE, 1, NM_TYPE_SETTINGS_CONNECTION); - - signals[CONNECTION_UPDATED] = - g_signal_new (NM_SETTINGS_SIGNAL_CONNECTION_UPDATED, - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMSettingsClass, connection_updated), - NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, - G_TYPE_NONE, 1, NM_TYPE_SETTINGS_CONNECTION); - - signals[CONNECTION_UPDATED_BY_USER] = - g_signal_new (NM_SETTINGS_SIGNAL_CONNECTION_UPDATED_BY_USER, - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - 0, - NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, - G_TYPE_NONE, 1, NM_TYPE_SETTINGS_CONNECTION); - - signals[CONNECTION_REMOVED] = - g_signal_new (NM_SETTINGS_SIGNAL_CONNECTION_REMOVED, - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMSettingsClass, connection_removed), - NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, - G_TYPE_NONE, 1, NM_TYPE_SETTINGS_CONNECTION); - - signals[CONNECTION_VISIBILITY_CHANGED] = - g_signal_new (NM_SETTINGS_SIGNAL_CONNECTION_VISIBILITY_CHANGED, - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMSettingsClass, connection_visibility_changed), - NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, - G_TYPE_NONE, 1, NM_TYPE_SETTINGS_CONNECTION); + signals[CONNECTION_ADDED] = + g_signal_new (NM_SETTINGS_SIGNAL_CONNECTION_ADDED, + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + 0, NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, NM_TYPE_SETTINGS_CONNECTION); + + signals[CONNECTION_UPDATED] = + g_signal_new (NM_SETTINGS_SIGNAL_CONNECTION_UPDATED, + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + 0, NULL, NULL, + NULL, + G_TYPE_NONE, 2, NM_TYPE_SETTINGS_CONNECTION, G_TYPE_BOOLEAN); + + signals[CONNECTION_REMOVED] = + g_signal_new (NM_SETTINGS_SIGNAL_CONNECTION_REMOVED, + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + 0, NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, NM_TYPE_SETTINGS_CONNECTION); + + signals[CONNECTION_VISIBILITY_CHANGED] = + g_signal_new (NM_SETTINGS_SIGNAL_CONNECTION_VISIBILITY_CHANGED, + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + 0, NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, NM_TYPE_SETTINGS_CONNECTION); signals[AGENT_REGISTERED] = - g_signal_new (NM_SETTINGS_SIGNAL_AGENT_REGISTERED, - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMSettingsClass, agent_registered), - NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, - G_TYPE_NONE, 1, NM_TYPE_SECRET_AGENT); - - - signals[NEW_CONNECTION] = - g_signal_new ("new-connection", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, 0, NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, - G_TYPE_NONE, 1, NM_TYPE_SETTINGS_CONNECTION); + g_signal_new (NM_SETTINGS_SIGNAL_AGENT_REGISTERED, + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + 0, NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, NM_TYPE_SECRET_AGENT); + + + signals[NEW_CONNECTION] = + g_signal_new ("new-connection", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, 0, NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, NM_TYPE_SETTINGS_CONNECTION); nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (class), NMDBUS_TYPE_SETTINGS_SKELETON, diff --git a/src/settings/nm-settings.h b/src/settings/nm-settings.h index 051c209423..5d41e5bc92 100644 --- a/src/settings/nm-settings.h +++ b/src/settings/nm-settings.h @@ -41,11 +41,10 @@ #define NM_SETTINGS_HOSTNAME "hostname" #define NM_SETTINGS_CAN_MODIFY "can-modify" #define NM_SETTINGS_CONNECTIONS "connections" -#define NM_SETTINGS_STARTUP_COMPLETE "connections" +#define NM_SETTINGS_STARTUP_COMPLETE "startup-complete" #define NM_SETTINGS_SIGNAL_CONNECTION_ADDED "connection-added" #define NM_SETTINGS_SIGNAL_CONNECTION_UPDATED "connection-updated" -#define NM_SETTINGS_SIGNAL_CONNECTION_UPDATED_BY_USER "connection-updated-by-user" #define NM_SETTINGS_SIGNAL_CONNECTION_REMOVED "connection-removed" #define NM_SETTINGS_SIGNAL_CONNECTION_VISIBILITY_CHANGED "connection-visibility-changed" #define NM_SETTINGS_SIGNAL_AGENT_REGISTERED "agent-registered" @@ -56,19 +55,6 @@ struct _NMSettings { typedef struct { NMExportedObjectClass parent_class; - - /* Signals */ - void (*properties_changed) (NMSettings *self, GHashTable *properties); - - void (*connection_added) (NMSettings *self, NMSettingsConnection *connection); - - void (*connection_updated) (NMSettings *self, NMSettingsConnection *connection); - - void (*connection_removed) (NMSettings *self, NMSettingsConnection *connection); - - void (*connection_visibility_changed) (NMSettings *self, NMSettingsConnection *connection); - - void (*agent_registered) (NMSettings *self, NMSecretAgent *agent); } NMSettingsClass; typedef void (*NMSettingsSetHostnameCb) (const char *name, gboolean result, gpointer user_data); |