Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37896654
en ru br
ALT Linux repositórios
S:8.15.1-alt1
5.0: 1.0.9-alt37
4.1: 1.0.9-alt0.M41.35
4.0: 1.0.9-alt0.M40.35
+backports:1.0.9-alt0.M40.16
3.0: 20050715-alt0.1
+backports:20061212-alt0.M30.1

Group :: Emuladores
RPM: wine

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

#!/bin/sh
#
# Create menu/desktop entries for an application
# This is used by the IShellLink interface
#
# Copyright 2000 Alexandre Julliard
# Modified Lav <lav@altlinux.ru> 2003
# - remove special support for windows manager's menu
# Modified Lav <lav@altlinux.ru> 2004, 2005
# - rewrite all menu handlers (only for cp1251 wine encoding)
# Modified Lav <lav@altlinux.ru> 2005
# - now local encoding used from WINE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#

mode=""
args=""
menu=""
icon=""
descr=""
link=""
path=""
workdir=""

enc_to_utf8()
{
# -r possible only in ALT Linux
iconv -r'_' -t UTF-8
}

usage()
{
cat <<EOF
usage: wineshelllink options

options:
--desktop create a desktop link
--menu create a menu entry
--path xx path to the application
--link xx name of link to create
--args xx command-line arguments for the application
--icon xx icon to display
--workdir xx working directory for the application
--descr xx application description

EOF
exit 2
}

if [ $# -eq 0 ] ; then
usage
fi

while [ $# -gt 0 ]
do
case "$1" in
--desktop) mode="desktop"; shift 1 ;;
--menu) mode="menu"; shift 1 ;;
--path) path="$2"; shift 2 ;;
--link) link="$2"; shift 2 ;;
--args) args="$2"; shift 2 ;;
--icon) icon="$2"; shift 2 ;;
--descr) descr="$2"; shift 2 ;;
--workdir) workdir="$2"; shift 2 ;;
*) usage ;;
esac
done

# Recoding
xname=`basename "$link"`
link="${link/Programs\///}"
xlname=`basename "$link"`
xlname=${xlname/ /_}
dirlink=`dirname "$link"`

if [ -z "$mode" ] ; then
echo "Either --desktop or --menu required"
usage
fi

if [ -z "$link" ] ; then
echo "You must specify a link name with --link"
usage
fi

freedesktop_entry()
{
cat <<EOF
[Desktop Entry]
Encoding=UTF-8
Name=$xname
Exec=wine "$path" $args
Type=Application
Comment=$descr
EOF
[ -n "$workdir" ] && echo "Path=\"$workdir\""
[ -n "$xpmicon" ] && echo "Icon=$xpmicon"
}

# copy the icon file
dir="$HOME/.icons"
mkdir -p "$dir"
if [ -f "$icon" ] ; then
xpmicon="$dir/$xlname.xpm"
# Note: if icon will not xpm?
cp "$icon" "$xpmicon"
rm "$icon"
else
xpmicon=""
fi

# Menu
if [ $mode = "menu" ] ; then
SECT="WINE Applications"
# KDE
if [ -d "$HOME/.kde" ] ; then
mkdir -p "$HOME/.kde/share/applnk-alt/$SECT/$dirlink"
freedesktop_entry | enc_to_utf8 > "$HOME/.kde/share/applnk-alt/$SECT/$dirlink/$xlname.desktop"
fi
# Gnome
if [ -d "$HOME/.gnome" ] ; then
mkdir -p "$HOME/.gnome/apps-alt/$SECT/$dirlink"
freedesktop_entry | enc_to_utf8 > "$HOME/.gnome/apps-alt/$SECT/$dirlink/$xlname.desktop"
fi
fi

# Desktop
if [ $mode = "desktop" ] ; then
if [ -d "$HOME/Desktop" ] ; then
freedesktop_entry | enc_to_utf8 > "$HOME/Desktop/$xlname.desktop"
fi
fi
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009