summary refs log tree commit diff
path: root/src/nmtui
diff options
context:
space:
mode:
Diffstat (limited to 'src/nmtui')
-rw-r--r--src/nmtui/nm-editor-utils.c4
-rw-r--r--src/nmtui/nmt-8021x-fields.c2
-rw-r--r--src/nmtui/nmt-address-list.c2
-rw-r--r--src/nmtui/nmt-connect-connection-list.c2
-rw-r--r--src/nmtui/nmt-editor-grid.c8
-rw-r--r--src/nmtui/nmt-editor.c2
-rw-r--r--src/nmtui/nmt-mac-entry.c8
-rw-r--r--src/nmtui/nmt-mac-entry.h3
-rw-r--r--src/nmtui/nmt-page-bond.c2
-rw-r--r--src/nmtui/nmt-page-ethernet.c2
-rw-r--r--src/nmtui/nmt-page-vlan.c2
-rw-r--r--src/nmtui/nmt-page-wifi.c2
-rw-r--r--src/nmtui/nmt-port-list.c2
-rw-r--r--src/nmtui/nmt-route-table.c4
-rw-r--r--src/nmtui/nmtui-connect.c4
-rw-r--r--src/nmtui/nmtui-edit.c4
16 files changed, 28 insertions, 25 deletions
diff --git a/src/nmtui/nm-editor-utils.c b/src/nmtui/nm-editor-utils.c
index 718c0aef..73fad6d1 100644
--- a/src/nmtui/nm-editor-utils.c
+++ b/src/nmtui/nm-editor-utils.c
@@ -447,9 +447,9 @@ nm_editor_utils_create_connection(GType type, NMConnection *controller, NMClient
                  nm_setting_get_name(s_hw),
                  NM_SETTING_CONNECTION_AUTOCONNECT,
                  !type_data->no_autoconnect,
-                 NM_SETTING_CONNECTION_MASTER,
+                 NM_SETTING_CONNECTION_CONTROLLER,
                  controller_uuid,
-                 NM_SETTING_CONNECTION_SLAVE_TYPE,
+                 NM_SETTING_CONNECTION_PORT_TYPE,
                  controller_setting_type,
                  NM_SETTING_CONNECTION_INTERFACE_NAME,
                  ifname,
diff --git a/src/nmtui/nmt-8021x-fields.c b/src/nmtui/nmt-8021x-fields.c
index 3a2185cf..a323be62 100644
--- a/src/nmtui/nmt-8021x-fields.c
+++ b/src/nmtui/nmt-8021x-fields.c
@@ -552,7 +552,7 @@ nmt_8021x_fields_constructed(GObject *object)
         entry.id    = (char *) eap_method_descs[i].id;
         g_array_append_val(entries, entry);
     }
-    priv->authentication = nmt_newt_popup_new(nm_g_array_index_p(entries, NmtNewtPopupEntry, 0));
+    priv->authentication = nmt_newt_popup_new(nm_g_array_first_p(entries, NmtNewtPopupEntry));
     nmt_editor_grid_append(grid, "Authentication", NMT_NEWT_WIDGET(priv->authentication), NULL);
 
     widget = nmt_newt_stack_new();
diff --git a/src/nmtui/nmt-address-list.c b/src/nmtui/nmt-address-list.c
index dba8e790..ff4bf1a4 100644
--- a/src/nmtui/nmt-address-list.c
+++ b/src/nmtui/nmt-address-list.c
@@ -194,7 +194,7 @@ nmt_address_list_set_property(GObject      *object,
         g_strfreev(priv->strings);
         priv->strings = g_value_dup_boxed(value);
         if (!priv->strings)
-            priv->strings = g_new0(char *, 1);
+            priv->strings = nm_strv_empty_new();
         nmt_widget_list_set_length(NMT_WIDGET_LIST(object), g_strv_length(priv->strings));
         break;
     default:
diff --git a/src/nmtui/nmt-connect-connection-list.c b/src/nmtui/nmt-connect-connection-list.c
index 5d771b61..329494cc 100644
--- a/src/nmtui/nmt-connect-connection-list.c
+++ b/src/nmtui/nmt-connect-connection-list.c
@@ -480,7 +480,7 @@ nmt_connect_connection_list_rebuild(NmtConnectConnectionList *list)
         for (citer = nmtdev->conns; citer; citer = citer->next) {
             nmtconn = citer->data;
 
-            max_width = MAX(max_width, nmt_newt_text_width(nmtconn->name));
+            max_width = NM_MAX(max_width, nmt_newt_text_width(nmtconn->name));
         }
     }
 
