mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-06 16:21:50 +00:00
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.
This commit is contained in:
parent
b78e5cf45c
commit
0b5e72b90d
|
@ -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)
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue