Factorizing code could be a better idea instead cut and paste ...

2014-04-02 17:55 GMT+02:00 Marcel Hollerbach <marcel.hollerb...@stzedn.de>:

> bu5hm4n pushed a commit to branch master.
>
>
> http://git.enlightenment.org/misc/entrance.git/commit/?id=ad00fd25dfe971aff71d8c2c735b52d978e19c29
>
> commit ad00fd25dfe971aff71d8c2c735b52d978e19c29
> Author: Marcel Hollerbach <marcel.hollerb...@stzedn.de>
> Date:   Wed Apr 2 16:00:04 2014 +0200
>
>     entrance: Use the algo from gui_update also for the user background !
> ---
>  src/bin/entrance_gui.c | 84
> ++++++++++++++++++++++++++++++--------------------
>  1 file changed, 50 insertions(+), 34 deletions(-)
>
> diff --git a/src/bin/entrance_gui.c b/src/bin/entrance_gui.c
> index 423f640..519d4be 100755
> --- a/src/bin/entrance_gui.c
> +++ b/src/bin/entrance_gui.c
> @@ -561,6 +561,51 @@ entrance_gui_vkbd_enabled_get(void)
>     return _gui->vkbd_enabled;
>  }
>
> +static Evas_Object *
> +_entrance_gui_background_obj_get(Evas_Object *par, const char *path,
> const char *group)
> +{
> +   Evas_Object *bg = NULL;
> +   if (group)
> +     {
> +        if (path)
> +          {
> +             bg = elm_layout_add(par);
> +             if (!elm_layout_file_set(bg, path, group))
> +               {
> +                 evas_object_del(bg);
> +                 return NULL;
> +               }
> +          }
> +        else
> +          {
> +             bg = entrance_gui_theme_get(par,
> +                                         "entrance/background/default");
> +          }
> +     }
> +   else if (path)
> +     {
> +        if (eina_str_has_extension(path,".edj"))
> +          {
> +             bg = elm_layout_add(par);
> +             if (!elm_layout_file_set(bg, path,
> "entrance/background/default"))
> +               {
> +                 evas_object_del(bg);
> +                 return NULL;
> +               }
> +          }
> +        else
> +          {
> +             bg = elm_bg_add(par);
> +             if (!elm_bg_file_set(bg, path, NULL))
> +               {
> +                 evas_object_del(bg);
> +                 return NULL;
> +               }
> +          }
> +     }
> +   return bg;
> +}
> +
>  void
>  entrance_gui_user_bg_set(const char *path, const char *group)
>  {
> @@ -568,12 +613,12 @@ entrance_gui_user_bg_set(const char *path, const
> char *group)
>     Entrance_Screen *screen;
>     Evas_Object *o;
>
> +   PT("User Background - %s %s", path, group);
>     EINA_LIST_FOREACH(_gui->screens, l, screen)
>       {
> -        if (path && group)
> +        if (path || group)
>            {
> -             o = elm_layout_add(screen->background);
> -             elm_layout_file_set(o, path, group);
> +             o = _entrance_gui_background_obj_get(screen->transition,
> path, group);
>               elm_object_part_content_set(screen->transition,
>                                           "entrance.wallpaper.user.start",
> o);
>               evas_object_show(o);
> @@ -599,38 +644,9 @@ _entrance_gui_update(void)
>          if (_gui->changed & ENTRANCE_CONF_WALLPAPER)
>            {
>               PT("Set background %s - %s\n", _gui->bg.path,
> _gui->bg.group);
> -             if (_gui->bg.group)
> -               {
> -                  if (_gui->bg.path)
> -                    {
> -                       bg = elm_layout_add(screen->transition);
> -                       success = elm_layout_file_set(bg, _gui->bg.path,
> _gui->bg.group);
> -                    }
> -                  else
> -                    {
> -                       bg = entrance_gui_theme_get(screen->transition,
> -
>  "entrance/background/default");
> -                       if (bg)
> -                         success = EINA_TRUE;
> -                    }
> -               }
> -             else if (_gui->bg.path)
> -               {
> -                  if (eina_str_has_extension(_gui->bg.path,".edj"))
> -                    {
> -                       bg = elm_layout_add(screen->transition);
> -                       success = 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 (!success)
> +             bg = _entrance_gui_background_obj_get(screen->transition,
> _gui->bg.path, _gui->bg.group);
> +             if (!bg)
>                 {
> -                  if (bg)
> -                    evas_object_del(bg);
>                    const char *path;
>                    const char *group;
>                    if ((_gui->bg.group) || (_gui->bg.path))
>
> --
>
>
>


-- 
Michaël Bouchaud (yoz) <y...@efl.so>
------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees_APR
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to