Enlightenment CVS committal Author : ningerso Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/lib Modified Files: ewl_theme.c ewl_widget.c Log Message: Fix overriding theme keys at the widget level by backing off some extra caching and using the widgets theme file when appropriate. =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_theme.c,v retrieving revision 1.34 retrieving revision 1.35 diff -u -3 -r1.34 -r1.35 --- ewl_theme.c 10 Jan 2007 11:34:25 -0000 1.34 +++ ewl_theme.c 17 Jan 2007 12:52:32 -0000 1.35 @@ -246,6 +246,50 @@ DRETURN_PTR(data, DLEVEL_STABLE); } +static void +ewl_theme_lookup_cache(Ecore_Hash *cache, const char *k, const char *v) +{ + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR("cache", cache); + DCHECK_PARAM_PTR("k", k); + + if (v != EWL_THEME_KEY_NOMATCH) { + if (v) { + ecore_hash_set(cache, strdup(k), strdup(v)); + } + /* + * Mark unmatched keys in the cache. + */ + else { + ecore_hash_set(cache, strdup(k), EWL_THEME_KEY_NOMATCH); + } + } + + DLEAVE_FUNCTION(DLEVEL_STABLE); +} + +static char * +ewl_theme_lookup_key(Ecore_Hash *cache, const char *path, const char *k) +{ + char *ret; + + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR_RET("cache", cache, NULL); + DCHECK_PARAM_PTR_RET("k", k, NULL); + + ret = ecore_hash_get(cache, k); + if (!ret) { + + /* + * Resort to looking in the edje. + */ + if (path) + ret = edje_file_data_get(path, k); + } + + DRETURN_PTR(ret, DLEVEL_STABLE); +} + /** * @param w: the widget to search * @param k: the key to search for @@ -309,7 +353,7 @@ w = w->parent; if (w && w->theme) - ret = ecore_hash_get(w->theme, temp); + ret = ewl_theme_lookup_key(w->theme, w->theme_path, temp); if (ret) break; @@ -328,31 +372,19 @@ if (!ret) { temp = key; while (temp && !ret) { - ret = ecore_hash_get(ewl_theme_def_data, temp); + ret = ewl_theme_lookup_key(ewl_theme_def_data, + ewl_theme_path, temp); if (ret) break; - /* - * Resort to looking in the edje. - */ - ret = edje_file_data_get(ewl_theme_path, temp); - if (ret) { - ecore_hash_set(ewl_theme_def_data, - strdup(temp), - strdup(ret)); - break; - } temp++; temp = strchr(temp, '/'); } - } - /* - * Mark unmatched keys in the cache. - */ - if (!ret && ret != EWL_THEME_KEY_NOMATCH) { - ecore_hash_set(ewl_theme_def_data, strdup(key), - EWL_THEME_KEY_NOMATCH); + /* + * Mark unmatched keys in the cache. + */ + ewl_theme_lookup_cache(ewl_theme_def_data, key, ret); } /* =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_widget.c,v retrieving revision 1.121 retrieving revision 1.122 diff -u -3 -r1.121 -r1.122 --- ewl_widget.c 10 Jan 2007 11:34:25 -0000 1.121 +++ ewl_widget.c 17 Jan 2007 12:52:32 -0000 1.122 @@ -2583,11 +2583,9 @@ /* * Retrieve the path to the theme file that will be loaded - * return if no file to be loaded. Also get the group name in the - * theme file. + * return if no file to be loaded. */ i = ewl_theme_image_get(w, "file"); - group = ewl_theme_data_str_get(w, "group"); if (i) { const char *t; @@ -2604,6 +2602,10 @@ w->theme_path = NULL; } + /* + * Defer group loading until the theme is loaded. + */ + group = ewl_theme_data_str_get(w, "group"); if (group) { const char *t; ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs