summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-12-06 17:09:18 +0100
committerThomas Haller <thaller@redhat.com>2019-12-10 09:17:17 +0100
commit0b5e72b90d99e6af567e5ca3fa7801882194df8f (patch)
treeda7547a6181c73983f9f4ec34237666cb8c6e7c4
parentb78e5cf45c38604f247c6787071f4bf6a2d2f73d (diff)
downloadNetworkManager-0b5e72b90d99e6af567e5ca3fa7801882194df8f.tar.gz
nm-online: 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.
-rw-r--r--Makefile.am1
-rw-r--r--clients/meson.build11
-rw-r--r--clients/nm-online.c19
3 files changed, 19 insertions, 12 deletions
diff --git a/Makefile.am b/Makefile.am
index 4f690a5c0e..fb9a3dd2e6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4216,6 +4216,7 @@ clients_nm_online_LDFLAGS = \
-Wl,--version-script="$(srcdir)/linker-script-binary.ver"
clients_nm_online_LDADD = \
+ shared/nm-libnm-aux/libnm-libnm-aux.la \
libnm/libnm.la \
$(GLIB_LIBS)
diff --git a/clients/meson.build b/clients/meson.build
index 69e0bfef2b..8b2fa4421b 100644
--- a/clients/meson.build
+++ b/clients/meson.build
@@ -2,15 +2,14 @@ clients_c_flags = ['-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_C
name = 'nm-online'
-deps = [
- libnm_dep,
- libnm_nm_default_dep,
-]
-
executable(
name,
name + '.c',
- dependencies: deps,
+ dependencies: [
+ libnm_dep,
+ libnm_nm_default_dep,
+ libnm_libnm_aux_dep,
+ ],
c_args: clients_c_flags + ['-DG_LOG_DOMAIN="@0@"'.format(name)],
link_args: ldflags_linker_script_binary,
link_depends: linker_script_binary,
diff --git a/clients/nm-online.c b/clients/nm-online.c
index de9c3794f0..014be11165 100644
--- a/clients/nm-online.c
+++ b/clients/nm-online.c
@@ -23,6 +23,8 @@
#include <getopt.h>
#include <locale.h>
+#include "nm-libnm-aux/nm-libnm-aux.h"
+
#define PROGRESS_STEPS 15
#define EXIT_NONE -1
@@ -198,13 +200,16 @@ got_client (GObject *source_object, GAsyncResult *res, gpointer user_data)
{
OnlineData *data = user_data;
gs_free_error GError *error = NULL;
- NMClient *client;
+
+ nm_assert (NM_IS_CLIENT (source_object));
+ nm_assert (NM_CLIENT (source_object) == data->client);
nm_clear_g_source (&data->client_new_timeout_id);
g_clear_object (&data->client_new_cancellable);
- client = nm_client_new_finish (res, &error);
- if (!client) {
+ if (!g_async_initable_init_finish (G_ASYNC_INITABLE (source_object),
+ res,
+ &error)) {
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
return;
data->quiet = TRUE;
@@ -214,8 +219,6 @@ got_client (GObject *source_object, GAsyncResult *res, gpointer user_data)
return;
}
- data->client = client;
-
if (quit_if_connected (data))
return;
@@ -285,7 +288,11 @@ main (int argc, char *argv[])
data.client_new_cancellable = g_cancellable_new ();
data.client_new_timeout_id = g_timeout_add_seconds (30, got_client_timeout, &data);
- nm_client_new_async (data.client_new_cancellable, got_client, &data);
+
+ data.client = nmc_client_new_async (data.client_new_cancellable,
+ got_client,
+ &data,
+ NULL);
g_main_loop_run (data.loop);