mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-27 07:00:09 +01:00
libnm-glib: fix introspection annotations for callbacks and user_data (rh #747302)
user_data arguments should be annotated with (closure) and callbacks should be marked (allow none) where it's safe to pass NULL.
This commit is contained in:
parent
0ca8ba791f
commit
a7f7e80839
5 changed files with 36 additions and 30 deletions
|
|
@ -1475,8 +1475,9 @@ deactivate_cb (DBusGProxy *proxy,
|
|||
/**
|
||||
* nm_device_disconnect:
|
||||
* @device: a #NMDevice
|
||||
* @callback: (scope async): callback to be called when disconnect operation completes
|
||||
* @user_data: caller-specific data passed to @callback
|
||||
* @callback: (scope async) (allow-none): callback to be called when disconnect
|
||||
* operation completes
|
||||
* @user_data: (closure): caller-specific data passed to @callback
|
||||
*
|
||||
* Disconnects the device if currently connected, and prevents the device from
|
||||
* automatically connecting to networks until the next manual network connection
|
||||
|
|
|
|||
|
|
@ -94,15 +94,17 @@ update_cb (DBusGProxy *proxy, GError *error, gpointer user_data)
|
|||
RemoteCall *call = user_data;
|
||||
NMRemoteConnectionCommitFunc func = (NMRemoteConnectionCommitFunc) call->callback;
|
||||
|
||||
(*func)(call->self, error, call->user_data);
|
||||
if (func != NULL)
|
||||
(*func)(call->self, error, call->user_data);
|
||||
remote_call_complete (call->self, call);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_remote_connection_commit_changes:
|
||||
* @connection: the #NMRemoteConnection
|
||||
* @callback: (scope async): a function to be called when the commit completes
|
||||
* @user_data: caller-specific data to be passed to @callback
|
||||
* @callback: (scope async) (allow none): a function to be called when the
|
||||
* commit completes
|
||||
* @user_data: (closure): caller-specific data to be passed to @callback
|
||||
*
|
||||
* Save any local changes to the settings and properties of this connection and
|
||||
* save them in the settings service.
|
||||
|
|
@ -154,7 +156,7 @@ delete_cb (DBusGProxy *proxy, GError *error, gpointer user_data)
|
|||
* nm_remote_connection_delete:
|
||||
* @connection: the #NMRemoteConnection
|
||||
* @callback: (scope async) (allow-none): a function to be called when the delete completes
|
||||
* @user_data: caller-specific data to be passed to @callback
|
||||
* @user_data: (closure): caller-specific data to be passed to @callback
|
||||
*
|
||||
* Delete the connection.
|
||||
**/
|
||||
|
|
@ -197,8 +199,9 @@ get_secrets_cb (DBusGProxy *proxy, GHashTable *secrets, GError *error, gpointer
|
|||
* nm_remote_connection_get_secrets:
|
||||
* @connection: the #NMRemoteConnection
|
||||
* @setting_name: the #NMSetting object name to get secrets for
|
||||
* @callback: (scope async): a function to be called when the update completes
|
||||
* @user_data: caller-specific data to be passed to @callback
|
||||
* @callback: (scope async): a function to be called when the update completes;
|
||||
* must not be NULL
|
||||
* @user_data: (closure): caller-specific data to be passed to @callback
|
||||
*
|
||||
* Request the connection's secrets.
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -501,7 +501,7 @@ add_connection_done (DBusGProxy *proxy, DBusGProxyCall *call, gpointer user_data
|
|||
* @connection: the connection to add. Note that this object's settings will be
|
||||
* added, not the object itself
|
||||
* @callback: (scope async): callback to be called when the add operation completes
|
||||
* @user_data: caller-specific data passed to @callback
|
||||
* @user_data: (closure): caller-specific data passed to @callback
|
||||
*
|
||||
* Requests that the remote settings service add the given settings to a new
|
||||
* connection.
|
||||
|
|
@ -594,7 +594,8 @@ save_hostname_cb (DBusGProxy *proxy,
|
|||
GError *error = NULL;
|
||||
|
||||
dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID);
|
||||
info->callback (info->settings, error, info->callback_data);
|
||||
if (info->callback != NULL)
|
||||
info->callback (info->settings, error, info->callback_data);
|
||||
g_clear_error (&error);
|
||||
}
|
||||
|
||||
|
|
@ -603,8 +604,9 @@ save_hostname_cb (DBusGProxy *proxy,
|
|||
* @settings: the %NMRemoteSettings
|
||||
* @hostname: the new persistent hostname to set, or NULL to clear any existing
|
||||
* persistent hostname
|
||||
* @callback: (scope async): callback to be called when the hostname operation completes
|
||||
* @user_data: caller-specific data passed to @callback
|
||||
* @callback: (scope async) (allow none): callback to be called when the
|
||||
* hostname operation completes
|
||||
* @user_data: (closure): caller-specific data passed to @callback
|
||||
*
|
||||
* Requests that the machine's persistent hostname be set to the specified value
|
||||
* or cleared.
|
||||
|
|
|
|||
|
|
@ -656,7 +656,7 @@ auto_register_cb (gpointer user_data)
|
|||
* @hints: (array zero-terminated=1): hints to the agent
|
||||
* @flags: flags that modify the behavior of the request
|
||||
* @callback: (scope async): a callback, invoked when the operation is done
|
||||
* @callback_data: (closure):
|
||||
* @user_data: (closure): caller-specific data to be passed to @callback
|
||||
*
|
||||
* Asyncronously retrieve secrets belonging to @connection for the
|
||||
* setting @setting_name. @flags indicate specific behavior that the secret
|
||||
|
|
@ -673,7 +673,7 @@ nm_secret_agent_get_secrets (NMSecretAgent *self,
|
|||
const char **hints,
|
||||
NMSecretAgentGetSecretsFlags flags,
|
||||
NMSecretAgentGetSecretsFunc callback,
|
||||
gpointer callback_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (self != NULL);
|
||||
g_return_if_fail (NM_IS_SECRET_AGENT (self));
|
||||
|
|
@ -691,7 +691,7 @@ nm_secret_agent_get_secrets (NMSecretAgent *self,
|
|||
hints,
|
||||
flags,
|
||||
callback,
|
||||
callback_data);
|
||||
user_data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -699,7 +699,7 @@ nm_secret_agent_get_secrets (NMSecretAgent *self,
|
|||
* @self: a #NMSecretAgent
|
||||
* @connection: a #NMConnection
|
||||
* @callback: (scope async): a callback, invoked when the operation is done
|
||||
* @callback_data: (closure):
|
||||
* @user_data: (closure): caller-specific data to be passed to @callback
|
||||
*
|
||||
* Asyncronously ensure that all secrets inside @connection
|
||||
* are stored to disk.
|
||||
|
|
@ -710,7 +710,7 @@ void
|
|||
nm_secret_agent_save_secrets (NMSecretAgent *self,
|
||||
NMConnection *connection,
|
||||
NMSecretAgentSaveSecretsFunc callback,
|
||||
gpointer callback_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (self != NULL);
|
||||
g_return_if_fail (NM_IS_SECRET_AGENT (self));
|
||||
|
|
@ -722,7 +722,7 @@ nm_secret_agent_save_secrets (NMSecretAgent *self,
|
|||
connection,
|
||||
nm_connection_get_path (connection),
|
||||
callback,
|
||||
callback_data);
|
||||
user_data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -730,7 +730,7 @@ nm_secret_agent_save_secrets (NMSecretAgent *self,
|
|||
* @self: a #NMSecretAgent
|
||||
* @connection: a #NMConnection
|
||||
* @callback: (scope async): a callback, invoked when the operation is done
|
||||
* @callback_data: (closure):
|
||||
* @user_data: (closure): caller-specific data to be passed to @callback
|
||||
*
|
||||
* Asynchronously ask the agent to delete all saved secrets belonging to
|
||||
* @connection.
|
||||
|
|
@ -741,7 +741,7 @@ void
|
|||
nm_secret_agent_delete_secrets (NMSecretAgent *self,
|
||||
NMConnection *connection,
|
||||
NMSecretAgentDeleteSecretsFunc callback,
|
||||
gpointer callback_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (self != NULL);
|
||||
g_return_if_fail (NM_IS_SECRET_AGENT (self));
|
||||
|
|
@ -753,7 +753,7 @@ nm_secret_agent_delete_secrets (NMSecretAgent *self,
|
|||
connection,
|
||||
nm_connection_get_path (connection),
|
||||
callback,
|
||||
callback_data);
|
||||
user_data);
|
||||
}
|
||||
|
||||
/**************************************************************/
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ typedef struct {
|
|||
/* Called when the subclass should retrieve and return secrets. Subclass
|
||||
* must copy or reference any arguments it may require after returning from
|
||||
* this method, as the arguments will freed (except for 'agent', 'callback',
|
||||
* and 'callback_data' of course). If the request is canceled, the callback
|
||||
* and 'user_data' of course). If the request is canceled, the callback
|
||||
* should still be called, but with the NM_SECRET_AGENT_ERROR_AGENT_CANCELED
|
||||
* error.
|
||||
*/
|
||||
|
|
@ -112,7 +112,7 @@ typedef struct {
|
|||
const char **hints,
|
||||
NMSecretAgentGetSecretsFlags flags,
|
||||
NMSecretAgentGetSecretsFunc callback,
|
||||
gpointer callback_data);
|
||||
gpointer user_data);
|
||||
|
||||
/* Called when the subclass should cancel an outstanding request to
|
||||
* get secrets for a given connection. Canceling the request MUST
|
||||
|
|
@ -127,26 +127,26 @@ typedef struct {
|
|||
/* Called when the subclass should save the secrets contained in the
|
||||
* connection to backing storage. Subclass must copy or reference any
|
||||
* arguments it may require after returning from this method, as the
|
||||
* arguments will freed (except for 'agent', 'callback', and 'callback_data'
|
||||
* arguments will freed (except for 'agent', 'callback', and 'user_data'
|
||||
* of course).
|
||||
*/
|
||||
void (*save_secrets) (NMSecretAgent *agent,
|
||||
NMConnection *connection,
|
||||
const char *connection_path,
|
||||
NMSecretAgentSaveSecretsFunc callback,
|
||||
gpointer callback_data);
|
||||
gpointer user_data);
|
||||
|
||||
/* Called when the subclass should delete the secrets contained in the
|
||||
* connection from backing storage. Subclass must copy or reference any
|
||||
* arguments it may require after returning from this method, as the
|
||||
* arguments will freed (except for 'agent', 'callback', and 'callback_data'
|
||||
* arguments will freed (except for 'agent', 'callback', and 'user_data'
|
||||
* of course).
|
||||
*/
|
||||
void (*delete_secrets) (NMSecretAgent *agent,
|
||||
NMConnection *connection,
|
||||
const char *connection_path,
|
||||
NMSecretAgentDeleteSecretsFunc callback,
|
||||
gpointer callback_data);
|
||||
gpointer user_data);
|
||||
|
||||
/* Signals */
|
||||
void (*registration_result) (NMSecretAgent *agent, GError *error);
|
||||
|
|
@ -172,17 +172,17 @@ void nm_secret_agent_get_secrets (NMSecretAgent *self,
|
|||
const char **hints,
|
||||
NMSecretAgentGetSecretsFlags flags,
|
||||
NMSecretAgentGetSecretsFunc callback,
|
||||
gpointer callback_data);
|
||||
gpointer user_data);
|
||||
|
||||
void nm_secret_agent_save_secrets (NMSecretAgent *self,
|
||||
NMConnection *connection,
|
||||
NMSecretAgentSaveSecretsFunc callback,
|
||||
gpointer callback_data);
|
||||
gpointer user_data);
|
||||
|
||||
void nm_secret_agent_delete_secrets (NMSecretAgent *self,
|
||||
NMConnection *connection,
|
||||
NMSecretAgentDeleteSecretsFunc callback,
|
||||
gpointer callback_data);
|
||||
gpointer user_data);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue