tray: allow themes to inherit from multiple themes

master
Ian Fan 6 years ago committed by Simon Ser
parent 66f0c91bb8
commit 3b894c387d

@ -21,7 +21,7 @@ struct icon_theme_subdir {
struct icon_theme { struct icon_theme {
char *name; char *name;
char *comment; char *comment;
char *inherits; list_t *inherits; // char *
list_t *directories; // char * list_t *directories; // char *
char *dir; char *dir;

@ -69,7 +69,7 @@ static void destroy_theme(struct icon_theme *theme) {
} }
free(theme->name); free(theme->name);
free(theme->comment); free(theme->comment);
free(theme->inherits); list_free_items_and_destroy(theme->inherits);
list_free_items_and_destroy(theme->directories); list_free_items_and_destroy(theme->directories);
free(theme->dir); free(theme->dir);
@ -149,7 +149,7 @@ static const char *entry_handler(char *group, char *key, char *value,
} else if (strcmp(key, "Comment") == 0) { } else if (strcmp(key, "Comment") == 0) {
theme->comment = strdup(value); theme->comment = strdup(value);
} else if (strcmp(key, "Inherits") == 0) { } else if (strcmp(key, "Inherits") == 0) {
theme->inherits = strdup(value); theme->inherits = split_string(value, ",");
} else if (strcmp(key, "Directories") == 0) { } else if (strcmp(key, "Directories") == 0) {
theme->directories = split_string(value, ","); theme->directories = split_string(value, ",");
} // Ignored: ScaledDirectories, Hidden, Example } // Ignored: ScaledDirectories, Hidden, Example
@ -496,8 +496,13 @@ static char *find_icon_with_theme(list_t *basedirs, list_t *themes, char *name,
} }
if (!icon && theme->inherits) { if (!icon && theme->inherits) {
for (int i = 0; i < theme->inherits->length; ++i) {
icon = find_icon_with_theme(basedirs, themes, name, size, icon = find_icon_with_theme(basedirs, themes, name, size,
theme->inherits, min_size, max_size); theme->inherits->items[i], min_size, max_size);
if (icon) {
break;
}
}
} }
return icon; return icon;

Loading…
Cancel
Save