add an option to sort the images before displaying them.
SVN revision: 52989
This commit is contained in:
parent
1c512b83f8
commit
1a73a71d36
|
@ -91,6 +91,8 @@ struct _Ephoto_Config
|
||||||
const char *slideshow_transition;
|
const char *slideshow_transition;
|
||||||
|
|
||||||
const char *editor;
|
const char *editor;
|
||||||
|
|
||||||
|
int sort_images;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*Ephoto Main Structure*/
|
/*Ephoto Main Structure*/
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "ephoto.h"
|
#include "ephoto.h"
|
||||||
|
|
||||||
#define CONFIG_VERSION 3
|
#define CONFIG_VERSION 4
|
||||||
|
|
||||||
static int _ephoto_config_load(Ephoto *em);
|
static int _ephoto_config_load(Ephoto *em);
|
||||||
static Eina_Bool _ephoto_on_config_save(void *data);
|
static Eina_Bool _ephoto_on_config_save(void *data);
|
||||||
|
@ -29,6 +29,7 @@ ephoto_config_init(Ephoto *em)
|
||||||
C_VAL(D, T, slideshow_timeout, EET_T_DOUBLE);
|
C_VAL(D, T, slideshow_timeout, EET_T_DOUBLE);
|
||||||
C_VAL(D, T, slideshow_transition, EET_T_STRING);
|
C_VAL(D, T, slideshow_transition, EET_T_STRING);
|
||||||
C_VAL(D, T, editor, 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))
|
switch (_ephoto_config_load(em))
|
||||||
{
|
{
|
||||||
|
@ -42,6 +43,7 @@ ephoto_config_init(Ephoto *em)
|
||||||
eina_stringshare_add("fade");
|
eina_stringshare_add("fade");
|
||||||
em->config->editor =
|
em->config->editor =
|
||||||
eina_stringshare_add("gimp %s");
|
eina_stringshare_add("gimp %s");
|
||||||
|
em->config->sort_images = 1;
|
||||||
break;
|
break;
|
||||||
case -1:
|
case -1:
|
||||||
if (em->config->config_version < 2)
|
if (em->config->config_version < 2)
|
||||||
|
@ -54,6 +56,8 @@ ephoto_config_init(Ephoto *em)
|
||||||
if (em->config->config_version < 3)
|
if (em->config->config_version < 3)
|
||||||
em->config->editor =
|
em->config->editor =
|
||||||
eina_stringshare_add("gimp %s");
|
eina_stringshare_add("gimp %s");
|
||||||
|
if (em->config->config_version < 4)
|
||||||
|
em->config->sort_images = 1;
|
||||||
|
|
||||||
/* Incremental additions */
|
/* Incremental additions */
|
||||||
em->config->config_version = CONFIG_VERSION;
|
em->config->config_version = CONFIG_VERSION;
|
||||||
|
|
|
@ -56,6 +56,15 @@ ephoto_show_preferences(Ephoto *em)
|
||||||
elm_box_pack_end(pg1, o);
|
elm_box_pack_end(pg1, o);
|
||||||
evas_object_show(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);
|
elm_box_pack_end(box, pager);
|
||||||
evas_object_show(pager);
|
evas_object_show(pager);
|
||||||
|
|
||||||
|
@ -170,6 +179,8 @@ _ephoto_preferences_item_change(void *data, Evas_Object *obj, void *event_info)
|
||||||
eina_stringshare_replace(
|
eina_stringshare_replace(
|
||||||
&em->config->editor,
|
&em->config->editor,
|
||||||
eina_stringshare_add(elm_entry_entry_get(obj)));
|
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);
|
ephoto_config_save(em, EINA_FALSE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,6 +198,23 @@ ephoto_create_thumb_browser(Evas_Object *parent)
|
||||||
return tb->layout;
|
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*/
|
/*Show the thumbnail browser*/
|
||||||
static void
|
static void
|
||||||
_ephoto_show_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
_ephoto_show_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
|
@ -244,6 +261,17 @@ _ephoto_populate_end(const void *data)
|
||||||
|
|
||||||
tb->list = NULL;
|
tb->list = NULL;
|
||||||
efreet_mime_shutdown();
|
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
|
static void
|
||||||
|
@ -261,22 +289,12 @@ static void
|
||||||
_ephoto_populate_main(const void *data, const char *file)
|
_ephoto_populate_main(const void *data, const char *file)
|
||||||
{
|
{
|
||||||
Ephoto_Thumb_Browser *tb = (Ephoto_Thumb_Browser*)data;
|
Ephoto_Thumb_Browser *tb = (Ephoto_Thumb_Browser*)data;
|
||||||
const char *thumb;
|
|
||||||
|
|
||||||
file = eina_stringshare_ref(file);
|
file = eina_stringshare_ref(file);
|
||||||
|
|
||||||
em->images = eina_list_append(em->images, file);
|
em->images = eina_list_append(em->images, file);
|
||||||
ethumb_client_file_set(tb->ec, file, NULL);
|
if (em->config->sort_images) return;
|
||||||
if (!ethumb_client_thumb_exists(tb->ec))
|
_ephoto_populate_thumb_browser(tb, file);
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Start a thread to list images in a directory without locking the interface */
|
/* Start a thread to list images in a directory without locking the interface */
|
||||||
|
|
Loading…
Reference in New Issue