settings: get rid of callback arguments for nm_settings_connection_delete()

This commit is contained in:
Thomas Haller
2017-10-19 11:22:14 +02:00
parent bd66285b1c
commit 3ecb57fdc4
7 changed files with 26 additions and 54 deletions

View File

@@ -1219,7 +1219,7 @@ dispose (GObject *object)
if (to_delete) {
nm_log_dbg (LOGD_BT, "bluez[%s] removing Bluetooth connection for NAP device: '%s' (%s)", priv->path,
nm_connection_get_id (to_delete), nm_connection_get_uuid (to_delete));
nm_settings_connection_delete (NM_SETTINGS_CONNECTION (to_delete), NULL, NULL);
nm_settings_connection_delete (NM_SETTINGS_CONNECTION (to_delete), NULL);
g_object_unref (to_delete);
}

View File

@@ -342,7 +342,7 @@ next_dev:
nm_settings_connection_get_uuid (con))) {
_LOGD ("rollback: deleting new connection %s",
nm_settings_connection_get_uuid (con));
nm_settings_connection_delete (con, NULL, NULL);
nm_settings_connection_delete (con, NULL);
}
}
}

View File

@@ -339,7 +339,7 @@ active_connection_remove (NMManager *self, NMActiveConnection *active)
if (nm_settings_has_connection (priv->settings, connection)) {
_LOGD (LOGD_DEVICE, "assumed connection disconnected. Deleting generated connection '%s' (%s)",
nm_settings_connection_get_id (connection), nm_settings_connection_get_uuid (connection));
nm_settings_connection_delete (connection, NULL, NULL);
nm_settings_connection_delete (connection, NULL);
}
g_object_unref (connection);
}
@@ -1990,7 +1990,7 @@ recheck_assume_connection (NMManager *self,
if (generated) {
_LOG2D (LOGD_DEVICE, device, "assume: deleting generated connection after assuming failed");
nm_settings_connection_delete (connection, NULL, NULL);
nm_settings_connection_delete (connection, NULL);
} else {
if (nm_device_sys_iface_state_get (device) == NM_DEVICE_SYS_IFACE_STATE_ASSUME)
nm_device_sys_iface_state_set (device, NM_DEVICE_SYS_IFACE_STATE_EXTERNAL);
@@ -4056,7 +4056,7 @@ activation_add_done (NMSettings *settings,
g_assert (error);
_internal_activation_failed (self, active, error->message);
if (new_connection)
nm_settings_connection_delete (new_connection, NULL, NULL);
nm_settings_connection_delete (new_connection, NULL);
g_dbus_method_invocation_return_gerror (context, error);
nm_audit_log_connection_op (NM_AUDIT_OP_CONN_ADD_ACTIVATE,
NULL,

View File

@@ -663,33 +663,31 @@ remove_entry_from_db (NMSettingsConnection *self, const char* db_name)
g_key_file_free (key_file);
}
void
gboolean
nm_settings_connection_delete (NMSettingsConnection *self,
NMSettingsConnectionDeleteFunc callback,
gpointer user_data)
GError **error)
{
gs_unref_object NMSettingsConnection *self_keep_alive = NULL;
gs_free_error GError *error = NULL;
NMSettingsConnectionClass *klass;
NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self);
NMConnection *for_agents;
g_return_if_fail (NM_IS_SETTINGS_CONNECTION (self));
g_return_val_if_fail (NM_IS_SETTINGS_CONNECTION (self), FALSE);
klass = NM_SETTINGS_CONNECTION_GET_CLASS (self);
self_keep_alive = g_object_ref (self);
if (!klass->delete) {
g_set_error (&error,
g_set_error (error,
NM_SETTINGS_ERROR,
NM_SETTINGS_ERROR_FAILED,
"delete not supported");
goto out;
return FALSE;
}
if (!klass->delete (self,
&error))
goto out;
error))
return FALSE;
set_visible (self, FALSE);
@@ -708,10 +706,7 @@ nm_settings_connection_delete (NMSettingsConnection *self,
remove_entry_from_db (self, "seen-bssids");
nm_settings_connection_signal_remove (self, FALSE);
out:
if (callback)
callback (self, error, user_data);
return TRUE;
}
@@ -1514,11 +1509,6 @@ typedef struct {
char *audit_args;
} UpdateInfo;
typedef struct {
GDBusMethodInvocation *context;
NMAuthSubject *subject;
} CallbackInfo;
static void
has_some_secrets_cb (NMSetting *setting,
const char *key,
@@ -1812,23 +1802,6 @@ impl_settings_connection_save (NMSettingsConnection *self,
settings_connection_update_helper (self, context, NULL, TRUE);
}
static void
con_delete_cb (NMSettingsConnection *self,
GError *error,
gpointer user_data)
{
CallbackInfo *info = user_data;
if (error)
g_dbus_method_invocation_return_gerror (info->context, error);
else
g_dbus_method_invocation_return_value (info->context, NULL);
nm_audit_log_connection_op (NM_AUDIT_OP_CONN_DELETE, self,
!error, NULL, info->subject, error ? error->message : NULL);
g_free (info);
}
static void
delete_auth_cb (NMSettingsConnection *self,
GDBusMethodInvocation *context,
@@ -1836,7 +1809,7 @@ delete_auth_cb (NMSettingsConnection *self,
GError *error,
gpointer data)
{
CallbackInfo *info;
gs_free_error GError *local = NULL;
if (error) {
nm_audit_log_connection_op (NM_AUDIT_OP_CONN_DELETE, self, FALSE, NULL, subject,
@@ -1845,11 +1818,15 @@ delete_auth_cb (NMSettingsConnection *self,
return;
}
info = g_malloc0 (sizeof (*info));
info->context = context;
info->subject = subject;
nm_settings_connection_delete (self, &local);
nm_settings_connection_delete (self, con_delete_cb, info);
nm_audit_log_connection_op (NM_AUDIT_OP_CONN_DELETE, self,
!local, NULL, subject, local ? local->message : NULL);
if (local)
g_dbus_method_invocation_return_gerror (context, local);
else
g_dbus_method_invocation_return_value (context, NULL);
}
static const char *

View File

@@ -94,10 +94,6 @@ typedef struct _NMSettingsConnectionCallId *NMSettingsConnectionCallId;
typedef struct _NMSettingsConnectionClass NMSettingsConnectionClass;
typedef void (*NMSettingsConnectionDeleteFunc) (NMSettingsConnection *self,
GError *error,
gpointer user_data);
struct _NMSettingsConnectionPrivate;
struct _NMSettingsConnection {
@@ -138,9 +134,8 @@ gboolean nm_settings_connection_replace_settings (NMSettingsConnection *self,
const char *log_diff_name,
GError **error);
void nm_settings_connection_delete (NMSettingsConnection *self,
NMSettingsConnectionDeleteFunc callback,
gpointer user_data);
gboolean nm_settings_connection_delete (NMSettingsConnection *self,
GError **error);
typedef void (*NMSettingsConnectionSecretsFunc) (NMSettingsConnection *self,
NMSettingsConnectionCallId call_id,

View File

@@ -1773,7 +1773,7 @@ nm_settings_device_removed (NMSettings *self, NMDevice *device, gboolean quittin
* remains up and can be assumed if NM starts again.
*/
if (quitting == FALSE)
nm_settings_connection_delete (connection, NULL, NULL);
nm_settings_connection_delete (connection, NULL);
}
}

View File

@@ -411,7 +411,7 @@ init (NMSettingsPlugin *config)
exported = g_hash_table_lookup (priv->connections, block->name);
if (exported) {
nm_log_info (LOGD_SETTINGS, "deleting %s from connections", block->name);
nm_settings_connection_delete (NM_SETTINGS_CONNECTION (exported), NULL, NULL);
nm_settings_connection_delete (NM_SETTINGS_CONNECTION (exported), NULL);
g_hash_table_remove (priv->connections, block->name);
}