bu5hm4n pushed a commit to branch master.

http://git.enlightenment.org/misc/entrance.git/commit/?id=9f5b40661a6543bf5784194bd89f526d5a117a2c

commit 9f5b40661a6543bf5784194bd89f526d5a117a2c
Author: Marcel Hollerbach <marcel.hollerb...@stzedn.de>
Date:   Thu Mar 6 14:09:37 2014 +0100

    entrance: Added Image loading for more paths.
    
    - Images are loaded from 3 pools, System(PREFIX/entrance/images),
      User(~/.config/entrance/images/) nad themes.
    
     In each directory is a layout from ..images/icons and
      ...images/backgrounds.
    
    - Each user can set his own Icon and his own Background out of the
      pools.
    
    - Renamed Entrance_Background to Entrance_Image because this struct is
      also used for the icons, so this would be a little bit confusing!
    
    - Directorys are parsed in the daemon, the theme in the client!
---
 src/bin/entrance_connect.c    |   4 +
 src/bin/entrance_gui.c        | 242 +++++++++++++++++++++++++++++++++---------
 src/bin/entrance_gui.h        |   6 +-
 src/daemon/Makefile.am        |   2 +
 src/daemon/entrance.h         |   1 +
 src/daemon/entrance_history.c |  15 ++-
 src/daemon/entrance_image.c   | 105 ++++++++++++++++++
 src/daemon/entrance_image.h   |  20 ++++
 src/daemon/entrance_server.c  |  11 ++
 src/event/entrance_event.c    |  44 ++++++--
 src/event/entrance_event.h    |  12 ++-
 11 files changed, 397 insertions(+), 65 deletions(-)

diff --git a/src/bin/entrance_connect.c b/src/bin/entrance_connect.c
index 8b48973..04055ac 100644
--- a/src/bin/entrance_connect.c
+++ b/src/bin/entrance_connect.c
@@ -146,6 +146,8 @@ entrance_connect_conf_gui_send(Entrance_Conf_Gui_Event *ev)
    PT("Send gui config\n");
    eev.event.conf_gui.bg.path = ev->bg.path;
    eev.event.conf_gui.bg.group = ev->bg.group;
+   eev.event.conf_gui.background_pool = NULL;
+   eev.event.conf_gui.icon_pool = NULL;
 
    eev.type = ENTRANCE_EVENT_CONF_GUI;
    entrance_event_send(&eev);
@@ -163,6 +165,8 @@ entrance_connect_conf_user_send(Entrance_Login *el)
    eev.event.conf_user.bg.path = el->bg.path;
    eev.event.conf_user.bg.group = el->bg.group;
    eev.event.conf_user.remember_session = el->remember_session;
+   eev.event.conf_user.icon_pool = NULL;
+   eev.event.conf_user.background_pool = NULL;
    eev.type = ENTRANCE_EVENT_CONF_USER;
    entrance_event_send(&eev);
 }
diff --git a/src/bin/entrance_gui.c b/src/bin/entrance_gui.c
index e8ae685..66ab019 100755
--- a/src/bin/entrance_gui.c
+++ b/src/bin/entrance_gui.c
@@ -17,6 +17,8 @@ static void _entrance_gui_update(void);
 static void _entrance_gui_auth_cb(void *data, const char *user, Eina_Bool 
granted);
 static void _entrance_gui_user_bg_cb(void *data, Evas_Object *obj, const char 
*sig, const char *src);
 static void _entrance_gui_check_wm_loaded(Ecore_X_Window *win);
+static Eina_List* _entrance_gui_theme_icons_cache_fill(Evas_Object *obj, const 
char *themename);
+static Eina_List* _entrance_gui_theme_background_cache_fill(Evas_Object *obj, 
const char *themename);
 
 static Entrance_Gui *_gui;
 
@@ -36,6 +38,10 @@ struct Entrance_Gui_
    Eina_List *users;
    Eina_List *actions;
    Eina_List *handlers;
+   Eina_List *background_pool;
+   Eina_List *icon_pool;
+   Eina_List *theme_background_pool;
+   Eina_List *theme_icon_pool;
    Entrance_Xsession *selected_session;
    const char *theme;
    struct
