summary refs log tree commit diff
path: root/clients/nm-online.c
diff options
context:
space:
mode:
Diffstat (limited to 'clients/nm-online.c')
-rw-r--r--clients/nm-online.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/clients/nm-online.c b/clients/nm-online.c
index de9c3794..5950da56 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,12 @@ 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,
+	                                    NM_CLIENT_INSTANCE_FLAGS, (guint) NM_CLIENT_INSTANCE_FLAGS_NO_AUTO_FETCH_PERMISSIONS,
+	                                    NULL);
 
 	g_main_loop_run (data.loop);
 
@@ -295,7 +303,7 @@ main (int argc, char *argv[])
 	nm_clear_g_signal_handler (data.client, &data.client_notify_id);
 	g_clear_object (&data.client);
 
-	g_clear_pointer (&data.loop, g_main_loop_unref);
+	nm_clear_pointer (&data.loop, g_main_loop_unref);
 
 	if (!data.quiet)
 		_print_progress (data.wait_startup, -1, NM_MAX (0, data.end_timestamp_ms - _now_ms ()), data.retval);