From: michael Date: Tue, 23 May 2006 19:14:09 +0000 (+0000) Subject: hide comboboxes when they are useless X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/snom-frontend/commitdiff_plain/76d5a918f8cd6d9b7880503e12e712613bf90645 hide comboboxes when they are useless --- diff --git a/snom.pl b/snom.pl index 9dcd536..97b8e99 100755 --- a/snom.pl +++ b/snom.pl @@ -1,5 +1,5 @@ #!/bin/sh -#$Id: snom.pl,v 1.42 2006-05-22 13:06:47 michael Exp $ +#$Id: snom.pl,v 1.43 2006-05-23 19:14:09 michael Exp $ PATH=/opt/csw/bin:/opt/local/bin:/usr/bin:/bin exec perl -w -x "$0" "$@" @@ -55,9 +55,8 @@ for my $section (@sections) { $g_host->set_active(0); UpdatePhoneInfo(); $g_host->signal_connect(changed => \&UpdatePhoneInfo); -$g_host->show(); +$g_host->show() if($#sections); $g_identity->signal_connect(changed => \&SwitchIdentity); -$g_identity->show(); set_locale Gtk2; @@ -374,6 +373,7 @@ sub UpdatePhoneInfo $g_identity->set_active(0); } my @lines=split("\n", $response->content()); + my $num = 0; foreach (@lines) { chomp; # @@ -383,8 +383,14 @@ sub UpdatePhoneInfo my $line = $3; $g_identity->append_text("${3}"); $g_identity->set_active(${1}-1) if(defined($2)); + $num++; } } + if ($num > 1) { + $g_identity->show; + } else { + $g_identity->hide; + } } sub SwitchIdentity