@@ -132,6 +138,10 @@ entrance_gui_init(const char *theme)
          if ((x + w) > ww) ww = x + w;
          if ((y + h) > hh) hh = y + h;
      }
+   _gui->theme_icon_pool =
+      _entrance_gui_theme_icons_cache_fill(_gui->win, _gui->theme);
+   _gui->theme_background_pool =
+      _entrance_gui_theme_background_cache_fill(_gui->win, _gui->theme);
    _entrance_gui_update();
    _gui->handlers =
       eina_list_append(_gui->handlers,
@@ -164,6 +174,7 @@ entrance_gui_shutdown(void)
    Entrance_Screen *screen;
    Entrance_Xsession *xsession;
    Ecore_Event_Handler *h;
+   Entrance_Image *img;
    PT("Gui shutdown\n");
    evas_object_del(_gui->win);
    EINA_LIST_FREE(_gui->screens, screen)
@@ -179,9 +190,113 @@ entrance_gui_shutdown(void)
      }
    EINA_LIST_FREE(_gui->handlers, h)
       ecore_event_handler_del(h);
+   EINA_LIST_FREE(_gui->background_pool, img)
+     {
+       eina_stringshare_del(img->path);
+       eina_stringshare_del(img->group);
+       free(img);
+     }
+   EINA_LIST_FREE(_gui->icon_pool, img)
+     {
+       eina_stringshare_del(img->path);
+       eina_stringshare_del(img->group);
+       free(img);
+     }
+   EINA_LIST_FREE(_gui->theme_icon_pool, img)
+     {
+       eina_stringshare_del(img->path);
+       eina_stringshare_del(img->group);
+       free(img);
+     }
+   EINA_LIST_FREE(_gui->theme_icon_pool, img)
+     {
+       eina_stringshare_del(img->path);
+       eina_stringshare_del(img->group);
+       free(img);
+     }
+
    if (_gui) free(_gui);
 }
 
+static Eina_List*
+_entrance_gui_string_to_entrance_image(Eina_List *src, char *stdfile, char 
*mask)
+{
+   //If srdfile is NULL we will set the src string to file, if not we will set 
the stdfile. And the src as group.
+   Eina_List *result = NULL;
+   char *src_str, path[PATH_MAX];
+   Entrance_Image *img;
+   EINA_LIST_FREE(src, src_str)
+     {
+        img = calloc(1, sizeof(Entrance_Image));
+        if (stdfile)
+          {
+            if (mask)
+              {
+                 snprintf(path, PATH_MAX, mask, src_str);
+                 img->group = eina_stringshare_add(path);
+                 eina_stringshare_del(src_str);
+              }
+            else
+              img->group = src_str;
+            img->path = eina_stringshare_add(stdfile);
+          }
+        else
+          img->path = src_str;
+        result = eina_list_append(result,img);
+     }
+   return result;
+}
+
+Eina_List*
+entrance_gui_theme_icons(void)
+{
+  return _gui->theme_icon_pool;
+}
+
+Eina_List*
+entrance_gui_theme_backgrounds(void)
+{
+  return _gui->theme_background_pool;
+}
+static Eina_List*
+_entrance_gui_theme_icons_cache_fill(Evas_Object *obj, const char *themename)
+{
+   Evas_Object *edje, *o;
+   char buf[PATH_MAX];
+   Eina_List *icons = NULL;
+
+   edje = elm_layout_add(obj);
+   snprintf(buf, sizeof(buf),
+            PACKAGE_DATA_DIR"/themes/%s.edj", themename);
+   if (!elm_layout_file_set(edje, buf, "entrance/user"))
+     return NULL; //Can we get to this point ??
+   o = elm_layout_edje_get(edje);
+   if (!o) return NULL;
+   icons = entrance_gui_stringlist_get(edje_object_data_get(o, "items"));
+   evas_object_del(edje);
+   return _entrance_gui_string_to_entrance_image(icons, buf, 
"entrance/user/%s");
+}
+
+static Eina_List*
+_entrance_gui_theme_background_cache_fill(Evas_Object *obj, const char 
*themename)
+{
+   Evas_Object *edje, *o;
+   char buf[PATH_MAX];
+   Eina_List *icons = NULL;
+
+   edje = elm_layout_add(obj);
+   snprintf(buf, sizeof(buf),
+            PACKAGE_DATA_DIR"/themes/%s.edj", themename);
+   if (!elm_layout_file_set(edje, buf, "entrance/background"))
+     return NULL;
+   o = elm_layout_edje_get(edje);
+   if (!o) return NULL;
+   icons = entrance_gui_stringlist_get(edje_object_data_get(o, "items"));
+   if (!icons) return NULL;
+   evas_object_del(edje);
+   return _entrance_gui_string_to_entrance_image(icons, buf, 
"entrance/background/%s");
+}
+
 Evas_Object *
 entrance_gui_theme_get (Evas_Object *win, const char *group)
 {
@@ -304,6 +419,21 @@ entrance_gui_users_get(void)
    return _gui->users;
 }
 
