Ephoto: Add the beginnings of a custom slideshow widget.
This commit is contained in:
parent
b491c6919d
commit
a2f674b21b
|
@ -367,6 +367,33 @@ collections {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
group { name: "ephoto,slideshow,base";
|
||||||
|
parts {
|
||||||
|
rect { "background";
|
||||||
|
scale: 1;
|
||||||
|
description {
|
||||||
|
state: "default" 0.0;
|
||||||
|
color: 0 0 0 255;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rect { "slide_clip";
|
||||||
|
scale: 1;
|
||||||
|
description {
|
||||||
|
state: "default" 0.0;
|
||||||
|
rel1.to: "background";
|
||||||
|
rel2.to: "background";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
swallow { "ephoto.swallow.slideshow";
|
||||||
|
scale: 1;
|
||||||
|
clip_to: "slide_clip";
|
||||||
|
mouse_events: 1;
|
||||||
|
description {
|
||||||
|
state: "default" 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
group { name: "ephoto,image,cropper,base";
|
group { name: "ephoto,image,cropper,base";
|
||||||
script {
|
script {
|
||||||
public message(Msg_Type:type, id, ...) {
|
public message(Msg_Type:type, id, ...) {
|
||||||
|
|
|
@ -5,6 +5,7 @@ typedef struct _Ephoto_Slideshow Ephoto_Slideshow;
|
||||||
struct _Ephoto_Slideshow
|
struct _Ephoto_Slideshow
|
||||||
{
|
{
|
||||||
Ephoto *ephoto;
|
Ephoto *ephoto;
|
||||||
|
Evas_Object *current_image;
|
||||||
Evas_Object *slideshow;
|
Evas_Object *slideshow;
|
||||||
Evas_Object *event;
|
Evas_Object *event;
|
||||||
Evas_Object *notify;
|
Evas_Object *notify;
|
||||||
|
@ -15,17 +16,119 @@ struct _Ephoto_Slideshow
|
||||||
Evas_Object *fullscreen_after;
|
Evas_Object *fullscreen_after;
|
||||||
Ephoto_Entry *entry;
|
Ephoto_Entry *entry;
|
||||||
Eina_Bool playing;
|
Eina_Bool playing;
|
||||||
|
Ecore_Timer *timer;
|
||||||
|
int timeout;
|
||||||
|
int current;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static Evas_Object *_slideshow_item_get(Ephoto_Entry *entry, Evas_Object *parent);
|
||||||
|
static Eina_Bool _slideshow_transition(void *data);
|
||||||
|
static void _slideshow_play(Ephoto_Slideshow *ss);
|
||||||
|
static void _slideshow_pause(Ephoto_Slideshow *ss);
|
||||||
static Evas_Object *_add_icon(Evas_Object *parent, const char *icon,
|
static Evas_Object *_add_icon(Evas_Object *parent, const char *icon,
|
||||||
const char *label, Evas_Object *before);
|
const char *label, Evas_Object *before);
|
||||||
|
|
||||||
|
static void
|
||||||
|
_image_shown(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||||
|
void *event_data EINA_UNUSED)
|
||||||
|
{
|
||||||
|
Ephoto_Entry *entry = data;
|
||||||
|
|
||||||
|
ephoto_title_set(entry->ephoto, entry->basename);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Evas_Object *
|
||||||
|
_slideshow_item_get(Ephoto_Entry *entry, Evas_Object *parent)
|
||||||
|
{
|
||||||
|
const char *group = NULL;
|
||||||
|
const char *ext = strrchr(entry->path, '.');
|
||||||
|
|
||||||
|
if (ext)
|
||||||
|
{
|
||||||
|
ext++;
|
||||||
|
if ((strcasecmp(ext, "edj") == 0))
|
||||||
|
{
|
||||||
|
if (edje_file_group_exists(entry->path, "e/desktop/background"))
|
||||||
|
group = "e/desktop/background";
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Eina_List *g = edje_file_collection_list(entry->path);
|
||||||
|
|
||||||
|
group = eina_list_data_get(g);
|
||||||
|
edje_file_collection_list_free(g);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Evas_Object *image = elm_image_add(parent);
|
||||||
|
elm_image_file_set(image, entry->path, group);
|
||||||
|
elm_image_fill_outside_set(image, EINA_FALSE);
|
||||||
|
evas_object_size_hint_weight_set(image, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
|
evas_object_size_hint_align_set(image, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
evas_object_data_set(image, "entry", entry);
|
||||||
|
evas_object_event_callback_add(image, EVAS_CALLBACK_SHOW, _image_shown,
|
||||||
|
entry);
|
||||||
|
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
_slideshow_transition(void *data)
|
||||||
|
{
|
||||||
|
Ephoto_Slideshow *ss = data;
|
||||||
|
|
||||||
|
if (ss->playing == 0)
|
||||||
|
{
|
||||||
|
if (ss->timer)
|
||||||
|
ecore_timer_del(ss->timer);
|
||||||
|
ss->timer = NULL;
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
if (ss->current_image)
|
||||||
|
{
|
||||||
|
elm_layout_content_unset(ss->slideshow, "ephoto.swallow.slideshow");
|
||||||
|
evas_object_del(ss->current_image);
|
||||||
|
}
|
||||||
|
ss->current += 1;
|
||||||
|
if (!eina_list_nth(ss->entries, ss->current))
|
||||||
|
ss->current = 0;
|
||||||
|
ss->current_image = _slideshow_item_get(eina_list_nth(ss->entries, ss->current),
|
||||||
|
ss->slideshow);
|
||||||
|
elm_layout_content_set(ss->slideshow, "ephoto.swallow.slideshow", ss->current_image);
|
||||||
|
evas_object_show(ss->current_image);
|
||||||
|
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_slideshow_play(Ephoto_Slideshow *ss)
|
||||||
|
{
|
||||||
|
if (!ss->current_image)
|
||||||
|
{
|
||||||
|
if (!eina_list_nth(ss->entries, ss->current))
|
||||||
|
ss->current = 0;
|
||||||
|
ss->current_image = _slideshow_item_get(eina_list_nth(ss->entries, ss->current),
|
||||||
|
ss->slideshow);
|
||||||
|
elm_layout_content_set(ss->slideshow, "ephoto.swallow.slideshow", ss->current_image);
|
||||||
|
evas_object_show(ss->current_image);
|
||||||
|
}
|
||||||
|
if (ss->timer)
|
||||||
|
ecore_timer_del(ss->timer);
|
||||||
|
ss->timer = ecore_timer_add(ss->timeout, _slideshow_transition, ss);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_slideshow_pause(Ephoto_Slideshow *ss)
|
||||||
|
{
|
||||||
|
if (ss->timer)
|
||||||
|
ss->timer = ecore_timer_del(ss->timer);
|
||||||
|
ss->timer = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||||
void *event_info EINA_UNUSED)
|
void *event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Ephoto_Slideshow *ss = data;
|
Ephoto_Slideshow *ss = data;
|
||||||
Elm_Object_Item *slideshow_item;
|
|
||||||
Ephoto_Entry *entry;
|
Ephoto_Entry *entry;
|
||||||
|
|
||||||
elm_layout_content_unset(ss->ephoto->layout, "ephoto.swallow.controls");
|
elm_layout_content_unset(ss->ephoto->layout, "ephoto.swallow.controls");
|
||||||
|
@ -33,9 +136,8 @@ _mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||||
elm_layout_content_set(ss->ephoto->layout, "ephoto.swallow.controls",
|
elm_layout_content_set(ss->ephoto->layout, "ephoto.swallow.controls",
|
||||||
ss->ephoto->statusbar);
|
ss->ephoto->statusbar);
|
||||||
|
|
||||||
slideshow_item = elm_slideshow_item_current_get(ss->slideshow);
|
if (ss->current_image)
|
||||||
if (slideshow_item)
|
entry = evas_object_data_get(ss->current_image, "entry");
|
||||||
entry = elm_object_item_data_get(slideshow_item);
|
|
||||||
else
|
else
|
||||||
entry = ss->entry;
|
entry = ss->entry;
|
||||||
if (ss->event)
|
if (ss->event)
|
||||||
|
@ -44,7 +146,16 @@ _mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||||
ss->event = NULL;
|
ss->event = NULL;
|
||||||
}
|
}
|
||||||
evas_object_smart_callback_call(ss->slideshow, "back", entry);
|
evas_object_smart_callback_call(ss->slideshow, "back", entry);
|
||||||
elm_slideshow_clear(ss->slideshow);
|
if (ss->current_image)
|
||||||
|
{
|
||||||
|
elm_layout_content_unset(ss->slideshow, "ephoto.swallow.slideshow");
|
||||||
|
evas_object_del(ss->current_image);
|
||||||
|
}
|
||||||
|
ss->current_image = NULL;
|
||||||
|
if (ss->timer)
|
||||||
|
ecore_timer_del(ss->timer);
|
||||||
|
ss->timer = NULL;
|
||||||
|
ss->current = 0;
|
||||||
ss->playing = 0;
|
ss->playing = 0;
|
||||||
evas_object_freeze_events_set(ss->slideshow, EINA_TRUE);
|
evas_object_freeze_events_set(ss->slideshow, EINA_TRUE);
|
||||||
}
|
}
|
||||||
|
@ -72,7 +183,6 @@ static void
|
||||||
_back(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
_back(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Ephoto_Slideshow *ss = data;
|
Ephoto_Slideshow *ss = data;
|
||||||
Elm_Object_Item *slideshow_item;
|
|
||||||
Ephoto_Entry *entry;
|
Ephoto_Entry *entry;
|
||||||
|
|
||||||
elm_layout_content_unset(ss->ephoto->layout, "ephoto.swallow.controls");
|
elm_layout_content_unset(ss->ephoto->layout, "ephoto.swallow.controls");
|
||||||
|
@ -80,9 +190,8 @@ _back(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||||
elm_layout_content_set(ss->ephoto->layout, "ephoto.swallow.controls",
|
elm_layout_content_set(ss->ephoto->layout, "ephoto.swallow.controls",
|
||||||
ss->ephoto->statusbar);
|
ss->ephoto->statusbar);
|
||||||
|
|
||||||
slideshow_item = elm_slideshow_item_current_get(ss->slideshow);
|
if (ss->current_image)
|
||||||
if (slideshow_item)
|
entry = evas_object_data_get(ss->current_image, "entry");
|
||||||
entry = elm_object_item_data_get(slideshow_item);
|
|
||||||
else
|
else
|
||||||
entry = ss->entry;
|
entry = ss->entry;
|
||||||
if (ss->event)
|
if (ss->event)
|
||||||
|
@ -91,7 +200,16 @@ _back(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||||
ss->event = NULL;
|
ss->event = NULL;
|
||||||
}
|
}
|
||||||
evas_object_smart_callback_call(ss->slideshow, "back", entry);
|
evas_object_smart_callback_call(ss->slideshow, "back", entry);
|
||||||
elm_slideshow_clear(ss->slideshow);
|
if (ss->current_image)
|
||||||
|
{
|
||||||
|
elm_layout_content_unset(ss->slideshow, "ephoto.swallow.controls");
|
||||||
|
evas_object_del(ss->current_image);
|
||||||
|
}
|
||||||
|
ss->current_image = NULL;
|
||||||
|
if (ss->timer)
|
||||||
|
ecore_timer_del(ss->timer);
|
||||||
|
ss->timer = NULL;
|
||||||
|
ss->current = 0;
|
||||||
ss->playing = 0;
|
ss->playing = 0;
|
||||||
evas_object_freeze_events_set(ss->slideshow, EINA_TRUE);
|
evas_object_freeze_events_set(ss->slideshow, EINA_TRUE);
|
||||||
}
|
}
|
||||||
|
@ -99,13 +217,33 @@ _back(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||||
static void
|
static void
|
||||||
_first(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
_first(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
elm_slideshow_item_show(elm_slideshow_item_nth_get(data, 0));
|
Ephoto_Slideshow *ss = data;
|
||||||
|
|
||||||
|
_slideshow_pause(ss);
|
||||||
|
if (ss->current_image)
|
||||||
|
{
|
||||||
|
elm_layout_content_unset(ss->slideshow, "ephoto.swallow.slideshow");
|
||||||
|
evas_object_del(ss->current_image);
|
||||||
|
ss->current_image = NULL;
|
||||||
|
}
|
||||||
|
ss->current = 0;
|
||||||
|
_slideshow_play(ss);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_next(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
_next(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
elm_slideshow_next(data);
|
Ephoto_Slideshow *ss = data;
|
||||||
|
|
||||||
|
_slideshow_pause(ss);
|
||||||
|
if (ss->current_image)
|
||||||
|
{
|
||||||
|
elm_layout_content_unset(ss->slideshow, "ephoto.swallow.slideshow");
|
||||||
|
evas_object_del(ss->current_image);
|
||||||
|
ss->current_image = NULL;
|
||||||
|
}
|
||||||
|
ss->current += 1;
|
||||||
|
_slideshow_play(ss);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -117,7 +255,7 @@ _pause(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||||
|
|
||||||
if (ss->playing)
|
if (ss->playing)
|
||||||
{
|
{
|
||||||
elm_slideshow_timeout_set(ss->slideshow, 0.0);
|
_slideshow_pause(ss);
|
||||||
ss->pause =
|
ss->pause =
|
||||||
_add_icon(ss->notify, "media-playback-start", _("Play"),
|
_add_icon(ss->notify, "media-playback-start", _("Play"),
|
||||||
ss->pause_after);
|
ss->pause_after);
|
||||||
|
@ -126,8 +264,7 @@ _pause(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
elm_slideshow_timeout_set(ss->slideshow,
|
_slideshow_play(ss);
|
||||||
ss->ephoto->config->slideshow_timeout);
|
|
||||||
ss->pause =
|
ss->pause =
|
||||||
_add_icon(ss->notify, "media-playback-pause", _("Pause"),
|
_add_icon(ss->notify, "media-playback-pause", _("Pause"),
|
||||||
ss->pause_after);
|
ss->pause_after);
|
||||||
|
@ -140,15 +277,33 @@ static void
|
||||||
_previous(void *data, Evas_Object *obj EINA_UNUSED,
|
_previous(void *data, Evas_Object *obj EINA_UNUSED,
|
||||||
void *event_info EINA_UNUSED)
|
void *event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
elm_slideshow_previous(data);
|
Ephoto_Slideshow *ss = data;
|
||||||
|
|
||||||
|
_slideshow_pause(ss);
|
||||||
|
if (ss->current_image)
|
||||||
|
{
|
||||||
|
elm_layout_content_unset(ss->slideshow, "ephoto.swallow.slideshow");
|
||||||
|
evas_object_del(ss->current_image);
|
||||||
|
ss->current_image = NULL;
|
||||||
|
}
|
||||||
|
ss->current -= 1;
|
||||||
|
_slideshow_play(ss);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_last(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
_last(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
unsigned int count = elm_slideshow_count_get(data);
|
Ephoto_Slideshow *ss = data;
|
||||||
|
|
||||||
elm_slideshow_item_show(elm_slideshow_item_nth_get(data, count - 1));
|
_slideshow_pause(ss);
|
||||||
|
if (ss->current_image)
|
||||||
|
{
|
||||||
|
elm_layout_content_unset(ss->slideshow, "ephoto.swallow.slideshow");
|
||||||
|
evas_object_del(ss->current_image);
|
||||||
|
ss->current_image = NULL;
|
||||||
|
}
|
||||||
|
ss->current = eina_list_count(ss->entries) - 1;
|
||||||
|
_slideshow_play(ss);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -216,19 +371,19 @@ _key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||||
}
|
}
|
||||||
else if (!strcmp(k, "Home"))
|
else if (!strcmp(k, "Home"))
|
||||||
{
|
{
|
||||||
_first(ss->slideshow, NULL, NULL);
|
_first(ss, NULL, NULL);
|
||||||
}
|
}
|
||||||
else if (!strcmp(k, "End"))
|
else if (!strcmp(k, "End"))
|
||||||
{
|
{
|
||||||
_last(ss->slideshow, NULL, NULL);
|
_last(ss, NULL, NULL);
|
||||||
}
|
}
|
||||||
else if (!strcmp(k, "Left"))
|
else if (!strcmp(k, "Left"))
|
||||||
{
|
{
|
||||||
_previous(ss->slideshow, NULL, NULL);
|
_previous(ss, NULL, NULL);
|
||||||
}
|
}
|
||||||
else if (!strcmp(k, "Right"))
|
else if (!strcmp(k, "Right"))
|
||||||
{
|
{
|
||||||
_next(ss->slideshow, NULL, NULL);
|
_next(ss, NULL, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,18 +445,18 @@ ephoto_slideshow_show_controls(Ephoto *ephoto)
|
||||||
but = _add_icon(ss->notify, "window-close", _("Back"), NULL);
|
but = _add_icon(ss->notify, "window-close", _("Back"), NULL);
|
||||||
evas_object_smart_callback_add(but, "clicked", _back, ss);
|
evas_object_smart_callback_add(but, "clicked", _back, ss);
|
||||||
but = _add_icon(ss->notify, "go-first", _("First"), NULL);
|
but = _add_icon(ss->notify, "go-first", _("First"), NULL);
|
||||||
evas_object_smart_callback_add(but, "clicked", _first, ss->slideshow);
|
evas_object_smart_callback_add(but, "clicked", _first, ss);
|
||||||
but = _add_icon(ss->notify, "go-previous", _("Previous"), NULL);
|
but = _add_icon(ss->notify, "go-previous", _("Previous"), NULL);
|
||||||
evas_object_smart_callback_add(but, "clicked", _previous, ss->slideshow);
|
evas_object_smart_callback_add(but, "clicked", _previous, ss);
|
||||||
ss->pause =
|
ss->pause =
|
||||||
_add_icon(ss->notify, "media-playback-start", _("Play"), NULL);
|
_add_icon(ss->notify, "media-playback-start", _("Play"), NULL);
|
||||||
evas_object_smart_callback_add(ss->pause, "clicked", _pause, ss);
|
evas_object_smart_callback_add(ss->pause, "clicked", _pause, ss);
|
||||||
ss->pause_after =
|
ss->pause_after =
|
||||||
_add_icon(ss->notify, "go-next", _("Next"), NULL);
|
_add_icon(ss->notify, "go-next", _("Next"), NULL);
|
||||||
evas_object_smart_callback_add(ss->pause_after, "clicked", _next,
|
evas_object_smart_callback_add(ss->pause_after, "clicked", _next,
|
||||||
ss->slideshow);
|
ss);
|
||||||
but = _add_icon(ss->notify, "go-last", _("Last"), NULL);
|
but = _add_icon(ss->notify, "go-last", _("Last"), NULL);
|
||||||
evas_object_smart_callback_add(but, "clicked", _last, ss->slideshow);
|
evas_object_smart_callback_add(but, "clicked", _last, ss);
|
||||||
ss->fullscreen =
|
ss->fullscreen =
|
||||||
_add_icon(ss->notify, "view-fullscreen", _("Fullscreen"), NULL);
|
_add_icon(ss->notify, "view-fullscreen", _("Fullscreen"), NULL);
|
||||||
evas_object_smart_callback_add(ss->fullscreen, "clicked", _fullscreen, ss);
|
evas_object_smart_callback_add(ss->fullscreen, "clicked", _fullscreen, ss);
|
||||||
|
@ -315,7 +470,7 @@ ephoto_slideshow_show_controls(Ephoto *ephoto)
|
||||||
Evas_Object *
|
Evas_Object *
|
||||||
ephoto_slideshow_add(Ephoto *ephoto, Evas_Object *parent)
|
ephoto_slideshow_add(Ephoto *ephoto, Evas_Object *parent)
|
||||||
{
|
{
|
||||||
Evas_Object *slideshow = elm_slideshow_add(parent);
|
Evas_Object *slideshow = elm_layout_add(parent);
|
||||||
Ephoto_Slideshow *ss;
|
Ephoto_Slideshow *ss;
|
||||||
|
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(slideshow, NULL);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(slideshow, NULL);
|
||||||
|
@ -325,8 +480,12 @@ ephoto_slideshow_add(Ephoto *ephoto, Evas_Object *parent)
|
||||||
ss->ephoto = ephoto;
|
ss->ephoto = ephoto;
|
||||||
ss->slideshow = slideshow;
|
ss->slideshow = slideshow;
|
||||||
ss->playing = 0;
|
ss->playing = 0;
|
||||||
|
ss->current = 0;
|
||||||
|
ss->current_image = NULL;
|
||||||
ss->event = NULL;
|
ss->event = NULL;
|
||||||
|
|
||||||
|
elm_layout_file_set(slideshow, PACKAGE_DATA_DIR "/themes/ephoto.edj",
|
||||||
|
"ephoto,slideshow,base");
|
||||||
evas_object_event_callback_add(slideshow, EVAS_CALLBACK_DEL, _slideshow_del,
|
evas_object_event_callback_add(slideshow, EVAS_CALLBACK_DEL, _slideshow_del,
|
||||||
ss);
|
ss);
|
||||||
evas_object_event_callback_add(slideshow, EVAS_CALLBACK_MOUSE_DOWN,
|
evas_object_event_callback_add(slideshow, EVAS_CALLBACK_MOUSE_DOWN,
|
||||||
|
@ -335,12 +494,9 @@ ephoto_slideshow_add(Ephoto *ephoto, Evas_Object *parent)
|
||||||
_main_focused, ss);
|
_main_focused, ss);
|
||||||
evas_object_data_set(slideshow, "slideshow", ss);
|
evas_object_data_set(slideshow, "slideshow", ss);
|
||||||
elm_object_tree_focus_allow_set(slideshow, EINA_FALSE);
|
elm_object_tree_focus_allow_set(slideshow, EINA_FALSE);
|
||||||
elm_slideshow_loop_set(slideshow, EINA_TRUE);
|
|
||||||
elm_slideshow_layout_set(slideshow, "fullscreen");
|
|
||||||
evas_object_size_hint_weight_set(slideshow, EVAS_HINT_EXPAND,
|
evas_object_size_hint_weight_set(slideshow, EVAS_HINT_EXPAND,
|
||||||
EVAS_HINT_EXPAND);
|
EVAS_HINT_EXPAND);
|
||||||
evas_object_size_hint_align_set(slideshow, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
evas_object_size_hint_align_set(slideshow, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
|
||||||
evas_object_freeze_events_set(ss->slideshow, EINA_TRUE);
|
evas_object_freeze_events_set(ss->slideshow, EINA_TRUE);
|
||||||
|
|
||||||
return ss->slideshow;
|
return ss->slideshow;
|
||||||
|
@ -350,50 +506,6 @@ ephoto_slideshow_add(Ephoto *ephoto, Evas_Object *parent)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
_image_shown(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
|
||||||
void *event_data EINA_UNUSED)
|
|
||||||
{
|
|
||||||
Ephoto_Entry *entry = data;
|
|
||||||
|
|
||||||
ephoto_title_set(entry->ephoto, entry->basename);
|
|
||||||
}
|
|
||||||
|
|
||||||
static Evas_Object *
|
|
||||||
_slideshow_item_get(void *data, Evas_Object *obj)
|
|
||||||
{
|
|
||||||
Ephoto_Entry *entry = data;
|
|
||||||
|
|
||||||
const char *group = NULL;
|
|
||||||
const char *ext = strrchr(entry->path, '.');
|
|
||||||
|
|
||||||
if (ext)
|
|
||||||
{
|
|
||||||
ext++;
|
|
||||||
if ((strcasecmp(ext, "edj") == 0))
|
|
||||||
{
|
|
||||||
if (edje_file_group_exists(entry->path, "e/desktop/background"))
|
|
||||||
group = "e/desktop/background";
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Eina_List *g = edje_file_collection_list(entry->path);
|
|
||||||
|
|
||||||
group = eina_list_data_get(g);
|
|
||||||
edje_file_collection_list_free(g);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Evas_Object *image = elm_image_add(obj);
|
|
||||||
elm_image_file_set(image, entry->path, group);
|
|
||||||
evas_object_event_callback_add(image, EVAS_CALLBACK_SHOW, _image_shown,
|
|
||||||
entry);
|
|
||||||
|
|
||||||
return image;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Elm_Slideshow_Item_Class _item_cls =
|
|
||||||
{ {_slideshow_item_get, NULL} };
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ephoto_slideshow_entries_set(Evas_Object *obj, Eina_List *entries)
|
ephoto_slideshow_entries_set(Evas_Object *obj, Eina_List *entries)
|
||||||
{
|
{
|
||||||
|
@ -407,25 +519,21 @@ void
|
||||||
ephoto_slideshow_entry_set(Evas_Object *obj, Ephoto_Entry *entry)
|
ephoto_slideshow_entry_set(Evas_Object *obj, Ephoto_Entry *entry)
|
||||||
{
|
{
|
||||||
Ephoto_Slideshow *ss = evas_object_data_get(obj, "slideshow");
|
Ephoto_Slideshow *ss = evas_object_data_get(obj, "slideshow");
|
||||||
Ephoto_Entry *itr;
|
|
||||||
const Eina_List *l;
|
if (!entry)
|
||||||
|
return;
|
||||||
|
|
||||||
if (ss->entry)
|
if (ss->entry)
|
||||||
ephoto_entry_free_listener_del(ss->entry, _entry_free, ss);
|
ephoto_entry_free_listener_del(ss->entry, _entry_free, ss);
|
||||||
|
|
||||||
ss->entry = entry;
|
ss->entry = entry;
|
||||||
|
ss->current = eina_list_data_idx(ss->entries, ss->entry);
|
||||||
|
|
||||||
if (entry)
|
if (entry)
|
||||||
ephoto_entry_free_listener_add(entry, _entry_free, ss);
|
ephoto_entry_free_listener_add(entry, _entry_free, ss);
|
||||||
|
|
||||||
elm_slideshow_loop_set(ss->slideshow, EINA_TRUE);
|
ss->timeout = ss->ephoto->config->slideshow_timeout;
|
||||||
elm_slideshow_transition_set(ss->slideshow,
|
_slideshow_play(ss);
|
||||||
ss->ephoto->config->slideshow_transition);
|
|
||||||
elm_slideshow_timeout_set(ss->slideshow,
|
|
||||||
ss->ephoto->config->slideshow_timeout);
|
|
||||||
elm_slideshow_clear(ss->slideshow);
|
|
||||||
if (!entry)
|
|
||||||
return;
|
|
||||||
|
|
||||||
evas_object_freeze_events_set(ss->slideshow, EINA_FALSE);
|
evas_object_freeze_events_set(ss->slideshow, EINA_FALSE);
|
||||||
|
|
||||||
|
@ -458,16 +566,6 @@ ephoto_slideshow_entry_set(Evas_Object *obj, Ephoto_Entry *entry)
|
||||||
_fullscreen, ss);
|
_fullscreen, ss);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EINA_LIST_FOREACH(ss->entries, l, itr)
|
|
||||||
{
|
|
||||||
Elm_Object_Item *slideshow_item;
|
|
||||||
|
|
||||||
slideshow_item = elm_slideshow_item_add(ss->slideshow,
|
|
||||||
&_item_cls, itr);
|
|
||||||
if (itr == entry)
|
|
||||||
elm_slideshow_item_show(slideshow_item);
|
|
||||||
}
|
|
||||||
if (ss->event)
|
if (ss->event)
|
||||||
{
|
{
|
||||||
evas_object_del(ss->event);
|
evas_object_del(ss->event);
|
||||||
|
|
Loading…
Reference in New Issue