diff options
author | Thomas Haller <thaller@redhat.com> | 2019-12-06 17:09:18 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-12-10 09:17:17 +0100 |
commit | 3035837aa8abee4eaab4fd5c2a9bbd076db41cfe (patch) | |
tree | dc8d36a2dcc734807fb4f829a064d259e9cbffb3 /clients/cli | |
parent | 00461632015714f87b9c6ea2524b823875bcca1b (diff) | |
download | NetworkManager-3035837aa8abee4eaab4fd5c2a9bbd076db41cfe.tar.gz |
cli: use nmc_client_new_async() instead of nm_client_new_async()
This will allow us to set construct parameters to the instance, like
NM_CLIENT_INSTANCE_FLAGS.
Diffstat (limited to 'clients/cli')
-rw-r--r-- | clients/cli/common.c | 16 | ||||
-rw-r--r-- | clients/cli/meson.build | 2 |
2 files changed, 14 insertions, 4 deletions
diff --git a/clients/cli/common.c b/clients/cli/common.c index 04ccf8dc1f..88be4376ef 100644 --- a/clients/cli/common.c +++ b/clients/cli/common.c @@ -13,6 +13,8 @@ #include <readline/readline.h> #include <readline/history.h> +#include "nm-libnm-aux/nm-libnm-aux.h" + #include "nm-vpn-helpers.h" #include "nm-client-utils.h" @@ -1216,17 +1218,22 @@ got_client (GObject *source_object, GAsyncResult *res, gpointer user_data) CmdCall *call = user_data; NmCli *nmc; + nm_assert (NM_IS_CLIENT (source_object)); + task = g_steal_pointer (&call->task); nmc = g_task_get_task_data (task); nmc->should_wait--; - nmc->client = nm_client_new_finish (res, &error); - if (!nmc->client) { + if (!g_async_initable_init_finish (G_ASYNC_INITABLE (source_object), + res, + &error)) { + g_object_unref (source_object); g_task_return_new_error (task, NMCLI_ERROR, NMC_RESULT_ERROR_UNKNOWN, _("Error: Could not create NMClient object: %s."), error->message); } else { + nmc->client = NM_CLIENT (source_object); call_cmd (nmc, g_steal_pointer (&task), call->cmd, call->argc, call->argv); } @@ -1259,7 +1266,10 @@ call_cmd (NmCli *nmc, GTask *task, const NMCCommand *cmd, int argc, char **argv) call->argc = argc; call->argv = argv; call->task = task; - nm_client_new_async (NULL, got_client, call); + nmc_client_new_async (NULL, + got_client, + call, + NULL); } } diff --git a/clients/cli/meson.build b/clients/cli/meson.build index 562020630d..1c8148920c 100644 --- a/clients/cli/meson.build +++ b/clients/cli/meson.build @@ -22,11 +22,11 @@ deps = [ libnmc_base_dep, libnmc_dep, readline_dep, + libnm_libnm_aux_dep, ] if enable_polkit_agent sources += nm_polkit_listener - deps += polkit_agent_dep endif |