Commit e01de575 authored by Thomas Haller's avatar Thomas Haller

c-e: forward the validation error to print more sensible error message to stdout

When a connection doesn't verify, the "Save" dialog stays desensitized.
Even for an advanced user it's not immediately clear what causes the
valdation failure.

We already print a message like "Invalid setting Ethernet" to stdout.
Extend the message to also print an more detailed error that gets propagated
from the validation.

This later should be improved further to indicating the failure reason
in the UI too.
parent 97954684
...@@ -128,8 +128,13 @@ ce_page_validate (CEPage *self, NMConnection *connection, GError **error) ...@@ -128,8 +128,13 @@ ce_page_validate (CEPage *self, NMConnection *connection, GError **error)
g_return_val_if_fail (CE_IS_PAGE (self), FALSE); g_return_val_if_fail (CE_IS_PAGE (self), FALSE);
g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE); g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE);
if (CE_PAGE_GET_CLASS (self)->ce_page_validate_v) if (CE_PAGE_GET_CLASS (self)->ce_page_validate_v) {
return CE_PAGE_GET_CLASS (self)->ce_page_validate_v (self, connection, error); if (!CE_PAGE_GET_CLASS (self)->ce_page_validate_v (self, connection, error)) {
if (error && !*error)
g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("unspecified error"));
return FALSE;
}
}
return TRUE; return TRUE;
} }
...@@ -210,18 +215,51 @@ ce_page_setup_mac_combo (CEPage *self, GtkComboBox *combo, ...@@ -210,18 +215,51 @@ ce_page_setup_mac_combo (CEPage *self, GtkComboBox *combo,
} }
gboolean gboolean
ce_page_mac_entry_valid (GtkEntry *entry, int type) ce_page_mac_entry_valid (GtkEntry *entry, int type, const char *property_name, GError **error)
{ {
const char *mac; const char *mac;
g_return_val_if_fail (entry != NULL, FALSE);
g_return_val_if_fail (GTK_IS_ENTRY (entry), FALSE); g_return_val_if_fail (GTK_IS_ENTRY (entry), FALSE);
mac = gtk_entry_get_text (entry); mac = gtk_entry_get_text (entry);
if (!mac || !*mac) if (mac && *mac) {
return TRUE; if (!nm_utils_hwaddr_valid (mac, nm_utils_hwaddr_len (type))) {
const char *addr_type;
addr_type = type == ARPHRD_ETHER ? _("MAC address") : _("HW addreess");
if (property_name) {
g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC,
_("invalid %s for %s (%s)"),
addr_type, property_name, mac);
} else {
g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC,
_("invalid %s (%s)"),
addr_type, mac);
}
return FALSE;
}
}
return TRUE;
}
return nm_utils_hwaddr_valid (mac, nm_utils_hwaddr_len (type)); gboolean
ce_page_interface_name_valid (const char *iface, const char *property_name, GError **error)
{
if (iface && *iface) {
if (!nm_utils_iface_valid_name (iface)) {
if (property_name) {
g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC,
_("invalid interface-name for %s (%s)"),
property_name, iface);
} else {
g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC,
_("invalid interface-name (%s)"),
iface);
}
return FALSE;
}
}
return TRUE;
} }
static char ** static char **
...@@ -376,16 +414,19 @@ ce_page_setup_device_combo (CEPage *self, ...@@ -376,16 +414,19 @@ ce_page_setup_device_combo (CEPage *self,
} }
gboolean gboolean
ce_page_device_entry_get (GtkEntry *entry, int type, char **ifname, char **mac) ce_page_device_entry_get (GtkEntry *entry, int type, char **ifname, char **mac, const char *device_name, GError **error)
{ {
char *first, *second; char *first, *second;
const char *ifname_tmp = NULL, *mac_tmp = NULL; const char *ifname_tmp = NULL, *mac_tmp = NULL;
gboolean valid = TRUE; gboolean valid = TRUE;
const char *str;
g_return_val_if_fail (entry != NULL, FALSE); g_return_val_if_fail (entry != NULL, FALSE);
g_return_val_if_fail (GTK_IS_ENTRY (entry), FALSE); g_return_val_if_fail (GTK_IS_ENTRY (entry), FALSE);
valid = _device_entry_parse (gtk_entry_get_text (entry), &first, &second); str = gtk_entry_get_text (entry);
valid = _device_entry_parse (str, &first, &second);
if (first) { if (first) {
if (nm_utils_hwaddr_valid (first, nm_utils_hwaddr_len (type))) if (nm_utils_hwaddr_valid (first, nm_utils_hwaddr_len (type)))
...@@ -418,6 +459,13 @@ ce_page_device_entry_get (GtkEntry *entry, int type, char **ifname, char **mac) ...@@ -418,6 +459,13 @@ ce_page_device_entry_get (GtkEntry *entry, int type, char **ifname, char **mac)
g_free (first); g_free (first);
g_free (second); g_free (second);
if (!valid) {
g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC,
_("invalid %s (%s)"),
device_name ? device_name : _("device"),
str);
}
return valid; return valid;
} }
......
...@@ -114,9 +114,12 @@ void ce_page_setup_device_combo (CEPage *self, ...@@ -114,9 +114,12 @@ void ce_page_setup_device_combo (CEPage *self,
const char *mac, const char *mac,
const char *mac_property, const char *mac_property,
gboolean ifname_first); gboolean ifname_first);
gboolean ce_page_mac_entry_valid (GtkEntry *entry, int type); gboolean ce_page_mac_entry_valid (GtkEntry *entry, int type, const char *property_name, GError **error);
gboolean ce_page_interface_name_valid (const char *iface, const char *property_name, GError **error);
gboolean ce_page_device_entry_get (GtkEntry *entry, int type, gboolean ce_page_device_entry_get (GtkEntry *entry, int type,
char **ifname, char **mac); char **ifname, char **mac,
const char *device_name,
GError **error);
void ce_page_changed (CEPage *self); void ce_page_changed (CEPage *self);
......
...@@ -143,8 +143,7 @@ ce_page_validate_v (CEPage *page, NMConnection *connection, GError **error) ...@@ -143,8 +143,7 @@ ce_page_validate_v (CEPage *page, NMConnection *connection, GError **error)
NMConnection *tmp_connection; NMConnection *tmp_connection;
NMSetting *s_8021x; NMSetting *s_8021x;
/* FIXME: get failed property and error out of wireless security objects */ valid = wireless_security_validate (priv->security, error);
valid = wireless_security_validate (priv->security);
if (valid) { if (valid) {
NMSetting *s_con; NMSetting *s_con;
...@@ -164,8 +163,7 @@ ce_page_validate_v (CEPage *page, NMConnection *connection, GError **error) ...@@ -164,8 +163,7 @@ ce_page_validate_v (CEPage *page, NMConnection *connection, GError **error)
nm_connection_add_setting (connection, NM_SETTING (g_object_ref (s_8021x))); nm_connection_add_setting (connection, NM_SETTING (g_object_ref (s_8021x)));
g_object_unref (tmp_connection); g_object_unref (tmp_connection);
} else }
g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, "Invalid 802.1x security");
} else { } else {
nm_connection_remove_setting (connection, NM_TYPE_SETTING_802_1X); nm_connection_remove_setting (connection, NM_TYPE_SETTING_802_1X);
valid = TRUE; valid = TRUE;
......
...@@ -145,7 +145,7 @@ ce_page_validate_v (CEPage *page, NMConnection *connection, GError **error) ...@@ -145,7 +145,7 @@ ce_page_validate_v (CEPage *page, NMConnection *connection, GError **error)
CEPageBluetooth *self = CE_PAGE_BLUETOOTH (page); CEPageBluetooth *self = CE_PAGE_BLUETOOTH (page);
CEPageBluetoothPrivate *priv = CE_PAGE_BLUETOOTH_GET_PRIVATE (self); CEPageBluetoothPrivate *priv = CE_PAGE_BLUETOOTH_GET_PRIVATE (self);
if (!ce_page_mac_entry_valid (priv->bdaddr, ARPHRD_ETHER)) if (!ce_page_mac_entry_valid (priv->bdaddr, ARPHRD_ETHER, _("bdaddr"), error))
return FALSE; return FALSE;
ui_to_setting (self); ui_to_setting (self);
......
...@@ -558,13 +558,12 @@ ce_page_validate_v (CEPage *page, NMConnection *connection, GError **error) ...@@ -558,13 +558,12 @@ ce_page_validate_v (CEPage *page, NMConnection *connection, GError **error)
{ {
CEPageBond *self = CE_PAGE_BOND (page); CEPageBond *self = CE_PAGE_BOND (page);
CEPageBondPrivate *priv = CE_PAGE_BOND_GET_PRIVATE (self); CEPageBondPrivate *priv = CE_PAGE_BOND_GET_PRIVATE (self);
const char *primary;
if (!CE_PAGE_CLASS (ce_page_bond_parent_class)->ce_page_validate_v (page, connection, error)) if (!CE_PAGE_CLASS (ce_page_bond_parent_class)->ce_page_validate_v (page, connection, error))
return FALSE; return FALSE;
primary = gtk_entry_get_text (priv->primary); if (!ce_page_interface_name_valid (gtk_entry_get_text (priv->primary),
if (primary && *primary && !nm_utils_iface_valid_name (primary)) _("primary"), error))
return FALSE; return FALSE;
ui_to_setting (self); ui_to_setting (self);
......
...@@ -304,7 +304,7 @@ ui_to_setting (CEPageEthernet *self) ...@@ -304,7 +304,7 @@ ui_to_setting (CEPageEthernet *self)
entry = gtk_bin_get_child (GTK_BIN (priv->device_combo)); entry = gtk_bin_get_child (GTK_BIN (priv->device_combo));
if (entry) if (entry)
ce_page_device_entry_get (GTK_ENTRY (entry), ARPHRD_ETHER, &ifname, &device_mac); ce_page_device_entry_get (GTK_ENTRY (entry), ARPHRD_ETHER, &ifname, &device_mac, NULL, NULL);
cloned_mac = gtk_entry_get_text (priv->cloned_mac); cloned_mac = gtk_entry_get_text (priv->cloned_mac);
g_object_set (s_con, g_object_set (s_con,
...@@ -333,11 +333,11 @@ ce_page_validate_v (CEPage *page, NMConnection *connection, GError **error) ...@@ -333,11 +333,11 @@ ce_page_validate_v (CEPage *page, NMConnection *connection, GError **error)
entry = gtk_bin_get_child (GTK_BIN (priv->device_combo)); entry = gtk_bin_get_child (GTK_BIN (priv->device_combo));
if (entry) { if (entry) {
if (!ce_page_device_entry_get (GTK_ENTRY (entry), ARPHRD_ETHER, NULL, NULL)) if (!ce_page_device_entry_get (GTK_ENTRY (entry), ARPHRD_ETHER, NULL, NULL, _("Ethernet device"), error))
return FALSE; return FALSE;
} }
if (!ce_page_mac_entry_valid (priv->cloned_mac, ARPHRD_ETHER)) if (!ce_page_mac_entry_valid (priv->cloned_mac, ARPHRD_ETHER, _("cloned MAC"), error))
return FALSE; return FALSE;
ui_to_setting (self); ui_to_setting (self);
......
...@@ -190,7 +190,7 @@ ui_to_setting (CEPageInfiniband *self) ...@@ -190,7 +190,7 @@ ui_to_setting (CEPageInfiniband *self)
entry = gtk_bin_get_child (GTK_BIN (priv->device_combo)); entry = gtk_bin_get_child (GTK_BIN (priv->device_combo));
if (entry) if (entry)
ce_page_device_entry_get (GTK_ENTRY (entry), ARPHRD_INFINIBAND, &ifname, &device_mac); ce_page_device_entry_get (GTK_ENTRY (entry), ARPHRD_INFINIBAND, &ifname, &device_mac, NULL, NULL);
g_object_set (s_con, g_object_set (s_con,
NM_SETTING_CONNECTION_INTERFACE_NAME, ifname, NM_SETTING_CONNECTION_INTERFACE_NAME, ifname,
...@@ -214,7 +214,7 @@ ce_page_validate_v (CEPage *page, NMConnection *connection, GError **error) ...@@ -214,7 +214,7 @@ ce_page_validate_v (CEPage *page, NMConnection *connection, GError **error)
entry = gtk_bin_get_child (GTK_BIN (priv->device_combo)); entry = gtk_bin_get_child (GTK_BIN (priv->device_combo));
if (entry) { if (entry) {
if (!ce_page_device_entry_get (GTK_ENTRY (entry), ARPHRD_INFINIBAND, NULL, NULL)) if (!ce_page_device_entry_get (GTK_ENTRY (entry), ARPHRD_INFINIBAND, NULL, NULL, _("infiniband device"), error))
return FALSE; return FALSE;
} }
......
...@@ -1174,7 +1174,7 @@ free_one_addr (gpointer data) ...@@ -1174,7 +1174,7 @@ free_one_addr (gpointer data)
} }
static gboolean static gboolean
ui_to_setting (CEPageIP4 *self) ui_to_setting (CEPageIP4 *self, GError **error)
{ {
CEPageIP4Private *priv = CE_PAGE_IP4_GET_PRIVATE (self); CEPageIP4Private *priv = CE_PAGE_IP4_GET_PRIVATE (self);
GtkTreeModel *model; GtkTreeModel *model;
...@@ -1239,8 +1239,7 @@ ui_to_setting (CEPageIP4 *self) ...@@ -1239,8 +1239,7 @@ ui_to_setting (CEPageIP4 *self)
if ( !addr if ( !addr
|| !nm_utils_ipaddr_valid (AF_INET, addr) || !nm_utils_ipaddr_valid (AF_INET, addr)
|| is_address_unspecified (addr)) { || is_address_unspecified (addr)) {
g_warning ("%s: IPv4 address '%s' missing or invalid!", g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, _("IPv4 address \"%s\" invalid"), addr ? addr : "");
__func__, addr ? addr : "<none>");
g_free (addr); g_free (addr);
g_free (netmask); g_free (netmask);
g_free (addr_gw); g_free (addr_gw);
...@@ -1248,8 +1247,7 @@ ui_to_setting (CEPageIP4 *self) ...@@ -1248,8 +1247,7 @@ ui_to_setting (CEPageIP4 *self)
} }
if (!parse_netmask (netmask, &prefix)) { if (!parse_netmask (netmask, &prefix)) {
g_warning ("%s: IPv4 prefix '%s' missing or invalid!", g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, _("IPv4 address netmask \"%s\" invalid"), netmask ? netmask : "");
__func__, netmask ? netmask : "<none>");
g_free (addr); g_free (addr);
g_free (netmask); g_free (netmask);
g_free (addr_gw); g_free (addr_gw);
...@@ -1258,8 +1256,7 @@ ui_to_setting (CEPageIP4 *self) ...@@ -1258,8 +1256,7 @@ ui_to_setting (CEPageIP4 *self)
/* Gateway is optional... */ /* Gateway is optional... */
if (addr_gw && *addr_gw && !nm_utils_ipaddr_valid (AF_INET, addr_gw)) { if (addr_gw && *addr_gw && !nm_utils_ipaddr_valid (AF_INET, addr_gw)) {
g_warning ("%s: IPv4 gateway '%s' invalid!", g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, _("IPv4 gateway \"%s\" invalid"), addr_gw);
__func__, addr_gw);
g_free (addr); g_free (addr);
g_free (netmask); g_free (netmask);
g_free (addr_gw); g_free (addr_gw);
...@@ -1302,6 +1299,7 @@ ui_to_setting (CEPageIP4 *self) ...@@ -1302,6 +1299,7 @@ ui_to_setting (CEPageIP4 *self)
if (inet_pton (AF_INET, stripped, &tmp_addr)) if (inet_pton (AF_INET, stripped, &tmp_addr))
g_ptr_array_add (tmp_array, g_strdup (stripped)); g_ptr_array_add (tmp_array, g_strdup (stripped));
else { else {
g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, _("IPv4 DNS server \"%s\" invalid"), stripped);
g_strfreev (items); g_strfreev (items);
g_ptr_array_free (tmp_array, TRUE); g_ptr_array_free (tmp_array, TRUE);
goto out; goto out;
...@@ -1369,7 +1367,7 @@ ce_page_validate_v (CEPage *page, NMConnection *connection, GError **error) ...@@ -1369,7 +1367,7 @@ ce_page_validate_v (CEPage *page, NMConnection *connection, GError **error)
CEPageIP4 *self = CE_PAGE_IP4 (page); CEPageIP4 *self = CE_PAGE_IP4 (page);
CEPageIP4Private *priv = CE_PAGE_IP4_GET_PRIVATE (self); CEPageIP4Private *priv = CE_PAGE_IP4_GET_PRIVATE (self);
if (!ui_to_setting (self)) if (!ui_to_setting (self, error))
return FALSE; return FALSE;
return nm_setting_verify (NM_SETTING (priv->setting), NULL, error); return nm_setting_verify (NM_SETTING (priv->setting), NULL, error);
} }
......
...@@ -1176,7 +1176,7 @@ ce_page_ip6_new (NMConnection *connection, ...@@ -1176,7 +1176,7 @@ ce_page_ip6_new (NMConnection *connection,
} }
static gboolean static gboolean
ui_to_setting (CEPageIP6 *self) ui_to_setting (CEPageIP6 *self, GError **error)
{ {
CEPageIP6Private *priv = CE_PAGE_IP6_GET_PRIVATE (self); CEPageIP6Private *priv = CE_PAGE_IP6_GET_PRIVATE (self);
GtkTreeModel *model; GtkTreeModel *model;
...@@ -1245,8 +1245,7 @@ ui_to_setting (CEPageIP6 *self) ...@@ -1245,8 +1245,7 @@ ui_to_setting (CEPageIP6 *self)
if ( !addr_str if ( !addr_str
|| !nm_utils_ipaddr_valid (AF_INET6, addr_str) || !nm_utils_ipaddr_valid (AF_INET6, addr_str)
|| is_address_unspecified (addr_str)) { || is_address_unspecified (addr_str)) {
g_warning ("%s: IPv6 address '%s' missing or invalid!", g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, _("IPv6 address \"%s\" invalid"), addr_str ? addr_str : "");
__func__, addr_str ? addr_str : "<none>");
g_free (addr_str); g_free (addr_str);
g_free (prefix_str); g_free (prefix_str);
g_free (addr_gw_str); g_free (addr_gw_str);
...@@ -1254,10 +1253,7 @@ ui_to_setting (CEPageIP6 *self) ...@@ -1254,10 +1253,7 @@ ui_to_setting (CEPageIP6 *self)
} }
if (!is_prefix_valid (prefix_str, &prefix)) { if (!is_prefix_valid (prefix_str, &prefix)) {
if (!prefix_str) g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, _("IPv6 prefix \"%s\" invalid"), prefix_str ? prefix_str : "");
g_warning ("%s: IPv6 prefix missing!", __func__);
else
g_warning ("%s: IPv6 prefix '%s' invalid!", __func__, prefix_str);
g_free (addr_str); g_free (addr_str);
g_free (prefix_str); g_free (prefix_str);
g_free (addr_gw_str); g_free (addr_gw_str);
...@@ -1266,8 +1262,7 @@ ui_to_setting (CEPageIP6 *self) ...@@ -1266,8 +1262,7 @@ ui_to_setting (CEPageIP6 *self)
/* Gateway is optional... */ /* Gateway is optional... */
if (addr_gw_str && *addr_gw_str && !nm_utils_ipaddr_valid (AF_INET6, addr_gw_str)) { if (addr_gw_str && *addr_gw_str && !nm_utils_ipaddr_valid (AF_INET6, addr_gw_str)) {
g_warning ("%s: IPv6 gateway '%s' invalid!", g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, _("IPv6 gateway \"%s\" invalid"), addr_gw_str);
__func__, addr_gw_str);
g_free (addr_str); g_free (addr_str);
g_free (prefix_str); g_free (prefix_str);
g_free (addr_gw_str); g_free (addr_gw_str);
...@@ -1309,6 +1304,7 @@ ui_to_setting (CEPageIP6 *self) ...@@ -1309,6 +1304,7 @@ ui_to_setting (CEPageIP6 *self)
if (inet_pton (AF_INET6, stripped, &tmp_addr)) { if (inet_pton (AF_INET6, stripped, &tmp_addr)) {
nm_setting_ip_config_add_dns (priv->setting, stripped); nm_setting_ip_config_add_dns (priv->setting, stripped);
} else { } else {
g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, _("IPv6 DNS server \"%s\" invalid"), stripped);
g_strfreev (items); g_strfreev (items);
goto out; goto out;
} }
...@@ -1366,7 +1362,7 @@ ce_page_validate_v (CEPage *page, NMConnection *connection, GError **error) ...@@ -1366,7 +1362,7 @@ ce_page_validate_v (CEPage *page, NMConnection *connection, GError **error)
CEPageIP6 *self = CE_PAGE_IP6 (page); CEPageIP6 *self = CE_PAGE_IP6 (page);
CEPageIP6Private *priv = CE_PAGE_IP6_GET_PRIVATE (self); CEPageIP6Private *priv = CE_PAGE_IP6_GET_PRIVATE (self);
if (!ui_to_setting (self)) if (!ui_to_setting (self, error))
return FALSE; return FALSE;
return nm_setting_verify (NM_SETTING (priv->setting), NULL, error); return nm_setting_verify (NM_SETTING (priv->setting), NULL, error);
} }
......
...@@ -722,17 +722,16 @@ ce_page_validate_v (CEPage *page, NMConnection *connection, GError **error) ...@@ -722,17 +722,16 @@ ce_page_validate_v (CEPage *page, NMConnection *connection, GError **error)
char *parent_iface; char *parent_iface;
if (gtk_combo_box_get_active (GTK_COMBO_BOX (priv->parent)) == -1) { if (gtk_combo_box_get_active (GTK_COMBO_BOX (priv->parent)) == -1) {
gboolean valid;
parent = gtk_entry_get_text (priv->parent_entry); parent = gtk_entry_get_text (priv->parent_entry);
parent_iface = g_strndup (parent, strcspn (parent, " ")); parent_iface = g_strndup (parent, strcspn (parent, " "));
valid = nm_utils_iface_valid_name (parent_iface); if (!ce_page_interface_name_valid (parent_iface, _("vlan parent"), error)) {
g_free (parent_iface); g_free (parent_iface);
if (!valid)
return FALSE; return FALSE;
}
g_free (parent_iface);
} }
if (!ce_page_mac_entry_valid (priv->cloned_mac, ARPHRD_ETHER)) if (!ce_page_mac_entry_valid (priv->cloned_mac, ARPHRD_ETHER, _("cloned MAC"), error))
return FALSE; return FALSE;
ui_to_setting (self); ui_to_setting (self);
......
...@@ -475,20 +475,17 @@ ce_page_validate_v (CEPage *page, NMConnection *connection, GError **error) ...@@ -475,20 +475,17 @@ ce_page_validate_v (CEPage *page, NMConnection *connection, GError **error)
GBytes *ssid = nm_setting_wireless_get_ssid (s_wireless); GBytes *ssid = nm_setting_wireless_get_ssid (s_wireless);
if (ssid) { if (ssid) {
/* FIXME: get failed property and error out of wifi security objects */ valid = wireless_security_validate (sec, error);
valid = wireless_security_validate (sec);
if (valid) if (valid)
wireless_security_fill_connection (sec, connection); wireless_security_fill_connection (sec, connection);
else
g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, "Invalid Wi-Fi security");
} else { } else {
g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, "Missing SSID"); g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, _("missing SSID"));
valid = FALSE; valid = FALSE;
} }
if (priv->adhoc) { if (priv->adhoc) {
if (!wireless_security_adhoc_compatible (sec)) { if (!wireless_security_adhoc_compatible (sec)) {
g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, "Security not compatible with Ad-Hoc mode"); g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, _("Security not compatible with Ad-Hoc mode"));
valid = FALSE; valid = FALSE;
} }
} }
......
...@@ -529,7 +529,7 @@ ui_to_setting (CEPageWifi *self) ...@@ -529,7 +529,7 @@ ui_to_setting (CEPageWifi *self)
bssid = gtk_entry_get_text (GTK_ENTRY (entry)); bssid = gtk_entry_get_text (GTK_ENTRY (entry));
entry = gtk_bin_get_child (GTK_BIN (priv->device_combo)); entry = gtk_bin_get_child (GTK_BIN (priv->device_combo));
if (entry) if (entry)
ce_page_device_entry_get (GTK_ENTRY (entry), ARPHRD_ETHER, &ifname, &device_mac); ce_page_device_entry_get (GTK_ENTRY (entry), ARPHRD_ETHER, &ifname, &device_mac, NULL, NULL);
cloned_mac = gtk_entry_get_text (priv->cloned_mac); cloned_mac = gtk_entry_get_text (priv->cloned_mac);
g_object_set (s_con, g_object_set (s_con,
...@@ -563,17 +563,17 @@ ce_page_validate_v (CEPage *page, NMConnection *connection, GError **error) ...@@ -563,17 +563,17 @@ ce_page_validate_v (CEPage *page, NMConnection *connection, GError **error)
entry = gtk_bin_get_child (GTK_BIN (priv->bssid)); entry = gtk_bin_get_child (GTK_BIN (priv->bssid));
if (entry) { if (entry) {
if (!ce_page_mac_entry_valid (GTK_ENTRY (entry), ARPHRD_ETHER)) if (!ce_page_mac_entry_valid (GTK_ENTRY (entry), ARPHRD_ETHER, _("bssid"), error))
return FALSE; return FALSE;
} }
entry = gtk_bin_get_child (GTK_BIN (priv->device_combo)); entry = gtk_bin_get_child (GTK_BIN (priv->device_combo));
if (entry) { if (entry) {
if (!ce_page_device_entry_get (GTK_ENTRY (entry), ARPHRD_ETHER, NULL, NULL)) if (!ce_page_device_entry_get (GTK_ENTRY (entry), ARPHRD_ETHER, NULL, NULL, _("Wi-Fi device"), error))
return FALSE; return FALSE;
} }
if (!ce_page_mac_entry_valid (priv->cloned_mac, ARPHRD_ETHER)) if (!ce_page_mac_entry_valid (priv->cloned_mac, ARPHRD_ETHER, _("cloned MAC"), error))
return FALSE; return FALSE;
ui_to_setting (self); ui_to_setting (self);
......
...@@ -36,8 +36,8 @@ static void ...@@ -36,8 +36,8 @@ static void
stuff_changed_cb (WirelessSecurity *sec, gpointer user_data) stuff_changed_cb (WirelessSecurity *sec, gpointer user_data)
{ {
GtkWidget *button = GTK_WIDGET (user_data); GtkWidget *button = GTK_WIDGET (user_data);
gtk_widget_set_sensitive (button, wireless_security_validate (sec)); gtk_widget_set_sensitive (button, wireless_security_validate (sec, NULL));
} }
static void static void
......