summaryrefslogtreecommitdiff
path: root/apps/plugins/theme_remove.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/theme_remove.c')
-rw-r--r--apps/plugins/theme_remove.c43
1 files changed, 1 insertions, 42 deletions
diff --git a/apps/plugins/theme_remove.c b/apps/plugins/theme_remove.c
index 674342a920..f39d224868 100644
--- a/apps/plugins/theme_remove.c
+++ b/apps/plugins/theme_remove.c
@@ -48,18 +48,12 @@ struct remove_setting {
48}; 48};
49 49
50static int remove_wps(struct remove_setting *); 50static int remove_wps(struct remove_setting *);
51#ifdef HAVE_LCD_BITMAP
52static int remove_icons(struct remove_setting *setting); 51static int remove_icons(struct remove_setting *setting);
53#endif
54 52
55enum remove_settings { 53enum remove_settings {
56#ifdef HAVE_LCD_BITMAP
57 REMOVE_FONT, 54 REMOVE_FONT,
58#endif
59 REMOVE_WPS, 55 REMOVE_WPS,
60#ifdef HAVE_LCD_BITMAP
61 REMOVE_SBS, 56 REMOVE_SBS,
62#endif
63#ifdef HAVE_REMOTE_LCD 57#ifdef HAVE_REMOTE_LCD
64 REMOVE_RWPS, 58 REMOVE_RWPS,
65 REMOVE_RSBS, 59 REMOVE_RSBS,
@@ -67,10 +61,8 @@ enum remove_settings {
67#if LCD_DEPTH > 1 61#if LCD_DEPTH > 1
68 REMOVE_BACKDROP, 62 REMOVE_BACKDROP,
69#endif 63#endif
70#ifdef HAVE_LCD_BITMAP
71 REMOVE_ICON, 64 REMOVE_ICON,
72 REMOVE_VICON, 65 REMOVE_VICON,
73#endif
74#ifdef HAVE_REMOTE_LCD 66#ifdef HAVE_REMOTE_LCD
75 REMOVE_RICON, 67 REMOVE_RICON,
76 REMOVE_RVICON, 68 REMOVE_RVICON,
@@ -83,16 +75,12 @@ enum remove_settings {
83 75
84static bool create_log = true; 76static bool create_log = true;
85static struct remove_setting remove_list[NUM_REMOVE_ITEMS] = { 77static struct remove_setting remove_list[NUM_REMOVE_ITEMS] = {
86#ifdef HAVE_LCD_BITMAP
87 [REMOVE_FONT] = { "font", FONT_DIR "/", ".fnt", "", 78 [REMOVE_FONT] = { "font", FONT_DIR "/", ".fnt", "",
88 ASK_FOR_REMOVAL, NULL, false }, 79 ASK_FOR_REMOVAL, NULL, false },
89#endif
90 [REMOVE_WPS] = { "wps", WPS_DIR "/", ".wps", "", 80 [REMOVE_WPS] = { "wps", WPS_DIR "/", ".wps", "",
91 REMOVE_IF_NOT_USED, remove_wps, false }, 81 REMOVE_IF_NOT_USED, remove_wps, false },
92#ifdef HAVE_LCD_BITMAP
93 [REMOVE_SBS] = { "sbs", SBS_DIR "/", ".sbs", "", 82 [REMOVE_SBS] = { "sbs", SBS_DIR "/", ".sbs", "",
94 REMOVE_IF_NOT_USED, remove_wps, false }, 83 REMOVE_IF_NOT_USED, remove_wps, false },
95#endif
96#ifdef HAVE_REMOTE_LCD 84#ifdef HAVE_REMOTE_LCD
97 [REMOVE_RWPS] = { "rwps", WPS_DIR "/", ".rwps", "", 85 [REMOVE_RWPS] = { "rwps", WPS_DIR "/", ".rwps", "",
98 REMOVE_IF_NOT_USED, remove_wps, false }, 86 REMOVE_IF_NOT_USED, remove_wps, false },
@@ -103,12 +91,10 @@ static struct remove_setting remove_list[NUM_REMOVE_ITEMS] = {
103 [REMOVE_BACKDROP] = { "backdrop", BACKDROP_DIR "/", ".bmp", "", 91 [REMOVE_BACKDROP] = { "backdrop", BACKDROP_DIR "/", ".bmp", "",
104 REMOVE_IF_NOT_USED, NULL, false }, 92 REMOVE_IF_NOT_USED, NULL, false },
105#endif 93#endif
106#ifdef HAVE_LCD_BITMAP
107 [REMOVE_ICON] = { "iconset", ICON_DIR "/", ".bmp", "", 94 [REMOVE_ICON] = { "iconset", ICON_DIR "/", ".bmp", "",
108 ASK_FOR_REMOVAL, NULL, false }, 95 ASK_FOR_REMOVAL, NULL, false },
109 [REMOVE_VICON] = { "viewers iconset", ICON_DIR "/", ".bmp", "", 96 [REMOVE_VICON] = { "viewers iconset", ICON_DIR "/", ".bmp", "",
110 ASK_FOR_REMOVAL, remove_icons, false }, 97 ASK_FOR_REMOVAL, remove_icons, false },
111#endif
112#ifdef HAVE_REMOTE_LCD 98#ifdef HAVE_REMOTE_LCD
113 [REMOVE_RICON] = { "remote iconset", ICON_DIR "/", ".bmp", "", 99 [REMOVE_RICON] = { "remote iconset", ICON_DIR "/", ".bmp", "",
114 ASK_FOR_REMOVAL, NULL, false }, 100 ASK_FOR_REMOVAL, NULL, false },
@@ -124,19 +110,15 @@ static char *option_names[NUM_REMOVE_OPTION] = {
124 "always", "never", "not used", "ask", 110 "always", "never", "not used", "ask",
125}; 111};
126static struct configdata config[] = { 112static struct configdata config[] = {
127#ifdef HAVE_LCD_BITMAP
128 { TYPE_INT, 0, NUM_REMOVE_OPTION, 113 { TYPE_INT, 0, NUM_REMOVE_OPTION,
129 { .int_p = &remove_list[REMOVE_FONT].option }, 114 { .int_p = &remove_list[REMOVE_FONT].option },
130 "remove font", option_names }, 115 "remove font", option_names },
131#endif
132 { TYPE_INT, 0, NUM_REMOVE_OPTION, 116 { TYPE_INT, 0, NUM_REMOVE_OPTION,
133 { .int_p = &remove_list[REMOVE_WPS].option }, 117 { .int_p = &remove_list[REMOVE_WPS].option },
134 "remove wps", option_names }, 118 "remove wps", option_names },
135#ifdef HAVE_LCD_BITMAP
136 { TYPE_INT, 0, NUM_REMOVE_OPTION, 119 { TYPE_INT, 0, NUM_REMOVE_OPTION,
137 { .int_p = &remove_list[REMOVE_SBS].option }, 120 { .int_p = &remove_list[REMOVE_SBS].option },
138 "remove sbs", option_names }, 121 "remove sbs", option_names },
139#endif
140#ifdef HAVE_REMOTE_LCD 122#ifdef HAVE_REMOTE_LCD
141 { TYPE_INT, 0, NUM_REMOVE_OPTION, 123 { TYPE_INT, 0, NUM_REMOVE_OPTION,
142 { .int_p = &remove_list[REMOVE_RWPS].option }, 124 { .int_p = &remove_list[REMOVE_RWPS].option },
@@ -150,14 +132,12 @@ static struct configdata config[] = {
150 { .int_p = &remove_list[REMOVE_BACKDROP].option }, 132 { .int_p = &remove_list[REMOVE_BACKDROP].option },
151 "remove backdrop", option_names }, 133 "remove backdrop", option_names },
152#endif 134#endif
153#ifdef HAVE_LCD_BITMAP
154 { TYPE_INT, 0, NUM_REMOVE_OPTION, 135 { TYPE_INT, 0, NUM_REMOVE_OPTION,
155 { .int_p = &remove_list[REMOVE_ICON].option }, 136 { .int_p = &remove_list[REMOVE_ICON].option },
156 "remove iconset", option_names }, 137 "remove iconset", option_names },
157 { TYPE_INT, 0, NUM_REMOVE_OPTION, 138 { TYPE_INT, 0, NUM_REMOVE_OPTION,
158 { .int_p = &remove_list[REMOVE_VICON].option }, 139 { .int_p = &remove_list[REMOVE_VICON].option },
159 "remove viconset", option_names }, 140 "remove viconset", option_names },
160#endif
161#ifdef HAVE_REMOTE_LCD 141#ifdef HAVE_REMOTE_LCD
162 { TYPE_INT, 0, NUM_REMOVE_OPTION, 142 { TYPE_INT, 0, NUM_REMOVE_OPTION,
163 { .int_p = &remove_list[REMOVE_RICON].option }, 143 { .int_p = &remove_list[REMOVE_RICON].option },
@@ -285,7 +265,6 @@ static int remove_wps(struct remove_setting *setting)
285 return remove_dir(bmpdir, MAX_PATH); 265 return remove_dir(bmpdir, MAX_PATH);
286} 266}
287 267
288#ifdef HAVE_LCD_BITMAP
289static int remove_icons(struct remove_setting *setting) 268static int remove_icons(struct remove_setting *setting)
290{ 269{
291 char path[MAX_PATH]; 270 char path[MAX_PATH];
@@ -306,19 +285,15 @@ static int remove_icons(struct remove_setting *setting)
306 show_mess("Removed", path); 285 show_mess("Removed", path);
307 return 0; 286 return 0;
308} 287}
309#endif
310 288
311#ifdef HAVE_LCD_BITMAP
312static char font_file[MAX_PATH]; 289static char font_file[MAX_PATH];
313#endif 290
314static bool is_deny_file(const char *file) 291static bool is_deny_file(const char *file)
315{ 292{
316 const char *deny_files[] = { 293 const char *deny_files[] = {
317 WPS_DEFAULTCFG, 294 WPS_DEFAULTCFG,
318 RWPS_DEFAULTCFG, 295 RWPS_DEFAULTCFG,
319#ifdef HAVE_LCD_BITMAP
320 font_file, 296 font_file,
321#endif
322 NULL 297 NULL
323 }; 298 };
324 const char **p = deny_files; 299 const char **p = deny_files;
@@ -334,13 +309,9 @@ static bool is_deny_file(const char *file)
334static void check_whether_used_in_setting(void) 309static void check_whether_used_in_setting(void)
335{ 310{
336 const char *setting_files[] = { 311 const char *setting_files[] = {
337#ifdef HAVE_LCD_BITMAP
338 rb->global_settings->font_file, 312 rb->global_settings->font_file,
339#endif
340 rb->global_settings->wps_file, 313 rb->global_settings->wps_file,
341#ifdef HAVE_LCD_BITMAP
342 rb->global_settings->sbs_file, 314 rb->global_settings->sbs_file,
343#endif
344#ifdef HAVE_REMOTE_LCD 315#ifdef HAVE_REMOTE_LCD
345 rb->global_settings->rwps_file, 316 rb->global_settings->rwps_file,
346 rb->global_settings->rsbs_file, 317 rb->global_settings->rsbs_file,
@@ -348,10 +319,8 @@ static void check_whether_used_in_setting(void)
348#if LCD_DEPTH > 1 319#if LCD_DEPTH > 1
349 rb->global_settings->backdrop_file, 320 rb->global_settings->backdrop_file,
350#endif 321#endif
351#ifdef HAVE_LCD_BITMAP
352 rb->global_settings->icon_file, 322 rb->global_settings->icon_file,
353 rb->global_settings->viewers_icon_file, 323 rb->global_settings->viewers_icon_file,
354#endif
355#ifdef HAVE_REMOTE_LCD 324#ifdef HAVE_REMOTE_LCD
356 rb->global_settings->remote_icon_file, 325 rb->global_settings->remote_icon_file,
357 rb->global_settings->remote_viewers_icon_file, 326 rb->global_settings->remote_viewers_icon_file,
@@ -419,12 +388,10 @@ static void check_whether_used(void)
419 DIR *dir; 388 DIR *dir;
420 389
421 check_whether_used_in_setting(); 390 check_whether_used_in_setting();
422#ifdef HAVE_LCD_BITMAP
423 /* mark font files come from rockbox-font.zip as used and don't remove 391 /* mark font files come from rockbox-font.zip as used and don't remove
424 * them automatically as themes may depend on those fonts. */ 392 * them automatically as themes may depend on those fonts. */
425 if (remove_list[REMOVE_FONT].option == REMOVE_IF_NOT_USED) 393 if (remove_list[REMOVE_FONT].option == REMOVE_IF_NOT_USED)
426 check_whether_used_in_file(RB_FONTS_CONFIG); 394 check_whether_used_in_file(RB_FONTS_CONFIG);
427#endif
428 395
429 dir = rb->opendir(THEME_DIR); 396 dir = rb->opendir(THEME_DIR);
430 if (!dir) 397 if (!dir)
@@ -591,13 +558,9 @@ static bool option_menu(void)
591{ 558{
592 MENUITEM_STRINGLIST(option_menu, "Remove Options", NULL, 559 MENUITEM_STRINGLIST(option_menu, "Remove Options", NULL,
593 /* same order as remove_list */ 560 /* same order as remove_list */
594#ifdef HAVE_LCD_BITMAP
595 "Font", 561 "Font",
596#endif
597 "WPS", 562 "WPS",
598#ifdef HAVE_LCD_BITMAP
599 "Statusbar Skin", 563 "Statusbar Skin",
600#endif
601#ifdef HAVE_REMOTE_LCD 564#ifdef HAVE_REMOTE_LCD
602 "Remote WPS", 565 "Remote WPS",
603 "Remote Statusbar Skin", 566 "Remote Statusbar Skin",
@@ -605,9 +568,7 @@ static bool option_menu(void)
605#if LCD_DEPTH > 1 568#if LCD_DEPTH > 1
606 "Backdrop", 569 "Backdrop",
607#endif 570#endif
608#ifdef HAVE_LCD_BITMAP
609 "Iconset", "Viewers Iconset", 571 "Iconset", "Viewers Iconset",
610#endif
611#ifdef HAVE_REMOTE_LCD 572#ifdef HAVE_REMOTE_LCD
612 "Remote Iconset", "Remote Viewers Iconset", 573 "Remote Iconset", "Remote Viewers Iconset",
613#endif 574#endif
@@ -669,10 +630,8 @@ enum plugin_status plugin_start(const void* parameter)
669 if((p = rb->strrchr(title, '.'))) 630 if((p = rb->strrchr(title, '.')))
670 *p = 0; 631 *p = 0;
671 632
672#ifdef HAVE_LCD_BITMAP
673 rb->snprintf(font_file, MAX_PATH, FONT_DIR "/%s.fnt", 633 rb->snprintf(font_file, MAX_PATH, FONT_DIR "/%s.fnt",
674 rb->global_settings->font_file); 634 rb->global_settings->font_file);
675#endif
676 rb->strlcpy(themefile, parameter, MAX_PATH); 635 rb->strlcpy(themefile, parameter, MAX_PATH);
677 if (!rb->file_exists(themefile)) 636 if (!rb->file_exists(themefile))
678 { 637 {