summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiří Klimeš <jklimes@redhat.com>2015-03-03 16:40:22 +0100
committerJiří Klimeš <jklimes@redhat.com>2015-03-03 17:53:25 +0100
commitf22b86f4d1bc2b1c6dd0b384db2aa5d57c530518 (patch)
tree94f884f7aa6bae45de7dece01fddf2f485a31641
parent0d2583ed6ae143f1a7221656accd511b2c5058b0 (diff)
downloadnetwork-manager-applet-f22b86f4d1bc2b1c6dd0b384db2aa5d57c530518.tar.gz
editor: correct on-the-fly color error indication for empty values
-rw-r--r--src/connection-editor/ip4-routes-dialog.c6
-rw-r--r--src/connection-editor/ip6-routes-dialog.c6
2 files changed, 10 insertions, 2 deletions
diff --git a/src/connection-editor/ip4-routes-dialog.c b/src/connection-editor/ip4-routes-dialog.c
index 89e8424f..e93c3c9d 100644
--- a/src/connection-editor/ip4-routes-dialog.c
+++ b/src/connection-editor/ip4-routes-dialog.c
@@ -426,7 +426,7 @@ cell_changed_cb (GtkEditable *editable,
/* Is it a prefix? */
if (!strchr (cell_text, '.')) {
tmp_prefix = strtol (cell_text, NULL, 10);
- if (!errno && tmp_prefix <= 32)
+ if (*cell_text && !errno && tmp_prefix <= 32)
value_valid = TRUE;
} else {
struct in_addr tmp_addr;
@@ -449,6 +449,10 @@ cell_changed_cb (GtkEditable *editable,
if (inet_pton (AF_INET, cell_text, &tmp_addr) > 0)
value_valid = TRUE;
+
+ /* Consider empty next_hop as valid */
+ if (!*cell_text && column == COL_NEXT_HOP)
+ value_valid = TRUE;
}
/* Change cell's background color while editing */
diff --git a/src/connection-editor/ip6-routes-dialog.c b/src/connection-editor/ip6-routes-dialog.c
index 94be45d5..9bad6933 100644
--- a/src/connection-editor/ip6-routes-dialog.c
+++ b/src/connection-editor/ip6-routes-dialog.c
@@ -379,7 +379,7 @@ cell_changed_cb (GtkEditable *editable,
errno = 0;
tmp_int = strtol (cell_text, NULL, 10);
- if (errno || tmp_int < 0 || tmp_int > 128)
+ if (!*cell_text || errno || tmp_int < 0 || tmp_int > 128)
value_valid = FALSE;
else
value_valid = TRUE;
@@ -397,6 +397,10 @@ cell_changed_cb (GtkEditable *editable,
if (inet_pton (AF_INET6, cell_text, &tmp_addr) > 0)
value_valid = TRUE;
+
+ /* Consider empty next_hop as valid */
+ if (!*cell_text && column == COL_NEXT_HOP)
+ value_valid = TRUE;
}
/* Change cell's background color while editing */