summary refs log tree commit diff
path: root/clients/tui
diff options
context:
space:
mode:
Diffstat (limited to 'clients/tui')
-rw-r--r--clients/tui/meson.build3
-rw-r--r--clients/tui/newt/meson.build2
-rw-r--r--clients/tui/newt/nmt-newt-form.c24
-rw-r--r--clients/tui/newt/nmt-newt-grid.c8
-rw-r--r--clients/tui/nm-editor-bindings.c15
-rw-r--r--clients/tui/nm-editor-utils.c19
-rw-r--r--clients/tui/nmt-connect-connection-list.c2
-rw-r--r--clients/tui/nmt-device-entry.c2
-rw-r--r--clients/tui/nmt-editor-grid.c2
-rw-r--r--clients/tui/nmt-page-team-port.c2
-rw-r--r--clients/tui/nmt-page-team.c2
-rw-r--r--clients/tui/nmt-page-wifi.c1
-rw-r--r--clients/tui/nmt-password-dialog.c4
-rw-r--r--clients/tui/nmt-route-entry.c2
-rw-r--r--clients/tui/nmtui.c9
15 files changed, 54 insertions, 43 deletions
diff --git a/clients/tui/meson.build b/clients/tui/meson.build
index 8948d6ff..4f945a69 100644
--- a/clients/tui/meson.build
+++ b/clients/tui/meson.build
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: LGPL-2.1+
+
 name = 'nmtui'
 
 common_c_flags = clients_c_flags + ['-DG_LOG_DOMAIN="@0@"'.format(name)]
