mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-15 12:34:55 +00:00
tui: create NMClient instance via async init
Using sync init (nm_client_new()) has an overhead as it requires an internal GMainContext to ensure preserving the order of D-Bus messages. Let's avoid that by using the async init. Note that the difference here is that we will iterate the caller's GMainContext while creating the instance. But that is no problem for nmtui at that point.
This commit is contained in:
parent
9e10b4f699
commit
5859e9a53d
|
@ -4640,6 +4640,7 @@ clients_tui_nmtui_LDADD = \
|
|||
clients/tui/newt/libnmt-newt.a \
|
||||
clients/common/libnmc.la \
|
||||
clients/common/libnmc-base.la \
|
||||
shared/nm-libnm-aux/libnm-libnm-aux.la \
|
||||
shared/nm-libnm-core-aux/libnm-libnm-core-aux.la \
|
||||
shared/nm-libnm-core-intern/libnm-libnm-core-intern.la \
|
||||
shared/nm-glib-aux/libnm-glib-aux.la \
|
||||
|
|
|
@ -51,6 +51,7 @@ deps = [
|
|||
libnmc_base_dep,
|
||||
libnmc_dep,
|
||||
libnmt_newt_dep,
|
||||
libnm_libnm_aux_dep,
|
||||
]
|
||||
|
||||
executable(
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
#include <locale.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "nm-libnm-aux/nm-libnm-aux.h"
|
||||
|
||||
#include "nmt-newt.h"
|
||||
#include "nm-editor-bindings.h"
|
||||
|
||||
|
@ -231,8 +233,10 @@ main (int argc, char **argv)
|
|||
|
||||
nm_editor_bindings_init ();
|
||||
|
||||
nm_client = nm_client_new (NULL, &error);
|
||||
if (!nm_client) {
|
||||
if (!nmc_client_new_waitsync (NULL,
|
||||
&nm_client,
|
||||
&error,
|
||||
NULL)) {
|
||||
g_printerr (_("Could not contact NetworkManager: %s.\n"), error->message);
|
||||
g_error_free (error);
|
||||
exit (1);
|
||||
|
|
Loading…
Reference in a new issue