diff options
author | Dan Winship <danw@gnome.org> | 2014-11-04 15:48:48 -0500 |
---|---|---|
committer | Dan Winship <danw@gnome.org> | 2014-11-07 07:49:41 -0500 |
commit | e374923bbe4a9f608644756f749b9bae9aa5f349 (patch) | |
tree | d7e0fffead6c3e4d1e3433d2b76dec3431b0816f /clients/tui/nm-editor-bindings.c | |
parent | ff608c24cd1ac409092f1a883452225a8be6513a (diff) | |
download | NetworkManager-e374923bbe4a9f608644756f749b9bae9aa5f349.tar.gz |
all: allow route metrics to be "0"
Change NMIPRoute to use "-1" for "default", so that "0" is a valid
metric. Update everything for that.
Diffstat (limited to 'clients/tui/nm-editor-bindings.c')
-rw-r--r-- | clients/tui/nm-editor-bindings.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/clients/tui/nm-editor-bindings.c b/clients/tui/nm-editor-bindings.c index 9db44c9d80..5560f83ca6 100644 --- a/clients/tui/nm-editor-bindings.c +++ b/clients/tui/nm-editor-bindings.c @@ -327,7 +327,7 @@ ip_route_transform_to_metric_string (GBinding *binding, char *string; route = g_value_get_boxed (source_value); - if (route && nm_ip_route_get_dest (route)) { + if (route && nm_ip_route_get_dest (route) && nm_ip_route_get_metric (route) != -1) { string = g_strdup_printf ("%lu", (gulong) nm_ip_route_get_metric (route)); g_value_take_string (target_value, string); } else @@ -400,10 +400,13 @@ ip_route_transform_from_metric_string (GBinding *binding, { NMIPRoute *route; const char *text; - guint32 metric; + gint64 metric; text = g_value_get_string (source_value); - metric = strtoul (text, NULL, 10); + if (*text) + metric = strtoul (text, NULL, 10); + else + metric = -1; /* Fetch the original property value */ g_object_get (g_binding_get_source (binding), |