diff options
author | Dan Winship <danw@redhat.com> | 2014-11-20 11:55:54 -0500 |
---|---|---|
committer | Dan Winship <danw@redhat.com> | 2014-11-21 12:08:35 -0500 |
commit | a1f746351a514560b07837f7f8ba0f6cde156ea9 (patch) | |
tree | bbee7da743b8d44e43b525963976d5fe36984c83 | |
parent | abcb3184b344bce43e1bb1b0a76efa5816e15e4a (diff) | |
download | NetworkManager-a1f746351a514560b07837f7f8ba0f6cde156ea9.tar.gz |
clients: NMSecretAgentSimple API fixups
nm_secret_agent_simple_*() functions should take an
NMSecretAgentSimple, not an NMSecretAgent.
The type macros were incorrectly validating against
NM_TYPE_SECRET_AGENT rather than NM_TYPE_SECRET_AGENT_SIMPLE.
-rw-r--r-- | clients/cli/agent.c | 2 | ||||
-rw-r--r-- | clients/cli/connections.c | 8 | ||||
-rw-r--r-- | clients/cli/devices.c | 4 | ||||
-rw-r--r-- | clients/common/nm-secret-agent-simple.c | 22 | ||||
-rw-r--r-- | clients/common/nm-secret-agent-simple.h | 26 | ||||
-rw-r--r-- | clients/tui/nmtui-connect.c | 10 |
6 files changed, 35 insertions, 37 deletions
diff --git a/clients/cli/agent.c b/clients/cli/agent.c index cc85b16674..2a5a81e5a3 100644 --- a/clients/cli/agent.c +++ b/clients/cli/agent.c @@ -147,7 +147,7 @@ do_agent_secret (NmCli *nmc, int argc, char **argv) /* We keep running */ nmc->should_wait = TRUE; - nm_secret_agent_simple_enable (nmc->secret_agent); + nm_secret_agent_simple_enable (NM_SECRET_AGENT_SIMPLE (nmc->secret_agent)); g_signal_connect (nmc->secret_agent, "request-secrets", G_CALLBACK (secrets_requested), nmc); g_print (_("nmcli successfully registered as a NetworkManager's secret agent.\n")); } else { diff --git a/clients/cli/connections.c b/clients/cli/connections.c index ff989008b9..dafb097f8c 100644 --- a/clients/cli/connections.c +++ b/clients/cli/connections.c @@ -1770,8 +1770,8 @@ active_connection_state_cb (NMActiveConnection *active, GParamSpec *pspec, gpoin NMRemoteConnection *connection = nm_active_connection_get_connection (active); const gchar *path = nm_connection_get_path (NM_CONNECTION (connection)); - nm_secret_agent_simple_set_connection_path (nmc->secret_agent, path); - nm_secret_agent_simple_enable (nmc->secret_agent); + nm_secret_agent_simple_set_connection_path (NM_SECRET_AGENT_SIMPLE (nmc->secret_agent), path); + nm_secret_agent_simple_enable (NM_SECRET_AGENT_SIMPLE (nmc->secret_agent)); } devices = nm_active_connection_get_devices (active); @@ -2094,8 +2094,8 @@ nmc_activate_connection (NmCli *nmc, if (connection) { const gchar *path = nm_object_get_path (NM_OBJECT (connection)); - nm_secret_agent_simple_set_connection_path (nmc->secret_agent, path); - nm_secret_agent_simple_enable (nmc->secret_agent); + nm_secret_agent_simple_set_connection_path (NM_SECRET_AGENT_SIMPLE (nmc->secret_agent), path); + nm_secret_agent_simple_enable (NM_SECRET_AGENT_SIMPLE (nmc->secret_agent)); } } diff --git a/clients/cli/devices.c b/clients/cli/devices.c index feefc0bf7c..b5b04dc3ad 100644 --- a/clients/cli/devices.c +++ b/clients/cli/devices.c @@ -1522,8 +1522,8 @@ connect_device_cb (GObject *client, GAsyncResult *result, gpointer user_data) NMRemoteConnection *connection = nm_active_connection_get_connection (active); const char *path = nm_connection_get_path (NM_CONNECTION (connection)); - nm_secret_agent_simple_set_connection_path (nmc->secret_agent, path); - nm_secret_agent_simple_enable (nmc->secret_agent); + nm_secret_agent_simple_set_connection_path (NM_SECRET_AGENT_SIMPLE (nmc->secret_agent), path); + nm_secret_agent_simple_enable (NM_SECRET_AGENT_SIMPLE (nmc->secret_agent)); } g_object_ref (device); diff --git a/clients/common/nm-secret-agent-simple.c b/clients/common/nm-secret-agent-simple.c index 41faef9674..cdfecfb473 100644 --- a/clients/common/nm-secret-agent-simple.c +++ b/clients/common/nm-secret-agent-simple.c @@ -584,15 +584,15 @@ nm_secret_agent_simple_delete_secrets (NMSecretAgent *agent, /** * nm_secret_agent_simple_set_connection_path: - * @agent: the #NMSecretAgentSimple + * @self: the #NMSecretAgentSimple * @path: the path of the connection the agent handle secrets for * * Sets the path for a new #NMSecretAgentSimple. */ void -nm_secret_agent_simple_set_connection_path (NMSecretAgent *agent, const char *path) +nm_secret_agent_simple_set_connection_path (NMSecretAgentSimple *self, const char *path) { - NMSecretAgentSimplePrivate *priv = NM_SECRET_AGENT_SIMPLE_GET_PRIVATE (agent); + NMSecretAgentSimplePrivate *priv = NM_SECRET_AGENT_SIMPLE_GET_PRIVATE (self); g_free (priv->path); priv->path = g_strdup (path); @@ -600,14 +600,14 @@ nm_secret_agent_simple_set_connection_path (NMSecretAgent *agent, const char *pa /** * nm_secret_agent_simple_enable: - * @agent: the #NMSecretAgentSimple + * @self: the #NMSecretAgentSimple * * Enables servicing the requests including the already queued ones. */ void -nm_secret_agent_simple_enable (NMSecretAgent *agent) +nm_secret_agent_simple_enable (NMSecretAgentSimple *self) { - NMSecretAgentSimplePrivate *priv = NM_SECRET_AGENT_SIMPLE_GET_PRIVATE (agent); + NMSecretAgentSimplePrivate *priv = NM_SECRET_AGENT_SIMPLE_GET_PRIVATE (self); GList *requests, *iter; GError *error; @@ -696,11 +696,7 @@ nm_secret_agent_simple_class_init (NMSecretAgentSimpleClass *klass) NMSecretAgent * nm_secret_agent_simple_new (const char *name) { - NMSecretAgent *agent; - - agent = g_initable_new (NM_TYPE_SECRET_AGENT_SIMPLE, NULL, NULL, - NM_SECRET_AGENT_IDENTIFIER, name, - NULL); - - return agent; + return g_initable_new (NM_TYPE_SECRET_AGENT_SIMPLE, NULL, NULL, + NM_SECRET_AGENT_OLD_IDENTIFIER, name, + NULL); } diff --git a/clients/common/nm-secret-agent-simple.h b/clients/common/nm-secret-agent-simple.h index 5d4278bdfa..a987dc28cc 100644 --- a/clients/common/nm-secret-agent-simple.h +++ b/clients/common/nm-secret-agent-simple.h @@ -24,11 +24,11 @@ G_BEGIN_DECLS #define NM_TYPE_SECRET_AGENT_SIMPLE (nm_secret_agent_simple_get_type ()) -#define NM_SECRET_AGENT_SIMPLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SECRET_AGENT, NMSecretAgentSimple)) -#define NM_SECRET_AGENT_SIMPLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SECRET_AGENT, NMSecretAgentSimpleClass)) -#define NM_IS_SECRET_AGENT_SIMPLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SECRET_AGENT)) -#define NM_IS_SECRET_AGENT_SIMPLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SECRET_AGENT)) -#define NM_SECRET_AGENT_SIMPLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SECRET_AGENT, NMSecretAgentSimpleClass)) +#define NM_SECRET_AGENT_SIMPLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SECRET_AGENT_SIMPLE, NMSecretAgentSimple)) +#define NM_SECRET_AGENT_SIMPLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SECRET_AGENT_SIMPLE, NMSecretAgentSimpleClass)) +#define NM_IS_SECRET_AGENT_SIMPLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SECRET_AGENT_SIMPLE)) +#define NM_IS_SECRET_AGENT_SIMPLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SECRET_AGENT_SIMPLE)) +#define NM_SECRET_AGENT_SIMPLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SECRET_AGENT_SIMPLE, NMSecretAgentSimpleClass)) typedef struct { NMSecretAgent parent; @@ -47,13 +47,15 @@ typedef struct { GType nm_secret_agent_simple_get_type (void); -NMSecretAgent *nm_secret_agent_simple_new (const char *name); -void nm_secret_agent_simple_response (NMSecretAgentSimple *self, - const char *request_id, - GPtrArray *secrets); -void nm_secret_agent_simple_set_connection_path (NMSecretAgent *agent, - const char *path); -void nm_secret_agent_simple_enable (NMSecretAgent *agent); +NMSecretAgent *nm_secret_agent_simple_new (const char *name); + +void nm_secret_agent_simple_response (NMSecretAgentSimple *self, + const char *request_id, + GPtrArray *secrets); + +void nm_secret_agent_simple_set_connection_path (NMSecretAgentSimple *self, + const char *path); +void nm_secret_agent_simple_enable (NMSecretAgentSimple *self); G_END_DECLS diff --git a/clients/tui/nmtui-connect.c b/clients/tui/nmtui-connect.c index 77c7ff0798..d894828768 100644 --- a/clients/tui/nmtui-connect.c +++ b/clients/tui/nmtui-connect.c @@ -148,9 +148,9 @@ activate_connection (NMConnection *connection, agent = nm_secret_agent_simple_new ("nmtui"); if (agent) { if (connection) { - nm_secret_agent_simple_set_connection_path (agent, - nm_object_get_path (NM_OBJECT (connection))); - nm_secret_agent_simple_enable (agent); + nm_secret_agent_simple_set_connection_path (NM_SECRET_AGENT_SIMPLE (agent), + nm_object_get_path (NM_OBJECT (connection))); + nm_secret_agent_simple_enable (NM_SECRET_AGENT_SIMPLE (agent)); } g_signal_connect (agent, "request-secrets", G_CALLBACK (secrets_requested), NULL); } @@ -194,8 +194,8 @@ activate_connection (NMConnection *connection, if (connection) { const gchar *path = nm_object_get_path (NM_OBJECT (connection)); - nm_secret_agent_simple_set_connection_path (agent, path); - nm_secret_agent_simple_enable (agent); + nm_secret_agent_simple_set_connection_path (NM_SECRET_AGENT_SIMPLE (agent), path); + nm_secret_agent_simple_enable (NM_SECRET_AGENT_SIMPLE (agent)); } } |