♻️ refactor: extract MAX_PORTS

main
Trisha 2021-10-19 11:19:01 -05:00
parent 8189bc9769
commit 3a8fdbe6cd
1 changed files with 4 additions and 2 deletions

View File

@ -136,7 +136,9 @@ impl GuiClient <'_> {
ports_col: &mut Flex, ports_col: &mut Flex,
fltk_tx: fltk::app::Sender <Message> fltk_tx: fltk::app::Sender <Message>
) { ) {
if self.ports.len () >= 5 { const MAX_PORTS: usize = 5;
if self.ports.len () >= MAX_PORTS {
return; return;
} }
@ -151,7 +153,7 @@ impl GuiClient <'_> {
self.ports.push (port); self.ports.push (port);
if self.ports.len () >= 5 { if self.ports.len () >= MAX_PORTS {
self.but_add_port.deactivate (); self.but_add_port.deactivate ();
} }
} }