+const Entrance_Login*
+entrance_gui_user_get(const char* name)
+{
+   Entrance_Login *el;
+   Eina_List *l;
+   EINA_LIST_FOREACH(_gui->users, l, el)
+     {
+       if(!strcmp(name, el->login))
+         {
+            return el;
+         }
+     }
+   return NULL;
+}
+
 void
 entrance_gui_xsessions_set(Eina_List *xsessions)
 {
@@ -326,6 +456,8 @@ entrance_gui_xsessions_get(void)
 void
 entrance_gui_conf_set(const Entrance_Conf_Gui_Event *conf)
 {
+   _gui->background_pool = conf->background_pool;
+   _gui->icon_pool = conf->icon_pool;
    if ((conf->bg.path) && (*conf->bg.path)
        && (_gui->bg.path != conf->bg.path))
      {
@@ -361,6 +493,18 @@ entrance_gui_theme_name_get(void)
    return _gui->theme;
 }
 
+Eina_List*
+entrance_gui_background_pool_get(void)
+{
+  return _gui->background_pool;
+}
+
+Eina_List*
+entrance_gui_icon_pool_get(void)
+{
+  return _gui->icon_pool;
+}
+
 const char *
 entrance_gui_theme_path_get(void)
 {
@@ -477,35 +621,46 @@ _entrance_gui_conf_clicked_cb(void *data, Evas_Object 
*obj EINA_UNUSED, void *ev
 ///////////////////////////////////////////////////
 
 
-static Evas_Object *
-_entrance_gui_user_icon_random_get(Evas_Object *obj)
+static Evas_Object*
+_entrance_gui_user_icon_random_get(Evas_Object *obj, const char *username)
 {
-   Evas_Object *ic, *o, *r;
-   Eina_List *icons;
-   unsigned char i;
-   const char *icon;
-   char buf[PATH_MAX];
+   unsigned int rnd = 0;
+   Evas_Object *o = NULL;
+   char buf[PATH_MAX], *path;
+   Entrance_Image *img;
+   const Entrance_Login *el;
+   Eina_List *user_icons, *sys_icons, *theme_icons;
 
-   ic = entrance_gui_theme_get(obj, "entrance/user");
-   if (!ic) return NULL;
-   o = elm_layout_edje_get(ic);
-   if (!o) return NULL;
-   icons = entrance_gui_stringlist_get(edje_object_data_get(o, "items"));
-   if (icons)
+   el = entrance_gui_user_get(username);
+   user_icons = el->icon_pool;
+   sys_icons = entrance_gui_icon_pool_get();
+   theme_icons = entrance_gui_theme_icons();
+
+   rnd = (((eina_list_count(user_icons) + eina_list_count(sys_icons) + 
eina_list_count(theme_icons))
+         * (double)rand()) / (RAND_MAX + 1.0));
+   if (rnd < eina_list_count(user_icons))
      {
-        srand(time(NULL));
-        i = (unsigned char) ((eina_list_count(icons) * (double)rand())
-                             / (RAND_MAX + 1.0));
-        icon = eina_list_nth(icons, i);
-        snprintf(buf, sizeof(buf),
-                 "entrance/user/%s", icon);
-        entrance_gui_stringlist_free(icons);
-        r = entrance_gui_theme_get(obj, buf);
-        elm_object_part_content_set(ic, "entrance.icon", r);
-        evas_object_show(r);
+        o = elm_icon_add(obj);
+        img = eina_list_nth(user_icons, rnd);
+        elm_image_file_set(o, img->path, NULL);
+
      }
+   else if((rnd >= eina_list_count(user_icons)) && (rnd < 
(eina_list_count(user_icons)
+            +eina_list_count(sys_icons))))
+     {
+        o = elm_icon_add(obj);
+        img = eina_list_nth(sys_icons, (rnd - eina_list_count(user_icons)));
+        elm_image_file_set(o, img->path, NULL);
+     }
+   else
+     {
+        img = eina_list_nth(theme_icons, (rnd - (eina_list_count(user_icons)
+                                        + eina_list_count(sys_icons)))); 
+        o = elm_icon_add(obj);
+        elm_image_file_set(o, img->path, img->group);
 
-   return ic;
+     }
+   return o;
 }
 
 static void
@@ -534,40 +689,29 @@ _entrance_gui_user_text_get(void *data, Evas_Object *obj 
EINA_UNUSED, const char
 static Evas_Object *
 _entrance_gui_user_content_get(void *data EINA_UNUSED, Evas_Object *obj, const 
char *part)
 {
-   Evas_Object *ic = NULL;
+   Evas_Object *ic = NULL, *o;
    Entrance_Login *eu;
    eu = data;
-
    if (eu && !strcmp(part, "elm.swallow.icon"))
      {
-        if ((eu->image.path) && (*eu->image.path == '/') && (!eu->image.group))
+        ic = entrance_gui_theme_get(obj, "entrance/user");
+        if ((!eu->image.path) && (!eu->image.group))
           {
-             ic = elm_icon_add(obj);
-             elm_image_file_set(ic, eu->image.path, "entrance/user/icon");
-             eu->image.group = eina_stringshare_add("entrance/user/icon");
-
+             o = _entrance_gui_user_icon_random_get(obj, eu->login);
+          }
+        else if(eu->image.path && (!eu->image.group))
+          {
+             o = elm_icon_add(obj);
+             elm_image_file_set(o, eu->image.path, NULL);
           }
         else
           {
-             if (eu->image.group)
-               {
-                  ic = elm_icon_add(obj);
-                  elm_image_file_set(ic, eu->image.path, eu->image.group);
-               }
-             else
-               {
-                  const char *path, *group;
-                  ic = _entrance_gui_user_icon_random_get(obj);
-                  edje_object_file_get(
-                     elm_layout_edje_get(
-                        elm_object_part_content_get(ic, "entrance.icon")),
-                     &path, &group);
-                  eu->image.path = eina_stringshare_add(path);
-                  eu->image.group = eina_stringshare_add(group);
-               }
+             o = entrance_gui_theme_get(obj, eu->image.group);
           }
-        evas_object_size_hint_weight_set(ic, EVAS_HINT_EXPAND, 
EVAS_HINT_EXPAND);
-        evas_object_show(ic);
+        //TODO if this fails we maybe should wipe those fields in the config 
and use a random one
+        evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 
EVAS_HINT_EXPAND);
+        evas_object_show(o);
+        elm_object_part_content_set(ic ,"entrance.icon", o);
      }
    return ic;
 }
diff --git a/src/bin/entrance_gui.h b/src/bin/entrance_gui.h
index 789d726..331a3e9 100644
--- a/src/bin/entrance_gui.h
+++ b/src/bin/entrance_gui.h
@@ -5,6 +5,8 @@
 
 int entrance_gui_init(const char *theme);
 void entrance_gui_shutdown(void);
+Eina_List* entrance_gui_theme_icons(void);
+Eina_List* entrance_gui_theme_backgrounds(void);
 void entrance_gui_run(void);
 Evas_Object *entrance_gui_theme_get (Evas_Object *win, const char *group);
 void entrance_gui_auth_valid(void);
@@ -14,6 +16,7 @@ void entrance_gui_xsession_set(Eina_List *xsessions);
 void entrance_gui_actions_set(Eina_List *actions);
 void entrance_gui_users_set(Eina_List *users);
 const Eina_List *entrance_gui_users_get(void);
+const Entrance_Login* entrance_gui_user_get(const char* name);
 void entrance_gui_xsessions_set(Eina_List *users);
 const Eina_List *entrance_gui_xsessions_get(void);
 void entrance_gui_conf_set(const Entrance_Conf_Gui_Event *conf);
@@ -25,7 +28,8 @@ void entrance_gui_background_get(const char **path, const 
char **group);
 Eina_Bool entrance_gui_vkbd_enabled_get(void);
 const char *entrance_gui_theme_path_get(void);
 void entrance_gui_user_bg_set(const char *path, const char *group);
-
+Eina_List* entrance_gui_background_pool_get(void);
+Eina_List* entrance_gui_icon_pool_get(void);
 /*
 char *entrance_gui_user_get();
 char *entrance_gui_password_get();
diff --git a/src/daemon/Makefile.am b/src/daemon/Makefile.am
index 428412e..245c563 100644
--- a/src/daemon/Makefile.am
+++ b/src/daemon/Makefile.am
@@ -38,6 +38,8 @@ entrance_history.h    \
 entrance_history.c    \
 entrance_action.h     \
 entrance_action.c     \
+entrance_image.h      \
+entrance_image.c      \
 entrance.h            \
 entrance.c
 
diff --git a/src/daemon/entrance.h b/src/daemon/entrance.h
index 193cd10..97d669c 100644
--- a/src/daemon/entrance.h
+++ b/src/daemon/entrance.h
@@ -23,6 +23,7 @@
 #include "entrance_server.h"
 #include "entrance_history.h"
 #include "entrance_action.h"
+#include "entrance_image.h"
 
 #define PT(f, x...)                                                     \
 do                                                                   \
diff --git a/src/daemon/entrance_history.c b/src/daemon/entrance_history.c
index c25c989..678af57 100644
--- a/src/daemon/entrance_history.c
+++ b/src/daemon/entrance_history.c
@@ -240,14 +240,12 @@ _entrance_user_init(void)
              if ((eu = (Entrance_Login *) calloc(1, sizeof(Entrance_Login))))
                {
                   eu->login = eina_stringshare_add(user);
-                  snprintf(buf, sizeof(buf),
-                           "/var/cache/"PACKAGE"/users/%s.edj", user);
-                  if (ecore_file_exists(buf))
-                    eu->image.path = eina_stringshare_add(buf);
                   eu->remember_session = EINA_TRUE;
                }
           }
         eina_stringshare_del(user);
+        eu->icon_pool = entrance_image_user_icons(eu->login);
+        eu->background_pool = entrance_image_user_backgrounds(eu->login);
         _lusers = eina_list_append(_lusers, eu);
      }
 }
@@ -256,6 +254,7 @@ static void
 _entrance_user_shutdown(void)
 {
    Entrance_Login *eu;
+   char *buf;
    EINA_LIST_FREE(_lusers, eu)
      {
         if (!_entrance_history_match(eu->login))
@@ -266,6 +265,14 @@ _entrance_user_shutdown(void)
              eina_stringshare_del(eu->image.group);
              eina_stringshare_del(eu->bg.path);
              eina_stringshare_del(eu->bg.group);
+             EINA_LIST_FREE(eu->background_pool, buf)
+               {
+                 eina_stringshare_del(buf);
+               }
+             EINA_LIST_FREE(eu->icon_pool, buf)
+               {
+                 eina_stringshare_del(buf);
+               }
              free(eu);
           }
      }
diff --git a/src/daemon/entrance_image.c b/src/daemon/entrance_image.c
new file mode 100644
index 0000000..6ece9ce
--- /dev/null
+++ b/src/daemon/entrance_image.c
@@ -0,0 +1,105 @@
+#include "entrance_image.h"
+
+const char *extn_images[] = {".png",".jpg",NULL};
+
+
+static Eina_List*
+_entrance_image_readdir(char *path)
+{
+   Eina_List *files;
+   Eina_List *targets = NULL;
+   char *filename, buf[PATH_MAX];
+   int i = 0;
+
+   files = ecore_file_ls(path);
+   if (!files) return NULL;
+   EINA_LIST_FREE(files, filename)
+     {
+        snprintf(buf, PATH_MAX, "%s/%s", path, filename);
+        if ((!ecore_file_is_dir(buf)) && (filename[0] != '.'))
+          {
+             for (i = 0; extn_images[i];i ++)
+               {
+                  if (eina_str_has_extension(filename, extn_images[i]))
+                    {
+                       targets = eina_list_append(targets, 
eina_stringshare_add(buf));
+                    }
+               }
+
+          }
+     } 
+   return targets;
+}
+static Eina_List*
+_entrance_image_string_to_entrance_image(Eina_List *src, char *stdfile, char 
*mask)
+{
+   //If srdfile is NULL we will set the src string to file, if not we will set 
the stdfile. And the src as group.
+   Eina_List *result = NULL;
+   char *src_str, path[PATH_MAX];
+   Entrance_Image *img;
+   EINA_LIST_FREE(src, src_str)
+     {
+        img = calloc(1, sizeof(Entrance_Image));
+        if (stdfile)
+          {
+            if (mask)
+              {
+                 snprintf(path, PATH_MAX, mask, src_str);
+                 img->group = eina_stringshare_add(path);
+                 eina_stringshare_del(src_str);
+              }
+            else
+              img->group = src_str;
+            img->path = eina_stringshare_add(stdfile);
+          }
+        else
+          img->path = src_str;
+        result = eina_list_append(result,img);
+     }
+   return result; 
+}
+static char*
+_entrance_image_homedir_get(const char *usr)
+{
+   char *name;
+   struct passwd *pw;
+   
+   pw = getpwnam(usr);
+   if (!pw) return NULL;
+   name = pw->pw_dir;
+   return name;
+}
+Eina_List* 
+entrance_image_system_icons(void)
+{
+   char path[PATH_MAX];
+   snprintf(path, PATH_MAX,"%s/images/icons/", PACKAGE_DATA_DIR);
+   return 
_entrance_image_string_to_entrance_image(_entrance_image_readdir(path), NULL, 
NULL);
+}
+Eina_List* 
+entrance_image_system_backgrounds(void)
+{
+   char path[PATH_MAX];
+   snprintf(path, PATH_MAX,"%s/images/backgrounds/", PACKAGE_DATA_DIR);
+   return 
_entrance_image_string_to_entrance_image(_entrance_image_readdir(path), NULL, 
NULL);
+}
+Eina_List* 
+entrance_image_user_icons(const char *username)
+{
+   char path[PATH_MAX], *homedir;
+ 
+   homedir = _entrance_image_homedir_get(username);
+   if (!homedir) return NULL;
+   snprintf(path, PATH_MAX,"%s/.config/entrance/images/icons/", homedir);
+   return 
_entrance_image_string_to_entrance_image(_entrance_image_readdir(path), NULL, 
NULL);
+}
+Eina_List* 
+entrance_image_user_backgrounds(const char *username)
+{
+   char path[PATH_MAX], *homedir;
+
+   homedir = _entrance_image_homedir_get(username);
+   if (!homedir) return NULL;
+   snprintf(path, PATH_MAX,"%s/.config/entrance/images/backgrounds/", homedir);
+   return 
_entrance_image_string_to_entrance_image(_entrance_image_readdir(path), NULL, 
NULL);
+}
diff --git a/src/daemon/entrance_image.h b/src/daemon/entrance_image.h
new file mode 100644
index 0000000..4dc7676
--- /dev/null
+++ b/src/daemon/entrance_image.h
@@ -0,0 +1,20 @@
+#ifndef ENTRANCE_IMAGE_H_
+#define ENTRANCE_IMAGE_H_
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+
+#include "entrance.h"
+
+extern const char *extn_images[];
+
+Eina_List* entrance_image_system_icons();
+Eina_List* entrance_image_system_backgrounds();
+Eina_List* entrance_image_user_icons(const char *username);
+Eina_List* entrance_image_user_backgrounds(const char *username);
+
+
+#endif /* ENTRANCE_H_ */
diff --git a/src/daemon/entrance_server.c b/src/daemon/entrance_server.c
index 21c95ba..77a09d3 100644
--- a/src/daemon/entrance_server.c
+++ b/src/daemon/entrance_server.c
@@ -14,6 +14,7 @@ static Eina_Bool
 _entrance_server_add(void *data EINA_UNUSED, int type EINA_UNUSED, void *event 
EINA_UNUSED)
 {
    Entrance_Event eev;
+   char *buf;
 
    PT("server client connected\n");
    PT("Sending users\n");
@@ -39,7 +40,17 @@ _entrance_server_add(void *data EINA_UNUSED, int type 
EINA_UNUSED, void *event E
         eev.event.conf_gui.enabled = EINA_TRUE;
         eev.event.conf_gui.bg.path = entrance_config->bg.path;
         eev.event.conf_gui.bg.group = entrance_config->bg.group;
+        eev.event.conf_gui.background_pool = 
entrance_image_system_backgrounds();
+        eev.event.conf_gui.icon_pool = entrance_image_system_icons();
         entrance_event_send(&eev);
+        EINA_LIST_FREE(eev.event.conf_gui.background_pool, buf)
+          {
+            eina_stringshare_del(buf);
+          }
+        EINA_LIST_FREE(eev.event.conf_gui.icon_pool, buf)
+          {
+            eina_stringshare_del(buf);
+          }
      }
    return ECORE_CALLBACK_RENEW;
 }
diff --git a/src/event/entrance_event.c b/src/event/entrance_event.c
index 4eef956..2e718ad 100644
--- a/src/event/entrance_event.c
+++ b/src/event/entrance_event.c
@@ -21,7 +21,8 @@ static Eet_Data_Descriptor 
*_entrance_event_xsessions_dd(void);
 static Eet_Data_Descriptor *_entrance_event_conf_gui_dd(void);
 static Eet_Data_Descriptor *_entrance_event_maxtries_dd(void);
 static Eet_Data_Descriptor *_entrance_event_users_dd(void);
-static Eet_Data_Descriptor *_entrance_event_conf_user_dd(void);
+static Eet_Data_Descriptor *_entrance_event_image_dd(void);
+static Eet_Data_Descriptor *_entrance_event_conf_user_dd(Eina_Bool stream);
 static Eet_Data_Descriptor *_entrance_event_actions_dd(void);
 static Eet_Data_Descriptor *_entrance_event_action_dd(void);
 static Eet_Data_Descriptor *_entrance_event_new(void);
@@ -154,11 +155,12 @@ _entrance_event_maxtries_dd(void)
 static Eet_Data_Descriptor *
 _entrance_event_conf_gui_dd(void)
 {
-   Eet_Data_Descriptor *edd;
+   Eet_Data_Descriptor *edd, *eddi;
    Eet_Data_Descriptor_Class eddc;
    EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc,
                                              Entrance_Conf_Gui_Event);
    edd = eet_data_descriptor_stream_new(&eddc);
+   eddi = _entrance_event_image_dd();
    EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Conf_Gui_Event, "enabled",
                                  enabled, EET_T_UCHAR);
    EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Conf_Gui_Event, "bg.path",
@@ -167,6 +169,10 @@ _entrance_event_conf_gui_dd(void)
                                  bg.group, EET_T_STRING);
    EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Conf_Gui_Event, "vkbd_enabled",
                                  vkbd_enabled, EET_T_UCHAR);
+   EET_DATA_DESCRIPTOR_ADD_LIST(edd, Entrance_Conf_Gui_Event, "icon_pool",
+                                icon_pool, eddi);
+   EET_DATA_DESCRIPTOR_ADD_LIST(edd, Entrance_Conf_Gui_Event, 
"background_pool",
+                                background_pool, eddi);
    return edd;
 }
 
