setup: fix field-order at addressconfig for red

Message ID 20210203183150.2639-1-arne_f@ipfire.org
State Accepted
Commit 2e2170bfb541ea1238f1dcc9f026fab1c3f28d51
Headers
Series setup: fix field-order at addressconfig for red |

Commit Message

Arne Fitzenreiter Feb. 3, 2021, 6:31 p.m. UTC
  i have added the gatewayfield at the line below the IP and Netmask
fields but prior this fields so the cursor jumps first the the gateway
and after this to the IP. This patch fix the activation order.

Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
---
 src/setup/netstuff.c | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)
  

Patch

diff --git a/src/setup/netstuff.c b/src/setup/netstuff.c
index dac407767..1e196dc1e 100644
--- a/src/setup/netstuff.c
+++ b/src/setup/netstuff.c
@@ -134,18 +134,6 @@  int changeaddress(struct keyvalue *kv, char *colour, int typeflag,
 				newtEntrySetFlags(dhcphostnameentry, NEWT_FLAG_DISABLED, NEWT_FLAGS_SET);
 				newtEntrySetFlags(dhcpforcemtuentry, NEWT_FLAG_DISABLED, NEWT_FLAGS_SET);
 			}
-		/* Gateway */
-		gatewaylabel = newtTextbox(2, (typeflag ? 11 : 4) + 2, 18, 1, 0);
-		newtTextboxSetText(gatewaylabel, _("Gateway:"));
-		strcpy(temp, "");
-		findkey(kv, gatewayfield, temp);
-		gatewayentry = newtEntry(20, (typeflag ? 11 : 4) + 2, temp, 20, &gatewayresult, 0);
-		newtEntrySetFilter(gatewayentry, ip_input_filter, NULL);
-		if (typeflag == 1 && startstatictype == 0)
-			newtEntrySetFlags(gatewayentry, NEWT_FLAG_DISABLED, NEWT_FLAGS_SET);
-		newtFormAddComponent(networkform, gatewaylabel);
-		newtFormAddComponent(networkform, gatewayentry);
-
 	}
 	/* Address */
 	addresslabel = newtTextbox(2, (typeflag ? 11 : 4) + 0, 18, 1, 0);
@@ -171,6 +159,20 @@  int changeaddress(struct keyvalue *kv, char *colour, int typeflag,
 	newtFormAddComponent(networkform, netmasklabel);
 	newtFormAddComponent(networkform, netmaskentry);
 
+	if (typeflag)
+	{
+		/* Gateway */
+		gatewaylabel = newtTextbox(2, (typeflag ? 11 : 4) + 2, 18, 1, 0);
+		newtTextboxSetText(gatewaylabel, _("Gateway:"));
+		strcpy(temp, "");
+		findkey(kv, gatewayfield, temp);
+		gatewayentry = newtEntry(20, (typeflag ? 11 : 4) + 2, temp, 20, &gatewayresult, 0);
+		newtEntrySetFilter(gatewayentry, ip_input_filter, NULL);
+		if (typeflag == 1 && startstatictype == 0)
+			newtEntrySetFlags(gatewayentry, NEWT_FLAG_DISABLED, NEWT_FLAGS_SET);
+		newtFormAddComponent(networkform, gatewaylabel);
+		newtFormAddComponent(networkform, gatewayentry);
+	}
 
 	/* Buttons. */
 	ok = newtButton(8, (typeflag ? 15 : 7), _("OK"));