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

[PATCH master 3/4] Remember user's choice when going back in Configure TCP/IP (#609570)



This will go to rhel 6.1 too.

---
 loader/net.c |   24 +++++++++++++++++++-----
 loader/net.h |    2 ++
 2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/loader/net.c b/loader/net.c
index 2b3110a..2974bfc 100644
--- a/loader/net.c
+++ b/loader/net.c
@@ -478,8 +478,10 @@ int readNetConfig(char * device, iface_t * iface,
 
     /* init opts */
     opts.ipv4Choice = 0;
+    opts.v4Method = 0;
 #ifdef ENABLE_IPV6
     opts.ipv6Choice = 0;
+    opts.v6Method = 0;
 #endif
 
     /* JKFIXME: we really need a way to override this and be able to change
@@ -596,8 +598,8 @@ int configureTCPIP(char * device, iface_t * iface,
 
     ipv4Checkbox = newtCheckbox(-1, -1, _("Enable IPv4 support"),
                                 opts->ipv4Choice, NULL, &(opts->ipv4Choice));
-    v4Method[0] = newtRadiobutton(-1, -1, DHCP_METHOD_STR, 1, NULL);
-    v4Method[1] = newtRadiobutton(-1, -1, MANUAL_METHOD_STR, 0, v4Method[0]);
+    v4Method[0] = newtRadiobutton(-1, -1, DHCP_METHOD_STR, (opts->v4Method == 0), NULL);
+    v4Method[1] = newtRadiobutton(-1, -1, MANUAL_METHOD_STR, (opts->v4Method == 1), v4Method[0]);
 
 #ifdef ENABLE_IPV6
     /* IPv6 checkbox */
@@ -610,9 +612,9 @@ int configureTCPIP(char * device, iface_t * iface,
 
     ipv6Checkbox = newtCheckbox(-1, -1, _("Enable IPv6 support"),
                                 opts->ipv6Choice, NULL, &(opts->ipv6Choice));
-    v6Method[0] = newtRadiobutton(-1, -1, AUTO_METHOD_STR, 1, NULL);
-    v6Method[1] = newtRadiobutton(-1, -1, DHCPV6_METHOD_STR, 0, v6Method[0]);
-    v6Method[2] = newtRadiobutton(-1, -1, MANUAL_METHOD_STR, 0, v6Method[1]);
+    v6Method[0] = newtRadiobutton(-1, -1, AUTO_METHOD_STR, (opts->v6Method == 0), NULL);
+    v6Method[1] = newtRadiobutton(-1, -1, DHCPV6_METHOD_STR, (opts->v6Method == 1), v6Method[0]);
+    v6Method[2] = newtRadiobutton(-1, -1, MANUAL_METHOD_STR, (opts->v6Method == 2), v6Method[1]);
 #endif
 
     /* button bar at the bottom of the window */
@@ -740,6 +742,18 @@ int configureTCPIP(char * device, iface_t * iface,
         }
 #endif
 
+        /* update opts keeping method choice for UI */
+        for (z = IPV4_FIRST_METHOD; z <= IPV4_LAST_METHOD; z++) {
+            if (newtRadioGetCurrent(v4Method[0]) == v4Method[z-1])
+                opts->v4Method = z-1;
+        }
+#ifdef ENABLE_IPV6
+        for (z = IPV6_FIRST_METHOD; z <= IPV6_LAST_METHOD; z++) {
+            if (newtRadioGetCurrent(v6Method[0]) == v6Method[z-1])
+                opts->v6Method = z-1;
+        }
+#endif
+
         /* do interface configuration (call DHCP here, or return for manual) */
 #ifdef ENABLE_IPV6
         if ((!FL_NOIPV4(flags) && iface->ipv4method == IPV4_MANUAL_METHOD) ||
diff --git a/loader/net.h b/loader/net.h
index 8cf12a0..a6a4ec5 100644
--- a/loader/net.h
+++ b/loader/net.h
@@ -48,8 +48,10 @@ struct intfconfig_s {
 
 struct netconfopts {
     char ipv4Choice;
+    int v4Method;
 #ifdef ENABLE_IPV6
     char ipv6Choice;
+    int v6Method;
 #endif
 };
 
-- 
1.6.0.6


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