From 6a42df9f9a8707fe0436154b297f32ef5cad3511 Mon Sep 17 00:00:00 2001 From: Sebastian Dransfeld Date: Fri, 26 Nov 2010 09:05:12 +0000 Subject: [PATCH] Search for icon theme in elm_need_efreet When searching for an icon in a theme, efreet needs to load the specific cache for the theme. So if an icon doesn't exist, this will be a huge overhead. So it is better to find a theme on init, and then stick with it. SVN revision: 55004 --- legacy/elementary/src/lib/elm_icon.c | 15 ++------------- legacy/elementary/src/lib/elm_main.c | 17 ++++++++++++++++- legacy/elementary/src/lib/elm_priv.h | 3 +++ 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/legacy/elementary/src/lib/elm_icon.c b/legacy/elementary/src/lib/elm_icon.c index 53f5025efc..0a44b6f522 100644 --- a/legacy/elementary/src/lib/elm_icon.c +++ b/legacy/elementary/src/lib/elm_icon.c @@ -292,19 +292,8 @@ _icon_freedesktop_set(Widget_Data *wd, Evas_Object *obj, const char *name, int s const char *path; elm_need_efreet(); - path = efreet_icon_path_find(getenv("E_ICON_THEME"), name, size); - if (!path) - { - const char **itr; - static const char *themes[] = { - "default", "highcolor", "hicolor", "gnome", "Human", "oxygen", NULL - }; - for (itr = themes; (!path) && (*itr); itr++) - { - path = efreet_icon_path_find(*itr, name, size); - if (path) break; - } - } + if (!icon_theme) return EINA_FALSE; + path = efreet_icon_path_find(icon_theme->name.internal, name, size); wd->freedesktop.use = !!path; if (wd->freedesktop.use) { diff --git a/legacy/elementary/src/lib/elm_main.c b/legacy/elementary/src/lib/elm_main.c index 1f27f82d9d..30d45ce19b 100644 --- a/legacy/elementary/src/lib/elm_main.c +++ b/legacy/elementary/src/lib/elm_main.c @@ -390,6 +390,7 @@ _elm_unneed_e_dbus(void) #ifdef ELM_EFREET static int _elm_need_efreet = 0; +Efreet_Icon_Theme *icon_theme = NULL; #endif EAPI Eina_Bool elm_need_efreet(void) @@ -399,7 +400,20 @@ elm_need_efreet(void) efreet_init(); efreet_mime_init(); efreet_trash_init(); - /* + icon_theme = efreet_icon_theme_find(getenv("E_ICON_THEME")); + if (!icon_theme) + { + const char **itr; + static const char *themes[] = { + "default", "highcolor", "hicolor", "gnome", "Human", "oxygen", NULL + }; + for (itr = themes; *itr; itr++) + { + icon_theme = efreet_icon_theme_find(*itr); + if (icon_theme) break; + } + } + /* { Eina_List **list; @@ -425,6 +439,7 @@ _elm_unneed_efreet(void) #ifdef ELM_EFREET if (--_elm_need_efreet) return; + icon_theme = NULL; _elm_need_efreet = 0; efreet_trash_shutdown(); efreet_mime_shutdown(); diff --git a/legacy/elementary/src/lib/elm_priv.h b/legacy/elementary/src/lib/elm_priv.h index ce8f17d0f4..3bf6b17b1c 100644 --- a/legacy/elementary/src/lib/elm_priv.h +++ b/legacy/elementary/src/lib/elm_priv.h @@ -196,5 +196,8 @@ extern const char *_elm_data_dir; extern const char *_elm_lib_dir; extern int _elm_log_dom; extern Eina_List *_elm_win_list; +#ifdef ELM_EFREET +extern Efreet_Icon_Theme *icon_theme; +#endif #endif