elm_theme: deduplicate theme apply code

the "default" style fallback code here was identical, so just call again
with "default" instead of copy and pasting the same code
This commit is contained in:
Mike Blumenkrantz 2018-02-27 15:22:08 -05:00
parent fe0bd38f4c
commit 7353fc1cb8
1 changed files with 2 additions and 28 deletions

View File

@ -321,35 +321,9 @@ _elm_theme_set(Elm_Theme *th, Evas_Object *o, const char *clas, const char *grou
if (!style)
return EFL_UI_THEME_APPLY_FAILED;
if (eina_streq(style, "default")) return EFL_UI_THEME_APPLY_FAILED;
// Use the elementary default style.
if (is_legacy)
snprintf(buf2, sizeof(buf2), "elm/%s/%s/%s", clas, (group) ? group : "base", "default");
else
snprintf(buf2, sizeof(buf2), "efl/%s%s%s", clas,
((group) ? group_sep : "\0"), ((group) ? group : "\0"));
if (!eina_hash_find(th->cache_style_load_failed, buf2))
{
file = _elm_theme_group_file_find(th, buf2);
if (file)
{
if (edje_object_mmap_set(o, file, buf2))
{
INF("could not set theme style '%s', fallback to default",
style);
return EFL_UI_THEME_APPLY_DEFAULT;
}
else
{
INF("could not set theme group '%s' from file '%s': %s",
buf2,
eina_file_filename_get(file),
edje_load_error_str(edje_object_load_error_get(o)));
}
}
//style not found, add to the not found list
eina_hash_add(th->cache_style_load_failed, buf2, (void *)1);
}
return EFL_UI_THEME_APPLY_FAILED;
return _elm_theme_set(th, o, clas, group, "default", is_legacy);
}
Eina_Bool