diff options
-rw-r--r-- | desktop-common-data.spec | 5 | ||||
-rwxr-xr-x | xinit.d/desktop-directories | 42 |
2 files changed, 40 insertions, 7 deletions
diff --git a/desktop-common-data.spec b/desktop-common-data.spec index 1df1ab0..5a5dba4 100644 --- a/desktop-common-data.spec +++ b/desktop-common-data.spec @@ -1,7 +1,7 @@ Summary: Desktop common files Name: desktop-common-data Version: 10.3.1 -Release: 3mdk +Release: 4mdk License: GPL URL: http://www.mandrivalinux.com/ Group: System/Configuration/Other @@ -171,6 +171,9 @@ rm -fr %buildroot %changelog +* Fri Aug 26 2005 Frederic Crozat <fcrozat@mandriva.com> 10.3.1-4mdk +- New scheme for default directories + * Wed Aug 24 2005 Frederic Crozat <fcrozat@mandriva.com> 10.3.1-3mdk - Add default directories xinit.d script diff --git a/xinit.d/desktop-directories b/xinit.d/desktop-directories index de4b02d..c5eaa92 100755 --- a/xinit.d/desktop-directories +++ b/xinit.d/desktop-directories @@ -1,14 +1,44 @@ #!/bin/sh -USER_STAMP=$HOME/.mdk-desktop +USER_STAMP=$HOME/.mdk-folders + +if [ ! -e $USER_STAMP ]; then + locale=C + if [ ! -z "$LC_ALL" ]; then + locale=$LC_ALL + elif [ ! -z "$LC_CTYPE" ]; then + locale=$LC_CTYPE + elif [ ! -z "$LANG" ]; then + locale=$LANG + fi + + [ -d $HOME/.mdk-folders ] || mkdir -p $HOME/.mdk-folders -if [ ! -f $USER_STAMP ]; then for file in /usr/share/mdk/menu/*-mdk.desktop.template ; do - echo $file - DIRECTORY_PATH="$HOME/`grep URL $file | sed -e 's|URL=file://\$HOME/||g'`" - FILE_PATH=$HOME/`basename $file .template` + TARGET_DIR=`grep Name[$locale] $file | sed -e 's|.*=||g'` + if [ -z "$TARGET_DIR" ]; then + locale=`echo $locale | sed -e 's/_.*//g' -e 's/@.*//g'` + TARGET_DIR=`grep -F Name[$locale] $file | sed -e 's|.*=||g'` + fi + + if [ -z "$TARGET_DIR" ]; then + TARGET_DIR=`grep -F Name $file | sed -e 's|.*=||g'` + fi + + if [ "$CHARSET" != "UTF-8" ]; then + TARGET_DIR=`echo $TARGET_DIR | iconv -f UTF-8 -t "$CHARSET"` + fi + + + DIRECTORY_PATH="$HOME/$TARGET_DIR" [ -d "$DIRECTORY_PATH" ] || mkdir -p $DIRECTORY_PATH - [ -f $FILE_PATH ] || cat $file | sed -e "s|\$HOME|${HOME}|g" > $FILE_PATH + echo -e [Desktop Entry]\\n`grep Icon= $file` > $DIRECTORY_PATH/.directory + + FILE_PATH=$HOME/.mdk-folders/`basename $file .template` + SYMLINK=$HOME/.mdk-folders/`basename $file -mdk.desktop.template` + + ln -f -s $DIRECTORY_PATH $SYMLINK + [ -f $FILE_PATH ] || cat $file | sed -e "s|\$HOME.*|$DIRECTORY_PATH|g" > $FILE_PATH if [ "$file" != "/usr/share/mdk/menu/desktop-mdk.desktop.template" ]; then echo "file://$FILE_PATH" >> $HOME/.gtk-bookmarks fi |