mixer: simplify icon logic.

This commit is contained in:
Alastair Poole 2021-04-25 11:30:53 +01:00
parent b59c07ea33
commit 5133b018a5
2 changed files with 12 additions and 28 deletions

View File

@ -84,7 +84,6 @@ _sink_icon_find(const char *name)
const char *dir;
char buf[PATH_MAX], *res = NULL, **strs, *glob, *icon;
FILE *f;
int i;
size_t len;
dir = e_module_dir_get(mixer_context->module);
@ -102,19 +101,12 @@ _sink_icon_find(const char *name)
strs = eina_str_split(buf, "|", 0);
if (strs)
{
i = 0;
for (glob = strs[i]; glob; i += 2)
glob = strs[0];
icon = strs[1];
if (icon)
{
icon = strs[i + 1];
if (icon)
{
if (e_util_glob_case_match(name, glob))
{
res = strdup(icon);
break;
}
}
else break;
if (e_util_glob_case_match(name, glob))
res = strdup(icon);
}
free(strs[0]);
free(strs);

View File

@ -52,11 +52,8 @@ _sink_icon_find(const char *name)
const char *file;
char buf[PATH_MAX], *res = NULL, **strs, *glob, *icon;
FILE *f;
int i;
size_t len;
if (!name) return NULL;
file = getenv("EMIX_SINK_ICONS");
if (!file) return NULL;
f = fopen(file, "r");
@ -71,23 +68,18 @@ _sink_icon_find(const char *name)
strs = eina_str_split(buf, "|", 0);
if (strs)
{
i = 0;
for (glob = strs[i]; glob; i += 2)
glob = strs[0];
icon = strs[1];
if (icon)
{
icon = strs[i + 1];
if (icon)
if (_glob_case_match(name, glob))
{
if (_glob_case_match(name, glob))
{
res = strdup(icon);
break;
}
res = strdup(icon);
}
else break;
}
free(strs[0]);
free(strs);
}
free(strs[0]);
free(strs);
if (res) break;
}
else break;