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 161 162 163
|
#!/bin/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')"
pol_winecfg()
{
POL_SetupWindow_wait_next_signal "$(eval_gettext "Killing processes in the prefix...")" "$TITLE"
wineserver -k
POL_SetupWindow_wait_next_signal "$(eval_gettext 'Starting Wine configuration')" "$TITLE"
POL_Wine winecfg
}
pol_kprocess()
{
if [ "$FIRSTARGUMENT" != "" ]; then
POL_SetupWindow_Init
fi
POL_SetupWindow_wait_next_signal "$(eval_gettext "Killing processes in the prefix...")" ""
sleep 1
wineserver -k
sleep 1
if [ "$FIRSTARGUMENT" != "" ]; then
POL_SetupWindow_Close
fi
}
pol_regedit()
{
POL_SetupWindow_wait_next_signal "$(eval_gettext "Killing processes in the prefix...")" "$TITLE"
wineserver -k
POL_SetupWindow_wait_next_signal "$(eval_gettext 'Starting regedit')" "$TITLE"
POL_Wine regedit
}
pol_wineboot()
{
POL_SetupWindow_wait_next_signal "$(eval_gettext "Killing processes in the prefix...")" "$TITLE"
wineserver -k
POL_SetupWindow_wait_next_signal "$(eval_gettext 'Simulating Windows reboot')" "$TITLE"
POL_Wine wineboot
}
pol_awinecfg()
{
POL_SetupWindow_wait_next_signal "$(eval_gettext "Killing processes in the prefix...")" "$TITLE"
wineserver -k
POL_SetupWindow_wait_next_signal "$(eval_gettext 'Starting Advanced Wine Configuration')" "$TITLE"
bash "$REPERTOIRE/plugins/Advanced Wine Configuration/scripts/menu"
}
pol_winetricks()
{
POL_SetupWindow_wait_next_signal "$(eval_gettext "Killing processes in the prefix...")" "$TITLE"
wineserver -k
POL_SetupWindow_wait_next_signal "$(eval_gettext 'Starting WineTricks plug-in')" "$TITLE"
bash "$REPERTOIRE/plugins/WineTricks/scripts/menu" "$FIRSTARGUMENT"
}
pol_scfg()
{
POL_SetupWindow_wait_next_signal "$(eval_gettext "Killing processes in the prefix...")" "$TITLE"
wineserver -k
POL_SetupWindow_wait_next_signal "$(eval_gettext 'Starting specific Wine configurator')" "$TITLE"
bash "$REPERTOIRE/configurations/configurators/$APP"
}
pol_changeicon()
{
if [ "$FIRSTARGUMENT" != "" ]; then
(convert "$FIRSTARGUMENT" -geometry 32X32 "$REPERTOIRE/icones/32/$APP" && (touch "$REPERTOIRE/icones/32/tmp" && sleep 1 && rm "$REPERTOIRE/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 "$REPERTOIRE/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 "$REPERTOIRE/icones/32/tmp"
sleep 1
rm "$REPERTOIRE/icones/32/tmp"
}
LNG_CONFIGURE=$(eval_gettext "Configure Wine")
LNG_REGISTRY=$(eval_gettext "Registry Editor")
LNG_KPROCESS=$(eval_gettext "Kill all prefix processes")
LNG_UPDATEPREFIX=$(eval_gettext "Update wineprefix")
LNG_WINDOWS_REBOOT=$(eval_gettext "Simulate Windows reboot")
LNG_APLUGIN=$(eval_gettext "Use Advanced Wine Configuration plugin")
LNG_POLCFG=$(eval_gettext "Use PlayOnLinux's configurator for")
LNG_CHANGEICON=$(eval_gettext 'Change the icon')
LNG_WINETRICKS=$(eval_gettext "Use WineTricks")
main_menu()
{
ITEMS="$LNG_CONFIGURE~$LNG_REGISTRY~$LNG_KPROCESS~$LNG_UPDATEPREFIX~$LNG_WINDOWS_REBOOT~$LNG_CHANGEICON"
if [ "-e" "$REPERTOIRE/plugins/Advanced Wine Configuration" ]
then
ITEMS+="~$LNG_APLUGIN"
fi
if [ "-e" "$REPERTOIRE/plugins/WineTricks" ]
then
ITEMS+="~$LNG_WINETRICKS"
fi
if [ "-e" "$REPERTOIRE/configurations/configurators/$APP" ]
then
ITEMS+="~$LNG_POLCFG $APP"
fi
POL_SetupWindow_menu "$(eval_gettext "Please choose an action to perform")" "$TITLE" "$ITEMS" "~"
redirect_to_pol_configure_function "$APP_ANSWER"
}
redirect_to_pol_configure_function()
{
if [ "$1" = "$LNG_CONFIGURE" ]
then
pol_winecfg
elif [ "$1" = "$LNG_REGISTRY" ]
then
pol_regedit
elif [ "$1" = "$LNG_KPROCESS" -o "$1" = "KillApp" ] # Encoding problem ! Be careful
then
pol_kprocess
elif [ "$1" = "IconChange" ] || [ "$1" = "$LNG_CHANGEICON" ]
then
pol_changeicon
fi
}
APP="$1"
FUNCTIONTORUN="$2" #0-run menu; other-run remotely
FIRSTARGUMENT="$3" #argument for function run remotely
prefixe=$(detect_wineprefix "$1")
export WINEPREFIX="$prefixe"
redirect_to_pol_configure_function "$FUNCTIONTORUN"
exit
|