clients: don't tread secret agent as NMSecretAgentOld
Most of the times we actually need a NMSecretAgentSimple typed pointer. This way, need need to cast less. But even if we would need to cast more, it's better to have pointers point to the actual type, not merely to avoid shortcomings of C.
This commit is contained in:
@@ -149,7 +149,7 @@ do_agent_secret (NmCli *nmc, int argc, char **argv)
|
||||
/* We keep running */
|
||||
nmc->should_wait++;
|
||||
|
||||
nm_secret_agent_simple_enable (NM_SECRET_AGENT_SIMPLE (nmc->secret_agent), NULL);
|
||||
nm_secret_agent_simple_enable (nmc->secret_agent, NULL);
|
||||
g_signal_connect (nmc->secret_agent,
|
||||
NM_SECRET_AGENT_SIMPLE_REQUEST_SECRETS,
|
||||
G_CALLBACK (secrets_requested),
|
||||
|
@@ -778,7 +778,7 @@ nmc_secrets_requested (NMSecretAgentSimple *agent,
|
||||
/* Unregister our secret agent on failure, so that another agent
|
||||
* may be tried */
|
||||
if (nmc->secret_agent) {
|
||||
nm_secret_agent_old_unregister (nmc->secret_agent, NULL, NULL);
|
||||
nm_secret_agent_old_unregister (NM_SECRET_AGENT_OLD (nmc->secret_agent), NULL, NULL);
|
||||
g_clear_object (&nmc->secret_agent);
|
||||
}
|
||||
}
|
||||
|
@@ -2474,7 +2474,7 @@ check_activated (ActivateConnectionInfo *info)
|
||||
if (nmc->secret_agent) {
|
||||
NMRemoteConnection *connection = nm_active_connection_get_connection (info->active);
|
||||
|
||||
nm_secret_agent_simple_enable (NM_SECRET_AGENT_SIMPLE (nmc->secret_agent),
|
||||
nm_secret_agent_simple_enable (nmc->secret_agent,
|
||||
nm_connection_get_path (NM_CONNECTION (connection)));
|
||||
}
|
||||
break;
|
||||
@@ -2776,7 +2776,6 @@ nmc_activate_connection (NmCli *nmc,
|
||||
g_hash_table_destroy (nmc->pwds_hash);
|
||||
nmc->pwds_hash = pwds_hash;
|
||||
|
||||
/* Create secret agent */
|
||||
nmc->secret_agent = nm_secret_agent_simple_new ("nmcli-connect");
|
||||
if (nmc->secret_agent) {
|
||||
g_signal_connect (nmc->secret_agent,
|
||||
@@ -6728,7 +6727,7 @@ progress_activation_editor_cb (gpointer user_data)
|
||||
NMRemoteConnection *connection;
|
||||
|
||||
connection = nm_active_connection_get_connection (ac);
|
||||
nm_secret_agent_simple_enable (NM_SECRET_AGENT_SIMPLE (info->nmc->secret_agent),
|
||||
nm_secret_agent_simple_enable (info->nmc->secret_agent,
|
||||
nm_object_get_path (NM_OBJECT (connection)));
|
||||
}
|
||||
|
||||
|
@@ -1961,7 +1961,7 @@ connect_device_cb (GObject *client, GAsyncResult *result, gpointer user_data)
|
||||
if (nmc->secret_agent) {
|
||||
NMRemoteConnection *connection = nm_active_connection_get_connection (active);
|
||||
|
||||
nm_secret_agent_simple_enable (NM_SECRET_AGENT_SIMPLE (nmc->secret_agent),
|
||||
nm_secret_agent_simple_enable (nmc->secret_agent,
|
||||
nm_connection_get_path (NM_CONNECTION (connection)));
|
||||
}
|
||||
|
||||
|
@@ -1017,7 +1017,7 @@ nmc_cleanup (NmCli *nmc)
|
||||
g_string_free (g_steal_pointer (&nmc->return_text), TRUE);
|
||||
|
||||
if (nmc->secret_agent) {
|
||||
nm_secret_agent_old_unregister (nmc->secret_agent, NULL, NULL);
|
||||
nm_secret_agent_old_unregister (NM_SECRET_AGENT_OLD (nmc->secret_agent), NULL, NULL);
|
||||
g_clear_object (&nmc->secret_agent);
|
||||
}
|
||||
|
||||
|
@@ -20,7 +20,7 @@
|
||||
#ifndef NMC_NMCLI_H
|
||||
#define NMC_NMCLI_H
|
||||
|
||||
#include "nm-secret-agent-old.h"
|
||||
#include "nm-secret-agent-simple.h"
|
||||
#include "nm-meta-setting-desc.h"
|
||||
|
||||
struct _NMPolkitListener;
|
||||
@@ -129,7 +129,7 @@ typedef struct _NmCli {
|
||||
|
||||
int timeout; /* Operation timeout */
|
||||
|
||||
NMSecretAgentOld *secret_agent; /* Secret agent */
|
||||
NMSecretAgentSimple *secret_agent; /* Secret agent */
|
||||
GHashTable *pwds_hash; /* Hash table with passwords in passwd-file */
|
||||
struct _NMPolkitListener *pk_listener; /* polkit agent listener */
|
||||
|
||||
|
@@ -1116,7 +1116,7 @@ nm_secret_agent_simple_init (NMSecretAgentSimple *agent)
|
||||
* Returns: a new #NMSecretAgentSimple if the agent creation is successful
|
||||
* or %NULL in case of a failure.
|
||||
*/
|
||||
NMSecretAgentOld *
|
||||
NMSecretAgentSimple *
|
||||
nm_secret_agent_simple_new (const char *name)
|
||||
{
|
||||
return g_initable_new (NM_TYPE_SECRET_AGENT_SIMPLE, NULL, NULL,
|
||||
|
@@ -56,7 +56,7 @@ typedef struct _NMSecretAgentSimpleClass NMSecretAgentSimpleClass;
|
||||
|
||||
GType nm_secret_agent_simple_get_type (void);
|
||||
|
||||
NMSecretAgentOld *nm_secret_agent_simple_new (const char *name);
|
||||
NMSecretAgentSimple *nm_secret_agent_simple_new (const char *name);
|
||||
|
||||
void nm_secret_agent_simple_response (NMSecretAgentSimple *self,
|
||||
const char *request_id,
|
||||
|
@@ -240,7 +240,7 @@ activate_connection (NMConnection *connection,
|
||||
NMObject *specific_object)
|
||||
{
|
||||
NmtNewtForm *form;
|
||||
gs_unref_object NMSecretAgentOld *agent = NULL;
|
||||
gs_unref_object NMSecretAgentSimple *agent = NULL;
|
||||
NmtNewtWidget *label;
|
||||
NmtSyncOp op;
|
||||
const char *specific_object_path;
|
||||
@@ -257,7 +257,7 @@ activate_connection (NMConnection *connection,
|
||||
agent = nm_secret_agent_simple_new ("nmtui");
|
||||
if (agent) {
|
||||
if (connection) {
|
||||
nm_secret_agent_simple_enable (NM_SECRET_AGENT_SIMPLE (agent),
|
||||
nm_secret_agent_simple_enable (agent,
|
||||
nm_object_get_path (NM_OBJECT (connection)));
|
||||
}
|
||||
g_signal_connect (agent,
|
||||
@@ -303,7 +303,7 @@ activate_connection (NMConnection *connection,
|
||||
if (agent && !connection) {
|
||||
connection = NM_CONNECTION (nm_active_connection_get_connection (ac));
|
||||
if (connection) {
|
||||
nm_secret_agent_simple_enable (NM_SECRET_AGENT_SIMPLE (agent),
|
||||
nm_secret_agent_simple_enable (agent,
|
||||
nm_object_get_path (NM_OBJECT (connection)));
|
||||
}
|
||||
}
|
||||
@@ -341,7 +341,7 @@ activate_connection (NMConnection *connection,
|
||||
g_object_unref (form);
|
||||
|
||||
if (agent)
|
||||
nm_secret_agent_old_unregister (agent, NULL, NULL);
|
||||
nm_secret_agent_old_unregister (NM_SECRET_AGENT_OLD (agent), NULL, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Reference in New Issue
Block a user