From 76d5a918f8cd6d9b7880503e12e712613bf90645 Mon Sep 17 00:00:00 2001 From: michael Date: Tue, 23 May 2006 19:14:09 +0000 Subject: [PATCH 1/1] hide comboboxes when they are useless --- snom.pl | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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 -- 2.39.5