After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 740017 - tui: fix gateway editing
tui: fix gateway editing
Status: RESOLVED FIXED
Product: NetworkManager
Classification: Platform
Component: nmtui
unspecified
Other All
: Normal normal
: ---
Assigned To: NetworkManager maintainer(s)
NetworkManager maintainer(s)
Depends on:
Blocks: nm-1.0
 
 
Reported: 2014-11-12 14:18 UTC by Dan Winship
Modified: 2014-12-01 11:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
tui: fix gateway editing (8.67 KB, patch)
2014-11-12 14:18 UTC, Dan Winship
committed Details | Review

Description Dan Winship 2014-11-12 14:18:38 UTC
Since adding NMSettingIPConfig:gateway, we were just binding that
property to the Gateway entry as a string. But this caused two
different problems: first, we were trying to set the :gateway property
from the entry even when the IP address in the entry was incomplete
(causing warnings), and second, we were no longer enforcing the rule
that the gateway can only be set when there are static addresses
configured.

Fix this by adding back nm_editor_bind_ip_gateway_to_string(), but
with new semantics reflecting the new way NMSettingIPConfig:addresses
and :gateway work. (Besides just fixing the new bugs, this also makes
the Gateway entry insensitive when there are no addresses; before,
nmtui would allow you to type there, but the value would not be
saved.)

Fixes: Test263_nmtui_ipv4_addresses_delete_ip_and_back_to_auto
Comment 1 Dan Winship 2014-11-12 14:18:40 UTC
Created attachment 290519 [details] [review]
tui: fix gateway editing
Comment 2 Thomas Haller 2014-11-12 15:20:48 UTC
Looks correct and tests correct too.

Only downside is that during one editing session, if you remove all addresses, the gateway field gets cleared.
But if you add an address again, the gateway field stays empty.
It would be very nice to fill the input field with the previous gateway value.
Comment 3 Dan Winship 2014-11-12 16:45:12 UTC
(In reply to comment #2)
> Only downside is that during one editing session, if you remove all addresses,
> the gateway field gets cleared.
> But if you add an address again, the gateway field stays empty.

That was true in 0.9.10 too

> It would be very nice to fill the input field with the previous gateway value.

Would it? It seems improbable that you'd have a connection with multiple IPs, and then you'd want to delete all of them and add new ones, while keeping the gateway the same. (If there's only a single IP then you would most likely just edit that IP address rather than delete it and re-add it, so the gateway wouldn't get deleted in that case.)
Comment 4 Dan Williams 2014-11-12 20:15:50 UTC
Review of attachment 290519 [details] [review]:

::: clients/tui/nm-editor-bindings.h
@@ +41,3 @@
+void nm_editor_bind_ip_gateway_to_string              (int            family,
+                                                       NMSettingIPConfig *source,
+                                                       gpointer       target,

Sure you don't want a NmtNewtEntry here or something, instead of gpointer?
Comment 5 Dan Winship 2014-11-12 20:42:45 UTC
(In reply to comment #4)
> Sure you don't want a NmtNewtEntry here or something, instead of gpointer?

nm-editor-bindings.[ch] is client-agnostic. In particular, nm_editor_bind_ip_gateway_to_string() would work correctly with a GtkEntry as well.
Comment 6 Dan Winship 2014-11-12 21:05:10 UTC
Attachment 290519 [details] pushed as 29ed625 - tui: fix gateway editing