@@ -186,12 +192,27 @@ _entrance_event_status_dd(void)
 }
 
 static Eet_Data_Descriptor *
+_entrance_event_image_dd(void)
+{
+   Eet_Data_Descriptor *edd;
+   Eet_Data_Descriptor_Class eddc;
+   EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Entrance_Image);
+   edd = eet_data_descriptor_stream_new(&eddc);
+   EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Image, "path",
+                                 path, EET_T_STRING);
+   EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Image, "group",
+                                 group, EET_T_INT);
+   return edd;
+
+}
+
+static Eet_Data_Descriptor *
 _entrance_event_users_dd(void)
 {
    Eet_Data_Descriptor *edd, *eddl;
    Eet_Data_Descriptor_Class eddc, eddcl;
    EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Entrance_Login);
-   edd = _entrance_event_conf_user_dd();
+   edd = _entrance_event_conf_user_dd(EINA_TRUE);
    EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddcl, Entrance_Users_Event);
    eddl = eet_data_descriptor_stream_new(&eddcl);
    EET_DATA_DESCRIPTOR_ADD_LIST(eddl, Entrance_Users_Event, "users",
@@ -200,10 +221,11 @@ _entrance_event_users_dd(void)
 }
 
 static Eet_Data_Descriptor *
-_entrance_event_conf_user_dd(void)
+_entrance_event_conf_user_dd(Eina_Bool stream)
 {
-   Eet_Data_Descriptor *edd;
+   Eet_Data_Descriptor *edd, *eddi;
    Eet_Data_Descriptor_Class eddc;
+   eddi = _entrance_event_image_dd();
    EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Entrance_Login);
    edd = eet_data_descriptor_stream_new(&eddc);
 #define EET_LOGIN_ADD(NAME, TYPE) \
