diff options
-rw-r--r-- | libnm-core/nm-connection.c | 75 | ||||
-rw-r--r-- | libnm-core/nm-core-internal.h | 9 |
2 files changed, 65 insertions, 19 deletions
diff --git a/libnm-core/nm-connection.c b/libnm-core/nm-connection.c index 1a88072400..4e4a835cbf 100644 --- a/libnm-core/nm-connection.c +++ b/libnm-core/nm-connection.c @@ -1689,6 +1689,43 @@ nm_connection_normalize (NMConnection *connection, return TRUE; } +/*****************************************************************************/ + +#if NM_MORE_ASSERTS +static void +_nmtst_connection_unchanging_changed_cb (NMConnection *connection, gpointer user_data) +{ + nm_assert_not_reached (); +} + +static void +_nmtst_connection_unchanging_secrets_updated_cb (NMConnection *connection, const char *setting_name, gpointer user_data) +{ + nm_assert_not_reached (); +} + +void +nmtst_connection_assert_unchanging (NMConnection *connection) +{ + nm_assert (NM_IS_CONNECTION (connection)); + + g_signal_connect (connection, + NM_CONNECTION_CHANGED, + G_CALLBACK (_nmtst_connection_unchanging_changed_cb), + NULL); + g_signal_connect (connection, + NM_CONNECTION_SECRETS_CLEARED, + G_CALLBACK (_nmtst_connection_unchanging_changed_cb), + NULL); + g_signal_connect (connection, + NM_CONNECTION_SECRETS_UPDATED, + G_CALLBACK (_nmtst_connection_unchanging_secrets_updated_cb), + NULL); +} +#endif + +/*****************************************************************************/ + /** * nm_connection_update_secrets: * @connection: the #NMConnection @@ -3158,13 +3195,13 @@ nm_connection_default_init (NMConnectionInterface *iface) */ signals[SECRETS_UPDATED] = g_signal_new (NM_CONNECTION_SECRETS_UPDATED, - NM_TYPE_CONNECTION, - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMConnectionInterface, secrets_updated), - NULL, NULL, - g_cclosure_marshal_VOID__STRING, - G_TYPE_NONE, 1, - G_TYPE_STRING); + NM_TYPE_CONNECTION, + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMConnectionInterface, secrets_updated), + NULL, NULL, + g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, 1, + G_TYPE_STRING); /** * NMConnection::secrets-cleared: @@ -3175,12 +3212,12 @@ nm_connection_default_init (NMConnectionInterface *iface) */ signals[SECRETS_CLEARED] = g_signal_new (NM_CONNECTION_SECRETS_CLEARED, - NM_TYPE_CONNECTION, - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMConnectionInterface, secrets_cleared), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); + NM_TYPE_CONNECTION, + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMConnectionInterface, secrets_cleared), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); /** * NMConnection::changed: @@ -3192,10 +3229,10 @@ nm_connection_default_init (NMConnectionInterface *iface) */ signals[CHANGED] = g_signal_new (NM_CONNECTION_CHANGED, - NM_TYPE_CONNECTION, - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMConnectionInterface, changed), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); + NM_TYPE_CONNECTION, + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMConnectionInterface, changed), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); } diff --git a/libnm-core/nm-core-internal.h b/libnm-core/nm-core-internal.h index d369a75949..7e55b1fc3c 100644 --- a/libnm-core/nm-core-internal.h +++ b/libnm-core/nm-core-internal.h @@ -203,6 +203,15 @@ NMSettingVerifyResult _nm_connection_verify (NMConnection *connection, GError ** gboolean _nm_connection_remove_setting (NMConnection *connection, GType setting_type); +#if NM_MORE_ASSERTS +void nmtst_connection_assert_unchanging (NMConnection *connection); +#else +static inline void +nmtst_connection_assert_unchanging (NMConnection *connection) +{ +} +#endif + NMConnection *_nm_simple_connection_new_from_dbus (GVariant *dict, NMSettingParseFlags parse_flags, GError **error); |