#!/bin/sh
#\
exec wish "$0"

# tkinetctrl - Script to control the dial-in and hangup of the ISDN card or
#            - modem
# Copyright (C) Son Sep 23 13:22:26 MEST 2001 by Ingo Blechschmidt
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# Ingo Blechschmidt
# Arberstraße 5
# 86179 Augsburg
# E-Mail: iblech@web.de, http://www.way.to/uselinux/
# Tel.: +49 / 821 882955
#
# 

wm title            . AugustaKom  # Intenet-Provider hier eintragen/
                                  # Insert ISP here.
wm deiconify        .
wm overrideredirect . false
wm resizable        . true true
wm geometry         . -15+33

proc status { } {
  global .status
  pack forget .status
  destroy .status 

  set s [ catch { exec /sbin/isdnctrl status ippp0 } ] # Befehl zum Abfragen
                                                       # des Status der Inter-
                                                       # net-Verbindung/
						       # Command to get the
						       # status of the con-
						       # nection

  if { $s == 1 } {
    label .status -text "Nicht verbunden" -relief sunken -bd 4 \
                  -background firebrick1 \
  		-font -adobe-helvetica-medium-r-normal-*-17-*-*-*-p-*-iso8859-1
  } else {
    label .status -text "Verbunden" -relief sunken -bd 4 \
                  -background darkorange \
                  -font -adobe-helvetica-medium-r-normal-*-17-*-*-*-p-*-iso8859-1
  }

  pack .dial .hangup .status -side left

}
 
# Hinter exec Befehl zum Verbinden eintragen/Insert below (after exec) command
# for dialing.
button .dial -text "Verbinden"\
               -relief raised\
               -bd 4\
	       -foreground black\
               -activebackground darkorange\
               -activeforeground white\
               -font -adobe-helvetica-medium-r-normal-*-17-*-*-*-p-*-iso8859-1\
               -cursor "pirate"\
               -command { exec /sbin/isdnctrl dial ippp0 &
	                  status }

# Hinter exec Befehl zum Trennen eintragen/Insert below (after exec) the
# command for hanguping.
button .hangup -text "Trennen"\
               -relief raised\
               -bd 4\
               -foreground black\
               -activebackground firebrick1\
               -activeforeground white\
               -font -adobe-helvetica-medium-r-normal-*-17-*-*-*-p-*-iso8859-1\
               -cursor "pirate"\
               -command { exec /sbin/isdnctrl hangup ippp0 &
                          status }

label .status -text "Nicht verbunden" -relief sunken -bd 4 \
              -background  firebrick1 \
              -font -adobe-helvetica-medium-r-normal-*-17-*-*-*-p-*-iso8859-1

pack .dial .hangup .status -side left

