summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/filetypes.c27
-rw-r--r--apps/gui/icon.c6
2 files changed, 7 insertions, 26 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
diff --git a/apps/gui/icon.c b/apps/gui/icon.c
index b283ec2c80..647c15434e 100644
--- a/apps/gui/icon.c
+++ b/apps/gui/icon.c
@@ -134,8 +134,8 @@ void screen_put_iconxy(struct screen * display,
134 else if (icon >= Icon_Last_Themeable) 134 else if (icon >= Icon_Last_Themeable)
135 { 135 {
136 icon -= Icon_Last_Themeable; 136 icon -= Icon_Last_Themeable;
137 if (!viewer_icons_loaded[screen] || 137 if (!viewer_icons_loaded[screen]/* ||
138 (icon*ICON_HEIGHT(screen) > viewer_iconset[screen].height)) 138 (icon*ICON_HEIGHT(screen) > viewer_iconset[screen].height)*/)
139 { 139 {
140 screen_clear_area(display, xpos, ypos, 140 screen_clear_area(display, xpos, ypos,
141 ICON_WIDTH(screen), ICON_HEIGHT(screen)); 141 ICON_WIDTH(screen), ICON_HEIGHT(screen));
@@ -270,7 +270,7 @@ void icons_init(void)
270 load_icons(path, Iconset_Remotescreen_viewers); 270 load_icons(path, Iconset_Remotescreen_viewers);
271 } 271 }
272 else 272 else
273 load_icons(DEFAULT_REMOTE_VIEWER_BMP, Iconset_Mainscreen_viewers); 273 load_icons(DEFAULT_REMOTE_VIEWER_BMP, Iconset_Remotescreen_viewers);
274#endif 274#endif
275} 275}
276 276