summaryrefslogtreecommitdiff
path: root/apps/filetypes.c
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2007-04-16 12:26:49 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2007-04-16 12:26:49 +0000
commit4a16739bddbff2ecd629c8a131ddce9e96c93c3a (patch)
treeedd14c0a125a95506d26e742c127ce53bce03fd2 /apps/filetypes.c
parent3124134a086e775ad61e97bd0c82758d81faec66 (diff)
downloadrockbox-4a16739bddbff2ecd629c8a131ddce9e96c93c3a.tar.gz
rockbox-4a16739bddbff2ecd629c8a131ddce9e96c93c3a.zip
Some gremlins got into my computer again and changed all my code!
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13181 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/filetypes.c')
-rw-r--r--apps/filetypes.c27
1 files changed, 4 insertions, 23 deletions
diff --git a/apps/filetypes.c b/apps/filetypes.c
index 407f3a00e2..25dc0fe7da 100644
--- a/apps/filetypes.c
+++ b/apps/filetypes.c
@@ -75,33 +75,12 @@ 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}
98void read_viewer_theme_file(void) 78void read_viewer_theme_file(void)
99{ 79{
100 char buffer[MAX_PATH]; 80 char buffer[MAX_PATH];
101 int fd; 81 int fd;
102 char *ext, *icon; 82 char *ext, *icon;
103 int i; 83 int i;
104 reset_icons();
105 snprintf(buffer, MAX_PATH, "%s/%s.icons", ICON_DIR, 84 snprintf(buffer, MAX_PATH, "%s/%s.icons", ICON_DIR,
106 global_settings.viewers_icon_file); 85 global_settings.viewers_icon_file);
107 fd = open(buffer, O_RDONLY); 86 fd = open(buffer, O_RDONLY);
@@ -119,7 +98,8 @@ void read_viewer_theme_file(void)
119 filetypes[i].icon = atoi(icon+1); 98 filetypes[i].icon = atoi(icon+1);
120 else if (*icon == '-') 99 else if (*icon == '-')
121 filetypes[i].icon = Icon_NOICON; 100 filetypes[i].icon = Icon_NOICON;
122 else filetypes[i].icon = Icon_Last_Themeable + atoi(icon); 101 else if (*icon >= '0' && *icon <= '9')
102 filetypes[i].icon = Icon_Last_Themeable + atoi(icon);
123 break; 103 break;
124 } 104 }
125 } 105 }
@@ -234,7 +214,8 @@ static void read_config(char* config_file)
234 filetypes[filetype_count].icon = atoi(s+1); 214 filetypes[filetype_count].icon = atoi(s+1);
235 else if (*s == '-') 215 else if (*s == '-')
236 filetypes[filetype_count].icon = Icon_NOICON; 216 filetypes[filetype_count].icon = Icon_NOICON;
237 else filetypes[filetype_count].icon = Icon_Last_Themeable + atoi(s); 217 else if (*s >= '0' && *s <= '9')
218 filetypes[filetype_count].icon = Icon_Last_Themeable + atoi(s);
238#else 219#else
239 filetypes[filetype_count].icon = Icon_NOICON; 220 filetypes[filetype_count].icon = Icon_NOICON;
240#endif 221#endif