mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-23 23:09:39 +03:00
[project @ 2006-01-07 13:12:58 by jmb]
Fix duplication of currently selected theme in theme_descriptor list svn path=/import/netsurf/; revision=2012
This commit is contained in:
parent
07d4f5c57b
commit
5f160daacb
@ -176,13 +176,18 @@ struct theme_descriptor *ro_gui_theme_get_available(void) {
|
||||
struct theme_descriptor *test;
|
||||
char pathname[256];
|
||||
|
||||
/* close any descriptors we've got so far */
|
||||
/* close any descriptors we've got so far
|
||||
* _except_ the current theme */
|
||||
ro_gui_theme_free(theme_descriptors);
|
||||
|
||||
assert(theme_descriptors == theme_current);
|
||||
|
||||
if (strcmp(theme_current->name, "Aletheia") != 0) {
|
||||
/* add our default 'Aletheia' theme */
|
||||
snprintf(pathname, 256, "%s.Resources", NETSURF_DIR);
|
||||
pathname[255] = '\0';
|
||||
ro_gui_theme_add_descriptor(pathname, "Aletheia");
|
||||
}
|
||||
|
||||
/* scan our choices directory */
|
||||
snprintf(pathname, 256, "%s%s", THEME_PATH_R, THEME_LEAFNAME);
|
||||
@ -212,6 +217,7 @@ struct theme_descriptor *ro_gui_theme_get_available(void) {
|
||||
while (theme_descriptors->previous)
|
||||
theme_descriptors = theme_descriptors->previous;
|
||||
}
|
||||
|
||||
return theme_descriptors;
|
||||
}
|
||||
|
||||
@ -320,6 +326,13 @@ bool ro_gui_theme_add_descriptor(const char *folder, const char *leafname) {
|
||||
current->filename = filename;
|
||||
current->leafname = current->filename + strlen(folder) + 1;
|
||||
|
||||
if (strcmp(current->name, theme_current->name) == 0) {
|
||||
/* Don't add if this theme matches the current one */
|
||||
free(current->filename);
|
||||
free(current);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* link in our new descriptor at the head*/
|
||||
if (theme_descriptors) {
|
||||
current->next = theme_descriptors;
|
||||
|
Loading…
Reference in New Issue
Block a user