Skip to content
Myr

icon: ignore “Context” when looking up icons

Before adoption: this commit came in with the history the project adopted, so no landing records it.

This is according to spec; context does not affect lookup, but is intended to be used for sorting and categorizing.

authored by Daniel Eklöf · committed by Daniel Eklöf · parent c9b09bf · Browse files · 1 file+0 added−28 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+0 added−28 removed

  • other:+0 added−28 removed

1 file+0 added−28 removed

modified:icon.c-28 removed
30 unmodified lines
31#include "xdg.h"3233typedef tll(char *) theme_names_t;3435static bool36dir_is_usable(const char *path, const char *context)37{38 if (path == NULL || context == NULL) {39 return false;40 }4142 /*43 * Valid names for application context: some icon themes use different44 * names other than applications, for example, Faenza uses "apps".45 */46 static const char *const app_contex[] = { "applications", "apps" };4748 for (size_t i = 0; i < sizeof(app_contex)/sizeof(char*); i++) {49 if (strcasecmp(context, app_contex[i]) == 0) {50 return true;51 }52 }5354 return false;55}5635static void36parse_theme(FILE *index, struct icon_theme *theme, theme_names_t *themes_to_load)37{38 char *section = NULL;
37 unmodified lines
7677 if (section == NULL || strcmp(d->path, section) != 0)78 continue;79102 if (!dir_is_usable(section, context))103 break;10480 d->size = size;81 d->min_size = min_size >= 0 ? min_size : size;82 d->max_size = max_size >= 0 ? max_size : size;83 d->scale = scale;
83 unmodified lines
167168 if (section == NULL || strcmp(d->path, section) != 0)169 continue;170196 if (!dir_is_usable(section, context))197 break;198171 d->size = size;172 d->min_size = min_size >= 0 ? min_size : size;173 d->max_size = max_size >= 0 ? max_size : size;174 d->scale = scale;
495 unmodified lines