guint32 nm_act_request_get_secrets (NMActRequest *self, const char *setting_name, NMSettingsGetSecretsFlags flags, const char *hint, NMActRequestSecretsFunc callback, gpointer callback_data) { NMActRequestPrivate *priv; GetSecretsInfo *info; guint32 call_id; NMConnection *connection; gboolean user_requested; g_return_val_if_fail (self, 0); g_return_val_if_fail (NM_IS_ACT_REQUEST (self), 0); priv = NM_ACT_REQUEST_GET_PRIVATE (self); info = g_malloc0 (sizeof (GetSecretsInfo)); info->self = self; info->callback = callback; info->callback_data = callback_data; user_requested = nm_active_connection_get_user_requested (NM_ACTIVE_CONNECTION (self)); if (user_requested) flags |= NM_SETTINGS_GET_SECRETS_FLAG_USER_REQUESTED; connection = nm_active_connection_get_connection (NM_ACTIVE_CONNECTION (self)); call_id = nm_settings_connection_get_secrets (NM_SETTINGS_CONNECTION (connection), user_requested, nm_active_connection_get_user_uid (NM_ACTIVE_CONNECTION (self)), setting_name, flags, hint, get_secrets_cb, info, NULL); if (call_id > 0) { info->call_id = call_id; priv->secrets_calls = g_slist_append (priv->secrets_calls, info); } else g_free (info); return call_id; }
/** * nm_act_request_get_secrets: * @self: * @setting_name: * @flags: * @hint: * @callback: * @callback_data: * * Asnychronously starts the request for secrets. This function cannot * fail. * * The return call-id can be used to cancel the request. You are * only allowed to cancel a still pending operation (once). * The callback will always be invoked once, even for canceling * or disposing of NMActRequest. * * Returns: a call-id. */ NMActRequestGetSecretsCallId nm_act_request_get_secrets (NMActRequest *self, const char *setting_name, NMSecretAgentGetSecretsFlags flags, const char *hint, NMActRequestSecretsFunc callback, gpointer callback_data) { NMActRequestPrivate *priv; GetSecretsInfo *info; NMSettingsConnectionCallId call_id_s; NMSettingsConnection *settings_connection; NMConnection *applied_connection; const char *hints[2] = { hint, NULL }; g_return_val_if_fail (NM_IS_ACT_REQUEST (self), 0); priv = NM_ACT_REQUEST_GET_PRIVATE (self); settings_connection = nm_act_request_get_settings_connection (self); applied_connection = nm_act_request_get_applied_connection (self); info = _get_secrets_info_new (self, callback, callback_data); priv->secrets_calls = g_slist_append (priv->secrets_calls, info); if (nm_active_connection_get_user_requested (NM_ACTIVE_CONNECTION (self))) flags |= NM_SECRET_AGENT_GET_SECRETS_FLAG_USER_REQUESTED; call_id_s = nm_settings_connection_get_secrets (settings_connection, applied_connection, nm_active_connection_get_subject (NM_ACTIVE_CONNECTION (self)), setting_name, flags, hints, get_secrets_cb, info); info->call_id = call_id_s; g_return_val_if_fail (call_id_s, NULL); return info; }