[gnome-control-center/gnome-3-10] network: don't warn for invalid settings



commit 67fbc1c18792b8b37c42012669721f2c6517dbdb
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Mon Feb 17 21:29:17 2014 +0100

    network: don't warn for invalid settings
    
    g_warning() is for environment errors, not user errors. Not being
    able to click OK is enough to understand that something is wrong,
    and if not we should highlight the faulty setting, not spam the logs,
    expecially in the middle of digitation. Keep a log anyway, for
    debugging.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=724312

 panels/network/connection-editor/ce-page-ip4.c     |    8 --------
 panels/network/connection-editor/ce-page-ip6.c     |    8 --------
 .../connection-editor/net-connection-editor.c      |    4 ++--
 3 files changed, 2 insertions(+), 18 deletions(-)
---
diff --git a/panels/network/connection-editor/ce-page-ip4.c b/panels/network/connection-editor/ce-page-ip4.c
index f8dad08..e580225 100644
--- a/panels/network/connection-editor/ce-page-ip4.c
+++ b/panels/network/connection-editor/ce-page-ip4.c
@@ -748,18 +748,15 @@ ui_to_setting (CEPageIP4 *page)
                 }
 
                 if (inet_pton (AF_INET, text_address, &tmp_addr) <= 0) {
-                        g_warning ("IPv4 address %s missing or invalid", text_address);
                         goto out;
                 }
 
 
                 if (!parse_netmask (text_netmask, &prefix)) {
-                        g_warning ("IPv4 prefix %s is invalid", text_netmask);
                         goto out;
                 }
 
                 if (text_gateway && inet_pton (AF_INET, text_gateway, &tmp_gateway) <= 0) {
-                        g_warning ("IPv4 gateway %s is invalid", text_gateway);
                         goto out;
                 }
 
@@ -798,7 +795,6 @@ ui_to_setting (CEPageIP4 *page)
                 }
 
                 if (inet_pton (AF_INET, text, &tmp_addr) <= 0) {
-                        g_warning ("IPv4 dns server %s invalid", text);
                         goto out;
                 }
 
@@ -835,18 +831,15 @@ ui_to_setting (CEPageIP4 *page)
                 }
 
                 if (inet_pton (AF_INET, text_address, &tmp_addr) <= 0) {
-                        g_warning ("IPv4 route address %s invalid", text_address);
                         goto out;
                 }
                 address = tmp_addr.s_addr;
 
                 if (!parse_netmask (text_netmask, &netmask)) {
-                        g_warning ("IPv4 route netmask %s invalid", text_netmask);
                         goto out;
                 }
 
                 if (inet_pton (AF_INET, text_gateway, &tmp_addr) <= 0) {
-                        g_warning ("IPv4 route gateway %s invalid", text_gateway);
                         goto out;
                 }
                 gateway = tmp_addr.s_addr;
@@ -856,7 +849,6 @@ ui_to_setting (CEPageIP4 *page)
                         errno = 0;
                         metric = strtoul (text_metric, NULL, 10);
                         if (errno) {
-                                g_warning ("IPv4 route metric %s invalid", text_metric);
                                 goto out;
                         }
                 }
diff --git a/panels/network/connection-editor/ce-page-ip6.c b/panels/network/connection-editor/ce-page-ip6.c
index c30a4b6..337b6a8 100644
--- a/panels/network/connection-editor/ce-page-ip6.c
+++ b/panels/network/connection-editor/ce-page-ip6.c
@@ -726,19 +726,16 @@ ui_to_setting (CEPageIP6 *page)
                 }
 
                 if (inet_pton (AF_INET6, text_address, &tmp_addr) <= 0) {
-                        g_warning ("IPv6 address %s missing or invalid", text_address);
                         goto out;
                 }
 
                 prefix = strtoul (text_prefix, &end, 10);
                 if (!end || *end || prefix == 0 || prefix > 128) {
-                        g_warning ("IPv6 prefix %s is invalid", text_prefix);
                         goto out;
                 }
 
                 if (text_gateway && *text_gateway) {
                         if (inet_pton (AF_INET6, text_gateway, &tmp_gateway) <= 0) {
-                                g_warning ("IPv6 gateway %s is invalid", text_gateway);
                                 goto out;
                         }
                         if (!IN6_IS_ADDR_UNSPECIFIED (&tmp_gateway))
@@ -773,7 +770,6 @@ ui_to_setting (CEPageIP6 *page)
                 }
 
                 if (inet_pton (AF_INET6, text, &tmp_addr) <= 0) {
-                        g_warning ("IPv6 dns server %s invalid", text);
                         goto out;
                 }
 
@@ -810,18 +806,15 @@ ui_to_setting (CEPageIP6 *page)
                 }
 
                 if (inet_pton (AF_INET6, text_address, &dest) <= 0) {
-                        g_warning ("IPv6 route address %s invalid", text_address);
                         goto out;
                 }
 
                 prefix = strtoul (text_prefix, &end, 10);
                 if (!end || *end || prefix == 0 || prefix > 128) {
-                        g_warning ("IPv6 route prefix %s invalid", text_prefix);
                         goto out;
                 }
 
                 if (inet_pton (AF_INET6, text_gateway, &gateway) <= 0) {
-                        g_warning ("IPv6 route gateway %s invalid", text_gateway);
                         goto out;
                 }
 
@@ -830,7 +823,6 @@ ui_to_setting (CEPageIP6 *page)
                         errno = 0;
                         metric = strtoul (text_metric, NULL, 10);
                         if (errno) {
-                                g_warning ("IPv6 route metric %s invalid", text_metric);
                                 goto out;
                         }
                 }
diff --git a/panels/network/connection-editor/net-connection-editor.c 
b/panels/network/connection-editor/net-connection-editor.c
index 10b54c0..e575bda 100644
--- a/panels/network/connection-editor/net-connection-editor.c
+++ b/panels/network/connection-editor/net-connection-editor.c
@@ -350,10 +350,10 @@ validate (NetConnectionEditor *editor)
                 if (!ce_page_validate (CE_PAGE (l->data), editor->connection, &error)) {
                         valid = FALSE;
                         if (error) {
-                                g_warning ("Invalid setting %s: %s", ce_page_get_title (CE_PAGE (l->data)), 
error->message);
+                                g_debug ("Invalid setting %s: %s", ce_page_get_title (CE_PAGE (l->data)), 
error->message);
                                 g_error_free (error);
                         } else {
-                                g_warning ("Invalid setting %s", ce_page_get_title (CE_PAGE (l->data)));
+                                g_debug ("Invalid setting %s", ce_page_get_title (CE_PAGE (l->data)));
                         }
                 }
         }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]