Fetch theme on first call to _icon_freedesktop_set
authorSebastian Dransfeld <sd@tango.flipp.net>
Fri, 26 Nov 2010 11:37:45 +0000 (11:37 +0000)
committerSebastian Dransfeld <sd@tango.flipp.net>
Fri, 26 Nov 2010 11:37:45 +0000 (11:37 +0000)
SVN revision: 55009

src/lib/elm_icon.c
src/lib/elm_main.c
src/lib/elm_priv.h

index fd0094fb3ed2258e9960ba1a06b46142e72bd756..9c1e49b40a683250b1d2e30a1885326fa55796cc 100644 (file)
@@ -1,6 +1,11 @@
 #include <Elementary.h>
 #include "elm_priv.h"
 
+#ifdef ELM_EFREET
+#define NON_EXISTING (void *)-1
+static Efreet_Icon_Theme *icon_theme = NULL;
+#endif
+
 /**
  * @defgroup Icon Icon
  *
@@ -293,7 +298,28 @@ _icon_freedesktop_set(Widget_Data *wd, Evas_Object *obj, const char *name, int s
    const char *path;
 
    elm_need_efreet();
-   if (!icon_theme) return EINA_FALSE;
+   if (icon_theme == NON_EXISTING) return EINA_FALSE;
+   if (!icon_theme)
+     {
+        icon_theme = efreet_icon_theme_find(getenv("E_ICON_THEME"));
+        if (!icon_theme)
+          {
+             const char **itr;
+             static const char *themes[] = {
+                  "gnome", "Human", "oxygen", "hicolor", NULL
+             };
+             for (itr = themes; *itr; itr++)
+               {
+                  icon_theme = efreet_icon_theme_find(*itr);
+                  if (icon_theme) break;
+               }
+          }
+     }
+   if (!icon_theme)
+     {
+        icon_theme = NON_EXISTING;
+        return EINA_FALSE;
+     }
    path = efreet_icon_path_find(icon_theme->name.internal, name, size);
    wd->freedesktop.use = !!path;
    if (wd->freedesktop.use)
index ff378d1c051c45c5bfe46cbd720ce55cd0c7b4b3..b8177fa19960fddf811fb0034c549868abfc29e3 100644 (file)
@@ -390,7 +390,6 @@ _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)
@@ -400,19 +399,6 @@ 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[] = {
-           "gnome", "Human", "oxygen", "hicolor", NULL
-        };
-        for (itr = themes; *itr; itr++)
-          {
-             icon_theme = efreet_icon_theme_find(*itr);
-             if (icon_theme) break;
-          }
-     }
     /*
      {
         Eina_List **list;
@@ -439,7 +425,6 @@ _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();
index 3bf6b17b1cd11fc6b8bf6d30c29e26f68b9a5e04..ce8f17d0f47ad53da13d66fd1c0e0af63cd2275d 100644 (file)
@@ -196,8 +196,5 @@ 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