clients: add define for NMSecretAgentSimple signal name

This commit is contained in:
Beniamino Galvani
2016-09-09 17:33:09 +02:00
parent eaad7ae431
commit b28b2ba8a9
6 changed files with 22 additions and 6 deletions

View File

@@ -148,7 +148,10 @@ do_agent_secret (NmCli *nmc, int argc, char **argv)
nmc->should_wait++; nmc->should_wait++;
nm_secret_agent_simple_enable (NM_SECRET_AGENT_SIMPLE (nmc->secret_agent), NULL); nm_secret_agent_simple_enable (NM_SECRET_AGENT_SIMPLE (nmc->secret_agent), NULL);
g_signal_connect (nmc->secret_agent, "request-secrets", G_CALLBACK (secrets_requested), nmc); g_signal_connect (nmc->secret_agent,
NM_SECRET_AGENT_SIMPLE_REQUEST_SECRETS,
G_CALLBACK (secrets_requested),
nmc);
g_print (_("nmcli successfully registered as a NetworkManager's secret agent.\n")); g_print (_("nmcli successfully registered as a NetworkManager's secret agent.\n"));
} else { } else {
g_string_printf (nmc->return_text, _("Error: secret agent initialization failed")); g_string_printf (nmc->return_text, _("Error: secret agent initialization failed"));

View File

@@ -2534,7 +2534,10 @@ nmc_activate_connection (NmCli *nmc,
/* Create secret agent */ /* Create secret agent */
nmc->secret_agent = nm_secret_agent_simple_new ("nmcli-connect"); nmc->secret_agent = nm_secret_agent_simple_new ("nmcli-connect");
if (nmc->secret_agent) { if (nmc->secret_agent) {
g_signal_connect (nmc->secret_agent, "request-secrets", G_CALLBACK (nmc_secrets_requested), nmc); g_signal_connect (nmc->secret_agent,
NM_SECRET_AGENT_SIMPLE_REQUEST_SECRETS,
G_CALLBACK (nmc_secrets_requested),
nmc);
if (connection) { if (connection) {
nm_secret_agent_simple_enable (NM_SECRET_AGENT_SIMPLE (nmc->secret_agent), nm_secret_agent_simple_enable (NM_SECRET_AGENT_SIMPLE (nmc->secret_agent),
nm_object_get_path (NM_OBJECT (connection))); nm_object_get_path (NM_OBJECT (connection)));

View File

@@ -1860,8 +1860,12 @@ do_device_connect (NmCli *nmc, int argc, char **argv)
/* Create secret agent */ /* Create secret agent */
nmc->secret_agent = nm_secret_agent_simple_new ("nmcli-connect"); nmc->secret_agent = nm_secret_agent_simple_new ("nmcli-connect");
if (nmc->secret_agent) if (nmc->secret_agent) {
g_signal_connect (nmc->secret_agent, "request-secrets", G_CALLBACK (nmc_secrets_requested), nmc); g_signal_connect (nmc->secret_agent,
NM_SECRET_AGENT_SIMPLE_REQUEST_SECRETS,
G_CALLBACK (nmc_secrets_requested),
nmc);
}
info = g_malloc0 (sizeof (AddAndActivateInfo)); info = g_malloc0 (sizeof (AddAndActivateInfo));
info->nmc = nmc; info->nmc = nmc;

View File

@@ -807,7 +807,7 @@ nm_secret_agent_simple_class_init (NMSecretAgentSimpleClass *klass)
* When the dialog is complete, the app must call * When the dialog is complete, the app must call
* nm_secret_agent_simple_response() with the results. * nm_secret_agent_simple_response() with the results.
*/ */
signals[REQUEST_SECRETS] = g_signal_new ("request-secrets", signals[REQUEST_SECRETS] = g_signal_new (NM_SECRET_AGENT_SIMPLE_REQUEST_SECRETS,
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (klass),
0, 0, NULL, NULL, NULL, 0, 0, NULL, NULL, NULL,
G_TYPE_NONE, G_TYPE_NONE,

View File

@@ -29,6 +29,9 @@
#define NM_IS_SECRET_AGENT_SIMPLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), 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)) #define NM_SECRET_AGENT_SIMPLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SECRET_AGENT_SIMPLE, NMSecretAgentSimpleClass))
/* Signals */
#define NM_SECRET_AGENT_SIMPLE_REQUEST_SECRETS "request-secrets"
typedef struct { typedef struct {
NMSecretAgentOld parent; NMSecretAgentOld parent;

View File

@@ -239,7 +239,10 @@ activate_connection (NMConnection *connection,
nm_secret_agent_simple_enable (NM_SECRET_AGENT_SIMPLE (agent), nm_secret_agent_simple_enable (NM_SECRET_AGENT_SIMPLE (agent),
nm_object_get_path (NM_OBJECT (connection))); nm_object_get_path (NM_OBJECT (connection)));
} }
g_signal_connect (agent, "request-secrets", G_CALLBACK (secrets_requested), connection); g_signal_connect (agent,
NM_SECRET_AGENT_SIMPLE_REQUEST_SECRETS,
G_CALLBACK (secrets_requested),
connection);
} }
specific_object_path = specific_object ? nm_object_get_path (specific_object) : NULL; specific_object_path = specific_object ? nm_object_get_path (specific_object) : NULL;