summaryrefslogtreecommitdiff
path: root/apps/filetypes.c
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2007-04-16 11:01:41 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2007-04-16 11:01:41 +0000
commitccaf24a29cbcad04ce2673523e552e4ee7021d57 (patch)
treec8dd790cc20e4605ef7d442486e5b123bc6053e1 /apps/filetypes.c
parentbfa55778699cdf5c479e614ed4748bb7cbcc7284 (diff)
downloadrockbox-ccaf24a29cbcad04ce2673523e552e4ee7021d57.tar.gz
rockbox-ccaf24a29cbcad04ce2673523e552e4ee7021d57.zip
Fix the wavplay icon
Fix copy+paste mistake Fix typo in comment Fix crash when trying to run a bmp Reset the icons properly when loading a .icons file (hopefully will use the correct icon now) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13179 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/filetypes.c')
-rw-r--r--apps/filetypes.c23
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)
75static void read_builtin_types(void); 75static void read_builtin_types(void);
76static void read_config(char* config_file); 76static void read_config(char* config_file);
77#ifdef HAVE_LCD_BITMAP 77#ifdef HAVE_LCD_BITMAP
78
79static 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}
78void read_viewer_theme_file(void) 98void 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);