public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Maximiliano Sandoval <m.sandoval@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH installer 2/3] proxinstall: set active element in combo box once
Date: Tue, 17 Dec 2024 16:23:15 +0100	[thread overview]
Message-ID: <20241217152316.381557-2-m.sandoval@proxmox.com> (raw)
In-Reply-To: <20241217152316.381557-1-m.sandoval@proxmox.com>

We connect to the signal before setting the active device so it triggers.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 proxinstall | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/proxinstall b/proxinstall
index 1d22e22..cb74cc2 100755
--- a/proxinstall
+++ b/proxinstall
@@ -391,6 +391,8 @@ sub create_ipconf_view {
 	    if $iface->{inet}->{prefix} || $iface->{inet6}->{prefix};
     };
 
+    my $active_device_pos = 0;
+
     my $i = 0;
     for my $index (sort keys $ipconf->{ifaces}->%*) {
 	my $iface = $ipconf->{ifaces}->{$index};
@@ -403,20 +405,19 @@ sub create_ipconf_view {
 	$device_active_map->{$i} = $index;
 	$device_active_reverse_map->{$iface->{name}} = $i;
 	if ($ipconf_first_view && $index == $ipconf->{default}) {
-	    $device_cb->set_active($i);
-	    &$device_change_handler($device_cb);
+	    $active_device_pos = $i;
 	    $ipconf_first_view = 0;
 	}
 	$i++;
     }
-    $device_cb->signal_connect('changed' => $device_change_handler);
 
     if (my $nic = Proxmox::Install::Config::get_mngmt_nic()) {
-	$device_cb->set_active($device_active_reverse_map->{$nic} // 0);
-    } else {
-	$device_cb->set_active(0);
+	$active_device_pos = $device_active_reverse_map->{$nic};
     }
 
+    $device_cb->signal_connect('changed' => $device_change_handler);
+    $device_cb->set_active($active_device_pos);
+
     my $label = Gtk3::Label->new("Management Interface");
     $label->set_size_request(150, -1);
     $label->set_xalign(1.0);
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


  reply	other threads:[~2024-12-17 15:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-17 15:23 [pve-devel] [PATCH installer 1/3] proxinstall: move device changed callback after loop Maximiliano Sandoval
2024-12-17 15:23 ` Maximiliano Sandoval [this message]
2024-12-17 15:23 ` [pve-devel] [PATCH installer 3/3] fix #2502: proxinstall: set cidr text manually Maximiliano Sandoval
2024-12-17 15:26   ` Maximiliano Sandoval

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241217152316.381557-2-m.sandoval@proxmox.com \
    --to=m.sandoval@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal