summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/filetypes.c26
-rw-r--r--apps/filetypes.h4
-rw-r--r--apps/tree.c4
3 files changed, 13 insertions, 21 deletions
diff --git a/apps/filetypes.c b/apps/filetypes.c
index ec9bd1a7ae..03f3cfa994 100644
--- a/apps/filetypes.c
+++ b/apps/filetypes.c
@@ -46,6 +46,10 @@
46/* max viewer plugins */ 46/* max viewer plugins */
47#define MAX_VIEWERS 56 47#define MAX_VIEWERS 56
48 48
49static void read_builtin_types_init(void) INIT_ATTR;
50static void read_viewers_config_init(void) INIT_ATTR;
51static void read_config_init(int fd) INIT_ATTR;
52
49/* a table for the known file types */ 53/* a table for the known file types */
50static const struct filetype inbuilt_filetypes[] = { 54static const struct filetype inbuilt_filetypes[] = {
51 { "mp3", FILE_ATTR_AUDIO }, 55 { "mp3", FILE_ATTR_AUDIO },
@@ -187,12 +191,6 @@ static const struct fileattr_icon_voice inbuilt_attr_icons_voices[] = {
187#endif 191#endif
188}; 192};
189 193
190void tree_get_filetypes(const struct filetype** types, int* count)
191{
192 *types = inbuilt_filetypes;
193 *count = sizeof(inbuilt_filetypes) / sizeof(*inbuilt_filetypes);
194}
195
196long tree_get_filetype_voiceclip(int attr) 194long tree_get_filetype_voiceclip(int attr)
197{ 195{
198 if (global_settings.talk_filetype) 196 if (global_settings.talk_filetype)
@@ -306,8 +304,6 @@ static int find_extension(const char* extension)
306 return -1; 304 return -1;
307} 305}
308 306
309static void read_builtin_types(void);
310static void read_config(int fd);
311#ifdef HAVE_LCD_COLOR 307#ifdef HAVE_LCD_COLOR
312/* Colors file format is similar to icons: 308/* Colors file format is similar to icons:
313 * ext:hex_color 309 * ext:hex_color
@@ -401,7 +397,7 @@ void read_viewer_theme_file(void)
401 custom_icons_loaded = true; 397 custom_icons_loaded = true;
402} 398}
403 399
404static void read_viewers_config(void) 400static void read_viewers_config_init(void)
405{ 401{
406 int fd = open(VIEWERS_CONFIG, O_RDONLY); 402 int fd = open(VIEWERS_CONFIG, O_RDONLY);
407 if(fd < 0) 403 if(fd < 0)
@@ -417,14 +413,14 @@ static void read_viewers_config(void)
417 if(strdup_handle <= 0) 413 if(strdup_handle <= 0)
418 goto out; 414 goto out;
419 415
420 read_config(fd); 416 read_config_init(fd);
421 core_shrink(strdup_handle, core_get_data(strdup_handle), strdup_cur_idx); 417 core_shrink(strdup_handle, core_get_data(strdup_handle), strdup_cur_idx);
422 418
423 out: 419 out:
424 close(fd); 420 close(fd);
425} 421}
426 422
427void filetype_init(void) 423void filetype_init(void)
428{ 424{
429 /* set the directory item first */ 425 /* set the directory item first */
430 filetypes[0].extension = NULL; 426 filetypes[0].extension = NULL;
@@ -435,8 +431,8 @@ void filetype_init(void)
435 viewer_count = 0; 431 viewer_count = 0;
436 filetype_count = 1; 432 filetype_count = 1;
437 433
438 read_builtin_types(); 434 read_builtin_types_init();
439 read_viewers_config(); 435 read_viewers_config_init();
440 read_viewer_theme_file(); 436 read_viewer_theme_file();
441#ifdef HAVE_LCD_COLOR 437#ifdef HAVE_LCD_COLOR
442 read_color_theme_file(); 438 read_color_theme_file();
@@ -459,7 +455,7 @@ static void rm_whitespaces(char* str)
459 *s = '\0'; 455 *s = '\0';
460} 456}
461 457
462static void read_builtin_types(void) 458static void read_builtin_types_init(void)
463{ 459{
464 int tree_attr; 460 int tree_attr;
465 size_t count = ARRAY_SIZE(inbuilt_filetypes); 461 size_t count = ARRAY_SIZE(inbuilt_filetypes);
@@ -487,7 +483,7 @@ static void read_builtin_types(void)
487 } 483 }
488} 484}
489 485
490static void read_config(int fd) 486static void read_config_init(int fd)
491{ 487{
492 char line[64], *s, *e; 488 char line[64], *s, *e;
493 char *extension, *plugin; 489 char *extension, *plugin;
diff --git a/apps/filetypes.h b/apps/filetypes.h
index 9013f81b02..5aae772a9c 100644
--- a/apps/filetypes.h
+++ b/apps/filetypes.h
@@ -55,12 +55,12 @@ struct filetype {
55 int tree_attr; 55 int tree_attr;
56}; 56};
57 57
58void tree_get_filetypes(const struct filetype**, int*) INIT_ATTR; 58long tree_get_filetype_voiceclip(int attr);
59long tree_get_filetype_voiceclip(int attr) INIT_ATTR;
60 59
61/* init the filetypes structs. 60/* init the filetypes structs.
62 uses audio buffer for storage, so call early in init... */ 61 uses audio buffer for storage, so call early in init... */
63void filetype_init(void) INIT_ATTR; 62void filetype_init(void) INIT_ATTR;
63
64void read_viewer_theme_file(void); 64void read_viewer_theme_file(void);
65#ifdef HAVE_LCD_COLOR 65#ifdef HAVE_LCD_COLOR
66void read_color_theme_file(void); 66void read_color_theme_file(void);
diff --git a/apps/tree.c b/apps/tree.c
index 3684e395a1..4df2c4e327 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -77,9 +77,6 @@
77 77
78#include "root_menu.h" 78#include "root_menu.h"
79 79
80static const struct filetype *filetypes;
81static int filetypes_count;
82
83static struct gui_synclist tree_lists; 80static struct gui_synclist tree_lists;
84 81
85/* I put it here because other files doesn't use it yet, 82/* I put it here because other files doesn't use it yet,
@@ -1090,7 +1087,6 @@ void tree_mem_init(void)
1090 cache->entries_handle = core_alloc_ex("tree entries", 1087 cache->entries_handle = core_alloc_ex("tree entries",
1091 cache->max_entries*(sizeof(struct entry)), 1088 cache->max_entries*(sizeof(struct entry)),
1092 &ops); 1089 &ops);
1093 tree_get_filetypes(&filetypes, &filetypes_count);
1094} 1090}
1095 1091
1096bool bookmark_play(char *resume_file, int index, unsigned long elapsed, 1092bool bookmark_play(char *resume_file, int index, unsigned long elapsed,