From bf7890c806ea9d84f36032b886b6d549f235a26e Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 28 Feb 2018 11:01:26 -0500 Subject: [PATCH] theme: add fallback matching when referenced theme is not found if done properly, this should never occur, but at least find some layout to use if one is available --- src/lib/elementary/elm_theme.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/lib/elementary/elm_theme.c b/src/lib/elementary/elm_theme.c index b60d1ad9c9..dbf3d11993 100644 --- a/src/lib/elementary/elm_theme.c +++ b/src/lib/elementary/elm_theme.c @@ -16,11 +16,11 @@ static Elm_Theme theme_default = static Eina_List *themes = NULL; static Eina_File * -_elm_theme_find_try(Elm_Theme *th, Elm_Theme_File *etf, const char *group) +_elm_theme_find_try(Elm_Theme *th, Elm_Theme_File *etf, const char *group, Eina_Bool force) { if (edje_mmap_group_exists(etf->handle, group)) { - if (etf->match_theme) // overlay or extension + if (etf->match_theme && (!force)) // overlay or extension { Elm_Theme_File *base_etf; Eina_Bool found = EINA_FALSE; @@ -218,8 +218,8 @@ _elm_theme_clear(Elm_Theme *th) } } -Eina_File * -_elm_theme_group_file_find(Elm_Theme *th, const char *group) +static Eina_File * +_elm_theme_group_file_find_internal(Elm_Theme *th, const char *group, Eina_Bool force) { Elm_Theme_File *etf; Eina_File *file = eina_hash_find(th->cache, group); @@ -228,23 +228,32 @@ _elm_theme_group_file_find(Elm_Theme *th, const char *group) EINA_INLIST_FOREACH(th->overlay, etf) { - file = _elm_theme_find_try(th, etf, group); + file = _elm_theme_find_try(th, etf, group, force); if (file) return file; } EINA_INLIST_FOREACH(th->themes, etf) { - file = _elm_theme_find_try(th, etf, group); + file = _elm_theme_find_try(th, etf, group, force); if (file) return file; } EINA_INLIST_FOREACH(th->extension, etf) { - file = _elm_theme_find_try(th, etf, group); + file = _elm_theme_find_try(th, etf, group, force); if (file) return file; } - if (th->ref_theme) return _elm_theme_group_file_find(th->ref_theme, group); + if (th->ref_theme) return _elm_theme_group_file_find_internal(th->ref_theme, group, force); return NULL; } +Eina_File * +_elm_theme_group_file_find(Elm_Theme *th, const char *group) +{ + Eina_File *file = _elm_theme_group_file_find_internal(th, group, EINA_FALSE); + if (file) return file; + file = _elm_theme_group_file_find_internal(th, group, EINA_TRUE); + return file; +} + static const char * _elm_theme_find_data_try(Elm_Theme *th, const Eina_File *f, const char *key) {