diff options
Diffstat (limited to 'apps/filetypes.c')
-rw-r--r-- | apps/filetypes.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/apps/filetypes.c b/apps/filetypes.c index f91df19652..cb05a60ad6 100644 --- a/apps/filetypes.c +++ b/apps/filetypes.c | |||
@@ -75,12 +75,33 @@ static char *filetypes_strdup(char* string) | |||
75 | static void read_builtin_types(void); | 75 | static void read_builtin_types(void); |
76 | static void read_config(char* config_file); | 76 | static void read_config(char* config_file); |
77 | #ifdef HAVE_LCD_BITMAP | 77 | #ifdef HAVE_LCD_BITMAP |
78 | |||
79 | static void reset_icons(void) | ||
80 | { | ||
81 | int i, j, count; | ||
82 | const struct filetype *types; | ||
83 | tree_get_filetypes(&types, &count); | ||
84 | for (i=1; i<filetype_count; i++) /* 0 is folders */ | ||
85 | { | ||
86 | filetypes[i].icon = Icon_Questionmark; | ||
87 | for (j=0; j<count; j++) | ||
88 | { | ||
89 | if (filetypes[i].extension && | ||
90 | !strcmp(filetypes[i].extension, types[j].extension)) | ||
91 | { | ||
92 | filetypes[i].icon = types[j].icon; | ||
93 | break; | ||
94 | } | ||
95 | } | ||
96 | } | ||
97 | } | ||
78 | void read_viewer_theme_file(void) | 98 | void read_viewer_theme_file(void) |
79 | { | 99 | { |
80 | char buffer[MAX_PATH]; | 100 | char buffer[MAX_PATH]; |
81 | int fd; | 101 | int fd; |
82 | char *ext, *icon; | 102 | char *ext, *icon; |
83 | int i; | 103 | int i; |
104 | reset_icons(); | ||
84 | snprintf(buffer, MAX_PATH, "%s/%s.icons", ICON_DIR, | 105 | snprintf(buffer, MAX_PATH, "%s/%s.icons", ICON_DIR, |
85 | global_settings.viewers_icon_file); | 106 | global_settings.viewers_icon_file); |
86 | fd = open(buffer, O_RDONLY); | 107 | fd = open(buffer, O_RDONLY); |
@@ -265,6 +286,8 @@ char* filetype_get_plugin(const struct entry* file) | |||
265 | int index = find_attr(file->attr); | 286 | int index = find_attr(file->attr); |
266 | if (index < 0) | 287 | if (index < 0) |
267 | return NULL; | 288 | return NULL; |
289 | if (filetypes[index].viewer == NULL) | ||
290 | return NULL; | ||
268 | snprintf(plugin_name, MAX_PATH, "%s/%s.%s", | 291 | snprintf(plugin_name, MAX_PATH, "%s/%s.%s", |
269 | filetypes[index].viewer? VIEWERS_DIR: PLUGIN_DIR, | 292 | filetypes[index].viewer? VIEWERS_DIR: PLUGIN_DIR, |
270 | filetypes[index].plugin, ROCK_EXTENSION); | 293 | filetypes[index].plugin, ROCK_EXTENSION); |