@@ -51,6 +53,7 @@ deps = [
   libnmc_base_dep,
   libnmc_dep,
   libnmt_newt_dep,
+  libnm_libnm_aux_dep,
 ]
 
 executable(
diff --git a/clients/tui/newt/meson.build b/clients/tui/newt/meson.build
index d543f7ea..f2af7b20 100644
--- a/clients/tui/newt/meson.build
+++ b/clients/tui/newt/meson.build
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: LGPL-2.1+
+
 sources = files(
   'nmt-newt-button-box.c',
   'nmt-newt-button.c',
diff --git a/clients/tui/newt/nmt-newt-form.c b/clients/tui/newt/nmt-newt-form.c
index 881b6f5d..2142e3c5 100644
--- a/clients/tui/newt/nmt-newt-form.c
+++ b/clients/tui/newt/nmt-newt-form.c
@@ -312,9 +312,9 @@ static GSList *form_stack;
 static GSource *keypress_source;
 
 static gboolean
-nmt_newt_form_keypress_callback (int          fd,
+nmt_newt_form_keypress_callback (int fd,
                                  GIOCondition condition,
-                                 gpointer     user_data)
+                                 gpointer user_data)
 {
 	g_return_val_if_fail (form_stack != NULL, FALSE);
 
@@ -340,16 +340,14 @@ static void
 nmt_newt_form_real_show (NmtNewtForm *form)
 {
 	if (!keypress_source) {
-		GIOChannel *io;
-
-		io = g_io_channel_unix_new (STDIN_FILENO);
-		keypress_source = g_io_create_watch (io, G_IO_IN);
+		keypress_source = nm_g_unix_fd_source_new (STDIN_FILENO,
+		                                           G_IO_IN,
+		                                           G_PRIORITY_DEFAULT,
+		                                           nmt_newt_form_keypress_callback,
+		                                           NULL,
+		                                           NULL);
 		g_source_set_can_recurse (keypress_source, TRUE);
-		g_source_set_callback (keypress_source,
-		                       (GSourceFunc)(void (*) (void)) nmt_newt_form_keypress_callback,
-		                       NULL, NULL);
 		g_source_attach (keypress_source, NULL);
-		g_io_channel_unref (io);
 	}
 
 	nmt_newt_form_build (form);
@@ -416,10 +414,8 @@ nmt_newt_form_quit (NmtNewtForm *form)
 
 	if (form_stack)
 		nmt_newt_form_iterate (form_stack->data);
-	else if (keypress_source) {
-		g_source_destroy (keypress_source);
-		g_clear_pointer (&keypress_source, g_source_unref);
-	}
+	else
+		nm_clear_g_source_inst (&keypress_source);
 
 	g_signal_emit (form, signals[QUIT], 0);
 	g_object_unref (form);
diff --git a/clients/tui/newt/nmt-newt-grid.c b/clients/tui/newt/nmt-newt-grid.c
index 68ac874c..ff411812 100644
--- a/clients/tui/newt/nmt-newt-grid.c
+++ b/clients/tui/newt/nmt-newt-grid.c
@@ -78,10 +78,10 @@ nmt_newt_grid_finalize (GObject *object)
 	NmtNewtGridPrivate *priv = NMT_NEWT_GRID_GET_PRIVATE (object);
 
 	g_array_unref (priv->children);
-	g_clear_pointer (&priv->row_heights, g_free);
-	g_clear_pointer (&priv->col_widths, g_free);
-	g_clear_pointer (&priv->expand_rows, g_free);
-	g_clear_pointer (&priv->expand_cols, g_free);
+	nm_clear_g_free (&priv->row_heights);
+	nm_clear_g_free (&priv->col_widths);
+	nm_clear_g_free (&priv->expand_rows);
+	nm_clear_g_free (&priv->expand_cols);
 
 	G_OBJECT_CLASS (nmt_newt_grid_parent_class)->finalize (object);
 }
diff --git a/clients/tui/nm-editor-bindings.c b/clients/tui/nm-editor-bindings.c
index 00a34fbf..c5606f11 100644
--- a/clients/tui/nm-editor-bindings.c
+++ b/clients/tui/nm-editor-bindings.c
@@ -192,7 +192,7 @@ ip_addresses_check_and_copy (GBinding     *binding,
 	strings = g_value_get_boxed (source_value);
 
 	for (i = 0; strings[i]; i++) {
-		if (!nm_utils_ipaddr_valid (addr_family, strings[i]))
+		if (!nm_utils_ipaddr_is_valid (addr_family, strings[i]))
 			return FALSE;
 	}
 
@@ -251,7 +251,7 @@ ip_gateway_from_string (GBinding     *binding,
 	const char *gateway;
 
 	gateway = g_value_get_string (source_value);
-	if (gateway && !nm_utils_ipaddr_valid (addr_family, gateway))
+	if (gateway && !nm_utils_ipaddr_is_valid (addr_family, gateway))
 		gateway = NULL;
 
 	g_value_set_string (target_value, gateway);
@@ -457,7 +457,7 @@ ip_route_transform_from_next_hop_string (GBinding     *binding,
 
 	text = g_value_get_string (source_value);
 	if (*text) {
-		if (!nm_utils_ipaddr_valid (addr_family, text))
+		if (!nm_utils_ipaddr_is_valid (addr_family, text))
 			return FALSE;
 	} else
 		text = NULL;
@@ -595,6 +595,9 @@ get_security_type (NMEditorWirelessSecurityMethodBinding *binding)
 	if (!strcmp (key_mgmt, "sae"))
 		return "wpa3-personal";
 
+	if (!strcmp (key_mgmt, "owe"))
+		return "owe";
+
 	if (!strcmp (key_mgmt, "wpa-eap"))
 		return "wpa-enterprise";
 
@@ -705,6 +708,12 @@ wireless_security_target_changed (GObject    *object,
 		              NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, NULL,
 		              NM_SETTING_WIRELESS_SECURITY_WEP_KEY_TYPE, NM_WEP_KEY_TYPE_UNKNOWN,
 		              NULL);
+	} else if (!strcmp (method, "owe")) {
+		g_object_set (binding->s_wsec,
+		              NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "owe",
+		              NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, NULL,
+		              NM_SETTING_WIRELESS_SECURITY_WEP_KEY_TYPE, NM_WEP_KEY_TYPE_UNKNOWN,
+		              NULL);
 	} else if (!strcmp (method, "wpa-enterprise")) {
 		g_object_set (binding->s_wsec,
 		              NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-eap",
diff --git a/clients/tui/nm-editor-utils.c b/clients/tui/nm-editor-utils.c
index 83fd8d3b..42019361 100644
--- a/clients/tui/nm-editor-utils.c
+++ b/clients/tui/nm-editor-utils.c
@@ -56,24 +56,19 @@ bond_connection_setup_func (NMConnection        *connection,
                             NMSetting           *s_hw)
 {
 	NMSettingBond *s_bond = NM_SETTING_BOND (s_hw);
-	const char *def, *cur;
+	guint i;
+	const char *value;
 	static const char *const options[] = {
-		NM_SETTING_BOND_OPTION_ARP_INTERVAL,
-		NM_SETTING_BOND_OPTION_ARP_IP_TARGET,
-		NM_SETTING_BOND_OPTION_DOWNDELAY,
-		NM_SETTING_BOND_OPTION_MIIMON,
 		NM_SETTING_BOND_OPTION_MODE,
-		NM_SETTING_BOND_OPTION_PRIMARY,
+		NM_SETTING_BOND_OPTION_MIIMON,
+		NM_SETTING_BOND_OPTION_DOWNDELAY,
 		NM_SETTING_BOND_OPTION_UPDELAY,
 	};
-	guint i;
 
-	/* Only add options supported by the UI */
 	for (i = 0; i < G_N_ELEMENTS (options); i++) {
-		def = nm_setting_bond_get_option_default (s_bond, options[i]);
-		cur = nm_setting_bond_get_option_by_name (s_bond, options[i]);
-		if (!nm_streq0 (def, cur))
-			nm_setting_bond_add_option (s_bond, options[i], def);
+		value = nm_setting_bond_get_option_default (s_bond, options[i]);
+		if (value)
+			nm_setting_bond_add_option (s_bond, options[i], value);
 	}
 }
 
diff --git a/clients/tui/nmt-connect-connection-list.c b/clients/tui/nmt-connect-connection-list.c
index 1975b1c6..411c2c00 100644
--- a/clients/tui/nmt-connect-connection-list.c
+++ b/clients/tui/nmt-connect-connection-list.c
@@ -80,7 +80,7 @@ nmt_connect_connection_free (NmtConnectConnection *nmtconn)
 static void
 nmt_connect_device_free (NmtConnectDevice *nmtdev)
 {
-	g_clear_pointer (&nmtdev->name, g_free);
+	nm_clear_g_free (&nmtdev->name);
 	g_clear_object (&nmtdev->device);
 
 	g_slist_free_full (nmtdev->conns, (GDestroyNotify) nmt_connect_connection_free);
diff --git a/clients/tui/nmt-device-entry.c b/clients/tui/nmt-device-entry.c
index 4ab59329..264bd59d 100644
--- a/clients/tui/nmt-device-entry.c
+++ b/clients/tui/nmt-device-entry.c
@@ -299,7 +299,7 @@ nmt_device_entry_set_mac_address (NmtDeviceEntry *deventry,
 		priv->mac_address = g_strdup (mac_address);
 		changed = TRUE;
 	} else if (!mac_address && priv->mac_address) {
-		g_clear_pointer (&priv->mac_address, g_free);
+		nm_clear_g_free (&priv->mac_address);
 		changed = TRUE;
 	} else if (   mac_address && priv->mac_address
 	           && !nm_utils_hwaddr_matches (mac_address, -1, priv->mac_address, -1)) {
diff --git a/clients/tui/nmt-editor-grid.c b/clients/tui/nmt-editor-grid.c
index a8ceedda..ac00c82b 100644
--- a/clients/tui/nmt-editor-grid.c
+++ b/clients/tui/nmt-editor-grid.c
@@ -77,7 +77,7 @@ nmt_editor_grid_finalize (GObject *object)
 	NmtEditorGridPrivate *priv = NMT_EDITOR_GRID_GET_PRIVATE (object);
 
 	g_array_unref (priv->rows);
-	g_clear_pointer (&priv->row_heights, g_free);
+	nm_clear_g_free (&priv->row_heights);
 
 	G_OBJECT_CLASS (nmt_editor_grid_parent_class)->finalize (object);
 }
diff --git a/clients/tui/nmt-page-team-port.c b/clients/tui/nmt-page-team-port.c
index c91633e8..dfefd80c 100644
--- a/clients/tui/nmt-page-team-port.c
+++ b/clients/tui/nmt-page-team-port.c
@@ -50,7 +50,7 @@ edit_clicked (NmtNewtButton *button,
 	new_config = nmt_newt_edit_string (config);
 
 	if (new_config && !*new_config)
-		g_clear_pointer (&new_config, g_free);
+		nm_clear_g_free (&new_config);
 	g_object_set (G_OBJECT (priv->s_port),
 	              NM_SETTING_TEAM_PORT_CONFIG, new_config,
 	              NULL);
diff --git a/clients/tui/nmt-page-team.c b/clients/tui/nmt-page-team.c
index af84db4b..a3d9d53a 100644
--- a/clients/tui/nmt-page-team.c
+++ b/clients/tui/nmt-page-team.c
@@ -103,7 +103,7 @@ edit_clicked (NmtNewtButton *button,
 	new_config = nmt_newt_edit_string (config);
 
 	if (new_config && !*new_config)
-		g_clear_pointer (&new_config, g_free);
+		nm_clear_g_free (&new_config);
 	g_object_set (G_OBJECT (priv->s_team),
 	              NM_SETTING_TEAM_CONFIG, new_config,
 	              NULL);
diff --git a/clients/tui/nmt-page-wifi.c b/clients/tui/nmt-page-wifi.c
index 2e738ac6..9494423b 100644
--- a/clients/tui/nmt-page-wifi.c
+++ b/clients/tui/nmt-page-wifi.c
@@ -72,6 +72,7 @@ static NmtNewtPopupEntry wifi_security[] = {
 	{ N_("WEP 128-bit Passphrase"),            "wep-passphrase" },
 	{ N_("Dynamic WEP (802.1x)"),              "dynamic-wep" },
 	{ N_("LEAP"),                              "leap" },
+	{ N_("Enhanced Open (OWE)"),                     "owe" },
 	{ NULL, NULL }
 };
 
diff --git a/clients/tui/nmt-password-dialog.c b/clients/tui/nmt-password-dialog.c
index 009ab7ce..979a5c68 100644
--- a/clients/tui/nmt-password-dialog.c
+++ b/clients/tui/nmt-password-dialog.c
@@ -175,8 +175,8 @@ nmt_password_dialog_finalize (GObject *object)
 
 	g_free (priv->request_id);
 	g_free (priv->prompt);
-	g_clear_pointer (&priv->entries, g_ptr_array_unref);
-	g_clear_pointer (&priv->secrets, g_ptr_array_unref);
+	nm_clear_pointer (&priv->entries, g_ptr_array_unref);
+	nm_clear_pointer (&priv->secrets, g_ptr_array_unref);
 
 	G_OBJECT_CLASS (nmt_password_dialog_parent_class)->finalize (object);
 }
diff --git a/clients/tui/nmt-route-entry.c b/clients/tui/nmt-route-entry.c
index e0f6df4e..88d64fa3 100644
--- a/clients/tui/nmt-route-entry.c
+++ b/clients/tui/nmt-route-entry.c
@@ -148,7 +148,7 @@ nmt_route_entry_finalize (GObject *object)
 {
 	NmtRouteEntryPrivate *priv = NMT_ROUTE_ENTRY_GET_PRIVATE (object);
 
-	g_clear_pointer (&priv->route, nm_ip_route_unref);
+	nm_clear_pointer (&priv->route, nm_ip_route_unref);
 
 	G_OBJECT_CLASS (nmt_route_entry_parent_class)->finalize (object);
 }
diff --git a/clients/tui/nmtui.c b/clients/tui/nmtui.c
index e9d2ab50..a6ea6f7f 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,11 @@ 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,
+	                              NM_CLIENT_INSTANCE_FLAGS, (guint) NM_CLIENT_INSTANCE_FLAGS_NO_AUTO_FETCH_PERMISSIONS,
+	                              NULL)) {
 		g_printerr (_("Could not contact NetworkManager: %s.\n"), error->message);
 		g_error_free (error);
 		exit (1);