##-- This function is called when a button is pressed --##
sub ButtonClicked {
        ##-- get the name of the  pressed buttons --#
        my ($button, $text) = @_;

        #####################################################
        ####----          Main get info interwall  ---- ####
        ####---- Get regulary update  of all infos --- ####
        ##################################################
        my $timer = Gtk->timeout_add(1000,\&get_all_stats);

        if ($text =~ /Linkquality/) {
                if ($fromconf{cisco} =~ /yes/) {
                build_progress ($fromconf{linktitle},\$g_airoconfig{'Signal Quality'});
                }
                else {
                build_progress($fromconf{linktitle},\$g_wirelessstat{link});
                }
        }
        elsif ($text =~ /Signallevel/) {
                if ($fromconf{cisco} =~ /yes/) {
                        build_progress ($fromconf{signaltitle},\$g_airoconfig{'Signal Strength'});
                }
                else {
                        build_progress ($fromconf{signaltitle},(\$g_wirelessstat{level}));
                }
        }
        elsif ($text =~ /Noiselevel/) {
                if ($fromconf{cisco} =~ /yes/) {
                        ####--- Cisco does not provide noise level until now
                }
                else {
                        build_progress ($fromconf{noisetitle},(\$g_wirelessstat{noise}));
                }
        }
        elsif ($text =~ /RX-Stats/) {
            build_statwin (\$fromconf{rxtitle},\$fromconf{rxcolumn},\%g_rxstat);
        }
        elsif ($text =~ /TX-Stats/) {
            build_statwin (\$fromconf{txtitle},\$fromconf{txcolumn},\%g_txstat);
        }
        elsif ($text =~ /MISC-Stats/) {
            build_statwin (\$fromconf{misctitle},\$fromconf{misccolumn},\%g_miscstat);
        }
        elsif ($text =~ /About/i) {
                build_about;
        }
        elsif ($text =~/Card-Config/i) {
                if ($fromconf{cisco} =~ /yes/) {
                                build_statwin (\$fromconf{configtitle},\$fromconf{configcolumn},\%g_airoconfig);
                }
                else {
                                build_statwin (\$fromconf{configtitle},\$fromconf{configcolumn},\%g_wirelessconf);
                }
        }
}

