bu5hm4n pushed a commit to branch master.

http://git.enlightenment.org/misc/entrance.git/commit/?id=70493a4fc8f30dce50f63dac3802720cbcb08924

commit 70493a4fc8f30dce50f63dac3802720cbcb08924
Author: Marcel Hollerbach <marcel.hollerb...@stzedn.de>
Date:   Tue Mar 18 10:17:00 2014 +0100

    entrance: enrtance is able to load standart images like png and jpg
    
    - the set of the conf can now also be a deletion of a attribute like the
      group
---
 src/bin/entrance_gui.c | 57 ++++++++++++++++++++++++++++++++++----------------
 1 file changed, 39 insertions(+), 18 deletions(-)

diff --git a/src/bin/entrance_gui.c b/src/bin/entrance_gui.c
index 1b80e3d..6dccf3f 100755
--- a/src/bin/entrance_gui.c
+++ b/src/bin/entrance_gui.c
@@ -460,16 +460,27 @@ 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))
+   //TODO free the pool if there was one before!
+   if (_gui->bg.path != conf->bg.path)
      {
-        eina_stringshare_replace(&_gui->bg.path, conf->bg.path);
+        if ((conf->bg.path) && (*conf->bg.path))
+          eina_stringshare_replace(&_gui->bg.path, conf->bg.path);
+        else
+          {
+             eina_stringshare_del(_gui->bg.path);
+             _gui->bg.path = NULL;
+          }
         _gui->changed &= ENTRANCE_CONF_WALLPAPER;
      }
-   if ((conf->bg.group) && (*conf->bg.group)
-       && (_gui->bg.group != conf->bg.group))
+   if (_gui->bg.group != conf->bg.group)
      {
-        eina_stringshare_replace(&_gui->bg.group, conf->bg.group);
+        if ((conf->bg.group) && (*conf->bg.group))
+          eina_stringshare_replace(&_gui->bg.group, conf->bg.group);
+        else
+          {
+             eina_stringshare_del(_gui->bg.group);
+             _gui->bg.group = NULL;
+          }
         _gui->changed &= ENTRANCE_CONF_WALLPAPER;
      }
 
@@ -565,33 +576,43 @@ _entrance_gui_update(void)
    EINA_LIST_FOREACH(_gui->screens, l, screen)
      {
         Evas_Object *bg = NULL;
+        Eina_Bool success = EINA_FALSE;
         if (_gui->changed & ENTRANCE_CONF_WALLPAPER)
           {
              PT("Set background %s - %s\n", _gui->bg.path, _gui->bg.group);
-             if (_gui->bg.path)
+             if (_gui->bg.group)
                {
-                  if (_gui->bg.group)
+                  if (_gui->bg.path) 
                     {
                        bg = elm_layout_add(screen->transition);
-                       elm_layout_file_set(bg, _gui->bg.path, _gui->bg.group);
+                       success = elm_layout_file_set(bg, _gui->bg.path, 
_gui->bg.group);
                     }
                   else
                     {
+                       bg = entrance_gui_theme_get(screen->transition,
+                                              "entrance/background/default");
+                    }
+               }
+             else if (_gui->bg.path) 
+               {
+                  if (eina_str_has_extension(_gui->bg.path,".edj"))
+                    {
                        bg = elm_layout_add(screen->transition);
-                       elm_layout_file_set(bg, _gui->bg.path,
-                                           "entrance/background/default");
+                       elm_layout_file_set(bg, _gui->bg.path, 
"entrance/background/default");
+                    }
+                  else
+                    {
+                       bg = elm_bg_add(screen->transition);
+                       success = elm_bg_file_set(bg, _gui->bg.path, NULL);
                     }
                }
-             if (!bg)
+             if (!success)
                {
                   const char *path;
                   const char *group;
-                  if (_gui->bg.group)
-                    bg = entrance_gui_theme_get(screen->transition,
-                                                _gui->bg.group);
-                  else
-                    bg = entrance_gui_theme_get(screen->transition,
-                                                "entrance/background/default");
+                  PT("Failed to load new background, fallback on the theme 
default! \n");
+                  bg = entrance_gui_theme_get(screen->transition,
+                                              "entrance/background/default");
                   edje_object_file_get(elm_layout_edje_get(bg), &path, &group);
                   eina_stringshare_replace(&_gui->bg.path, path);
                   eina_stringshare_replace(&_gui->bg.group, group);

-- 


Reply via email to