Commit f6064e7b authored by Dan Williams's avatar Dan Williams

libnm-util: implement connection changed signal

Emitted whenever settings are added or removed from the connection,
and whenever any property of any setting in the connection is changed.
parent 3bf4d84c
......@@ -113,6 +113,7 @@ enum {
enum {
SECRETS_UPDATED,
SECRETS_CLEARED,
CHANGED,
LAST_SIGNAL
};
......@@ -172,6 +173,14 @@ nm_connection_create_setting (const char *name)
return setting;
}
static void
setting_changed_cb (NMSetting *setting,
GParamSpec *pspec,
NMConnection *self)
{
g_signal_emit (self, signals[CHANGED], 0);
}
/**
* nm_connection_add_setting:
* @connection: a #NMConnection
......@@ -191,6 +200,10 @@ nm_connection_add_setting (NMConnection *connection, NMSetting *setting)
g_hash_table_insert (NM_CONNECTION_GET_PRIVATE (connection)->settings,
(gpointer) G_OBJECT_TYPE_NAME (setting),
setting);
/* Listen for property changes so we can emit the 'changed' signal */
g_signal_connect (setting, "notify", (GCallback) setting_changed_cb, connection);
g_signal_emit (connection, signals[CHANGED], 0);
}
/**
......@@ -204,10 +217,21 @@ nm_connection_add_setting (NMConnection *connection, NMSetting *setting)
void
nm_connection_remove_setting (NMConnection *connection, GType setting_type)
{
NMConnectionPrivate *priv;
NMSetting *setting;
const char *setting_name;
g_return_if_fail (NM_IS_CONNECTION (connection));
g_return_if_fail (g_type_is_a (setting_type, NM_TYPE_SETTING));
g_hash_table_remove (NM_CONNECTION_GET_PRIVATE (connection)->settings, g_type_name (setting_type));
priv = NM_CONNECTION_GET_PRIVATE (connection);
setting_name = g_type_name (setting_type);
setting = g_hash_table_lookup (priv->settings, setting_name);
if (setting) {
g_signal_handlers_disconnect_by_func (setting, setting_changed_cb, connection);
g_hash_table_remove (priv->settings, setting_name);
g_signal_emit (connection, signals[CHANGED], 0);
}
}
/**
......@@ -339,14 +363,18 @@ nm_connection_replace_settings (NMConnection *connection,
GHashTable *new_settings,
GError **error)
{
gboolean valid = FALSE;
g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE);
g_return_val_if_fail (new_settings != NULL, FALSE);
if (error)
g_return_val_if_fail (*error == NULL, FALSE);
if (!validate_permissions_type (new_settings, error))
return FALSE;
return hash_to_connection (connection, new_settings, error);
if (validate_permissions_type (new_settings, error)) {
valid = hash_to_connection (connection, new_settings, error);
g_signal_emit (connection, signals[CHANGED], 0);
}
return valid;
}
/**
......@@ -728,8 +756,10 @@ nm_connection_update_secrets (NMConnection *connection,
}
}
if (updated)
if (updated) {
g_signal_emit (connection, signals[SECRETS_UPDATED], 0, setting_name);
g_signal_emit (connection, signals[CHANGED], 0);
}
return success;
}
......@@ -815,6 +845,7 @@ nm_connection_clear_secrets (NMConnection *connection)
nm_setting_clear_secrets (setting);
g_signal_emit (connection, signals[SECRETS_CLEARED], 0);
g_signal_emit (connection, signals[CHANGED], 0);
}
/**
......@@ -841,6 +872,7 @@ nm_connection_clear_secrets_with_flags (NMConnection *connection,
nm_setting_clear_secrets_with_flags (setting, func, user_data);
g_signal_emit (connection, signals[SECRETS_CLEARED], 0);
g_signal_emit (connection, signals[CHANGED], 0);
}
/**
......@@ -1536,6 +1568,23 @@ nm_connection_init (NMConnection *connection)
priv->settings = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref);
}
static void
dispose (GObject *object)
{
NMConnection *self = NM_CONNECTION (object);
NMConnectionPrivate *priv = NM_CONNECTION_GET_PRIVATE (self);
GHashTableIter iter;
NMSetting *setting;
g_hash_table_iter_init (&iter, priv->settings);
while (g_hash_table_iter_next (&iter, NULL, (gpointer) &setting)) {
g_signal_handlers_disconnect_by_func (setting, setting_changed_cb, self);
g_hash_table_iter_remove (&iter);
}
G_OBJECT_CLASS (nm_connection_parent_class)->dispose (object);
}
static void
finalize (GObject *object)
{
......@@ -1543,10 +1592,7 @@ finalize (GObject *object)
NMConnectionPrivate *priv = NM_CONNECTION_GET_PRIVATE (connection);
g_hash_table_destroy (priv->settings);
priv->settings = NULL;
g_free (priv->path);
priv->path = NULL;
G_OBJECT_CLASS (nm_connection_parent_class)->finalize (object);
}
......@@ -1593,6 +1639,7 @@ nm_connection_class_init (NMConnectionClass *klass)
/* virtual methods */
object_class->set_property = set_property;
object_class->get_property = get_property;
object_class->dispose = dispose;
object_class->finalize = finalize;
/* Properties */
......@@ -1623,7 +1670,7 @@ nm_connection_class_init (NMConnectionClass *klass)
* have been changed.
*/
signals[SECRETS_UPDATED] =
g_signal_new ("secrets-updated",
g_signal_new (NM_CONNECTION_SECRETS_UPDATED,
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (NMConnectionClass, secrets_updated),
......@@ -1640,7 +1687,25 @@ nm_connection_class_init (NMConnectionClass *klass)
* are cleared.
*/
signals[SECRETS_CLEARED] =
g_signal_new ("secrets-cleared",
g_signal_new (NM_CONNECTION_SECRETS_CLEARED,
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
0, NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
/**
* NMConnection::changed:
* @connection: the object on which the signal is emitted
*
* The ::changed signal is emitted when any property of any property
* (including secrets) of any setting of the connection is modified,
* or when settings are added or removed.
*
* Since: 0.9.10
*/
signals[CHANGED] =
g_signal_new (NM_CONNECTION_CHANGED,
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
0, NULL, NULL,
......
......@@ -63,6 +63,13 @@ G_BEGIN_DECLS
#define NM_IS_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_CONNECTION))
#define NM_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_CONNECTION, NMConnectionClass))
/* Signals */
#define NM_CONNECTION_SECRETS_UPDATED "secrets-updated"
#define NM_CONNECTION_SECRETS_CLEARED "secrets-cleared"
#define NM_CONNECTION_CHANGED "changed"
/* Properties */
#define NM_CONNECTION_PATH "path"
/**
* NMConnectionError:
......@@ -91,8 +98,6 @@ typedef enum
#define NM_CONNECTION_ERROR nm_connection_error_quark ()
GQuark nm_connection_error_quark (void);
#define NM_CONNECTION_PATH "path"
/**
* NMConnection:
*
......
......@@ -248,6 +248,7 @@ nm_setting_802_1x_add_eap_method (NMSetting8021x *setting, const char *eap)
}
priv->eap = g_slist_append (priv->eap, g_ascii_strdown (eap, -1));
g_object_notify (G_OBJECT (setting), NM_SETTING_802_1X_EAP);
return TRUE;
}
......@@ -272,6 +273,7 @@ nm_setting_802_1x_remove_eap_method (NMSetting8021x *setting, guint32 i)
g_free (elt->data);
priv->eap = g_slist_delete_link (priv->eap, elt);
g_object_notify (G_OBJECT (setting), NM_SETTING_802_1X_EAP);
}
/**
......@@ -290,6 +292,7 @@ nm_setting_802_1x_clear_eap_methods (NMSetting8021x *setting)
priv = NM_SETTING_802_1X_GET_PRIVATE (setting);
nm_utils_slist_free (priv->eap, g_free);
priv->eap = NULL;
g_object_notify (G_OBJECT (setting), NM_SETTING_802_1X_EAP);
}
/**
......@@ -534,8 +537,10 @@ nm_setting_802_1x_set_ca_cert (NMSetting8021x *self,
priv->ca_cert = NULL;
}
if (!cert_path)
if (!cert_path) {
g_object_notify (G_OBJECT (self), NM_SETTING_802_1X_CA_CERT);
return TRUE;
}
data = crypto_load_and_verify_certificate (cert_path, &format, error);
if (data) {
......@@ -559,6 +564,7 @@ nm_setting_802_1x_set_ca_cert (NMSetting8021x *self,
g_byte_array_unref (data);
}
g_object_notify (G_OBJECT (self), NM_SETTING_802_1X_CA_CERT);
return priv->ca_cert != NULL;
}
......@@ -647,6 +653,7 @@ nm_setting_802_1x_add_altsubject_match (NMSetting8021x *setting,
}
priv->altsubject_matches = g_slist_append (priv->altsubject_matches, g_strdup (altsubject_match));
g_object_notify (G_OBJECT (setting), NM_SETTING_802_1X_ALTSUBJECT_MATCHES);
return TRUE;
}
......@@ -671,6 +678,7 @@ nm_setting_802_1x_remove_altsubject_match (NMSetting8021x *setting, guint32 i)
g_free (elt->data);
priv->altsubject_matches = g_slist_delete_link (priv->altsubject_matches, elt);
g_object_notify (G_OBJECT (setting), NM_SETTING_802_1X_ALTSUBJECT_MATCHES);
}
/**
......@@ -689,6 +697,7 @@ nm_setting_802_1x_clear_altsubject_matches (NMSetting8021x *setting)
priv = NM_SETTING_802_1X_GET_PRIVATE (setting);
nm_utils_slist_free (priv->altsubject_matches, g_free);
priv->altsubject_matches = NULL;
g_object_notify (G_OBJECT (setting), NM_SETTING_802_1X_ALTSUBJECT_MATCHES);
}
/**
......@@ -809,8 +818,10 @@ nm_setting_802_1x_set_client_cert (NMSetting8021x *self,
priv->client_cert = NULL;
}
if (!cert_path)
if (!cert_path) {
g_object_notify (G_OBJECT (self), NM_SETTING_802_1X_CLIENT_CERT);
return TRUE;
}
data = crypto_load_and_verify_certificate (cert_path, &format, error);
if (data) {
......@@ -846,6 +857,7 @@ nm_setting_802_1x_set_client_cert (NMSetting8021x *self,
g_byte_array_unref (data);
}
g_object_notify (G_OBJECT (self), NM_SETTING_802_1X_CLIENT_CERT);
return priv->client_cert != NULL;
}
......@@ -1070,8 +1082,10 @@ nm_setting_802_1x_set_phase2_ca_cert (NMSetting8021x *self,
priv->phase2_ca_cert = NULL;
}
if (!cert_path)
if (!cert_path) {
g_object_notify (G_OBJECT (self), NM_SETTING_802_1X_PHASE2_CA_CERT);
return TRUE;
}
data = crypto_load_and_verify_certificate (cert_path, &format, error);
if (data) {
......@@ -1095,6 +1109,7 @@ nm_setting_802_1x_set_phase2_ca_cert (NMSetting8021x *self,
g_byte_array_unref (data);
}
g_object_notify (G_OBJECT (self), NM_SETTING_802_1X_PHASE2_CA_CERT);
return priv->phase2_ca_cert != NULL;
}
......@@ -1185,6 +1200,7 @@ nm_setting_802_1x_add_phase2_altsubject_match (NMSetting8021x *setting,
priv->phase2_altsubject_matches = g_slist_append (priv->altsubject_matches,
g_strdup (phase2_altsubject_match));
g_object_notify (G_OBJECT (setting), NM_SETTING_802_1X_PHASE2_ALTSUBJECT_MATCHES);
return TRUE;
}
......@@ -1209,6 +1225,7 @@ nm_setting_802_1x_remove_phase2_altsubject_match (NMSetting8021x *setting, guint
g_free (elt->data);
priv->phase2_altsubject_matches = g_slist_delete_link (priv->phase2_altsubject_matches, elt);
g_object_notify (G_OBJECT (setting), NM_SETTING_802_1X_PHASE2_ALTSUBJECT_MATCHES);
}
/**
......@@ -1227,6 +1244,7 @@ nm_setting_802_1x_clear_phase2_altsubject_matches (NMSetting8021x *setting)
priv = NM_SETTING_802_1X_GET_PRIVATE (setting);
nm_utils_slist_free (priv->phase2_altsubject_matches, g_free);
priv->phase2_altsubject_matches = NULL;
g_object_notify (G_OBJECT (setting), NM_SETTING_802_1X_PHASE2_ALTSUBJECT_MATCHES);
}
/**
......@@ -1349,8 +1367,10 @@ nm_setting_802_1x_set_phase2_client_cert (NMSetting8021x *self,
priv->phase2_client_cert = NULL;
}
if (!cert_path)
if (!cert_path) {
g_object_notify (G_OBJECT (self), NM_SETTING_802_1X_PHASE2_CLIENT_CERT);
return TRUE;
}
data = crypto_load_and_verify_certificate (cert_path, &format, error);
if (data) {
......@@ -1387,6 +1407,7 @@ nm_setting_802_1x_set_phase2_client_cert (NMSetting8021x *self,
g_byte_array_unref (data);
}
g_object_notify (G_OBJECT (self), NM_SETTING_802_1X_PHASE2_CLIENT_CERT);
return priv->phase2_client_cert != NULL;
}
......@@ -1615,6 +1636,7 @@ nm_setting_802_1x_set_private_key (NMSetting8021x *self,
{
NMSetting8021xPrivate *priv;
NMCryptoFileFormat format = NM_CRYPTO_FILE_FORMAT_UNKNOWN;
gboolean key_cleared = FALSE, password_cleared = FALSE;
g_return_val_if_fail (NM_IS_SETTING_802_1X (self), FALSE);
......@@ -1650,13 +1672,22 @@ nm_setting_802_1x_set_private_key (NMSetting8021x *self,
memset (priv->private_key->data, 0, priv->private_key->len);
g_byte_array_free (priv->private_key, TRUE);
priv->private_key = NULL;
key_cleared = TRUE;
}
g_free (priv->private_key_password);
priv->private_key_password = NULL;
if (priv->private_key_password) {
g_free (priv->private_key_password);
priv->private_key_password = NULL;
password_cleared = TRUE;
}
if (key_path == NULL)
if (key_path == NULL) {
if (key_cleared)
g_object_notify (G_OBJECT (self), NM_SETTING_802_1X_PRIVATE_KEY);
if (password_cleared)
g_object_notify (G_OBJECT (self), NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD);
return TRUE;
}
priv->private_key_password = g_strdup (password);
if (scheme == NM_SETTING_802_1X_CK_SCHEME_BLOB) {
......@@ -1678,8 +1709,13 @@ nm_setting_802_1x_set_private_key (NMSetting8021x *self,
priv->client_cert = g_byte_array_sized_new (priv->private_key->len);
g_byte_array_append (priv->client_cert, priv->private_key->data, priv->private_key->len);
g_object_notify (G_OBJECT (self), NM_SETTING_802_1X_CLIENT_CERT);
}
g_object_notify (G_OBJECT (self), NM_SETTING_802_1X_PRIVATE_KEY);
if (password_cleared || password)
g_object_notify (G_OBJECT (self), NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD);
if (out_format)
*out_format = format;
return priv->private_key != NULL;
......@@ -1908,6 +1944,7 @@ nm_setting_802_1x_set_phase2_private_key (NMSetting8021x *self,
{
NMSetting8021xPrivate *priv;
NMCryptoFileFormat format = NM_CRYPTO_FILE_FORMAT_UNKNOWN;
gboolean key_cleared = FALSE, password_cleared = FALSE;
g_return_val_if_fail (NM_IS_SETTING_802_1X (self), FALSE);
......@@ -1943,13 +1980,22 @@ nm_setting_802_1x_set_phase2_private_key (NMSetting8021x *self,
memset (priv->phase2_private_key->data, 0, priv->phase2_private_key->len);
g_byte_array_free (priv->phase2_private_key, TRUE);
priv->phase2_private_key = NULL;
key_cleared = TRUE;
}
g_free (priv->phase2_private_key_password);
priv->phase2_private_key_password = NULL;
if (priv->phase2_private_key_password) {
g_free (priv->phase2_private_key_password);
priv->phase2_private_key_password = NULL;
password_cleared = TRUE;
}
if (key_path == NULL)
if (key_path == NULL) {
if (key_cleared)
g_object_notify (G_OBJECT (self), NM_SETTING_802_1X_PHASE2_PRIVATE_KEY);
if (password_cleared)
g_object_notify (G_OBJECT (self), NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD);
return TRUE;
}
priv->phase2_private_key_password = g_strdup (password);
if (scheme == NM_SETTING_802_1X_CK_SCHEME_BLOB) {
......@@ -1971,8 +2017,13 @@ nm_setting_802_1x_set_phase2_private_key (NMSetting8021x *self,
priv->phase2_client_cert = g_byte_array_sized_new (priv->phase2_private_key->len);
g_byte_array_append (priv->phase2_client_cert, priv->phase2_private_key->data, priv->phase2_private_key->len);
g_object_notify (G_OBJECT (self), NM_SETTING_802_1X_PHASE2_CLIENT_CERT);
}
g_object_notify (G_OBJECT (self), NM_SETTING_802_1X_PHASE2_PRIVATE_KEY);
if (password_cleared || password)
g_object_notify (G_OBJECT (self), NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD);
if (out_format)
*out_format = format;
return priv->phase2_private_key != NULL;
......
......@@ -264,6 +264,8 @@ gboolean nm_setting_bond_add_option (NMSettingBond *setting,
} else if (!strcmp (name, NM_SETTING_BOND_OPTION_ARP_INTERVAL))
g_hash_table_remove (priv->options, NM_SETTING_BOND_OPTION_MIIMON);
g_object_notify (G_OBJECT (setting), NM_SETTING_BOND_OPTIONS);
return TRUE;
}
......@@ -282,10 +284,15 @@ gboolean
nm_setting_bond_remove_option (NMSettingBond *setting,
const char *name)
{
gboolean found;
g_return_val_if_fail (NM_IS_SETTING_BOND (setting), FALSE);
g_return_val_if_fail (validate_option (name), FALSE);
return g_hash_table_remove (NM_SETTING_BOND_GET_PRIVATE (setting)->options, name);
found = g_hash_table_remove (NM_SETTING_BOND_GET_PRIVATE (setting)->options, name);
if (found)
g_object_notify (G_OBJECT (setting), NM_SETTING_BOND_OPTIONS);
return found;
}
/**
......
......@@ -413,6 +413,7 @@ nm_setting_connection_add_permission (NMSettingConnection *setting,
p = permission_new (pitem);
g_return_val_if_fail (p != NULL, FALSE);
priv->permissions = g_slist_append (priv->permissions, p);
g_object_notify (G_OBJECT (setting), NM_SETTING_CONNECTION_PERMISSIONS);
return TRUE;
}
......@@ -439,6 +440,7 @@ nm_setting_connection_remove_permission (NMSettingConnection *setting,
permission_free ((Permission *) iter->data);
priv->permissions = g_slist_delete_link (priv->permissions, iter);
g_object_notify (G_OBJECT (setting), NM_SETTING_CONNECTION_PERMISSIONS);
}
......@@ -624,6 +626,7 @@ nm_setting_connection_add_secondary (NMSettingConnection *setting,
}
priv->secondaries = g_slist_append (priv->secondaries, g_strdup (sec_uuid));
g_object_notify (G_OBJECT (setting), NM_SETTING_CONNECTION_SECONDARIES);
return TRUE;
}
......@@ -650,6 +653,7 @@ nm_setting_connection_remove_secondary (NMSettingConnection *setting, guint32 id
g_free (elt->data);
priv->secondaries = g_slist_delete_link (priv->secondaries, elt);
g_object_notify (G_OBJECT (setting), NM_SETTING_CONNECTION_SECONDARIES);
}
static gint
......
......@@ -193,6 +193,7 @@ nm_setting_ip4_config_add_dns (NMSettingIP4Config *setting, guint32 dns)
}
g_array_append_val (priv->dns, dns);
g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_DNS);
return TRUE;
}
......@@ -214,6 +215,7 @@ nm_setting_ip4_config_remove_dns (NMSettingIP4Config *setting, guint32 i)
g_return_if_fail (i <= priv->dns->len);
g_array_remove_index (priv->dns, i);
g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_DNS);
}
/**
......@@ -231,6 +233,7 @@ nm_setting_ip4_config_clear_dns (NMSettingIP4Config *setting)
priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting);
g_array_remove_range (priv->dns, 0, priv->dns->len);
g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_DNS);
}
/**
......@@ -295,6 +298,7 @@ nm_setting_ip4_config_add_dns_search (NMSettingIP4Config *setting,
}
priv->dns_search = g_slist_append (priv->dns_search, g_strdup (dns_search));
g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_DNS_SEARCH);
return TRUE;
}
......@@ -319,6 +323,7 @@ nm_setting_ip4_config_remove_dns_search (NMSettingIP4Config *setting, guint32 i)
g_free (elt->data);
priv->dns_search = g_slist_delete_link (priv->dns_search, elt);
g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_DNS_SEARCH);
}
/**
......@@ -334,6 +339,7 @@ nm_setting_ip4_config_clear_dns_searches (NMSettingIP4Config *setting)
nm_utils_slist_free (NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->dns_search, g_free);
NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->dns_search = NULL;
g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_DNS_SEARCH);
}
/**
......@@ -402,6 +408,7 @@ nm_setting_ip4_config_add_address (NMSettingIP4Config *setting,
g_return_val_if_fail (copy != NULL, FALSE);
priv->addresses = g_slist_append (priv->addresses, copy);
g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_ADDRESSES);
return TRUE;
}
......@@ -426,6 +433,7 @@ nm_setting_ip4_config_remove_address (NMSettingIP4Config *setting, guint32 i)
nm_ip4_address_unref ((NMIP4Address *) elt->data);
priv->addresses = g_slist_delete_link (priv->addresses, elt);
g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_ADDRESSES);
}
/**
......@@ -443,6 +451,7 @@ nm_setting_ip4_config_clear_addresses (NMSettingIP4Config *setting)
nm_utils_slist_free (priv->addresses, (GDestroyNotify) nm_ip4_address_unref);
priv->addresses = NULL;
g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_ADDRESSES);
}
/**
......@@ -510,6 +519,7 @@ nm_setting_ip4_config_add_route (NMSettingIP4Config *setting,
g_return_val_if_fail (copy != NULL, FALSE);
priv->routes = g_slist_append (priv->routes, copy);
g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_ROUTES);
return TRUE;
}
......@@ -534,6 +544,7 @@ nm_setting_ip4_config_remove_route (NMSettingIP4Config *setting, guint32 i)
nm_ip4_route_unref ((NMIP4Route *) elt->data);
priv->routes = g_slist_delete_link (priv->routes, elt);
g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_ROUTES);
}
/**
......@@ -551,6 +562,7 @@ nm_setting_ip4_config_clear_routes (NMSettingIP4Config *setting)
nm_utils_slist_free (priv->routes, (GDestroyNotify) nm_ip4_route_unref);
priv->routes = NULL;
g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_ROUTES);
}
/**
......
......@@ -212,6 +212,7 @@ nm_setting_ip6_config_add_dns (NMSettingIP6Config *setting, const struct in6_add
copy = g_malloc0 (sizeof (struct in6_addr));
memcpy (copy, addr, sizeof (struct in6_addr));
priv->dns = g_slist_append (priv->dns, copy);
g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_DNS);
return TRUE;
}
......@@ -237,6 +238,7 @@ nm_setting_ip6_config_remove_dns (NMSettingIP6Config *setting, guint32 i)
g_free (elt->data);
priv->dns = g_slist_delete_link (priv->dns, elt);
g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_DNS);
}
/**
......@@ -252,6 +254,7 @@ nm_setting_ip6_config_clear_dns (NMSettingIP6Config *setting)
nm_utils_slist_free (NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->dns, g_free);
NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->dns = NULL;
g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_DNS);
}
/**
......@@ -316,6 +319,7 @@ nm_setting_ip6_config_add_dns_search (NMSettingIP6Config *setting,
}
priv->dns_search = g_slist_append (priv->dns_search, g_strdup (dns_search));
g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_DNS_SEARCH);
return TRUE;
}
......@@ -340,6 +344,7 @@ nm_setting_ip6_config_remove_dns_search (NMSettingIP6Config *setting, guint32 i)
g_free (elt->data);
priv->dns_search = g_slist_delete_link (priv->dns_search, elt);
g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_DNS_SEARCH);
}
/**
......@@ -355,6 +360,7 @@ nm_setting_ip6_config_clear_dns_searches (NMSettingIP6Config *setting)
nm_utils_slist_free (NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->dns_search, g_free);
NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->dns_search = NULL;
g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_DNS_SEARCH);
}
/**
......@@ -423,6 +429,7 @@ nm_setting_ip6_config_add_address (NMSettingIP6Config *setting,
g_return_val_if_fail (copy != NULL, FALSE);
priv->addresses = g_slist_append (priv->addresses, copy);
g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_ADDRESSES);
return TRUE;
}
......@@ -447,6 +454,7 @@ nm_setting_ip6_config_remove_address (NMSettingIP6Config *setting, guint32 i)
nm_ip6_address_unref ((NMIP6Address *) elt->data);
priv->addresses = g_slist_delete_link (priv->addresses, elt);
g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_ADDRESSES);
}
/**
......@@ -464,6 +472,7 @@ nm_setting_ip6_config_clear_addresses (NMSettingIP6Config *setting)
nm_utils_slist_free (priv->addresses, (GDestroyNotify) nm_ip6_address_unref);
priv->addresses = NULL;
g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_ADDRESSES);
}
/**
......@@ -531,6 +540,7 @@ nm_setting_ip6_config_add_route (NMSettingIP6Config *setting,
g_return_val_if_fail (copy != NULL, FALSE);
priv->routes = g_slist_append (priv->routes, copy);
g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_ROUTES);
return TRUE;
}
......@@ -555,6 +565,7 @@ nm_setting_ip6_config_remove_route (NMSettingIP6Config *setting, guint32 i)
nm_ip6_route_unref ((NMIP6Route *) elt->data);
priv->routes = g_slist_delete_link (priv->routes, elt);
g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_ROUTES);
}
/**
......@@ -572,6 +583,7 @@ nm_setting_ip6_config_clear_routes (NMSettingIP6Config *setting)
nm_utils_slist_free (priv->routes, (GDestroyNotify) nm_ip6_route_unref);
priv->routes = NULL;
g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_ROUTES);
}
/**
......
......@@ -222,11 +222,13 @@ get_map (NMSettingVlan *self, NMVlanPriorityMap map)
static void
set_map (NMSettingVlan *self, NMVlanPriorityMap map, GSList *list)
{
if (map == NM_VLAN_INGRESS_MAP)
if (map == NM_VLAN_INGRESS_MAP) {
NM_SETTING_VLAN_GET_PRIVATE (self)->ingress_priority_map = list;
else if (map == NM_VLAN_EGRESS_MAP)
g_object_notify (G_OBJECT (self), NM_SETTING_VLAN_INGRESS_PRIORITY_MAP);
} else if (map == NM_VLAN_EGRESS_MAP) {
NM_SETTING_VLAN_GET_PRIVATE (self)->egress_priority_map = list;
else
g_object_notify (G_OBJECT (self), NM_SETTING_VLAN_EGRESS_PRIORITY_MAP);
} else
g_assert_not_reached ();
}
......@@ -269,6 +271,10 @@ nm_setting_vlan_add_priority_str (NMSettingVlan *setting,
if (p->from == item->from) {
p->to = item->to;
g_free (item);
if (map == NM_VLAN_INGRESS_MAP)
g_object_notify (G_OBJECT (setting), NM_SETTING_VLAN_INGRESS_PRIORITY_MAP);
else
g_object_notify (G_OBJECT (setting), NM_SETTING_VLAN_EGRESS_PRIORITY_MAP);
return TRUE;
}
}
......@@ -373,6 +379,10 @@ nm_setting_vlan_add_priority (NMSettingVlan *setting,
item = iter->data;
if (item->from == from) {
item->to = to;
if (map == NM_VLAN_INGRESS_MAP)
g_object_notify (G_OBJECT (setting), NM_SETTING_VLAN_INGRESS_PRIORITY_MAP);
else
g_object_notify (G_OBJECT (setting), NM_SETTING_VLAN_EGRESS_PRIORITY_MAP);
return TRUE;
}
}
......
......@@ -196,6 +196,7 @@ nm_setting_vpn_add_data_item (NMSettingVPN *setting,
g_hash_table_insert (NM_SETTING_VPN_GET_PRIVATE (setting)->data,
g_strdup (key), g_strdup (item));
g_object_notify (G_OBJECT (setting), NM_SETTING_VPN_DATA);
}
/**
......@@ -230,9 +231,14 @@ nm_setting_vpn_get_data_item (NMSettingVPN *setting, const char *key)
gboolean
nm_setting_vpn_remove_data_item (NMSettingVPN *setting, const char *key)
{
gboolean found;
g_return_val_if_fail (NM_IS_SETTING_VPN (setting), FALSE);
return g_hash_table_remove (NM_SETTING_VPN_GET_PRIVATE (setting)->data, key);
found = g_hash_table_remove (NM_SETTING_VPN_GET_PRIVATE (setting)->data, key);
if (found)
g_object_notify (G_OBJECT (setting), NM_SETTING_VPN_DATA);
return found;
}
static void
......@@ -323,6 +329,7 @@ nm_setting_vpn_add_secret (NMSettingVPN *setting,
g_hash_table_insert (NM_SETTING_VPN_GET_PRIVATE (setting)->secrets,
g_strdup (key), g_strdup (secret));
g_object_notify (G_OBJECT (setting), NM_SETTING_VPN_SECRETS);
}