diff options
author | Thomas Haller <thaller@redhat.com> | 2013-10-11 16:16:06 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2013-10-18 19:56:37 +0200 |
commit | e46722b72b7d0ac03ab0be24f20c6a86d7300c13 (patch) | |
tree | 639e51394fbb62f4cb4f3053060bd744ed790d66 | |
parent | 6b8bf26b79eb6dcfbefb122d8921b6062999b3da (diff) | |
download | NetworkManager-e46722b72b7d0ac03ab0be24f20c6a86d7300c13.tar.gz |
core: make callback argument in nm_settings_connection_commit_changes/_delete optional
Signed-off-by: Thomas Haller <thaller@redhat.com>
-rw-r--r-- | src/settings/nm-settings-connection.c | 14 | ||||
-rw-r--r-- | src/settings/plugins/ifupdown/plugin.c | 11 |
2 files changed, 9 insertions, 16 deletions
diff --git a/src/settings/nm-settings-connection.c b/src/settings/nm-settings-connection.c index 2726912f79..0d7fe3a8e1 100644 --- a/src/settings/nm-settings-connection.c +++ b/src/settings/nm-settings-connection.c @@ -504,7 +504,7 @@ nm_settings_connection_replace_and_commit (NMSettingsConnection *self, g_return_if_fail (NM_IS_CONNECTION (new_connection)); if (nm_settings_connection_replace_settings (self, new_connection, TRUE, &error)) { - nm_settings_connection_commit_changes (self, callback ? callback : ignore_cb, user_data); + nm_settings_connection_commit_changes (self, callback, user_data); } else { if (callback) callback (self, error, user_data); @@ -533,17 +533,17 @@ nm_settings_connection_commit_changes (NMSettingsConnection *connection, gpointer user_data) { g_return_if_fail (NM_IS_SETTINGS_CONNECTION (connection)); - g_return_if_fail (callback != NULL); if (NM_SETTINGS_CONNECTION_GET_CLASS (connection)->commit_changes) { NM_SETTINGS_CONNECTION_GET_CLASS (connection)->commit_changes (connection, - callback, + callback ? callback : ignore_cb, user_data); } else { GError *error = g_error_new (NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INTERNAL_ERROR, "%s: %s:%d commit_changes() unimplemented", __func__, __FILE__, __LINE__); - callback (connection, error, user_data); + if (callback) + callback (connection, error, user_data); g_error_free (error); } } @@ -554,17 +554,17 @@ nm_settings_connection_delete (NMSettingsConnection *connection, gpointer user_data) { g_return_if_fail (NM_IS_SETTINGS_CONNECTION (connection)); - g_return_if_fail (callback != NULL); if (NM_SETTINGS_CONNECTION_GET_CLASS (connection)->delete) { NM_SETTINGS_CONNECTION_GET_CLASS (connection)->delete (connection, - callback, + callback ? callback : ignore_cb, user_data); } else { GError *error = g_error_new (NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INTERNAL_ERROR, "%s: %s:%d delete() unimplemented", __func__, __FILE__, __LINE__); - callback (connection, error, user_data); + if (callback) + callback (connection, error, user_data); g_error_free (error); } } diff --git a/src/settings/plugins/ifupdown/plugin.c b/src/settings/plugins/ifupdown/plugin.c index 110a0c6dbb..5b3ba6e06e 100644 --- a/src/settings/plugins/ifupdown/plugin.c +++ b/src/settings/plugins/ifupdown/plugin.c @@ -182,13 +182,6 @@ sc_plugin_ifupdown_class_init (SCPluginIfupdownClass *req_class) } static void -ignore_cb (NMSettingsConnection *connection, - GError *error, - gpointer user_data) -{ -} - -static void bind_device_to_connection (SCPluginIfupdown *self, GUdevDevice *device, NMIfupdownConnection *exported) @@ -228,7 +221,7 @@ bind_device_to_connection (SCPluginIfupdown *self, } g_byte_array_free (mac_address, TRUE); - nm_settings_connection_commit_changes (NM_SETTINGS_CONNECTION (exported), ignore_cb, NULL); + nm_settings_connection_commit_changes (NM_SETTINGS_CONNECTION (exported), NULL, NULL); } static void @@ -433,7 +426,7 @@ SCPluginIfupdown_init (NMSystemConfigInterface *config) exported = g_hash_table_lookup (priv->connections, block->name); if (exported) { PLUGIN_PRINT("SCPlugin-Ifupdown", "deleting %s from connections", block->name); - nm_settings_connection_delete (NM_SETTINGS_CONNECTION (exported), ignore_cb, NULL); + nm_settings_connection_delete (NM_SETTINGS_CONNECTION (exported), NULL, NULL); g_hash_table_remove (priv->connections, block->name); } |