On Sun, Oct 3, 2010 at 2:13 AM, Enlightenment SVN
<no-re...@enlightenment.org> wrote:
> Log:
>  add an option to sort the images before displaying them.

This patch sounds like it break the async loading of a directory and
delay it until all the directory content is listed. Maybe you should
insert inside a sorted listed so you don't need to wait until the end
to start building the grid.

> Author:       urandom
> Date:         2010-10-02 17:13:02 -0700 (Sat, 02 Oct 2010)
> New Revision: 52989
>
> Modified:
>  trunk/ephoto/src/bin/ephoto.h trunk/ephoto/src/bin/ephoto_config.c 
> trunk/ephoto/src/bin/ephoto_preferences.c 
> trunk/ephoto/src/bin/ephoto_thumb_browser.c
>
> Modified: trunk/ephoto/src/bin/ephoto.h
> ===================================================================
> --- trunk/ephoto/src/bin/ephoto.h       2010-10-02 22:27:30 UTC (rev 52988)
> +++ trunk/ephoto/src/bin/ephoto.h       2010-10-03 00:13:02 UTC (rev 52989)
> @@ -91,6 +91,8 @@
>         const char *slideshow_transition;
>
>         const char *editor;
> +
> +        int sort_images;
>  };
>
>  /*Ephoto Main Structure*/
>
> Modified: trunk/ephoto/src/bin/ephoto_config.c
> ===================================================================
> --- trunk/ephoto/src/bin/ephoto_config.c        2010-10-02 22:27:30 UTC (rev 
> 52988)
> +++ trunk/ephoto/src/bin/ephoto_config.c        2010-10-03 00:13:02 UTC (rev 
> 52989)
> @@ -1,6 +1,6 @@
>  #include "ephoto.h"
>
> -#define CONFIG_VERSION 3
> +#define CONFIG_VERSION 4
>
>  static int _ephoto_config_load(Ephoto *em);
>  static Eina_Bool _ephoto_on_config_save(void *data);
> @@ -29,6 +29,7 @@
>         C_VAL(D, T, slideshow_timeout, EET_T_DOUBLE);
>         C_VAL(D, T, slideshow_transition, EET_T_STRING);
>         C_VAL(D, T, editor, EET_T_STRING);
> +        C_VAL(D, T, sort_images, EET_T_INT);
>
>         switch (_ephoto_config_load(em))
>         {
> @@ -42,6 +43,7 @@
>                                 eina_stringshare_add("fade");
>                         em->config->editor =
>                                 eina_stringshare_add("gimp %s");
> +                        em->config->sort_images = 1;
>                         break;
>                 case -1:
>                         if (em->config->config_version < 2)
> @@ -54,6 +56,8 @@
>                         if (em->config->config_version < 3)
>                                 em->config->editor =
>                                         eina_stringshare_add("gimp %s");
> +                        if (em->config->config_version < 4)
> +                                em->config->sort_images = 1;
>
>                         /* Incremental additions */
>                         em->config->config_version = CONFIG_VERSION;
>
> Modified: trunk/ephoto/src/bin/ephoto_preferences.c
> ===================================================================
> --- trunk/ephoto/src/bin/ephoto_preferences.c   2010-10-02 22:27:30 UTC (rev 
> 52988)
> +++ trunk/ephoto/src/bin/ephoto_preferences.c   2010-10-03 00:13:02 UTC (rev 
> 52989)
> @@ -56,6 +56,15 @@
>                 elm_box_pack_end(pg1, o);
>                 evas_object_show(o);
>
> +                o = elm_check_add(pg1);
> +                elm_check_label_set(o, "Sort images");
> +                elm_check_state_set(o, em->config->sort_images);
> +                evas_object_data_set(o, "config", "sort_images");
> +                evas_object_smart_callback_add(o, "changed",
> +                                               
> _ephoto_preferences_item_change, em);
> +                elm_box_pack_end(pg1, o);
> +                evas_object_show(o);
> +
>                 elm_box_pack_end(box, pager);
>                 evas_object_show(pager);
>
> @@ -170,6 +179,8 @@
>                 eina_stringshare_replace(
>                     &em->config->editor,
>                     eina_stringshare_add(elm_entry_entry_get(obj)));
> +        else if (!strcmp(key, "sort_images"))
> +                em->config->sort_images = elm_check_state_get(obj);
>
>         ephoto_config_save(em, EINA_FALSE);
>  }
>
> Modified: trunk/ephoto/src/bin/ephoto_thumb_browser.c
> ===================================================================
> --- trunk/ephoto/src/bin/ephoto_thumb_browser.c 2010-10-02 22:27:30 UTC (rev 
> 52988)
> +++ trunk/ephoto/src/bin/ephoto_thumb_browser.c 2010-10-03 00:13:02 UTC (rev 
> 52989)
> @@ -198,6 +198,23 @@
>        return tb->layout;
>  }
>
> +static void
> +_ephoto_populate_thumb_browser(Ephoto_Thumb_Browser *tb, const char *file)
> +{
> +        const char *thumb;
> +        ethumb_client_file_set(tb->ec, file, NULL);
> +        if (!ethumb_client_thumb_exists(tb->ec))
> +        {
> +                ethumb_client_generate(tb->ec, _ephoto_thumbnail_generated, 
> tb, NULL);
> +        }
> +        else
> +        {
> +                ethumb_client_thumb_path_get(tb->ec, &thumb, NULL);
> +                _ephoto_thumbnail_generated(tb, tb->ec, 0, file, NULL,
> +                                            thumb, NULL, EINA_TRUE);
> +        }
> +}
> +
>  /*Show the thumbnail browser*/
>  static void
>  _ephoto_show_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
> @@ -244,6 +261,17 @@
>
>         tb->list = NULL;
>         efreet_mime_shutdown();
> +
> +        if (em->config->sort_images)
> +        {
> +                Eina_List *l;
> +                const char *file;
> +                em->images = eina_list_sort(em->images,
> +                                            eina_list_count(em->images),
> +                                            EINA_COMPARE_CB(strcoll));
> +                EINA_LIST_FOREACH(em->images, l, file)
> +                        _ephoto_populate_thumb_browser(tb, file);
> +        }
>  }
>
>  static void
> @@ -261,22 +289,12 @@
>  _ephoto_populate_main(const void *data, const char *file)
>  {
>         Ephoto_Thumb_Browser *tb = (Ephoto_Thumb_Browser*)data;
> -       const char *thumb;
>
>        file = eina_stringshare_ref(file);
>
>        em->images = eina_list_append(em->images, file);
> -       ethumb_client_file_set(tb->ec, file, NULL);
> -       if (!ethumb_client_thumb_exists(tb->ec))
> -       {
> -               ethumb_client_generate(tb->ec, _ephoto_thumbnail_generated, 
> tb, NULL);
> -       }
> -       else
> -       {
> -               ethumb_client_thumb_path_get(tb->ec, &thumb, NULL);
> -               _ephoto_thumbnail_generated(tb, tb->ec, 0, file, NULL,
> -                                           thumb, NULL, EINA_TRUE);
> -       }
> +        if (em->config->sort_images) return;
> +        _ephoto_populate_thumb_browser(tb, file);
>  }
>
>  /* Start a thread to list images in a directory without locking the 
> interface */
>
>
> ------------------------------------------------------------------------------
> Start uncovering the many advantages of virtual appliances
> and start using them to simplify application deployment and
> accelerate your shift to cloud computing.
> http://p.sf.net/sfu/novell-sfdev2dev
> _______________________________________________
> enlightenment-svn mailing list
> enlightenment-...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-svn
>
>



-- 
Cedric BAIL
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to