1#!/usr/local/bin/bash
2
3# Theme creator for Cairo-Dock
4#
5# Copyright : (C) 2008 by Fabounet
6# E-mail    : fabounet@glx-dock.org
7#
8#
9# This program is free software; you can redistribute it and/or
10# modify it under the terms of the GNU General Public License
11# as published by the Free Software Foundation; either version 2
12# of the License, or (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17# GNU General Public License for more details.
18# http://www.gnu.org/licenses/licenses.html#GPL
19
20# Auteur : Nochka85
21# Contact : nochka85@glx-dock.org
22# Version : 05/07/08
23
24# Changelog
25# 05/07/08 :	Ajout catégorie drive_internet ET specific_vlc_icon
26# 05/07/08 :	Refonte totale du scipt + Ajout de fonctionnalités (choix des catégories dans une liste coché ou décoché)... ;-)
27# 02/07/08 :	Ajout de l'option --test - 1ere mise en ligne sur le FTP ;-)
28# 01/07/08 :	Ajout des catégories specific_firefox_icon, specific_thunderbird_icon, specific_inkscape_icon, specific_gimp_icon, launcher, settings, gohome ET system_search
29# 30/06/08 :	Ajout de catégories + Ajout d'icônes spécifiques + Ajout options --relink --[category] --help
30# 29/06/08 :	Ajout detection format + répertoire source + amelioration diverse
31# 29/06/08 :	Ebauche du programme
32
33
34DEBUG=0 # Attention, ne pas oublier de remettre a 0 pour une MAJ du script ... quand ce sera dispo ;-)
35
36# ICONS_DIR="/home/$USER/cairo-dock_theme-creator/"  ## Pour moi ;-)
37ICONS_DIR="/home/$USER/.cairo-dock/icons_themes/"
38
39# MAIN_CAT="web_browser mail_reader video_messenger video_player"  # Encore pour moi :-)
40MAIN_CAT="web_browser file_browser mail_reader image_reader audio_player video_player writer bittorrent downloader cd_burner settings gohome system_search launcher image_editor text_messenger video_messenger terminal packages system_monitor calculator virtual_machine remote_control logo_distribution home_folder default_folder desktop computer webcam irc"
41
42DRIVES_CAT="drive_usb_mounted drive_usb_unmounted network_folder harddrive drive_optical floppy_unmounted drive_internet"
43
44#SPECIFICS_CAT="specific_firefox_icon"	# Encore pour moi :-)
45SPECIFICS_CAT="googleearth specific_skype_icon specific_amsn_icon specific_gaim_icon specific_oowriter_icon specific_oodraw_icon specific_oocalc_icon specific_ooimpress_icon specific_oobase_icon specific_oomath_icon specific_update_manager specific_firefox_icon specific_thunderbird_icon specific_inkscape_icon specific_gimp_icon specific_vlc_icon"
46
47
48
49## Catégories MAIN_CAT :
50LINKS_WEB_BROWSER="firefox firefox-3.0 opera epiphany"
51LINKS_FILE_BROWSER="nautilus konqueror thunar pcmanfm"
52LINKS_MAIL_READER="thunderbird kmail evolution"
53LINKS_IMAGE_READER="eog gqview gwenview f-spot"
54LINKS_AUDIO_PLAYER="rhythmbox exaile xmms listen audacious beep-media-player bmp amarok"
55LINKS_VIDEO_PLAYER="totem mplayer vlc xine kaffeine smplayer"
56LINKS_WRITER="gedit kate oowriter ooo-writer abiword emacs mousepad"
57LINKS_BITTORRENT="transmission deluge bittornado gnome-btdownload ktorrent"
58LINKS_DOWNLOADER="amule emule filezilla"
59LINKS_CD_BURNER="nautilus-burner graveman k3b brasero gnomebaker"
60LINKS_SETTINGS="gnome-settings"
61LINKS_GOHOME="gohome"
62LINKS_SYSTEM_SEARCH="system-search tracker-search-tool"
63LINKS_LAUNCHER="gnome-panel-launcher"
64LINKS_IMAGE_EDITOR="gimp inkscape krita"
65LINKS_TEXT_MESSENGER="gaim pidgin kopete emessene"
66LINKS_VIDEO_MESSENGER="skype ekiga amsn"
67LINKS_TERMINAL="gnome-terminal konsole xfce4-terminal"
68LINKS_PACKAGES="synaptic adept pacman-g2 update-manager"
69LINKS_SYSTEM_MONITOR="ksysguard gnome-system-monitor utilities-system-monitor conky"
70LINKS_CALCULATOR="gnome-calculator accessories-calculator gcalctool crunch"
71LINKS_VIRTUAL_MACHINE="VBox vmware-server"
72LINKS_REMOTE_CONTROL="tsclient"
73LINKS_LOGO_DISTRIBUTION="distributor-logo gnome-main-menu start-here"
74LINKS_HOME_FOLDER="user-home gnome-fs-home folder_home"
75LINKS_DEFAULT_FOLDER="folder gnome-fs-directory"
76LINKS_DESKTOP="desktop"
77LINKS_COMPUTER="computer"
78LINKS_WEBCAM="cheese"
79LINKS_IRC="xchat konversation kvirc"
80
81## Catégories DRIVES_CAT :
82LINKS_DRIVE_USB_MOUNTED="drive-harddisk-usb"
83LINKS_DRIVE_USB_UNMOUNTED="drive-removable-media-usb"
84LINKS_NETWORK_FOLDER="network folder-remote"
85LINKS_HARDDRIVE="gnome-dev-harddisk drive-harddisk"
86LINKS_DRIVE_OPTICAL="drive-optical"
87LINKS_FLOPPY_UNMOUNTED="drive-removable-media"
88LINKS_DRIVE_INTERNET="applications-internet gnome-globe package_network redhat-internet stock_internet xfce-internet"
89
90## Catégories SPECIFICS_CAT :
91LINKS_GOOGLEEARTH="googleearth"
92LINKS_SPECIFIC_SKYPE_ICON="skype"
93LINKS_SPECIFIC_AMSN_ICON="amsn"
94LINKS_SPECIFIC_GAIM_ICON="gaim"
95LINKS_SPECIFIC_OOWRITER_ICON="oowriter ooo-writer"
96LINKS_SPECIFIC_OODRAW_ICON="oodraw ooo-draw"
97LINKS_SPECIFIC_OOCALC_ICON="oocalc ooo-calc"
98LINKS_SPECIFIC_OOIMPRESS_ICON="ooimpress ooo-impress"
99LINKS_SPECIFIC_OOBASE_ICON="oobase ooo-base"
100LINKS_SPECIFIC_OOMATH_ICON="oomath ooo-math"
101LINKS_SPECIFIC_UPDATE_MANAGER="update-manager"
102LINKS_SPECIFIC_FIREFOX_ICON="firefox firefox-3.0"
103LINKS_SPECIFIC_THUNDERBIRD_ICON="thunderbird"
104LINKS_SPECIFIC_INKSCAPE_ICON="inkscape"
105LINKS_SPECIFIC_GIMP_ICON="gimp"
106LINKS_SPECIFIC_VLC_ICON="vlc"
107
108
109
110
111
112
113
114SCRIPT="cairo-dock_theme-creator.sh"		#OK
115SCRIPT_SAVE="cairo-dock_theme-creator.sh.save"	#OK
116SCRIPT_NEW="cairo-dock_theme-creator.sh.new"	#OK
117HOST="http://theme_creator.glx-dock.org"	#OK
118
119
120
121
122IFS=" "				#OK
123START_MENU=""			#OK
124TODO_LIST=""			#OK
125TODO_FINAL=""			#OK
126THEME_NAME=""			#OK
127WORK_DIR=""			#OK
128LINKS=""			#OK
129CURRENT_ICON=""			#OK
130START_DIR="/home/$USER/"	#OK
131REDO_DIR=""			#OK
132GLOBAL_NAME=""			#OK
133FILENAME=""			#OK
134FORMAT=""			#OK
135DETAIL_LIST=""			#OK
136TRUE_FALSE=""			#OK
137TEST_FILE="test_links.log"	#OK
138LOG_FILE="log.txt"
139
140
141NORMAL="\\033[0;39m"
142BLEU="\\033[1;34m"
143VERT="\\033[1;32m"
144ROUGE="\\033[1;31m"
145
146
147#############################################################################################################
148links_definition() {
149## Catégories MAIN_CAT :
150	if [ $current_category = "web_browser" ]; then LINKS=$LINKS_WEB_BROWSER;
151	elif [ $current_category = "file_browser" ]; then LINKS=$LINKS_FILE_BROWSER;
152	elif [ $current_category = "mail_reader" ]; then LINKS=$LINKS_MAIL_READER;
153	elif [ $current_category = "image_reader" ]; then LINKS=$LINKS_IMAGE_READER;
154	elif [ $current_category = "audio_player" ]; then LINKS=$LINKS_AUDIO_PLAYER;
155	elif [ $current_category = "video_player" ]; then LINKS=$LINKS_VIDEO_PLAYER;
156	elif [ $current_category = "writer" ]; then LINKS=$LINKS_WRITER;
157	elif [ $current_category = "bittorrent" ]; then LINKS=$LINKS_BITTORRENT;
158	elif [ $current_category = "downloader" ]; then LINKS=$LINKS_DOWNLOADER;
159	elif [ $current_category = "cd_burner" ]; then LINKS=$LINKS_CD_BURNER;
160	elif [ $current_category = "settings" ]; then LINKS=$LINKS_SETTINGS;
161	elif [ $current_category = "gohome" ]; then LINKS=$LINKS_GOHOME;
162	elif [ $current_category = "system_search" ]; then LINKS=$LINKS_SYSTEM_SEARCH;
163	elif [ $current_category = "launcher" ]; then LINKS=$LINKS_LAUNCHER;
164	elif [ $current_category = "image_editor" ]; then LINKS=$LINKS_IMAGE_EDITOR;
165	elif [ $current_category = "text_messenger" ]; then LINKS=$LINKS_TEXT_MESSENGER;
166	elif [ $current_category = "video_messenger" ]; then LINKS=$LINKS_VIDEO_MESSENGER;
167	elif [ $current_category = "terminal" ]; then LINKS=$LINKS_TERMINAL;
168	elif [ $current_category = "packages" ]; then LINKS=$LINKS_PACKAGES;
169	elif [ $current_category = "system_monitor" ]; then LINKS=$LINKS_SYSTEM_MONITOR;
170	elif [ $current_category = "calculator" ]; then LINKS=$LINKS_CALCULATOR;
171	elif [ $current_category = "virtual_machine" ]; then LINKS=$LINKS_VIRTUAL_MACHINE;
172	elif [ $current_category = "remote_control" ]; then LINKS=$LINKS_REMOTE_CONTROL;
173	elif [ $current_category = "logo_distribution" ]; then LINKS=$LINKS_LOGO_DISTRIBUTION;
174	elif [ $current_category = "home_folder" ]; then LINKS=$LINKS_HOME_FOLDER;
175	elif [ $current_category = "default_folder" ]; then LINKS=$LINKS_DEFAULT_FOLDER;
176	elif [ $current_category = "desktop" ]; then LINKS=$LINKS_DESKTOP;
177	elif [ $current_category = "computer" ]; then LINKS=$LINKS_COMPUTER;
178	elif [ $current_category = "webcam" ]; then LINKS=$LINKS_WEBCAM;
179	elif [ $current_category = "irc" ]; then LINKS=$LINKS_IRC;
180
181
182## Catégories DRIVES_CAT :
183	elif [ $current_category = "drive_usb_mounted" ]; then LINKS=$LINKS_DRIVE_USB_MOUNTED;
184	elif [ $current_category = "drive_usb_unmounted" ]; then LINKS=$LINKS_DRIVE_USB_UNMOUNTED;
185	elif [ $current_category = "network_folder" ]; then LINKS=$LINKS_NETWORK_FOLDER;
186	elif [ $current_category = "harddrive" ]; then LINKS=$LINKS_HARDDRIVE;
187	elif [ $current_category = "drive_optical" ]; then LINKS=$LINKS_DRIVE_OPTICAL;
188	elif [ $current_category = "floppy_unmounted" ]; then LINKS=$LINKS_FLOPPY_UNMOUNTED;
189	elif [ $current_category = "drive_internet" ]; then LINKS=$LINKS_DRIVE_INTERNET;
190
191## Catégories SPECIFICS_CAT :
192	elif [ $current_category = "googleearth" ]; then LINKS=$LINKS_GOOGLEEARTH;
193	elif [ $current_category = "specific_skype_icon" ]; then LINKS=$LINKS_SPECIFIC_SKYPE_ICON;
194	elif [ $current_category = "specific_amsn_icon" ]; then LINKS=$LINKS_SPECIFIC_AMSN_ICON;
195	elif [ $current_category = "specific_gaim_icon" ]; then LINKS=$LINKS_SPECIFIC_GAIM_ICON;
196	elif [ $current_category = "specific_oowriter_icon" ]; then LINKS=$LINKS_SPECIFIC_OOWRITER_ICON;
197	elif [ $current_category = "specific_oodraw_icon" ]; then LINKS=$LINKS_SPECIFIC_OODRAW_ICON;
198	elif [ $current_category = "specific_oocalc_icon" ]; then LINKS=$LINKS_SPECIFIC_OOCALC_ICON;
199	elif [ $current_category = "specific_ooimpress_icon" ]; then LINKS=$LINKS_SPECIFIC_OOIMPRESS_ICON;
200	elif [ $current_category = "specific_oobase_icon" ]; then LINKS=$LINKS_SPECIFIC_OOBASE_ICON;
201	elif [ $current_category = "specific_oomath_icon" ]; then LINKS=$LINKS_SPECIFIC_OOMATH_ICON;
202	elif [ $current_category = "specific_update_manager" ]; then LINKS=$LINKS_SPECIFIC_UPDATE_MANAGER;
203	elif [ $current_category = "specific_firefox_icon" ]; then LINKS=$LINKS_SPECIFIC_FIREFOX_ICON;
204	elif [ $current_category = "specific_thunderbird_icon" ]; then LINKS=$LINKS_SPECIFIC_THUNDERBIRD_ICON;
205	elif [ $current_category = "specific_inkscape_icon" ]; then LINKS=$LINKS_SPECIFIC_INKSCAPE_ICON;
206	elif [ $current_category = "specific_gimp_icon" ]; then LINKS=$LINKS_SPECIFIC_GIMP_ICON;
207	elif [ $current_category = "specific_vlc_icon" ]; then LINKS=$LINKS_SPECIFIC_VLC_ICON;
208	fi
209}
210
211
212#############################################################################################################
213check_new_script() {
214	cp $SCRIPT $SCRIPT_SAVE #pour moi :)
215	echo -e "$NORMAL"""
216	echo "Vérification de la disponibilité d'un nouveau script"
217	wget $HOST/$SCRIPT -q -O $SCRIPT_NEW
218	diff $SCRIPT $SCRIPT_NEW >/dev/null
219	if [ $? -eq 1 ]; then
220		echo -e "$ROUGE"
221		echo "Veuillez relancer le script, une mise à jour a été téléchargée"
222		echo -e "$NORMAL"
223		mv $SCRIPT_NEW $SCRIPT
224		chmod u+x $SCRIPT
225		zenity --info --title="Cairo-Dock Theme Creator" --text="Une mise à jour a été téléchargée.	Cliquez sur Ok pour fermer le terminal."
226		exit
227	else
228		echo ""
229		echo -e "$VERT""Vous possédez la dernière version du script de Nochka85"
230	fi
231	echo -e "$NORMAL"
232	rm $SCRIPT_NEW
233}
234
235
236#############################################################################################################
237start_menu() {
238# Remise à zéro des variables:
239IFS=" "
240START_MENU=""			#OK
241TODO_LIST=""			#OK
242TODO_FINAL=""			#OK
243THEME_NAME=""			#OK
244WORK_DIR=""			#OK
245LINKS=""			#OK
246CURRENT_ICON=""			#OK
247START_DIR="/home/$USER/"	#OK
248REDO_DIR=""			#OK
249GLOBAL_NAME=""			#OK
250FILENAME=""			#OK
251FORMAT=""			#OK
252DETAIL_LIST=""			#OK
253TRUE_FALSE=""			#OK
254
255
256
257
258
259
260START_MENU=$(zenity --width=800 --height=400 --list --separator " " --column="Choix" --column="Action" --column="Observation" --radiolist --text="Choisissez l'action à effectuer (Cliquez sur "Annuler" pour quitter) :" --title="CD Theme Creator" \
261true "NOUVEAU THEME D'ICÔNES" "Créez un nouveau thème d'icônes standard pour Cairo-dock" \
262false "Re-créer les liens d'un thème d'icônes standard" "A effectuer en cas de liens cassés et/ou manquants dans un thème d'icônes créé avec ce script" \
263false "Sélectionner les catégories dans une liste" "Sélectionnez vous même les catégories à traiter dans une liste (TOUT DECOCHE par défaut)" \
264false "Désélectionner les catégories dans une liste" "Sélectionnez vous même les catégories à traiter dans une liste (TOUT COCHE par défaut)" \
265false "Tester ou contrôler un thème d'icônes existant" "Retrouvez facilement les catégories et les liens qu'il manque à votre thème d'icônes")
266
267
268if [ "$START_MENU" = "" ]; then
269	exit
270else
271	IFS="|"
272	for temp in $START_MENU
273		do
274
275		if [ $temp = "NOUVEAU THEME D'ICÔNES" ]; then
276			new_theme
277			start_menu
278
279		elif [ $temp = "Re-créer les liens d'un thème d'icônes standard" ]; then
280			relink
281			start_menu
282
283		elif [ $temp = "Sélectionner les catégories dans une liste" ]; then
284			select_false
285			start_menu
286
287		elif [ $temp = "Désélectionner les catégories dans une liste" ]; then
288			select_true
289			start_menu
290
291		elif [ $temp = "Tester ou contrôler un thème d'icônes existant" ]; then
292			do_report
293			start_menu
294
295		fi
296		done
297fi
298IFS=" "
299}
300
301#############################################################################################################
302new_theme() {
303choose_category		# Definition de $TODO_FINAL
304working_directory	# Definition du nom du répertoire $WORK_DIR
305new_directory		# Création du nouveau répertoire
306cd $WORK_DIR
307REDO_DIR="$START_DIR"
308copy_categories		# Copie des icônes des différentes catégories
309relink_icons		# Création des liens
310zenity --info --title="CD Theme Creator" --text="Votre thème a été créé dans le répertoire:\n$WORK_DIR"
311}
312
313#############################################################################################################
314relink() {
315tempo_text="Spécifier le répertoire dans lequel re-créer les liens"
316todo_relink
317relink_icons
318zenity --info --title="CD Theme Creator" --text="Tous les liens ont été re-créés dans :\n$WORK_DIR\n\nCliquer sur Valider pour revenir au menu principal..."
319}
320
321#############################################################################################################
322select_false() {
323TRUE_FALSE="FALSE"
324select_true_false
325}
326
327#############################################################################################################
328select_true() {
329TRUE_FALSE="TRUE"
330select_true_false
331}
332
333#############################################################################################################
334select_true_false() {
335choose_category
336detail_list		# Definition de $TODO_FINAL et $WORK_DIR
337cd $WORK_DIR
338REDO_DIR="$START_DIR"
339copy_categories		# Copie des icônes des différentes catégories
340relink_icons		# Création des liens
341zenity --info --title="CD Theme Creator" --text="Toutes les catégories sélectionnées ont été créés dans le répertoire:\n$WORK_DIR"
342}
343
344
345#############################################################################################################
346choose_category() {
347IFS=" "
348TODO_LIST=$(zenity --width=750 --height=400 --list --column="Choix" --column="Catégories" --column="Observation" --checklist --text="Choisissez les catégories d'icônes à traiter\n\nATTENTION : Les icônes génériques sont OBLIGATOIRES\n" --title="CD Theme Creator" \
349true "Icônes génériques" "Ce sont les icônes OBLIGATOIRES pour un thème standard cairo-dock" \
350false "Icônes des VOLUMES" "Conseillés pour certaines applets de cairo-dock" \
351false "Icônes spécifiques" "Permettent de "surcharger" les icônes génériques pour certaines applications (exemple : Firefox, Thunderbird,etc...)")
352
353if [ "$TODO_LIST" = "" ]; then start_menu
354
355else
356	IFS="|"
357	for temp in $TODO_LIST
358		do
359
360		if [ $temp = "Icônes génériques" ]; then
361						for categorie in $MAIN_CAT
362							do
363								TODO_FINAL="$TODO_FINAL$categorie "
364							done
365
366		elif [ $temp = "Icônes des VOLUMES" ]; then
367						for categorie in $DRIVES_CAT
368							do
369								TODO_FINAL="$TODO_FINAL$categorie "
370							done
371
372		elif [ $temp = "Icônes spécifiques" ]; then
373						for categorie in $SPECIFICS_CAT
374							do
375								TODO_FINAL="$TODO_FINAL$categorie "
376							done
377		fi
378		done
379fi
380IFS=" "
381}
382
383
384#############################################################################################################
385working_directory() {
386THEME_NAME=$(zenity --entry --title="CD Theme Creator" --text="Entrez le nom de votre thème d'icônes (il sera placé dans $ICONS_DIR)")
387if [ "$THEME_NAME" = "" ]; then
388				zenity --error --text "Aucun nom n'a été rentré ou l'opération a été annulée..."
389				TODO_FINAL=""
390				start_menu
391else
392WORK_DIR="$ICONS_DIR$THEME_NAME"/
393fi
394}
395
396
397#############################################################################################################
398new_directory() {
399 if test -e $ICONS_DIR$THEME_NAME; then
400		zenity --error --text "Le répertoire $THEME_NAME existe déjà dans \n $ICONS_DIR\nVeuillez entrer un autre nom pour votre thème d'icônes..."
401		working_directory
402		new_directory
403 else
404	mkdir -p $WORK_DIR
405 fi
406}
407
408#############################################################################################################
409copy_categories() {
410for current_category in $TODO_FINAL
411		do
412			choose_icon
413			if [ "$CURRENT_ICON" != "" ]; then
414				rm -f $WORK_DIR.$current_category.*
415				cp -f $CURRENT_ICON $WORK_DIR.$current_category.$FORMAT
416			fi
417		done
418}
419
420
421#############################################################################################################
422choose_icon() {
423	zenity --info --title="CD Theme Creator" --text="Choisissez une image pour "$current_category"\n\nAnnuler pour passer\n"
424	CURRENT_ICON=$(zenity --file-selection --filename $REDO_DIR --title="CD Theme Creator - Image "$current_category)
425	if [ "$CURRENT_ICON" != "" ]; then
426		REDO_DIR=`dirname $CURRENT_ICON`/		# Répertoire de l'icône
427		GLOBAL_NAME=`basename $CURRENT_ICON`		# Nom de l'image avec son extension
428		FILENAME=${GLOBAL_NAME%.*}			# Nom du fichier SANS extension
429		FORMAT=${GLOBAL_NAME##*.}			# Extension SEULE
430	fi
431}
432
433
434#############################################################################################################
435todo_relink() {
436TODO_FINAL=""
437for categorie in $MAIN_CAT
438	do
439		TODO_FINAL="$TODO_FINAL$categorie "
440	done
441
442for categorie in $DRIVES_CAT
443	do
444		TODO_FINAL="$TODO_FINAL$categorie "
445	done
446
447for categorie in $SPECIFICS_CAT
448	do
449		TODO_FINAL="$TODO_FINAL$categorie "
450	done
451
452zenity --info --title="CD Theme Creator" --text="$tempo_text"
453WORK_DIR=$(zenity --file-selection --filename $ICONS_DIR --directory --title="CD Theme Creator")/
454
455if [ "$WORK_DIR" = "/" ]; then
456				zenity --error --text "L'opération a été annulée..."
457				TODO_FINAL=""
458				start_menu
459fi
460}
461
462
463
464#############################################################################################################
465relink_icons() {
466IFS=" "
467	for current_category in $TODO_FINAL
468		do
469			for FORMAT in "svg" "png"
470				do
471					if test -e $WORK_DIR.$current_category.$FORMAT; then
472						cd $WORK_DIR
473						links_definition
474						for links in $LINKS
475							do
476								rm -f $links.*
477								ln -s -f .$current_category.$FORMAT $links.$FORMAT
478							done
479					fi
480				done
481		done
482}
483
484
485
486#############################################################################################################
487detail_list() {
488DETAIL_LIST=""
489for current_category in $TODO_FINAL
490	do
491		links_definition
492		temp=""
493		for links in $LINKS
494			do
495			temp="$temp[$links]"
496			done
497
498		DETAIL_LIST="$DETAIL_LIST$TRUE_FALSE $current_category $temp "
499	done
500
501TODO_FINAL=""
502TODO_FINAL=$(zenity --width=750 --height=400 --list --column="Choix" --column="Catégories" --column="Liste des applications concernées" --checklist --text="Choisissez les catégories d'icônes à traiter\n\nATTENTION : Les icônes génériques sont OBLIGATOIRES\n" --title="CD Theme Creator" $DETAIL_LIST)
503DETAIL_LIST="$TODO_FINAL"
504TODO_FINAL=""
505IFS="|"
506for temp in $DETAIL_LIST
507	do
508		TODO_FINAL="$TODO_FINAL$temp "
509	done
510IFS=" "
511
512if [ "$TODO_FINAL" = "" ]; then
513				zenity --error --text "Aucune catégorie n'a été sélectionnée ou l'opération a été annulée..."
514				TODO_FINAL=""
515				start_menu
516fi
517
518
519
520zenity --info --title="CD Theme Creator" --text="Spécifier le répertoire dans lequel (re-)créer les liens"
521WORK_DIR=$(zenity --file-selection --filename $ICONS_DIR --directory --title="CD Theme Creator")/
522
523
524if [ "$WORK_DIR" = "/" ]; then
525				zenity --error --text "Aucun répertoire n'a été spécifié ou l'opération a été annulée..."
526				TODO_FINAL=""
527				start_menu
528fi
529
530
531}
532
533
534#############################################################################################################
535do_report() {
536tempo_text="Spécifier le répertoire où tester les liens"
537todo_relink		# Definition $TODO_FINAL et $WORK_DIR
538cd $WORK_DIR
539rm -f $TEST_FILE
540IFS=" "
541
542for current_category in $TODO_FINAL
543	do
544		for FORMAT in "png" "svg"
545			do
546				if test -e .$current_category.$FORMAT; then
547					echo "OK : La categorie $current_category EXISTE au format $FORMAT">>$TEST_FILE
548					CURRENT=.$current_category.$FORMAT
549					links_definition
550					for links in $LINKS
551						do
552							if test -e $links.$FORMAT; then
553								cd $WORK_DIR
554							else
555								echo "          ATTENTION : le lien $links.$FORMAT est absent de la categorie $current_category">>$TEST_FILE
556							fi
557						done
558				else
559					echo "La categorie $current_category n'a pas ete creee en $FORMAT">>$TEST_FILE
560				fi
561			done
562		echo "">>$TEST_FILE
563		echo "">>$TEST_FILE
564	done
565
566zenity --info --title="CD Theme Creator" --text="Un fichier de rapport $TEST_FILE a été créé dans $WORK_DIR\nCliquer sur Valider pour continuer"
567cat $TEST_FILE | zenity --text-info --title="CD Theme Creator - $TEST_FILE" --width 550 --height=700
568}
569
570
571
572
573#############################################################################################################
574# DEBUT DU PROGRAMME
575#############################################################################################################
576
577
578if [ $DEBUG -ne 1 ]; then
579	check_new_script
580fi
581
582
583case $1 in
584
585	"--help")
586		echo -e "$VERT""Usage:"
587		echo -e "$NORMAL""$0""$VERT""         			Créer un nouveau thème"
588		echo -e "$NORMAL""$0 --relink""$VERT""        		Re-créer les liens dans un répertoire avec des liens cassés"
589		echo -e "$NORMAL""$0 --choose_all""$VERT""        	Specifier la (ou les) catégorie(s) à traiter (Tout coché par défaut)"
590		echo -e "$NORMAL""$0 --choose_none""$VERT""        	Specifier la (ou les) catégorie(s) à traiter (Tout décoché par défaut)"
591		echo -e "$NORMAL""$0 --test""$VERT""        		Vérifier qu'un thème est complet"
592		echo -e "$NORMAL""$0 --help""$VERT""          		Afficher ce menu d'aide "
593		echo ""
594		echo ""
595		echo -e "$NORMAL""Auteur : Nochka85"
596		echo -e "$NORMAL""Contact : nochka85@glx-dock.org"
597		echo ""
598		exit
599	;;
600
601	"--relink")
602		relink
603		exit
604	;;
605
606	"--choose_all")
607		select_true
608		exit
609	;;
610
611	"--choose_none")
612		select_false
613		exit
614	;;
615
616	"--test")
617		do_report
618		exit
619	;;
620esac
621
622start_menu
623exit
624
625
626
627