Some more functions

This commit is contained in:
Jack-Benny Persson 2014-01-10 13:19:45 +01:00
parent 84ee451b94
commit 1df25cedba

View File

@ -75,12 +75,11 @@ search_pkg()
uninstall_pkg() uninstall_pkg()
{ {
#Pkginfo=`$Dpkg --status $Search`
$Zenity --title "dpkg-frontend" \ $Zenity --title "dpkg-frontend" \
--question \ --question \
--text="Package $Search is installed.\nUninstall ${Search}?" --text="Package $Search is installed.\nUninstall ${Search}?"
if [ $? -eq 0 ]; then # CHANGE NEXT LINE if [ $? -eq 0 ]; then # CHANGE NEXT LINE
sleep 5 | $Zenity --title "dpkg-frontend" \ sleep 3 | $Zenity --title "dpkg-frontend" \
--progress --pulsate --text "Uninstalling ${Search}..." --progress --pulsate --text "Uninstalling ${Search}..."
fi fi
} }
@ -97,6 +96,17 @@ show_selections()
--info --text "Selections for $Search is: <b>${Selections}</b>" --info --text "Selections for $Search is: <b>${Selections}</b>"
} }
choice_dialog()
{
Choice=`$Zenity --list --column=Action --column=Description \
--radiolist uninstall "Uninstall" show "Show selections"`
if [ "$Choice" = "Uninstall" ]; then
return 11
elif [ "$Choice" = "Show selections" ]; then
return 12
fi
}
# Create variables with absolute path to binaries and check # Create variables with absolute path to binaries and check
# if we can execute it (binaries will be avaliable in # if we can execute it (binaries will be avaliable in
# variables with first character uppercase, such as Grep) # variables with first character uppercase, such as Grep)
@ -133,11 +143,12 @@ done
### Main ### ### Main ###
search_pkg search_pkg
if [ $? -eq 0 ]; then choice_dialog
if [ $? -eq 11 ]; then
uninstall_pkg uninstall_pkg
elif [ $? -eq 12 ]; then
show_selections
fi fi
show_selections
echo $Search echo $Search
exit 0 exit 0