1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
|
#!/usr/bin/env bash
# Copyright (C) 2007-2010 PlayOnLinux Team
# Copyright (C) 2008 Pâris Quentin
# Copyright (C) 2009 Łukasz Wojniłowicz
# 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.
[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"
TITLE="$(eval_gettext '$APPLICATION_TITLE Application Configurator')"
polconfigurator_winecfg()
{
POL_Wine_AutoSetVersionEnv
wineserver -k
POL_Wine winecfg
}
polconfigurator_kprocess()
{
if [ "$1" ]; then
POL_SetupWindow_Init
POL_SetupWindow_wait_next_signal "$(eval_gettext "Killing programs in the virtual drive...")" "$TITLE"
fi
sleep 1
POL_Wine_AutoSetVersionEnv
wineserver -k
sleep 1
if [ "$1" ]; then
POL_SetupWindow_Close
fi
}
polconfigurator_regedit()
{
POL_Wine_AutoSetVersionEnv
wineserver -k
POL_Wine regedit
}
polconfigurator_wineboot()
{
POL_Wine_AutoSetVersionEnv
wineserver -k
POL_Wine wineboot
}
polconfigurator_awinecfg()
{
POL_Wine_AutoSetVersionEnv
wineserver -k
bash "$POL_USER_ROOT/plugins/Advanced Wine Configuration/scripts/menu"
}
polconfigurator_winetricks()
{
POL_Wine_AutoSetVersionEnv
wineserver -k
bash "$POL_USER_ROOT/plugins/WineTricks/scripts/menu" "$1"
}
polconfigurator_scfg()
{
POL_Wine_AutoSetVersionEnv
wineserver -k
bash "$POL_USER_ROOT/configurations/configurators/$APP"
}
polconfigurator_changeicon()
{
if [ "$1" ]; then
(convert "$1" -geometry 32X32 "$POL_USER_ROOT/icones/32/$APP" && touch "$POL_USER_ROOT/icones/32/tmp" && sleep 1 && rm "$POL_USER_ROOT/icones/32/tmp")&
exit
else
cd "$HOME/.local/share/icons/"
POL_SetupWindow_browse "$(eval_gettext "Please select an icon file")" "$(eval_gettext "Icon selection")"
iconame=$(basename "$APP_ANSWER")
extensionwithoutcase=${iconame##*.}
extension=`echo "$extensionwithoutcase" | tr '[:upper:]' '[:lower:]'`
if [ "$iconame" != "" ] && [ "$extension" = ico ] || [ "$extension" = xpm ] || [ "$extension" = png ] || [ "$extension" = jpg ] || [ "$extension" = jpeg ] || [ "$extension" = bmp ]; then
convert "$APP_ANSWER" -geometry 32X32 "$POL_USER_ROOT/icones/32/$APP"
else
POL_SetupWindow_message_image "$extension $(eval_gettext "is not an icon extension")" "$(eval_gettext "Bad file extension")" "$PLAYONLINUX/themes/tango/warning.png"
return
fi
fi
touch "$POL_USER_ROOT/icones/32/tmp"
sleep 1
rm "$POL_USER_ROOT/icones/32/tmp"
}
main_menu()
{
local LNG_CONFIGURE=$(eval_gettext "Configure Wine")
local LNG_REGISTRY=$(eval_gettext "Registry Editor")
local LNG_KPROCESS=$(eval_gettext "Kill all prefix processes")
local LNG_UPDATEPREFIX=$(eval_gettext "Update wineprefix")
local LNG_WINDOWS_REBOOT=$(eval_gettext "Simulate Windows reboot")
local LNG_APLUGIN=$(eval_gettext "Use Advanced Wine Configuration plugin")
local LNG_POLCFG=$(eval_gettext "Use PlayOnLinux's configurator for")
local LNG_CHANGEICON=$(eval_gettext 'Change the icon')
local LNG_WINETRICKS=$(eval_gettext "Use WineTricks")
# ~$LNG_UPDATEPREFIX
local ITEMS="$LNG_CONFIGURE~$LNG_REGISTRY~$LNG_KPROCESS~$LNG_WINDOWS_REBOOT~$LNG_CHANGEICON"
if [ -e "$POL_USER_ROOT/plugins/Advanced Wine Configuration" ]
then
ITEMS+="~$LNG_APLUGIN"
fi
if [ -e "$POL_USER_ROOT/plugins/WineTricks" ]
then
ITEMS+="~$LNG_WINETRICKS"
fi
if [ -e "$POL_USER_ROOT/configurations/configurators/$APP" ]
then
ITEMS+="~$LNG_POLCFG $APP"
fi
local funct=""
while [ -z "$funct" ]; do
POL_SetupWindow_menu "$(eval_gettext "Please choose an action to perform")" "$TITLE" "$ITEMS" "~"
[ "$APP_ANSWER" = "$LNG_CONFIGURE" ] && funct=winecfg
[ "$APP_ANSWER" = "$LNG_REGISTRY" ] && funct=regedit
[ "$APP_ANSWER" = "$LNG_KPROCESS" ] && funct=kprocess
# [ "$APP_ANSWER" = "$LNG_UPDATEPREFIX" ] && funct="??"
[ "$APP_ANSWER" = "$LNG_WINDOWS_REBOOT" ] && funct=wineboot
[ "$APP_ANSWER" = "$LNG_CHANGEICON" ] && funct=changeicon
[ "$APP_ANSWER" = "$LNG_APLUGIN" ] && funct=awinecfg
[ "$APP_ANSWER" = "$LNG_WINETRICKS" ] && funct=winetricks
[ "$APP_ANSWER" = "$LNG_POLCFG" ] && funct=scfg
done
redirect_to_pol_configure_function "$APP" "$funct"
}
redirect_to_pol_configure_function()
{
local APP="$1"
local FUNCTIONTORUN="$2"
shift 2
polconfigurator_"$FUNCTIONTORUN" "$@"
}
prefixe=$(detect_wineprefix "$1")
export WINEPREFIX="$prefixe"
redirect_to_pol_configure_function "$@"
exit
|