diff --git a/src/nmtui/nmt-editor-grid.c b/src/nmtui/nmt-editor-grid.c
index 9b76e3fe..bdcc02e2 100644
--- a/src/nmtui/nmt-editor-grid.c
+++ b/src/nmtui/nmt-editor-grid.c
@@ -326,10 +326,10 @@ nmt_editor_grid_size_request(NmtNewtWidget *widget, int *width, int *height)
         if (rows[i].label) {
             nmt_newt_widget_size_request(rows[i].label, &lwidth, &lheight);
             lwidth += priv->indent;
-            state->col_widths[0] = MAX(state->col_widths[0], lwidth);
+            state->col_widths[0] = NM_MAX(state->col_widths[0], lwidth);
 
             nmt_newt_widget_size_request(rows[i].widget, &wwidth, &wheight);
-            state->col_widths[1] = MAX(state->col_widths[1], wwidth);
+            state->col_widths[1] = NM_MAX(state->col_widths[1], wwidth);
             priv->row_heights[i] = wheight;
 
             add_padding = TRUE;
@@ -340,8 +340,8 @@ nmt_editor_grid_size_request(NmtNewtWidget *widget, int *width, int *height)
 
         if (rows[i].extra) {
             nmt_newt_widget_size_request(rows[i].extra, &ewidth, &eheight);
-            state->col_widths[2] = MAX(state->col_widths[2], ewidth);
-            priv->row_heights[i] = MAX(priv->row_heights[i], eheight);
+            state->col_widths[2] = NM_MAX(state->col_widths[2], ewidth);
+            priv->row_heights[i] = NM_MAX(priv->row_heights[i], eheight);
         }
 
         *height += priv->row_heights[i];
diff --git a/src/nmtui/nmt-editor.c b/src/nmtui/nmt-editor.c
index ad8803b6..6e502778 100644
--- a/src/nmtui/nmt-editor.c
+++ b/src/nmtui/nmt-editor.c
@@ -385,7 +385,7 @@ nmt_editor_constructed(GObject *object)
     add_sections_for_page(editor, grid, page);
     nmt_editor_grid_append(grid, NULL, nmt_newt_separator_new(), NULL);
 
-    port_type = nm_setting_connection_get_slave_type(s_con);
+    port_type = nm_setting_connection_get_port_type(s_con);
     if (port_type) {
         if (!strcmp(port_type, NM_SETTING_BRIDGE_SETTING_NAME))
             add_sections_for_page(editor, grid, nmt_page_bridge_port_new(priv->edit_connection));
diff --git a/src/nmtui/nmt-mac-entry.c b/src/nmtui/nmt-mac-entry.c
index 11ceecf9..6cecf0e9 100644
--- a/src/nmtui/nmt-mac-entry.c
+++ b/src/nmtui/nmt-mac-entry.c
@@ -90,8 +90,10 @@ mac_validator(NmtNewtEntry *entry, const char *text, gpointer user_data)
     if (!*text)
         return TRUE;
 
-    if (priv->entry_type == NMT_MAC_ENTRY_TYPE_CLONED) {
-        if (NM_CLONED_MAC_IS_SPECIAL(text))
+    if (NM_IN_SET(priv->entry_type,
+                  NMT_MAC_ENTRY_TYPE_CLONED_ETHERNET,
+                  NMT_MAC_ENTRY_TYPE_CLONED_WIFI)) {
+        if (NM_CLONED_MAC_IS_SPECIAL(text, priv->entry_type == NMT_MAC_ENTRY_TYPE_CLONED_WIFI))
             return TRUE;
     }
 
@@ -237,7 +239,7 @@ nmt_mac_entry_class_init(NmtMacEntryClass *entry_class)
                          "",
                          "",
                          NMT_MAC_ENTRY_TYPE_MAC,
-                         NMT_MAC_ENTRY_TYPE_CLONED,
+                         NMT_MAC_ENTRY_TYPE_CLONED_WIFI,
                          NMT_MAC_ENTRY_TYPE_MAC,
                          G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
 }
diff --git a/src/nmtui/nmt-mac-entry.h b/src/nmtui/nmt-mac-entry.h
index 6b5b2896..c5acd35a 100644
--- a/src/nmtui/nmt-mac-entry.h
+++ b/src/nmtui/nmt-mac-entry.h
@@ -11,7 +11,8 @@
 
 typedef enum {
     NMT_MAC_ENTRY_TYPE_MAC,
-    NMT_MAC_ENTRY_TYPE_CLONED,
+    NMT_MAC_ENTRY_TYPE_CLONED_ETHERNET,
+    NMT_MAC_ENTRY_TYPE_CLONED_WIFI,
 } NmtMacEntryType;
 
 #define NMT_TYPE_MAC_ENTRY (nmt_mac_entry_get_type())
diff --git a/src/nmtui/nmt-page-bond.c b/src/nmtui/nmt-page-bond.c
index 5a64590c..c7483150 100644
--- a/src/nmtui/nmt-page-bond.c
+++ b/src/nmtui/nmt-page-bond.c
@@ -395,7 +395,7 @@ nmt_page_bond_constructed(GObject *object)
     nmt_editor_grid_append(grid, _("ARP targets"), widget, NULL);
     priv->arp_ip_target = NMT_ADDRESS_LIST(widget);
 
-    widget = nmt_mac_entry_new(40, ETH_ALEN, NMT_MAC_ENTRY_TYPE_CLONED);
+    widget = nmt_mac_entry_new(40, ETH_ALEN, NMT_MAC_ENTRY_TYPE_CLONED_ETHERNET);
     g_object_bind_property(s_wired,
                            NM_SETTING_WIRED_CLONED_MAC_ADDRESS,
                            widget,
diff --git a/src/nmtui/nmt-page-ethernet.c b/src/nmtui/nmt-page-ethernet.c
index 77abbb40..652a2603 100644
--- a/src/nmtui/nmt-page-ethernet.c
+++ b/src/nmtui/nmt-page-ethernet.c
@@ -107,7 +107,7 @@ nmt_page_ethernet_constructed(GObject *object)
     section = nmt_editor_section_new(_("ETHERNET"), NULL, FALSE);
     grid    = nmt_editor_section_get_body(section);
 
-    widget = nmt_mac_entry_new(40, ETH_ALEN, NMT_MAC_ENTRY_TYPE_CLONED);
+    widget = nmt_mac_entry_new(40, ETH_ALEN, NMT_MAC_ENTRY_TYPE_CLONED_ETHERNET);
     g_object_bind_property(s_wired,
                            NM_SETTING_WIRED_CLONED_MAC_ADDRESS,
                            widget,
diff --git a/src/nmtui/nmt-page-vlan.c b/src/nmtui/nmt-page-vlan.c
index 1956d3d6..238dbafb 100644
--- a/src/nmtui/nmt-page-vlan.c
+++ b/src/nmtui/nmt-page-vlan.c
@@ -83,7 +83,7 @@ nmt_page_vlan_constructed(GObject *object)
 
     nmt_editor_grid_append(grid, NULL, nmt_newt_separator_new(), NULL);
 
-    widget = nmt_mac_entry_new(40, ETH_ALEN, NMT_MAC_ENTRY_TYPE_CLONED);
+    widget = nmt_mac_entry_new(40, ETH_ALEN, NMT_MAC_ENTRY_TYPE_CLONED_ETHERNET);
     g_object_bind_property(s_wired,
                            NM_SETTING_WIRED_CLONED_MAC_ADDRESS,
                            widget,
diff --git a/src/nmtui/nmt-page-wifi.c b/src/nmtui/nmt-page-wifi.c
index 55feaee2..9767597b 100644
--- a/src/nmtui/nmt-page-wifi.c
+++ b/src/nmtui/nmt-page-wifi.c
@@ -378,7 +378,7 @@ nmt_page_wifi_constructed(GObject *object)
                            G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
     nmt_editor_grid_append(grid, _("BSSID"), widget, NULL);
 
-    widget = nmt_mac_entry_new(40, ETH_ALEN, NMT_MAC_ENTRY_TYPE_CLONED);
+    widget = nmt_mac_entry_new(40, ETH_ALEN, NMT_MAC_ENTRY_TYPE_CLONED_WIFI);
     g_object_bind_property(s_wireless,
                            NM_SETTING_WIRELESS_CLONED_MAC_ADDRESS,
                            widget,
diff --git a/src/nmtui/nmt-port-list.c b/src/nmtui/nmt-port-list.c
index 9f964c73..9e4dd8a6 100644
--- a/src/nmtui/nmt-port-list.c
+++ b/src/nmtui/nmt-port-list.c
@@ -103,7 +103,7 @@ nmt_port_list_connection_filter(NmtEditConnectionList *list,
     s_con = nm_connection_get_setting_connection(connection);
     g_return_val_if_fail(s_con != NULL, FALSE);
 
-    port_type = nm_setting_connection_get_slave_type(s_con);
+    port_type = nm_setting_connection_get_port_type(s_con);
     if (g_strcmp0(port_type, priv->controller_type) != 0)
         return FALSE;
 
diff --git a/src/nmtui/nmt-route-table.c b/src/nmtui/nmt-route-table.c
index 4dc28d7c..04c37f3a 100644
--- a/src/nmtui/nmt-route-table.c
+++ b/src/nmtui/nmt-route-table.c
@@ -185,8 +185,8 @@ nmt_route_table_init(NmtRouteTable *table)
     metric_width = nmt_newt_text_width(text);
     nmt_newt_grid_add(NMT_NEWT_GRID(header), metric_label, 2, 0);
 
-    priv->ip_entry_width     = MAX(20, MAX(dest_prefix_width, next_hop_width));
-    priv->metric_entry_width = MAX(7, metric_width);
+    priv->ip_entry_width     = NM_MAX(20, NM_MAX(dest_prefix_width, next_hop_width));
+    priv->metric_entry_width = NM_MAX(7, metric_width);
 
     nmt_newt_widget_set_padding(dest_prefix_label,
                                 0,
diff --git a/src/nmtui/nmtui-connect.c b/src/nmtui/nmtui-connect.c
index 0dfbf6ac..4f90adf3 100644
--- a/src/nmtui/nmtui-connect.c
+++ b/src/nmtui/nmtui-connect.c
@@ -326,8 +326,8 @@ listbox_active_changed(GObject *object, GParamSpec *pspec, gpointer button)
         deactivate       = _("Deactivate");
         deactivate_width = nmt_newt_text_width(deactivate);
 
-        activate_padding   = MAX(0, deactivate_width - activate_width);
-        deactivate_padding = MAX(0, activate_width - deactivate_width);
+        activate_padding   = NM_MAX(0, deactivate_width - activate_width);
+        deactivate_padding = NM_MAX(0, activate_width - deactivate_width);
     }
 
     has_selection = nmt_connect_connection_list_get_selection(list, NULL, NULL, NULL, &ac);
diff --git a/src/nmtui/nmtui-edit.c b/src/nmtui/nmtui-edit.c
index 3cedf197..723cfea9 100644
--- a/src/nmtui/nmtui-edit.c
+++ b/src/nmtui/nmtui-edit.c
@@ -61,7 +61,7 @@ edit_connection_list_filter(NmtEditConnectionList *list,
     controller = nm_setting_connection_get_master(s_con);
     if (!controller)
         return TRUE;
-    port_type = nm_setting_connection_get_slave_type(s_con);
+    port_type = nm_setting_connection_get_port_type(s_con);
     if (g_strcmp0(port_type, NM_SETTING_BOND_SETTING_NAME) != 0
         && g_strcmp0(port_type, NM_SETTING_TEAM_SETTING_NAME) != 0
         && g_strcmp0(port_type, NM_SETTING_BRIDGE_SETTING_NAME) != 0)
@@ -511,7 +511,7 @@ nmt_remove_connection(NMRemoteConnection *connection)
                                     _("Delete"),
                                     _("Are you sure you want to delete the connection '%s'?"),
                                     nm_connection_get_id(NM_CONNECTION(connection)));
-    if (choice == 1)
+    if (choice != 2)
         return;
 
     g_object_ref(connection);