]> git.zerfleddert.de Git - snom-frontend/commitdiff
hide comboboxes when they are useless
authormichael <michael>
Tue, 23 May 2006 19:14:09 +0000 (19:14 +0000)
committermichael <michael>
Tue, 23 May 2006 19:14:09 +0000 (19:14 +0000)
snom.pl

diff --git a/snom.pl b/snom.pl
index 9dcd53613373dc52575f568103fb255a0c297317..97b8e9937dca9ad06a5cf44b9d41b18e388b124a 100755 (executable)
--- 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;
                #<option value="1" selected>51@stargate.gernoth.loc</option>
@@ -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
Impressum, Datenschutz