@@ -217,6 +239,13 @@ _entrance_event_conf_user_dd(void)
    EET_LOGIN_ADD(remember_session, EET_T_INT);
    // TODO screenshot
 
+   if (stream)
+     {
+        EET_DATA_DESCRIPTOR_ADD_LIST(edd, Entrance_Login, "icon_pool",
+                                     icon_pool, eddi);
+        EET_DATA_DESCRIPTOR_ADD_LIST(edd, Entrance_Login, "background_pool",
+                                     background_pool, eddi);
+     }
 #undef EET_LOGIN_ADD
    return edd;
 }
@@ -277,7 +306,7 @@ _entrance_event_new(void)
    EET_DATA_DESCRIPTOR_ADD_MAPPING(unified, ENTRANCE_EVENT_USERS_NAME,
                                    _entrance_event_users_dd());
    EET_DATA_DESCRIPTOR_ADD_MAPPING(unified, ENTRANCE_EVENT_CONF_USER_NAME,
-                                   _entrance_event_conf_user_dd());
+                                   _entrance_event_conf_user_dd(EINA_TRUE));
    EET_DATA_DESCRIPTOR_ADD_MAPPING(unified, ENTRANCE_EVENT_ACTIONS_NAME,
                                    _entrance_event_actions_dd());
    EET_DATA_DESCRIPTOR_ADD_MAPPING(unified, ENTRANCE_EVENT_ACTION_NAME,
@@ -335,5 +364,6 @@ entrance_event_received(const void *data, size_t size)
 Eet_Data_Descriptor *
 entrance_event_user_dd(void)
 {
-   return _entrance_event_conf_user_dd();
+  //this is used extern for the history!
+   return _entrance_event_conf_user_dd(EINA_FALSE);
 }
diff --git a/src/event/entrance_event.h b/src/event/entrance_event.h
index 187ab48..eb6e4ee 100644
--- a/src/event/entrance_event.h
+++ b/src/event/entrance_event.h
@@ -77,22 +77,26 @@ typedef struct Entrance_Conf_Gui_Event_
         const char *path;
      } bg;
    Eina_Bool vkbd_enabled;
+   Eina_List *background_pool;
+   Eina_List *icon_pool;
 } Entrance_Conf_Gui_Event;
 
 
-typedef struct Entrance_Background_
+typedef struct Entrance_Image_
 {
    const char *group;
    const char *path;
-} Entrance_Background;
+} Entrance_Image;
 
 typedef struct Entrance_Login_
 {
    const char *login;
    const char *lsess;
-   Entrance_Background bg;
-   Entrance_Background image;
+   Entrance_Image bg;
+   Entrance_Image image;
    Eina_Bool remember_session;
+   Eina_List *icon_pool;
+   Eina_List *background_pool;
 } Entrance_Login;
 
 typedef struct Entrance_Event_

-- 


Reply via email to