core: make callback argument in nm_settings_connection_commit_changes/_delete optional

Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
Thomas Haller
2013-10-11 16:16:06 +02:00
parent 6b8bf26b79
commit e46722b72b
2 changed files with 9 additions and 16 deletions

View File

@@ -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,16 +533,16 @@ 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__);
if (callback)
callback (connection, error, user_data);
g_error_free (error);
}
@@ -554,16 +554,16 @@ 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__);
if (callback)
callback (connection, error, user_data);
g_error_free (error);
}

View File

@@ -181,13 +181,6 @@ sc_plugin_ifupdown_class_init (SCPluginIfupdownClass *req_class)
NM_SYSTEM_CONFIG_INTERFACE_HOSTNAME);
}
static void
ignore_cb (NMSettingsConnection *connection,
GError *error,
gpointer user_data)
{
}
static void
bind_device_to_connection (SCPluginIfupdown *self,
GUdevDevice *device,
@@ -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);
}