# Copyright (2011) David Francos Cuartero
#DEPENDS: yad
#        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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

# This can also be used as skeleton for airoscript override-functions plugin.

export mark="";
warn(){ notify-send -i "$path/../doc/airoscript-ng/airoscript-ng.png" "Airoscript notification" "${@}"; }
yesno(){ zenity --question $@; }
single_question(){ ans=`zenity --entry --text "${@}"`; }

mkmenuheader(){ return; }
mkmenuline(){ return; }
mkmenueline(){ return; }

mkmenu(){ title=$1; shift; declare -a res; args=("${@}"); for i in ${!args[@]}; do res+=( "$i" "${args[$i]}" ); done ;
	choice=$(yad --class="airoscript-ng" --window-icon="/usr/local/share/pixmaps/airoscript-ng.png" --separator=" " --list --width=450 --height=250 --title="$title" --text "Select an action:" --column=" " --column="n" --no-headers=1 "${res[@]}" --print-column=1;)
    [[ $? == 1 ]] && [[ $title == "Main Menu" ]] && exit
}
selectap_wrapper(){
choice=$(yad --class="airoscript-ng" --window-icon="/usr/local/cal/share/pixmaps/airoscript-ng.png" --separator=" " --list --width=450 --height=250 --title="$title" --text "Select an action:" --column "position" --column "MAC" --column "Channel" --column "Privacy" --column "POWER" --column "LENGHT" --column "ESSID" --hide-column=1 "${res[@]}" --print-column=1;)
}
launch_counter(){  ( for i in $( seq 1 $1 ); do a=$(( ($i * 100) / $1 )); sleep 1; echo "$a"; done ) | zenity --text "Scanning for targets" --progress --auto-close --title="Scanning for targets"; }
