Enlightenment CVS committal
Author : dj2
Project : e17
Module : libs/ewl
Dir : e17/libs/ewl/src/lib
Modified Files:
ewl_icon_theme.c
Log Message:
- if we don't find the icon in the user set theme then we check in a theme
named EWL for the fallback icon. (This will end up checking the hicolor
theme twice but don't think it's a big deal as we cache the results
anyway.)
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_icon_theme.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- ewl_icon_theme.c 4 Jan 2007 05:09:47 -0000 1.13
+++ ewl_icon_theme.c 12 Jan 2007 10:32:48 -0000 1.14
@@ -7,7 +7,11 @@
static int ewl_icon_theme_is_edje = 0;
static Ecore_Hash *ewl_icon_theme_cache = NULL;
+static Ecore_Hash *ewl_icon_fallback_theme_cache = NULL;
static void ewl_icon_theme_cb_free(void *data);
+static char *ewl_icon_theme_icon_path_get_helper(const char *icon,
+ const char *size, const char *theme,
+ const char *key, Ecore_Hash *cache);
/**
* @return Returns TRUE on success or FALSE on failure
@@ -23,6 +27,13 @@
ewl_icon_theme_cache = ecore_hash_new(ecore_str_hash,
ecore_str_compare);
ecore_hash_set_free_key(ewl_icon_theme_cache,
ewl_icon_theme_cb_free);
ecore_hash_set_free_value(ewl_icon_theme_cache,
ewl_icon_theme_cb_free);
+
+ ewl_icon_fallback_theme_cache = ecore_hash_new(
+ ecore_str_hash,
ecore_str_compare);
+ ecore_hash_set_free_key(ewl_icon_fallback_theme_cache,
+ ewl_icon_theme_cb_free);
+ ecore_hash_set_free_value(ewl_icon_fallback_theme_cache,
+ ewl_icon_theme_cb_free);
}
DRETURN_INT(TRUE, DLEVEL_STABLE);
@@ -110,19 +121,36 @@
icon_size = size;
snprintf(key, sizeof(key), "[EMAIL PROTECTED]", icon, icon_size);
- ret = ecore_hash_get(ewl_icon_theme_cache, key);
+ ret = ewl_icon_theme_icon_path_get_helper(icon, icon_size, icon_theme,
+ key, ewl_icon_theme_cache);
+
+ if (ret == EWL_THEME_KEY_NOMATCH)
+ ret = ewl_icon_theme_icon_path_get_helper(icon, icon_size,
"EWL",
+ key, ewl_icon_fallback_theme_cache);
+
+ if (ret == EWL_THEME_KEY_NOMATCH)
+ ret = NULL;
+
+ DRETURN_PTR(ret, DLEVEL_STABLE);
+}
+
+static char *
+ewl_icon_theme_icon_path_get_helper(const char *icon, const char *size,
+ const char *theme, const char *key,
+ Ecore_Hash *cache)
+{
+ char *ret;
+
+ ret = ecore_hash_get(cache, key);
if (!ret)
{
- ret = ecore_desktop_icon_find(icon, icon_size, icon_theme);
+ ret = ecore_desktop_icon_find(icon, size, theme);
if (!ret) ret = EWL_THEME_KEY_NOMATCH;
- ecore_hash_set(ewl_icon_theme_cache, strdup(key), ret);
+ ecore_hash_set(cache, strdup(key), ret);
}
-
- if (ret == EWL_THEME_KEY_NOMATCH)
- ret = NULL;
- DRETURN_PTR(ret, DLEVEL_STABLE);
+ return ret;
}
static void
-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs