summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-12-06 13:02:31 +0100
committerThomas Haller <thaller@redhat.com>2019-12-10 09:17:17 +0100
commit5859e9a53d8f2170ed468ea0d77020c5849c0f8c (patch)
treeaa4d7ff39322237316aee980beb765da06f5defc
parent9e10b4f699dbaa47b5773244157a3c9be1aa4eb4 (diff)
downloadNetworkManager-5859e9a53d8f2170ed468ea0d77020c5849c0f8c.tar.gz
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.
-rw-r--r--Makefile.am1
-rw-r--r--clients/tui/meson.build1
-rw-r--r--clients/tui/nmtui.c8
3 files changed, 8 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am
index 748c0c9ef2..6c29e44ff2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -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 \
diff --git a/clients/tui/meson.build b/clients/tui/meson.build
index 8948d6ff35..db6bd429fd 100644
--- a/clients/tui/meson.build
+++ b/clients/tui/meson.build
@@ -51,6 +51,7 @@ deps = [
libnmc_base_dep,
libnmc_dep,
libnmt_newt_dep,
+ libnm_libnm_aux_dep,
]
executable(
diff --git a/clients/tui/nmtui.c b/clients/tui/nmtui.c
index e9d2ab506b..dcd8973772 100644
--- a/clients/tui/nmtui.c
+++ b/clients/tui/nmtui.c
@@ -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);