From 90255cea979a8db7b2670f34ac63661e5acdde36 Mon Sep 17 00:00:00 2001 From: io <> Date: Sat, 13 Nov 2004 11:10:59 +0000 Subject: [PATCH] Kategoriern-Filter eingebaut --- gnome-menu/viertversuch/manage-kategs.sh | 64 +++++++++++++++++------- 1 file changed, 47 insertions(+), 17 deletions(-) diff --git a/gnome-menu/viertversuch/manage-kategs.sh b/gnome-menu/viertversuch/manage-kategs.sh index ddab4da..d2efecb 100755 --- a/gnome-menu/viertversuch/manage-kategs.sh +++ b/gnome-menu/viertversuch/manage-kategs.sh @@ -3,7 +3,8 @@ set -u KATEG_FILES="`dirname $0`/kategorien-norm.lst `dirname $0`/kategorien-debian.lst" -READ_DESKTOP_DIR="/var/lib/menu-xdg/applications/menu-xdg" +#READ_DESKTOP_DIR="/var/lib/menu-xdg/applications/menu-xdg" +READ_DESKTOP_DIR="/usr/share/applications" WRITE_DESKTOP_DIR="`dirname $0`/desktop-files" #DATA_FILE="`dirname $0`/database.dat" DATA_FILE="/tmp/database.dat" @@ -24,7 +25,7 @@ hole_app_liste() # Parameter: app-name lade_app_kategs() { - DDATEI="$READ_DESKTOP_DIR/$1.desktop" + DDATEI=`find $READ_DESKTOP_DIR -type f -name $1.desktop` if [ -e "$DATA_FILE" ] && grep -q "^$1=" "$DATA_FILE" then grep "^$1=" "$DATA_FILE" | cut -d "=" -f 2 else [ -e "$DDATEI" ] && grep "^Categories=" "$DDATEI" | cut -d "=" -f 2 | tr "\n" " " | tr ";" " " @@ -69,9 +70,29 @@ hole_verwandte_kategs_der_app() } +hole_anzahl_apps() +{ + echo "$ALLE_APPS" | wc -l +} + + +# entfernt alle Apps, die nicht in der angegebenen Kategorie sind +# Parameter: - die Kategorie +# - die Anwendungen +filter_apps_nach_kateg() +{ + local KATEG="$1" + shift + echo -e "$ALLE_APPS" | while read num name + do lade_app_kategs "$name" | grep -q "$KATEG" && echo -e "$num\t$name" + done +} + + + speichere_formdaten() { - local POST_DATA=`cat - | tr "&" "\n" | tee /tmp/out` + local POST_DATA=`cat - | tr "&" "\n"` local EINTRAEGE=`echo "$POST_DATA" | grep "^text_kategs_" | cut -d = -f 1 | sed 's/^text_kategs_//'` local NEUE_KATEGS local APP_NAME @@ -167,7 +188,7 @@ html_apps_config() html_formular() { echo -n '