Use evas_smart objects for flow and thumb browsers, we can now use them as regular evas smart objects with evas_object_show/del/hide ...
SVN revision: 52192
This commit is contained in:
parent
a13304ff1d
commit
ea18ee503b
|
@ -14,6 +14,7 @@ collections
|
||||||
name: "/ephoto/thumb";
|
name: "/ephoto/thumb";
|
||||||
parts
|
parts
|
||||||
{
|
{
|
||||||
|
|
||||||
part
|
part
|
||||||
{
|
{
|
||||||
name: "background";
|
name: "background";
|
||||||
|
@ -24,9 +25,24 @@ collections
|
||||||
state: "default" 0.0;
|
state: "default" 0.0;
|
||||||
color: 255 255 255 255;
|
color: 255 255 255 255;
|
||||||
image.normal: "thumb_shadow.png";
|
image.normal: "thumb_shadow.png";
|
||||||
image.border: 12 12 7 13;
|
image.border: 17 17 17 17;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
part
|
||||||
|
{
|
||||||
|
name: "border";
|
||||||
|
type: RECT;
|
||||||
|
mouse_events: 0;
|
||||||
|
description
|
||||||
|
{
|
||||||
|
state: "default" 0.0;
|
||||||
|
color: 255 255 255 255;
|
||||||
|
rel1.to: "background";
|
||||||
|
rel1.offset: 16 16;
|
||||||
|
rel2.to: "background";
|
||||||
|
rel2.offset: -15 -15;
|
||||||
|
}
|
||||||
|
}
|
||||||
part
|
part
|
||||||
{
|
{
|
||||||
name: "clipper";
|
name: "clipper";
|
||||||
|
@ -36,10 +52,10 @@ collections
|
||||||
{
|
{
|
||||||
state: "default" 0.0;
|
state: "default" 0.0;
|
||||||
visible: 1;
|
visible: 1;
|
||||||
rel1.to: "background";
|
rel1.to: "border";
|
||||||
rel1.offset: 12 7;
|
rel1.offset: 8 8;
|
||||||
rel2.to: "background";
|
rel2.to: "border";
|
||||||
rel2.offset: -13 -14;
|
rel2.offset: -9 -9;
|
||||||
color: 255 255 255 255;
|
color: 255 255 255 255;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -375,10 +391,31 @@ collections
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
group
|
group
|
||||||
{
|
{
|
||||||
name: "ephoto/main/layout";
|
name: "ephoto/main/layout";
|
||||||
parts {
|
parts {
|
||||||
|
part {
|
||||||
|
name: "ephoto.content.swallow";
|
||||||
|
type: SWALLOW;
|
||||||
|
description {
|
||||||
|
state: "default" 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
group
|
||||||
|
{
|
||||||
|
name: "ephoto/browser/layout";
|
||||||
|
parts {
|
||||||
|
part {
|
||||||
|
name: "bg";
|
||||||
|
type: RECT;
|
||||||
|
description {
|
||||||
|
state: "default" 0.0;
|
||||||
|
color: 10 10 10 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
part {
|
part {
|
||||||
name: "ephoto.thumb.swallow";
|
name: "ephoto.thumb.swallow";
|
||||||
type: SWALLOW;
|
type: SWALLOW;
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 781 B After Width: | Height: | Size: 1.1 KiB |
|
@ -26,10 +26,12 @@
|
||||||
void ephoto_create_main_window(const char *directory, const char *image);
|
void ephoto_create_main_window(const char *directory, const char *image);
|
||||||
|
|
||||||
/*Ephoto Flow Browser*/
|
/*Ephoto Flow Browser*/
|
||||||
void ephoto_create_flow_browser(void);
|
Evas_Object *ephoto_create_flow_browser(Evas_Object *parent);
|
||||||
void ephoto_show_flow_browser(const char *current_image);
|
void ephoto_flow_browser_image_set(Evas_Object *obj, const char *current_image);
|
||||||
void ephoto_hide_flow_browser(void);
|
/* smart callbacks called:
|
||||||
void ephoto_delete_flow_browser(void);
|
* "delete,request" - the user requested to delete the flow browser, typically called when go_back button is pressed or Escape key is typed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*Ephoto Slideshow*/
|
/*Ephoto Slideshow*/
|
||||||
void ephoto_create_slideshow(void);
|
void ephoto_create_slideshow(void);
|
||||||
|
@ -38,11 +40,21 @@ void ephoto_hide_slideshow(void);
|
||||||
void ephoto_delete_slideshow(void);
|
void ephoto_delete_slideshow(void);
|
||||||
|
|
||||||
/*Ephoto Thumb Browser*/
|
/*Ephoto Thumb Browser*/
|
||||||
void ephoto_create_thumb_browser(const char *directory);
|
Evas_Object *ephoto_create_thumb_browser(Evas_Object *parent, const char *directory);
|
||||||
void ephoto_show_thumb_browser(void);
|
void ephoto_populate_thumbnails(Evas_Object *obj);
|
||||||
void ephoto_hide_thumb_browser(void);
|
/* smart callbacks called:
|
||||||
void ephoto_delete_thumb_browser(void);
|
* "selected" - an item in the thumb browser is selected. The selected file is passed as event_info argument.
|
||||||
void ephoto_populate_thumbnails(void);
|
*/
|
||||||
|
|
||||||
|
typedef enum _Ephoto_State Ephoto_State;
|
||||||
|
|
||||||
|
/* Enum for the state machine */
|
||||||
|
enum _Ephoto_State
|
||||||
|
{
|
||||||
|
EPHOTO_STATE_THUMB,
|
||||||
|
EPHOTO_STATE_FLOW,
|
||||||
|
EPHOTO_STATE_SLIDESHOW
|
||||||
|
};
|
||||||
|
|
||||||
/*Ephoto Main Structure*/
|
/*Ephoto Main Structure*/
|
||||||
struct _Ephoto
|
struct _Ephoto
|
||||||
|
@ -50,14 +62,15 @@ struct _Ephoto
|
||||||
Evas *e;
|
Evas *e;
|
||||||
Evas_Object *win;
|
Evas_Object *win;
|
||||||
Evas_Object *bg;
|
Evas_Object *bg;
|
||||||
Evas_Object *box;
|
|
||||||
Evas_Object *layout;
|
Evas_Object *layout;
|
||||||
Evas_Object *flow_browser;
|
Evas_Object *flow_browser;
|
||||||
Evas_Object *slideshow;
|
Evas_Object *slideshow;
|
||||||
Evas_Object *thumb_browser;
|
Evas_Object *thumb_browser;
|
||||||
Eina_List *images;
|
Eina_List *images;
|
||||||
|
Ephoto_State state;
|
||||||
};
|
};
|
||||||
typedef struct _Ephoto Ephoto;
|
typedef struct _Ephoto Ephoto;
|
||||||
|
|
||||||
extern Ephoto *em;
|
extern Ephoto *em;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -8,11 +8,20 @@ static void _ephoto_go_next(void *data, Evas_Object *obj, void *event_info);
|
||||||
static void _ephoto_go_previous(void *data, Evas_Object *obj, void *event_info);
|
static void _ephoto_go_previous(void *data, Evas_Object *obj, void *event_info);
|
||||||
static void _ephoto_go_slideshow(void *data, Evas_Object *obj, void *event_info);
|
static void _ephoto_go_slideshow(void *data, Evas_Object *obj, void *event_info);
|
||||||
static void _ephoto_key_pressed(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
static void _ephoto_key_pressed(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||||
|
static void _ephoto_flow_browser_show_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||||
|
static void _ephoto_flow_browser_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||||
|
|
||||||
/*Inline variables*/
|
typedef struct _Ephoto_Flow_Browser Ephoto_Flow_Browser;
|
||||||
static Eina_List *iter;
|
|
||||||
static Evas_Object *image, *image2, *toolbar;
|
struct _Ephoto_Flow_Browser
|
||||||
static const char *cur_image;
|
{
|
||||||
|
Evas_Object *flow_browser;
|
||||||
|
Eina_List *iter;
|
||||||
|
Evas_Object *image;
|
||||||
|
Evas_Object *image2;
|
||||||
|
Evas_Object *toolbar;
|
||||||
|
const char *cur_image;
|
||||||
|
};
|
||||||
|
|
||||||
static const char *toolbar_items[] = {
|
static const char *toolbar_items[] = {
|
||||||
"First",
|
"First",
|
||||||
|
@ -35,7 +44,7 @@ _ephoto_set_title(const char *file)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ephoto_go_update(void)
|
_ephoto_go_update(Ephoto_Flow_Browser *ef)
|
||||||
{
|
{
|
||||||
const char *file_type;
|
const char *file_type;
|
||||||
char *buffer;
|
char *buffer;
|
||||||
|
@ -43,157 +52,163 @@ _ephoto_go_update(void)
|
||||||
|
|
||||||
efreet_mime_init();
|
efreet_mime_init();
|
||||||
|
|
||||||
elm_layout_content_unset(em->flow_browser, "ephoto.flow.swallow");
|
elm_layout_content_unset(ef->flow_browser, "ephoto.flow.swallow");
|
||||||
|
|
||||||
evas_object_hide(image);
|
evas_object_hide(ef->image);
|
||||||
evas_object_hide(image2);
|
evas_object_hide(ef->image2);
|
||||||
|
|
||||||
file_type = efreet_mime_type_get(cur_image);
|
file_type = efreet_mime_type_get(ef->cur_image);
|
||||||
if (file_type && !strcmp(file_type, "image/jpeg"))
|
if (file_type && !strcmp(file_type, "image/jpeg"))
|
||||||
{
|
{
|
||||||
elm_photocam_file_set(image, cur_image);
|
elm_photocam_file_set(ef->image, ef->cur_image);
|
||||||
elm_layout_content_set(em->flow_browser, "ephoto.flow.swallow", image);
|
elm_layout_content_set(ef->flow_browser, "ephoto.flow.swallow", ef->image);
|
||||||
evas_object_show(image);
|
evas_object_show(ef->image);
|
||||||
} else {
|
} else {
|
||||||
elm_image_file_set(image2, cur_image, NULL);
|
elm_image_file_set(ef->image2, ef->cur_image, NULL);
|
||||||
elm_layout_content_set(em->flow_browser, "ephoto.flow.swallow", image2);
|
elm_layout_content_set(ef->flow_browser, "ephoto.flow.swallow", ef->image2);
|
||||||
evas_object_show(image2);
|
evas_object_show(ef->image2);
|
||||||
}
|
}
|
||||||
|
|
||||||
elm_toolbar_item_unselect_all(toolbar);
|
elm_toolbar_item_unselect_all(ef->toolbar);
|
||||||
|
|
||||||
efreet_mime_shutdown();
|
efreet_mime_shutdown();
|
||||||
|
|
||||||
length = strlen(cur_image) + strlen("Ephoto - ") + 1;
|
length = strlen(ef->cur_image) + strlen("Ephoto - ") + 1;
|
||||||
buffer = alloca(length);
|
buffer = alloca(length);
|
||||||
snprintf(buffer, length, "Ephoto - %s", cur_image);
|
snprintf(buffer, length, "Ephoto - %s", ef->cur_image);
|
||||||
elm_win_title_set(em->win, buffer);
|
elm_win_title_set(em->win, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Create the flow browser*/
|
/*Create the flow browser*/
|
||||||
void
|
Evas_Object *
|
||||||
ephoto_create_flow_browser(void)
|
ephoto_create_flow_browser(Evas_Object *parent)
|
||||||
{
|
{
|
||||||
Evas_Object *o;
|
Evas_Object *o;
|
||||||
|
Ephoto_Flow_Browser *ef;
|
||||||
|
|
||||||
em->flow_browser = elm_layout_add(em->win);
|
ef = calloc(1, sizeof(Ephoto_Flow_Browser));
|
||||||
elm_layout_file_set(em->flow_browser,
|
|
||||||
|
ef->flow_browser = elm_layout_add(parent);
|
||||||
|
elm_layout_file_set(ef->flow_browser,
|
||||||
PACKAGE_DATA_DIR "/themes/default/ephoto.edj",
|
PACKAGE_DATA_DIR "/themes/default/ephoto.edj",
|
||||||
"ephoto/flow/layout");
|
"ephoto/flow/layout");
|
||||||
elm_win_resize_object_add(em->win, em->flow_browser);
|
// elm_win_resize_object_add(em->win, em->flow_browser);
|
||||||
evas_object_size_hint_weight_set(em->flow_browser, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
evas_object_size_hint_weight_set(ef->flow_browser, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
evas_object_size_hint_align_set(em->flow_browser, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
evas_object_size_hint_align_set(ef->flow_browser, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
|
||||||
image = elm_photocam_add(em->win);
|
ef->image = elm_photocam_add(ef->flow_browser);
|
||||||
elm_photocam_zoom_mode_set(image, ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT);
|
elm_photocam_zoom_mode_set(ef->image, ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT);
|
||||||
evas_object_size_hint_weight_set(image, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
evas_object_size_hint_weight_set(ef->image, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
evas_object_size_hint_align_set(image, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
evas_object_size_hint_align_set(ef->image, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
|
||||||
image2 = elm_image_add(em->win);
|
ef->image2 = elm_image_add(ef->flow_browser);
|
||||||
elm_image_smooth_set(image2, EINA_TRUE);
|
elm_image_smooth_set(ef->image2, EINA_TRUE);
|
||||||
evas_object_size_hint_weight_set(image2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
evas_object_size_hint_weight_set(ef->image2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
evas_object_size_hint_align_set(image2, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
evas_object_size_hint_align_set(ef->image2, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
|
||||||
toolbar = elm_toolbar_add(em->win);
|
ef->toolbar = elm_toolbar_add(ef->flow_browser);
|
||||||
elm_toolbar_icon_size_set(toolbar, 24);
|
elm_toolbar_icon_size_set(ef->toolbar, 24);
|
||||||
elm_toolbar_homogenous_set(toolbar, EINA_TRUE);
|
elm_toolbar_homogenous_set(ef->toolbar, EINA_TRUE);
|
||||||
evas_object_size_hint_weight_set(toolbar, EVAS_HINT_EXPAND, 0.0);
|
evas_object_size_hint_weight_set(ef->toolbar, EVAS_HINT_EXPAND, 0.0);
|
||||||
evas_object_size_hint_align_set(toolbar, EVAS_HINT_FILL, 0.5);
|
evas_object_size_hint_align_set(ef->toolbar, EVAS_HINT_FILL, 0.5);
|
||||||
elm_layout_content_set(em->flow_browser, "ephoto.flow.swallow", toolbar);
|
elm_layout_content_set(ef->flow_browser, "ephoto.flow.swallow", ef->toolbar);
|
||||||
evas_object_show(toolbar);
|
evas_object_show(ef->toolbar);
|
||||||
|
|
||||||
o = elm_icon_add(em->win);
|
o = elm_icon_add(ef->toolbar);
|
||||||
elm_icon_file_set(o, PACKAGE_DATA_DIR "/images/go_back.png", NULL);
|
elm_icon_file_set(o, PACKAGE_DATA_DIR "/images/go_back.png", NULL);
|
||||||
elm_toolbar_item_add(toolbar, o, "Go Back", _ephoto_go_back, NULL);
|
elm_toolbar_item_add(ef->toolbar, o, "Go Back", _ephoto_go_back, ef);
|
||||||
|
|
||||||
o = elm_icon_add(em->win);
|
o = elm_icon_add(ef->toolbar);
|
||||||
elm_icon_file_set(o, PACKAGE_DATA_DIR "/images/first.png", NULL);
|
elm_icon_file_set(o, PACKAGE_DATA_DIR "/images/first.png", NULL);
|
||||||
elm_toolbar_item_add(toolbar, o, "First", _ephoto_go_first, NULL);
|
elm_toolbar_item_add(ef->toolbar, o, "First", _ephoto_go_first, ef);
|
||||||
|
|
||||||
o = elm_icon_add(em->win);
|
o = elm_icon_add(ef->toolbar);
|
||||||
elm_icon_file_set(o, PACKAGE_DATA_DIR "/images/previous.png", NULL);
|
elm_icon_file_set(o, PACKAGE_DATA_DIR "/images/previous.png", NULL);
|
||||||
elm_toolbar_item_add(toolbar, o, "Previous", _ephoto_go_previous, NULL);
|
elm_toolbar_item_add(ef->toolbar, o, "Previous", _ephoto_go_previous, ef);
|
||||||
|
|
||||||
o = elm_icon_add(em->win);
|
o = elm_icon_add(ef->toolbar);
|
||||||
elm_icon_file_set(o, PACKAGE_DATA_DIR "/images/next.png", NULL);
|
elm_icon_file_set(o, PACKAGE_DATA_DIR "/images/next.png", NULL);
|
||||||
elm_toolbar_item_add(toolbar, o, "Next", _ephoto_go_next, NULL);
|
elm_toolbar_item_add(ef->toolbar, o, "Next", _ephoto_go_next, ef);
|
||||||
|
|
||||||
o = elm_icon_add(em->win);
|
o = elm_icon_add(ef->toolbar);
|
||||||
elm_icon_file_set(o, PACKAGE_DATA_DIR "/images/last.png", NULL);
|
elm_icon_file_set(o, PACKAGE_DATA_DIR "/images/last.png", NULL);
|
||||||
elm_toolbar_item_add(toolbar, o, "Last", _ephoto_go_last, NULL);
|
elm_toolbar_item_add(ef->toolbar, o, "Last", _ephoto_go_last, ef);
|
||||||
|
|
||||||
o = elm_icon_add(em->win);
|
o = elm_icon_add(ef->toolbar);
|
||||||
elm_icon_file_set(o, PACKAGE_DATA_DIR "/images/play_slideshow.png", NULL);
|
elm_icon_file_set(o, PACKAGE_DATA_DIR "/images/play_slideshow.png", NULL);
|
||||||
elm_toolbar_item_add(toolbar, o, "Slideshow", _ephoto_go_slideshow, NULL);
|
elm_toolbar_item_add(ef->toolbar, o, "Slideshow", _ephoto_go_slideshow, ef);
|
||||||
|
|
||||||
|
|
||||||
|
evas_object_event_callback_add(ef->flow_browser, EVAS_CALLBACK_SHOW,
|
||||||
|
_ephoto_flow_browser_show_cb, ef);
|
||||||
|
evas_object_event_callback_add(ef->flow_browser, EVAS_CALLBACK_DEL,
|
||||||
|
_ephoto_flow_browser_del_cb, ef);
|
||||||
|
evas_object_data_set(ef->flow_browser, "flow_browser", ef);
|
||||||
|
|
||||||
|
return ef->flow_browser;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Show the flow browser*/
|
/*Show the flow browser*/
|
||||||
|
|
||||||
void
|
void
|
||||||
ephoto_show_flow_browser(const char *current_image)
|
ephoto_flow_browser_image_set(Evas_Object *obj, const char *current_image)
|
||||||
{
|
{
|
||||||
|
Ephoto_Flow_Browser *ef;
|
||||||
const char *file_type;
|
const char *file_type;
|
||||||
Elm_Toolbar_Item *o;
|
Elm_Toolbar_Item *o;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
ef = evas_object_data_get(obj, "flow_browser");
|
||||||
|
|
||||||
if (current_image)
|
if (current_image)
|
||||||
{
|
{
|
||||||
cur_image = current_image;
|
ef->cur_image = current_image;
|
||||||
|
|
||||||
evas_object_event_callback_add(em->flow_browser, EVAS_CALLBACK_KEY_UP,
|
evas_object_event_callback_add(ef->flow_browser, EVAS_CALLBACK_KEY_UP,
|
||||||
_ephoto_key_pressed, NULL);
|
_ephoto_key_pressed, ef);
|
||||||
|
|
||||||
iter = eina_list_data_find_list(em->images, current_image);
|
ef->iter = eina_list_data_find_list(em->images, current_image);
|
||||||
for (i = 0; i < (sizeof (toolbar_items) / sizeof (char*)); ++i)
|
for (i = 0; i < (sizeof (toolbar_items) / sizeof (char*)); ++i)
|
||||||
{
|
{
|
||||||
o = elm_toolbar_item_find_by_label(toolbar, toolbar_items[i]);
|
o = elm_toolbar_item_find_by_label(ef->toolbar, toolbar_items[i]);
|
||||||
elm_toolbar_item_disabled_set(o, !iter ? EINA_TRUE : EINA_FALSE);
|
elm_toolbar_item_disabled_set(o, !ef->iter ? EINA_TRUE : EINA_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "iter: %p\n", iter);
|
fprintf(stderr, "iter: %p\n", ef->iter);
|
||||||
|
|
||||||
_ephoto_go_update();
|
_ephoto_go_update(ef);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (i = 0; i < (sizeof (toolbar_items) / sizeof (char*)); ++i)
|
for (i = 0; i < (sizeof (toolbar_items) / sizeof (char*)); ++i)
|
||||||
{
|
{
|
||||||
o = elm_toolbar_item_find_by_label(toolbar, toolbar_items[i]);
|
o = elm_toolbar_item_find_by_label(ef->toolbar, toolbar_items[i]);
|
||||||
elm_toolbar_item_disabled_set(o, EINA_TRUE);
|
elm_toolbar_item_disabled_set(o, EINA_TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elm_layout_content_set(em->flow_browser, "ephoto.toolbar.swallow", toolbar);
|
elm_layout_content_set(ef->flow_browser, "ephoto.toolbar.swallow", ef->toolbar);
|
||||||
evas_object_show(toolbar);
|
evas_object_show(ef->toolbar);
|
||||||
evas_object_show(em->flow_browser);
|
evas_object_show(ef->flow_browser);
|
||||||
evas_object_focus_set(em->flow_browser, 1);
|
evas_object_focus_set(ef->flow_browser, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Hide the flow browser*/
|
static void
|
||||||
void
|
_ephoto_flow_browser_show_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
ephoto_hide_flow_browser(void)
|
|
||||||
{
|
{
|
||||||
evas_object_hide(image);
|
Ephoto_Flow_Browser *ef = data;
|
||||||
evas_object_hide(image2);
|
ephoto_flow_browser_image_set(ef->flow_browser, NULL);
|
||||||
evas_object_hide(toolbar);
|
|
||||||
evas_object_hide(em->flow_browser);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*Delete the flow browser*/
|
/*Delete the flow browser*/
|
||||||
void
|
static void
|
||||||
ephoto_delete_flow_browser(void)
|
_ephoto_flow_browser_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
{
|
{
|
||||||
Eina_List *items;
|
Ephoto_Flow_Browser *ef = data;
|
||||||
|
Eina_List *items;
|
||||||
|
|
||||||
|
|
||||||
items = elm_toolbar_item_get_all(toolbar);
|
|
||||||
while (items)
|
|
||||||
{
|
|
||||||
evas_object_del(eina_list_data_get(items));
|
|
||||||
items = eina_list_next(items);
|
|
||||||
}
|
|
||||||
|
|
||||||
evas_object_del(image);
|
|
||||||
evas_object_del(image2);
|
|
||||||
evas_object_del(toolbar);
|
|
||||||
evas_object_del(em->flow_browser);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*A key has been pressed*/
|
/*A key has been pressed*/
|
||||||
|
@ -212,33 +227,39 @@ static const struct
|
||||||
static void
|
static void
|
||||||
_ephoto_key_pressed(void *data, Evas *e, Evas_Object *obj, void *event_data)
|
_ephoto_key_pressed(void *data, Evas *e, Evas_Object *obj, void *event_data)
|
||||||
{
|
{
|
||||||
|
Ephoto_Flow_Browser *ef = data;
|
||||||
Evas_Event_Key_Up *eku;
|
Evas_Event_Key_Up *eku;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
eku = (Evas_Event_Key_Up *)event_data;
|
eku = (Evas_Event_Key_Up *)event_data;
|
||||||
for (i = 0; keys[i].name; ++i)
|
for (i = 0; keys[i].name; ++i)
|
||||||
if (!strcmp(eku->keyname, keys[i].name))
|
if (!strcmp(eku->keyname, keys[i].name))
|
||||||
keys[i].func(NULL, NULL, NULL);
|
keys[i].func(ef, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Go back to the thumbnail viewer*/
|
/*Go back to the thumbnail viewer*/
|
||||||
static void
|
static void
|
||||||
_ephoto_go_back(void *data, Evas_Object *obj, void *event_info)
|
_ephoto_go_back(void *data, Evas_Object *obj, void *event_info)
|
||||||
{
|
{
|
||||||
ephoto_hide_flow_browser();
|
Ephoto_Flow_Browser *ef = data;
|
||||||
ephoto_show_thumb_browser();
|
|
||||||
|
evas_object_smart_callback_call(ef->flow_browser, "delete,request", NULL);
|
||||||
|
/* elm_toolbar_item_unselect_all(ef->toolbar); */
|
||||||
|
/* em->thumb_browser = ephoto_create_thumb_browser(em->layout, ecore_file_dir_get(ef->cur_image)); */
|
||||||
|
/* elm_layout_content_set(em->layout, "ephoto.content.swallow", em->thumb_browser); */
|
||||||
|
|
||||||
elm_toolbar_item_unselect_all(toolbar);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Go to the very first image in the list*/
|
/*Go to the very first image in the list*/
|
||||||
static void
|
static void
|
||||||
_ephoto_go_first(void *data, Evas_Object *obj, void *event_info)
|
_ephoto_go_first(void *data, Evas_Object *obj, void *event_info)
|
||||||
{
|
{
|
||||||
iter = em->images;
|
Ephoto_Flow_Browser *ef = data;
|
||||||
|
|
||||||
cur_image = eina_list_data_get(iter);
|
ef->iter = em->images;
|
||||||
_ephoto_go_update();
|
|
||||||
|
ef->cur_image = eina_list_data_get(ef->iter);
|
||||||
|
_ephoto_go_update(ef);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Go to the very last image in the list*/
|
/*Go to the very last image in the list*/
|
||||||
|
@ -246,11 +267,12 @@ static void
|
||||||
_ephoto_go_last(void *data, Evas_Object *obj, void *event_info)
|
_ephoto_go_last(void *data, Evas_Object *obj, void *event_info)
|
||||||
{
|
{
|
||||||
const char *file_type;
|
const char *file_type;
|
||||||
|
Ephoto_Flow_Browser *ef = data;
|
||||||
|
|
||||||
iter = eina_list_last(em->images);
|
ef->iter = eina_list_last(em->images);
|
||||||
cur_image = eina_list_data_get(iter);
|
ef->cur_image = eina_list_data_get(ef->iter);
|
||||||
|
|
||||||
_ephoto_go_update();
|
_ephoto_go_update(ef);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Go to the next image in the list*/
|
/*Go to the next image in the list*/
|
||||||
|
@ -258,13 +280,14 @@ static void
|
||||||
_ephoto_go_next(void *data, Evas_Object *obj, void *event_info)
|
_ephoto_go_next(void *data, Evas_Object *obj, void *event_info)
|
||||||
{
|
{
|
||||||
const char *file_type;
|
const char *file_type;
|
||||||
|
Ephoto_Flow_Browser *ef = data;
|
||||||
|
|
||||||
iter = eina_list_next(iter);
|
ef->iter = eina_list_next(ef->iter);
|
||||||
if (!iter) iter = em->images;
|
if (!ef->iter) ef->iter = em->images;
|
||||||
|
|
||||||
cur_image = eina_list_data_get(iter);
|
ef->cur_image = eina_list_data_get(ef->iter);
|
||||||
|
|
||||||
_ephoto_go_update();
|
_ephoto_go_update(ef);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Go to the previous image in the list*/
|
/*Go to the previous image in the list*/
|
||||||
|
@ -272,22 +295,25 @@ static void
|
||||||
_ephoto_go_previous(void *data, Evas_Object *obj, void *event_info)
|
_ephoto_go_previous(void *data, Evas_Object *obj, void *event_info)
|
||||||
{
|
{
|
||||||
const char *file_type;
|
const char *file_type;
|
||||||
|
Ephoto_Flow_Browser *ef = data;
|
||||||
|
|
||||||
iter = eina_list_prev(iter);
|
ef->iter = eina_list_prev(ef->iter);
|
||||||
if (!iter)
|
if (!ef->iter)
|
||||||
iter = eina_list_last(em->images);
|
ef->iter = eina_list_last(em->images);
|
||||||
|
|
||||||
cur_image = eina_list_data_get(iter);
|
ef->cur_image = eina_list_data_get(ef->iter);
|
||||||
|
|
||||||
_ephoto_go_update();
|
_ephoto_go_update(ef);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Go to the slideshow*/
|
/*Go to the slideshow*/
|
||||||
static void
|
static void
|
||||||
_ephoto_go_slideshow(void *data, Evas_Object *obj, void *event_info)
|
_ephoto_go_slideshow(void *data, Evas_Object *obj, void *event_info)
|
||||||
{
|
{
|
||||||
ephoto_hide_flow_browser();
|
Ephoto_Flow_Browser *ef = data;
|
||||||
ephoto_show_slideshow(1, cur_image);
|
// FIXME
|
||||||
elm_toolbar_item_unselect_all(toolbar);
|
//ephoto_hide_flow_browser();
|
||||||
|
ephoto_show_slideshow(1, ef->cur_image);
|
||||||
|
elm_toolbar_item_unselect_all(ef->toolbar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,37 @@ Ephoto *em;
|
||||||
|
|
||||||
/*Inline Callbacks*/
|
/*Inline Callbacks*/
|
||||||
static void _ephoto_delete_main_window(void *data, Evas_Object *obj, void *event_info);
|
static void _ephoto_delete_main_window(void *data, Evas_Object *obj, void *event_info);
|
||||||
|
static void _ephoto_flow_browser_delete_cb(void *data, Evas_Object *obj, void *event_info);
|
||||||
|
static void _ephoto_thumb_browser_selected_cb(void *data, Evas_Object *obj, void *event_info);
|
||||||
|
|
||||||
|
/* Objects Callbacks */
|
||||||
|
static void
|
||||||
|
_ephoto_flow_browser_delete_cb(void *data, Evas_Object *obj, void *event_info)
|
||||||
|
{
|
||||||
|
em->thumb_browser = ephoto_create_thumb_browser(em->layout, NULL/*ecore_file_dir_get(ef->cur_image)*/);
|
||||||
|
elm_layout_content_set(em->layout, "ephoto.content.swallow", em->thumb_browser);
|
||||||
|
evas_object_smart_callback_add(em->thumb_browser,
|
||||||
|
"selected",
|
||||||
|
_ephoto_thumb_browser_selected_cb,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
em->state = EPHOTO_STATE_THUMB;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_ephoto_thumb_browser_selected_cb(void *data, Evas_Object *obj, void *event_info)
|
||||||
|
{
|
||||||
|
const char *file = event_info;
|
||||||
|
|
||||||
|
em->flow_browser = ephoto_create_flow_browser(em->layout);
|
||||||
|
ephoto_flow_browser_image_set(em->flow_browser, file);
|
||||||
|
elm_layout_content_set(em->layout, "ephoto.content.swallow", em->flow_browser);
|
||||||
|
evas_object_smart_callback_add(em->flow_browser,
|
||||||
|
"delete,request",
|
||||||
|
_ephoto_flow_browser_delete_cb,
|
||||||
|
NULL);
|
||||||
|
em->state = EPHOTO_STATE_FLOW;
|
||||||
|
}
|
||||||
|
|
||||||
/*Create the main ephoto window*/
|
/*Create the main ephoto window*/
|
||||||
void
|
void
|
||||||
|
@ -41,25 +72,43 @@ ephoto_create_main_window(const char *directory, const char *image)
|
||||||
evas_object_size_hint_fill_set(em->layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
evas_object_size_hint_fill_set(em->layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
evas_object_show(em->layout);
|
evas_object_show(em->layout);
|
||||||
|
|
||||||
ephoto_create_thumb_browser(directory);
|
|
||||||
ephoto_create_flow_browser();
|
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
ephoto_show_flow_browser(image);
|
em->flow_browser = ephoto_create_flow_browser(em->layout);
|
||||||
|
ephoto_flow_browser_image_set(em->flow_browser, image);
|
||||||
eina_stringshare_del(image);
|
eina_stringshare_del(image);
|
||||||
|
elm_layout_content_set(em->layout, "ephoto.content.swallow", em->flow_browser);
|
||||||
|
evas_object_smart_callback_add(em->flow_browser,
|
||||||
|
"delete,request",
|
||||||
|
_ephoto_flow_browser_delete_cb,
|
||||||
|
NULL);
|
||||||
|
em->state = EPHOTO_STATE_FLOW;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ephoto_show_thumb_browser();
|
{
|
||||||
|
em->thumb_browser = ephoto_create_thumb_browser(em->layout, directory);
|
||||||
|
evas_object_show(em->thumb_browser);
|
||||||
|
elm_layout_content_set(em->layout, "ephoto.content.swallow", em->thumb_browser);
|
||||||
|
evas_object_smart_callback_add(em->thumb_browser,
|
||||||
|
"selected",
|
||||||
|
_ephoto_thumb_browser_selected_cb,
|
||||||
|
NULL);
|
||||||
|
em->state = EPHOTO_STATE_THUMB;
|
||||||
|
}
|
||||||
|
|
||||||
evas_object_resize(em->win, 840, 530);
|
evas_object_resize(em->win, 1024, 534);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Delete the main ephoto window*/
|
/*Delete the main ephoto window*/
|
||||||
static void
|
static void
|
||||||
_ephoto_delete_main_window(void *data, Evas_Object *obj, void *event_info)
|
_ephoto_delete_main_window(void *data, Evas_Object *obj, void *event_info)
|
||||||
{
|
{
|
||||||
ephoto_delete_thumb_browser();
|
if (em->thumb_browser)
|
||||||
ephoto_delete_flow_browser();
|
evas_object_del(em->thumb_browser);
|
||||||
|
if (em->flow_browser)
|
||||||
|
evas_object_del(em->flow_browser);
|
||||||
|
|
||||||
evas_object_del(em->layout);
|
evas_object_del(em->layout);
|
||||||
evas_object_del(em->bg);
|
evas_object_del(em->bg);
|
||||||
if (em->images)
|
if (em->images)
|
||||||
|
|
|
@ -34,7 +34,7 @@ ephoto_show_slideshow(int view, const char *current_image)
|
||||||
return_view = view;
|
return_view = view;
|
||||||
cur_image = current_image;
|
cur_image = current_image;
|
||||||
|
|
||||||
evas_object_geometry_get(em->layout, &x, &y, &w, &h);
|
evas_object_geometry_get(em->win, &x, &y, &w, &h);
|
||||||
evas_object_resize(em->slideshow, w, h);
|
evas_object_resize(em->slideshow, w, h);
|
||||||
evas_object_move(em->slideshow, 0, 0);
|
evas_object_move(em->slideshow, 0, 0);
|
||||||
|
|
||||||
|
@ -56,10 +56,12 @@ void
|
||||||
ephoto_hide_slideshow(void)
|
ephoto_hide_slideshow(void)
|
||||||
{
|
{
|
||||||
ephoto_delete_slideshow();
|
ephoto_delete_slideshow();
|
||||||
|
// FIXME
|
||||||
|
/*
|
||||||
if (return_view == 0)
|
if (return_view == 0)
|
||||||
ephoto_show_thumb_browser();
|
ephoto_show_thumb_browser();
|
||||||
else
|
else*/
|
||||||
ephoto_show_flow_browser(cur_image);
|
//ephoto_show_flow_browser(cur_image);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Delete the slideshow object*/
|
/*Delete the slideshow object*/
|
||||||
|
|
|
@ -1,5 +1,31 @@
|
||||||
#include "ephoto.h"
|
#include "ephoto.h"
|
||||||
|
|
||||||
|
typedef struct _Ephoto_Thumb_Data Ephoto_Thumb_Data;
|
||||||
|
typedef struct _Ephoto_Thumb_Browser Ephoto_Thumb_Browser;
|
||||||
|
|
||||||
|
struct _Ephoto_Thumb_Data
|
||||||
|
{
|
||||||
|
char *thumb_path;
|
||||||
|
char *file;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _Ephoto_Thumb_Browser
|
||||||
|
{
|
||||||
|
Evas_Object *layout;
|
||||||
|
Evas_Object *thumb_browser;
|
||||||
|
Evas_Object *dir_label;
|
||||||
|
Evas_Object *toolbar;
|
||||||
|
Evas_Object *thumb_slider;
|
||||||
|
Evas_Object *thbox;
|
||||||
|
Evas_Object *fsel_win;
|
||||||
|
Elm_Gengrid_Item_Class eg;
|
||||||
|
Ethumb_Client *ec;
|
||||||
|
const char *current_directory;
|
||||||
|
int cur_val;
|
||||||
|
Eio_File *list;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/*Callbacks*/
|
/*Callbacks*/
|
||||||
static void _ephoto_slider_changed(void *data, Evas_Object *obj, void *event_info);
|
static void _ephoto_slider_changed(void *data, Evas_Object *obj, void *event_info);
|
||||||
static void _ephoto_thumber_connected(void *data, Ethumb_Client *client, Eina_Bool success);
|
static void _ephoto_thumber_connected(void *data, Ethumb_Client *client, Eina_Bool success);
|
||||||
|
@ -16,178 +42,143 @@ static void _ephoto_thumb_clicked(void *data, Evas_Object *obj, void *event_info
|
||||||
static void _ephoto_view_large(void *data, Evas_Object *obj, void *event_info);
|
static void _ephoto_view_large(void *data, Evas_Object *obj, void *event_info);
|
||||||
static void _ephoto_change_directory(void *data, Evas_Object *obj, void *event_info);
|
static void _ephoto_change_directory(void *data, Evas_Object *obj, void *event_info);
|
||||||
static void _ephoto_view_slideshow(void *data, Evas_Object *obj, void *event_info);
|
static void _ephoto_view_slideshow(void *data, Evas_Object *obj, void *event_info);
|
||||||
|
static void _ephoto_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||||
/*Inline Variables*/
|
static void _ephoto_show_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||||
static Elm_Gengrid_Item_Class eg;
|
|
||||||
static Ethumb_Client *ec;
|
|
||||||
static const char *current_directory;
|
|
||||||
static int cur_val;
|
|
||||||
static Eio_File *list = NULL;
|
|
||||||
static Evas_Object *toolbar, *dir_label, *thumb_slider, *thbox;
|
|
||||||
|
|
||||||
typedef struct _Ephoto_Thumb_Data Ephoto_Thumb_Data;
|
|
||||||
struct _Ephoto_Thumb_Data
|
|
||||||
{
|
|
||||||
const char *thumb_path;
|
|
||||||
const char *file;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*Create the thumbnail browser object*/
|
/*Create the thumbnail browser object*/
|
||||||
void
|
Evas_Object *
|
||||||
ephoto_create_thumb_browser(const char *directory)
|
ephoto_create_thumb_browser(Evas_Object *parent, const char *directory)
|
||||||
{
|
{
|
||||||
Evas_Object *o;
|
Evas_Object *o;
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
|
Ephoto_Thumb_Browser *tb;
|
||||||
|
|
||||||
|
tb = calloc(1, sizeof(Ephoto_Thumb_Browser));
|
||||||
|
|
||||||
elm_theme_extension_add(NULL, PACKAGE_DATA_DIR "/themes/default/ephoto.edj");
|
elm_theme_extension_add(NULL, PACKAGE_DATA_DIR "/themes/default/ephoto.edj");
|
||||||
|
|
||||||
ec = ethumb_client_connect(_ephoto_thumber_connected, NULL, NULL);
|
tb->ec = ethumb_client_connect(_ephoto_thumber_connected, tb, NULL);
|
||||||
|
|
||||||
|
tb->layout = elm_layout_add(parent);
|
||||||
|
elm_layout_file_set(tb->layout,
|
||||||
|
PACKAGE_DATA_DIR "/themes/default/ephoto.edj",
|
||||||
|
"ephoto/browser/layout");
|
||||||
|
|
||||||
|
evas_object_size_hint_weight_set(tb->layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
|
evas_object_size_hint_fill_set(tb->layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
evas_object_show(tb->layout);
|
||||||
|
|
||||||
if (!directory)
|
if (!directory)
|
||||||
{
|
{
|
||||||
getcwd(buf, PATH_MAX);
|
getcwd(buf, PATH_MAX);
|
||||||
current_directory = eina_stringshare_add(buf);
|
tb->current_directory = eina_stringshare_add(buf);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
current_directory = eina_stringshare_add(directory);
|
tb->current_directory = eina_stringshare_add(directory);
|
||||||
}
|
}
|
||||||
|
|
||||||
thbox = elm_box_add(em->win);
|
tb->thbox = elm_box_add(tb->layout);
|
||||||
elm_box_horizontal_set(thbox, EINA_TRUE);
|
elm_box_horizontal_set(tb->thbox, EINA_TRUE);
|
||||||
evas_object_size_hint_weight_set(thbox, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
|
evas_object_size_hint_weight_set(tb->thbox, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
|
||||||
evas_object_size_hint_fill_set(thbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
evas_object_size_hint_fill_set(tb->thbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
elm_layout_content_set(em->layout, "ephoto.location.swallow", thbox);
|
elm_layout_content_set(tb->layout, "ephoto.location.swallow", tb->thbox);
|
||||||
//elm_box_pack_end(em->box, thbox);
|
|
||||||
|
|
||||||
dir_label = elm_label_add(em->win);
|
tb->dir_label = elm_label_add(tb->thbox);
|
||||||
elm_label_label_set(dir_label, current_directory);
|
elm_label_label_set(tb->dir_label, tb->current_directory);
|
||||||
evas_object_size_hint_weight_set(dir_label, EVAS_HINT_EXPAND, 0.0);
|
evas_object_size_hint_weight_set(tb->dir_label, EVAS_HINT_EXPAND, 0.0);
|
||||||
evas_object_size_hint_align_set(dir_label, 0.01, 0.5);
|
evas_object_size_hint_align_set(tb->dir_label, 0.01, 0.5);
|
||||||
elm_box_pack_end(thbox, dir_label);
|
elm_box_pack_end(tb->thbox, tb->dir_label);
|
||||||
|
|
||||||
thumb_slider = elm_slider_add(em->win);
|
tb->thumb_slider = elm_slider_add(tb->thbox);
|
||||||
elm_slider_label_set(thumb_slider, "Thumb Size:");
|
elm_slider_label_set(tb->thumb_slider, "Thumb Size:");
|
||||||
elm_slider_span_size_set(thumb_slider, 100);
|
elm_slider_span_size_set(tb->thumb_slider, 100);
|
||||||
elm_slider_min_max_set(thumb_slider, 0, 100);
|
elm_slider_min_max_set(tb->thumb_slider, 0, 100);
|
||||||
elm_slider_value_set(thumb_slider, 50);
|
elm_slider_value_set(tb->thumb_slider, 50);
|
||||||
elm_box_pack_end(thbox, thumb_slider);
|
elm_box_pack_end(tb->thbox, tb->thumb_slider);
|
||||||
evas_object_smart_callback_add(thumb_slider, "changed",
|
evas_object_smart_callback_add(tb->thumb_slider, "changed",
|
||||||
_ephoto_slider_changed, NULL);
|
_ephoto_slider_changed, tb);
|
||||||
|
evas_object_show(tb->thumb_slider);
|
||||||
|
evas_object_show(tb->dir_label);
|
||||||
|
|
||||||
em->thumb_browser = elm_gengrid_add(em->win);
|
tb->thumb_browser = elm_gengrid_add(tb->layout);
|
||||||
elm_gengrid_align_set(em->thumb_browser, 0.5, 0.5);
|
elm_gengrid_align_set(tb->thumb_browser, 0.5, 0.5);
|
||||||
elm_gengrid_item_size_set(em->thumb_browser, 208, 146);
|
elm_gengrid_item_size_set(tb->thumb_browser, 256, 192);
|
||||||
elm_gengrid_horizontal_set(em->thumb_browser, EINA_TRUE);
|
elm_gengrid_horizontal_set(tb->thumb_browser, EINA_TRUE);
|
||||||
evas_object_size_hint_align_set(em->thumb_browser, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
evas_object_size_hint_align_set(tb->thumb_browser, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
evas_object_size_hint_weight_set(em->thumb_browser, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
evas_object_size_hint_weight_set(tb->thumb_browser, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
evas_object_size_hint_fill_set(em->thumb_browser, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
evas_object_size_hint_fill_set(tb->thumb_browser, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
|
||||||
elm_object_style_set(em->thumb_browser, "ephoto");
|
elm_object_style_set(tb->thumb_browser, "ephoto");
|
||||||
evas_object_smart_callback_add(em->thumb_browser, "clicked", _ephoto_thumb_clicked, NULL);
|
evas_object_smart_callback_add(tb->thumb_browser, "clicked", _ephoto_thumb_clicked, tb);
|
||||||
elm_layout_content_set(em->layout, "ephoto.thumb.swallow", em->thumb_browser);
|
elm_layout_content_set(tb->layout, "ephoto.thumb.swallow", tb->thumb_browser);
|
||||||
|
|
||||||
toolbar = elm_toolbar_add(em->win);
|
tb->toolbar = elm_toolbar_add(tb->layout);
|
||||||
elm_toolbar_icon_size_set(toolbar, 24);
|
elm_toolbar_icon_size_set(tb->toolbar, 24);
|
||||||
elm_toolbar_homogenous_set(toolbar, EINA_TRUE);
|
elm_toolbar_homogenous_set(tb->toolbar, EINA_TRUE);
|
||||||
elm_toolbar_scrollable_set(toolbar, EINA_FALSE);
|
elm_toolbar_scrollable_set(tb->toolbar, EINA_FALSE);
|
||||||
|
|
||||||
evas_object_size_hint_weight_set(toolbar, EVAS_HINT_EXPAND, 0.0);
|
evas_object_size_hint_weight_set(tb->toolbar, EVAS_HINT_EXPAND, 0.0);
|
||||||
evas_object_size_hint_align_set(toolbar, EVAS_HINT_FILL, 0.5);
|
evas_object_size_hint_align_set(tb->toolbar, EVAS_HINT_FILL, 0.5);
|
||||||
|
|
||||||
elm_layout_content_set(em->layout, "ephoto.toolbar.swallow", toolbar);
|
elm_layout_content_set(tb->layout, "ephoto.toolbar.swallow", tb->toolbar);
|
||||||
|
|
||||||
o = elm_icon_add(em->win);
|
o = elm_icon_add(tb->toolbar);
|
||||||
elm_icon_file_set(o, PACKAGE_DATA_DIR "/images/change_directory.png", NULL);
|
elm_icon_file_set(o, PACKAGE_DATA_DIR "/images/change_directory.png", NULL);
|
||||||
elm_toolbar_item_add(toolbar, o, "Change Directory", _ephoto_change_directory, NULL);
|
elm_toolbar_item_add(tb->toolbar, o, "Change Directory", _ephoto_change_directory, tb);
|
||||||
|
|
||||||
o = elm_icon_add(em->win);
|
o = elm_icon_add(tb->toolbar);
|
||||||
elm_icon_file_set(o, PACKAGE_DATA_DIR "/images/filter.png", NULL);
|
elm_icon_file_set(o, PACKAGE_DATA_DIR "/images/filter.png", NULL);
|
||||||
elm_toolbar_item_add(toolbar, o, "Filter", NULL, NULL);
|
elm_toolbar_item_add(tb->toolbar, o, "Filter", NULL, NULL);
|
||||||
|
|
||||||
o = elm_icon_add(em->win);
|
o = elm_icon_add(tb->toolbar);
|
||||||
elm_icon_file_set(o, PACKAGE_DATA_DIR "/images/view_presentation.png", NULL);
|
elm_icon_file_set(o, PACKAGE_DATA_DIR "/images/view_presentation.png", NULL);
|
||||||
elm_toolbar_item_add(toolbar, o, "View Large", _ephoto_view_large, NULL);
|
elm_toolbar_item_add(tb->toolbar, o, "View Large", _ephoto_view_large, tb);
|
||||||
|
|
||||||
o = elm_icon_add(em->win);
|
o = elm_icon_add(tb->toolbar);
|
||||||
elm_icon_file_set(o, PACKAGE_DATA_DIR "/images/play_slideshow.png", NULL);
|
elm_icon_file_set(o, PACKAGE_DATA_DIR "/images/play_slideshow.png", NULL);
|
||||||
elm_toolbar_item_add(toolbar, o, "Play Slideshow", _ephoto_view_slideshow, NULL);
|
elm_toolbar_item_add(tb->toolbar, o, "Play Slideshow", _ephoto_view_slideshow, tb);
|
||||||
|
|
||||||
cur_val = 50;
|
tb->cur_val = 50;
|
||||||
|
|
||||||
eg.item_style = "ephoto";
|
tb->eg.item_style = "ephoto";
|
||||||
eg.func.label_get = _ephoto_get_label;
|
tb->eg.func.label_get = _ephoto_get_label;
|
||||||
eg.func.icon_get = _ephoto_get_icon;
|
tb->eg.func.icon_get = _ephoto_get_icon;
|
||||||
eg.func.state_get = _ephoto_get_state;
|
tb->eg.func.state_get = _ephoto_get_state;
|
||||||
eg.func.del = _ephoto_grid_del;
|
tb->eg.func.del = _ephoto_grid_del;
|
||||||
|
|
||||||
|
evas_object_data_set(tb->layout, "thumb_browser", tb);
|
||||||
|
evas_object_event_callback_add(tb->layout, EVAS_CALLBACK_DEL, _ephoto_del_cb, tb);
|
||||||
|
evas_object_event_callback_add(tb->layout, EVAS_CALLBACK_SHOW, _ephoto_show_cb, tb);
|
||||||
|
return tb->layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Show the thumbnail browser*/
|
/*Show the thumbnail browser*/
|
||||||
void
|
static void
|
||||||
ephoto_show_thumb_browser(void)
|
_ephoto_show_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
{
|
|
||||||
evas_object_show(toolbar);
|
|
||||||
evas_object_show(em->thumb_browser);
|
|
||||||
evas_object_show(dir_label);
|
|
||||||
evas_object_show(thumb_slider);
|
|
||||||
evas_object_show(thbox);
|
|
||||||
|
|
||||||
if (current_directory)
|
{
|
||||||
|
Ephoto_Thumb_Browser *tb = evas_object_data_get(obj, "thumb_browser");
|
||||||
|
|
||||||
|
/* evas_object_show(tb->toolbar); */
|
||||||
|
/* evas_object_show(tb->thumb_browser); */
|
||||||
|
/* evas_object_show(tb->dir_label); */
|
||||||
|
/* evas_object_show(tb->thumb_slider); */
|
||||||
|
/* evas_object_show(tb->thbox); */
|
||||||
|
|
||||||
|
if (tb->current_directory)
|
||||||
{
|
{
|
||||||
char *buffer;
|
char *buffer;
|
||||||
int length;
|
int length;
|
||||||
|
|
||||||
length = strlen(current_directory) + strlen("Ephoto - ") + 1;
|
length = strlen(tb->current_directory) + strlen("Ephoto - ") + 1;
|
||||||
buffer = alloca(length);
|
buffer = alloca(length);
|
||||||
snprintf(buffer, length, "Ephoto - %s", current_directory);
|
snprintf(buffer, length, "Ephoto - %s", tb->current_directory);
|
||||||
elm_win_title_set(em->win, buffer);
|
elm_win_title_set(em->win, buffer);
|
||||||
} else {
|
} else {
|
||||||
elm_win_title_set(em->win, "Ephoto");
|
elm_win_title_set(em->win, "Ephoto");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Hide the thumbnail browser*/
|
|
||||||
void
|
|
||||||
ephoto_hide_thumb_browser(void)
|
|
||||||
{
|
|
||||||
evas_object_hide(toolbar);
|
|
||||||
evas_object_hide(em->thumb_browser);
|
|
||||||
evas_object_hide(dir_label);
|
|
||||||
evas_object_hide(thumb_slider);
|
|
||||||
evas_object_hide(thbox);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*Destroy the thumbnail browser*/
|
|
||||||
void
|
|
||||||
ephoto_delete_thumb_browser(void)
|
|
||||||
{
|
|
||||||
const Eina_List *items, *l, *iter;
|
|
||||||
Elm_Gengrid_Item *item;
|
|
||||||
Ephoto_Thumb_Data *etd;
|
|
||||||
|
|
||||||
items = elm_toolbar_item_get_all(toolbar);
|
|
||||||
while (items)
|
|
||||||
{
|
|
||||||
evas_object_del(eina_list_data_get(items));
|
|
||||||
items = eina_list_next(items);
|
|
||||||
}
|
|
||||||
l = elm_gengrid_items_get(em->thumb_browser);
|
|
||||||
EINA_LIST_FOREACH(l, iter, item)
|
|
||||||
{
|
|
||||||
etd = (Ephoto_Thumb_Data *)elm_gengrid_item_data_get(item);
|
|
||||||
eina_stringshare_del(etd->thumb_path);
|
|
||||||
eina_stringshare_del(etd->file);
|
|
||||||
free(etd);
|
|
||||||
}
|
|
||||||
eina_stringshare_del(current_directory);
|
|
||||||
evas_object_del(toolbar);
|
|
||||||
evas_object_del(em->thumb_browser);
|
|
||||||
evas_object_del(dir_label);
|
|
||||||
evas_object_del(thumb_slider);
|
|
||||||
evas_object_del(thbox);
|
|
||||||
ethumb_client_disconnect(ec);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Use ecore thread facility to avoid lock completly */
|
/* Use ecore thread facility to avoid lock completly */
|
||||||
|
|
||||||
/* Check image type from another thread */
|
/* Check image type from another thread */
|
||||||
|
@ -208,16 +199,18 @@ _ephoto_populate_filter(const void *data, const char *file)
|
||||||
static void
|
static void
|
||||||
_ephoto_populate_end(const void *data)
|
_ephoto_populate_end(const void *data)
|
||||||
{
|
{
|
||||||
list = NULL;
|
Ephoto_Thumb_Browser *tb = (Ephoto_Thumb_Browser *)data;
|
||||||
|
|
||||||
efreet_mime_shutdown();
|
tb->list = NULL;
|
||||||
|
efreet_mime_shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ephoto_populate_error(int error, const void *data)
|
_ephoto_populate_error(int error, const void *data)
|
||||||
{
|
{
|
||||||
|
Ephoto_Thumb_Browser *tb = (Ephoto_Thumb_Browser*)data;
|
||||||
/* We don't handle error case in ephoto */
|
/* We don't handle error case in ephoto */
|
||||||
list = NULL;
|
tb->list = NULL;
|
||||||
|
|
||||||
efreet_mime_shutdown();
|
efreet_mime_shutdown();
|
||||||
}
|
}
|
||||||
|
@ -226,39 +219,42 @@ _ephoto_populate_error(int error, const void *data)
|
||||||
static void
|
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;
|
||||||
const char *thumb;
|
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(ec, file, NULL);
|
ethumb_client_file_set(tb->ec, file, NULL);
|
||||||
if (!ethumb_client_thumb_exists(ec))
|
if (!ethumb_client_thumb_exists(tb->ec))
|
||||||
{
|
{
|
||||||
ethumb_client_generate(ec, _ephoto_thumbnail_generated, NULL, NULL);
|
ethumb_client_generate(tb->ec, _ephoto_thumbnail_generated, tb, NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ethumb_client_thumb_path_get(ec, &thumb, NULL);
|
ethumb_client_thumb_path_get(tb->ec, &thumb, NULL);
|
||||||
_ephoto_thumbnail_generated(NULL, ec, 0, file, NULL,
|
_ephoto_thumbnail_generated(tb, tb->ec, 0, file, NULL,
|
||||||
thumb, NULL, EINA_TRUE);
|
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 */
|
||||||
void
|
void
|
||||||
ephoto_populate_thumbnails(void)
|
ephoto_populate_thumbnails(Evas_Object *obj)
|
||||||
{
|
{
|
||||||
if (!current_directory) return ;
|
Ephoto_Thumb_Browser *tb = evas_object_data_get(obj, "thumb_browser");
|
||||||
|
|
||||||
|
if (!tb->current_directory) return ;
|
||||||
|
|
||||||
if (!efreet_mime_init())
|
if (!efreet_mime_init())
|
||||||
fprintf(stderr, "Could not init efreet_mime!\n");
|
fprintf(stderr, "Could not init efreet_mime!\n");
|
||||||
|
|
||||||
list = eio_file_ls(current_directory,
|
tb->list = eio_file_ls(tb->current_directory,
|
||||||
_ephoto_populate_filter,
|
_ephoto_populate_filter,
|
||||||
_ephoto_populate_main,
|
_ephoto_populate_main,
|
||||||
_ephoto_populate_end,
|
_ephoto_populate_end,
|
||||||
_ephoto_populate_error,
|
_ephoto_populate_error,
|
||||||
NULL);
|
tb);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Change the thumbnail size*/
|
/*Change the thumbnail size*/
|
||||||
|
@ -266,32 +262,34 @@ static void
|
||||||
_ephoto_slider_changed(void *data, Evas_Object *obj, void *event)
|
_ephoto_slider_changed(void *data, Evas_Object *obj, void *event)
|
||||||
{
|
{
|
||||||
int w, h, val;
|
int w, h, val;
|
||||||
|
Ephoto_Thumb_Browser *tb = data;
|
||||||
|
|
||||||
val = elm_slider_value_get(thumb_slider);
|
val = elm_slider_value_get(tb->thumb_slider);
|
||||||
elm_gengrid_item_size_get(em->thumb_browser, &w, &h);
|
elm_gengrid_item_size_get(tb->thumb_browser, &w, &h);
|
||||||
if (val < cur_val)
|
if (val < tb->cur_val)
|
||||||
{
|
{
|
||||||
w -= cur_val-val;
|
w -= tb->cur_val-val;
|
||||||
h -= cur_val-val;
|
h -= tb->cur_val-val;
|
||||||
}
|
}
|
||||||
else if (val > cur_val)
|
else if (val > tb->cur_val)
|
||||||
{
|
{
|
||||||
w += val-cur_val;
|
w += val-tb->cur_val;
|
||||||
h += val-cur_val;
|
h += val-tb->cur_val;
|
||||||
}
|
}
|
||||||
elm_gengrid_item_size_set(em->thumb_browser, w, h);
|
elm_gengrid_item_size_set(tb->thumb_browser, w, h);
|
||||||
cur_val = val;
|
tb->cur_val = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Callback when the client is connected*/
|
/*Callback when the client is connected*/
|
||||||
static void _ephoto_thumber_connected(void *data, Ethumb_Client *client, Eina_Bool success)
|
static void _ephoto_thumber_connected(void *data, Ethumb_Client *client, Eina_Bool success)
|
||||||
{
|
{
|
||||||
|
Ephoto_Thumb_Browser *tb = data;
|
||||||
if (success == EINA_TRUE)
|
if (success == EINA_TRUE)
|
||||||
{
|
{
|
||||||
ethumb_client_fdo_set(ec, ETHUMB_THUMB_LARGE);
|
ethumb_client_fdo_set(tb->ec, ETHUMB_THUMB_LARGE);
|
||||||
ethumb_client_format_set(ec, ETHUMB_THUMB_FDO);
|
ethumb_client_format_set(tb->ec, ETHUMB_THUMB_FDO);
|
||||||
ethumb_client_aspect_set(ec, ETHUMB_THUMB_KEEP_ASPECT);
|
ethumb_client_aspect_set(tb->ec, ETHUMB_THUMB_KEEP_ASPECT);
|
||||||
ephoto_populate_thumbnails();
|
ephoto_populate_thumbnails(tb->layout);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -306,6 +304,7 @@ _ephoto_thumbnail_generated(void *data, Ethumb_Client *client, int id,
|
||||||
const char *thumb_path, const char *thumb_key,
|
const char *thumb_path, const char *thumb_key,
|
||||||
Eina_Bool success)
|
Eina_Bool success)
|
||||||
{
|
{
|
||||||
|
Ephoto_Thumb_Browser *tb = data;
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
Ephoto_Thumb_Data *etd;
|
Ephoto_Thumb_Data *etd;
|
||||||
|
@ -314,7 +313,7 @@ _ephoto_thumbnail_generated(void *data, Ethumb_Client *client, int id,
|
||||||
etd->thumb_path = eina_stringshare_add(thumb_path);
|
etd->thumb_path = eina_stringshare_add(thumb_path);
|
||||||
etd->file = eina_stringshare_add(file);
|
etd->file = eina_stringshare_add(file);
|
||||||
|
|
||||||
elm_gengrid_item_append(em->thumb_browser, &eg, etd, NULL, NULL);
|
elm_gengrid_item_append(tb->thumb_browser, &tb->eg, etd, NULL, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -343,13 +342,13 @@ _ephoto_get_icon(const void *data, Evas_Object *obj, const char *part)
|
||||||
|
|
||||||
if (!strcmp(part, "elm.swallow.icon"))
|
if (!strcmp(part, "elm.swallow.icon"))
|
||||||
{
|
{
|
||||||
thumb = elm_layout_add(em->win);
|
thumb = elm_layout_add(obj);
|
||||||
elm_layout_file_set(thumb, PACKAGE_DATA_DIR "/themes/default/ephoto.edj",
|
elm_layout_file_set(thumb, PACKAGE_DATA_DIR "/themes/default/ephoto.edj",
|
||||||
"/ephoto/thumb");
|
"/ephoto/thumb");
|
||||||
evas_object_size_hint_weight_set(thumb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
evas_object_size_hint_weight_set(thumb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
evas_object_show(thumb);
|
evas_object_show(thumb);
|
||||||
|
|
||||||
o = elm_bg_add(em->win);
|
o = elm_bg_add(thumb);
|
||||||
elm_bg_file_set(o, etd->thumb_path, NULL);
|
elm_bg_file_set(o, etd->thumb_path, NULL);
|
||||||
evas_object_resize(o, 176, 117);
|
evas_object_resize(o, 176, 117);
|
||||||
|
|
||||||
|
@ -383,8 +382,11 @@ _ephoto_thumb_clicked_job(void *data)
|
||||||
|
|
||||||
file = data;
|
file = data;
|
||||||
|
|
||||||
ephoto_hide_thumb_browser();
|
/* evas_object_smart_callback_call(ef->flow_browser, "selected", file); */
|
||||||
ephoto_show_flow_browser(file);
|
|
||||||
|
/* em->flow_browser = ephoto_create_flow_browser(em->layout); */
|
||||||
|
/* ephoto_flow_browser_image_set(em->flow_browser, file); */
|
||||||
|
/* elm_layout_content_set(em->layout, "ephoto.content.swallow", em->flow_browser); */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Check to see if the thumbnail was double clicked*/
|
/*Check to see if the thumbnail was double clicked*/
|
||||||
|
@ -394,18 +396,21 @@ _ephoto_thumb_clicked(void *data, Evas_Object *obj, void *event_info)
|
||||||
const Eina_List *selected;
|
const Eina_List *selected;
|
||||||
Ephoto_Thumb_Data *etd;
|
Ephoto_Thumb_Data *etd;
|
||||||
Evas_Object *o;
|
Evas_Object *o;
|
||||||
|
Ephoto_Thumb_Browser *tb = data;
|
||||||
|
|
||||||
selected = elm_gengrid_selected_items_get(em->thumb_browser);
|
selected = elm_gengrid_selected_items_get(tb->thumb_browser);
|
||||||
o = eina_list_data_get(selected);
|
o = eina_list_data_get(selected);
|
||||||
etd = (Ephoto_Thumb_Data *)elm_gengrid_item_data_get((Elm_Gengrid_Item *)o);
|
etd = (Ephoto_Thumb_Data *)elm_gengrid_item_data_get((Elm_Gengrid_Item *)o);
|
||||||
ecore_job_add(_ephoto_thumb_clicked_job, etd->file);
|
evas_object_smart_callback_call(tb->layout, "selected", etd->file);
|
||||||
|
// ecore_job_add(_ephoto_thumb_clicked_job, etd->file);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*File Selector is shown*/
|
/*File Selector is shown*/
|
||||||
static void
|
static void
|
||||||
_ephoto_fileselector_shown(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
_ephoto_fileselector_shown(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
{
|
{
|
||||||
elm_fileselector_path_set(obj, current_directory);
|
Ephoto_Thumb_Browser *tb = data;
|
||||||
|
elm_fileselector_path_set(obj, tb->current_directory);
|
||||||
evas_render(em->e);
|
evas_render(em->e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -414,18 +419,16 @@ static void
|
||||||
_ephoto_directory_chosen(void *data, Evas_Object *obj, void *event_info)
|
_ephoto_directory_chosen(void *data, Evas_Object *obj, void *event_info)
|
||||||
{
|
{
|
||||||
const Eina_List *l, *iter;
|
const Eina_List *l, *iter;
|
||||||
Evas_Object *win;
|
|
||||||
Elm_Gengrid_Item *item;
|
Elm_Gengrid_Item *item;
|
||||||
Ephoto_Thumb_Data *etd;
|
Ephoto_Thumb_Data *etd;
|
||||||
const char *directory;
|
const char *directory;
|
||||||
|
Ephoto_Thumb_Browser *tb = data;
|
||||||
win = (Evas_Object *)data;
|
|
||||||
|
|
||||||
directory = elm_fileselector_selected_get(obj);
|
directory = elm_fileselector_selected_get(obj);
|
||||||
|
|
||||||
if ((directory) && (eina_stringshare_replace(¤t_directory, directory)))
|
if ((directory) && (eina_stringshare_replace(&tb->current_directory, directory)))
|
||||||
{
|
{
|
||||||
l = elm_gengrid_items_get(em->thumb_browser);
|
l = elm_gengrid_items_get(tb->thumb_browser);
|
||||||
EINA_LIST_FOREACH(l, iter, item)
|
EINA_LIST_FOREACH(l, iter, item)
|
||||||
{
|
{
|
||||||
etd = (Ephoto_Thumb_Data *)elm_gengrid_item_data_get(item);
|
etd = (Ephoto_Thumb_Data *)elm_gengrid_item_data_get(item);
|
||||||
|
@ -433,28 +436,28 @@ _ephoto_directory_chosen(void *data, Evas_Object *obj, void *event_info)
|
||||||
eina_stringshare_del(etd->file);
|
eina_stringshare_del(etd->file);
|
||||||
free(etd);
|
free(etd);
|
||||||
}
|
}
|
||||||
elm_gengrid_clear(em->thumb_browser);
|
elm_gengrid_clear(tb->thumb_browser);
|
||||||
eina_list_free(em->images);
|
eina_list_free(em->images);
|
||||||
em->images = NULL;
|
em->images = NULL;
|
||||||
ephoto_populate_thumbnails();
|
ephoto_populate_thumbnails(tb->layout);
|
||||||
elm_label_label_set(dir_label, current_directory);
|
elm_label_label_set(tb->dir_label, tb->current_directory);
|
||||||
|
|
||||||
if (current_directory)
|
if (tb->current_directory)
|
||||||
{
|
{
|
||||||
char *buffer;
|
char *buffer;
|
||||||
int length;
|
int length;
|
||||||
|
|
||||||
length = strlen(current_directory) + strlen("Ephoto - ") + 1;
|
length = strlen(tb->current_directory) + strlen("Ephoto - ") + 1;
|
||||||
buffer = alloca(length);
|
buffer = alloca(length);
|
||||||
snprintf(buffer, length, "Ephoto - %s", current_directory);
|
snprintf(buffer, length, "Ephoto - %s", tb->current_directory);
|
||||||
elm_win_title_set(em->win, buffer);
|
elm_win_title_set(em->win, buffer);
|
||||||
} else {
|
} else {
|
||||||
elm_win_title_set(em->win, "Ephoto");
|
elm_win_title_set(em->win, "Ephoto");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
evas_object_del(obj);
|
|
||||||
evas_object_del(win);
|
evas_object_del(tb->fsel_win);
|
||||||
elm_toolbar_item_unselect_all(toolbar);
|
elm_toolbar_item_unselect_all(tb->toolbar);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Show the flow browser*/
|
/*Show the flow browser*/
|
||||||
|
@ -464,53 +467,83 @@ _ephoto_view_large(void *data, Evas_Object *obj, void *event_info)
|
||||||
const Eina_List *selected;
|
const Eina_List *selected;
|
||||||
Evas_Object *o;
|
Evas_Object *o;
|
||||||
Ephoto_Thumb_Data *etd;
|
Ephoto_Thumb_Data *etd;
|
||||||
|
Ephoto_Thumb_Browser *tb = data;
|
||||||
|
|
||||||
ephoto_hide_thumb_browser();
|
selected = elm_gengrid_selected_items_get(tb->thumb_browser);
|
||||||
|
|
||||||
selected = elm_gengrid_selected_items_get(em->thumb_browser);
|
/* em->flow_browser = ephoto_create_flow_browser(em->layout); */
|
||||||
|
|
||||||
if (eina_list_data_get(selected))
|
if (eina_list_data_get(selected))
|
||||||
{
|
{
|
||||||
o = eina_list_data_get(selected);
|
o = eina_list_data_get(selected);
|
||||||
etd = (Ephoto_Thumb_Data *)elm_gengrid_item_data_get((Elm_Gengrid_Item *)o);
|
etd = (Ephoto_Thumb_Data *)elm_gengrid_item_data_get((Elm_Gengrid_Item *)o);
|
||||||
ephoto_show_flow_browser(etd->file);
|
/* _ephoto_thumb_clicked_job(etd->file); */
|
||||||
|
evas_object_smart_callback_call(tb->layout, "selected", etd->file);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ephoto_show_flow_browser(eina_list_data_get(em->images));
|
/* _ephoto_thumb_clicked_job( eina_list_data_get(em->images)); */
|
||||||
|
evas_object_smart_callback_call(tb->layout, "selected", eina_list_data_get(em->images));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
elm_toolbar_item_unselect_all(toolbar);
|
elm_toolbar_item_unselect_all(tb->toolbar);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Change directory*/
|
/*Change directory*/
|
||||||
static void
|
static void
|
||||||
_ephoto_change_directory(void *data, Evas_Object *obj, void *event_info)
|
_ephoto_change_directory(void *data, Evas_Object *obj, void *event_info)
|
||||||
{
|
{
|
||||||
Evas_Object *win, *fsel;
|
Evas_Object *fsel;
|
||||||
|
Ephoto_Thumb_Browser *tb = data;
|
||||||
|
|
||||||
win = elm_win_inwin_add(em->win);
|
tb->fsel_win = elm_win_inwin_add(em->win);
|
||||||
|
|
||||||
fsel = elm_fileselector_add(em->win);
|
fsel = elm_fileselector_add(tb->fsel_win);
|
||||||
elm_fileselector_folder_only_set(fsel, EINA_TRUE);
|
elm_fileselector_folder_only_set(fsel, EINA_TRUE);
|
||||||
elm_fileselector_buttons_ok_cancel_set(fsel, EINA_TRUE);
|
elm_fileselector_buttons_ok_cancel_set(fsel, EINA_TRUE);
|
||||||
|
elm_fileselector_path_set(fsel, tb->current_directory);
|
||||||
evas_object_event_callback_add(fsel, EVAS_CALLBACK_SHOW,
|
evas_object_event_callback_add(fsel, EVAS_CALLBACK_SHOW,
|
||||||
_ephoto_fileselector_shown, NULL);
|
_ephoto_fileselector_shown, tb);
|
||||||
evas_object_smart_callback_add(fsel, "done",
|
evas_object_smart_callback_add(fsel, "done",
|
||||||
_ephoto_directory_chosen, win);
|
_ephoto_directory_chosen, tb);
|
||||||
|
|
||||||
elm_win_inwin_content_set(win, fsel);
|
elm_win_inwin_content_set(tb->fsel_win, fsel);
|
||||||
elm_win_inwin_activate(win);
|
elm_win_inwin_activate(tb->fsel_win);
|
||||||
|
|
||||||
evas_object_show(fsel);
|
evas_object_show(fsel);
|
||||||
evas_object_show(win);
|
evas_object_show(tb->fsel_win);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Show slideshow*/
|
/*Show slideshow*/
|
||||||
static void
|
static void
|
||||||
_ephoto_view_slideshow(void *data, Evas_Object *obj, void *event_info)
|
_ephoto_view_slideshow(void *data, Evas_Object *obj, void *event_info)
|
||||||
{
|
{
|
||||||
ephoto_hide_thumb_browser();
|
Ephoto_Thumb_Browser *tb = data;
|
||||||
|
/* FIXME */
|
||||||
|
//ephoto_hide_thumb_browser();
|
||||||
ephoto_show_slideshow(0, NULL);
|
ephoto_show_slideshow(0, NULL);
|
||||||
elm_toolbar_item_unselect_all(toolbar);
|
elm_toolbar_item_unselect_all(tb->toolbar);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Destroy the thumbnail browser object itself*/
|
||||||
|
static void
|
||||||
|
_ephoto_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
|
{
|
||||||
|
Ephoto_Thumb_Browser *tb = data;
|
||||||
|
const Eina_List *items, *l, *iter;
|
||||||
|
Elm_Gengrid_Item *item;
|
||||||
|
Ephoto_Thumb_Data *etd;
|
||||||
|
|
||||||
|
l = elm_gengrid_items_get(tb->thumb_browser);
|
||||||
|
EINA_LIST_FOREACH(l, iter, item)
|
||||||
|
{
|
||||||
|
etd = (Ephoto_Thumb_Data *)elm_gengrid_item_data_get(item);
|
||||||
|
eina_stringshare_del(etd->thumb_path);
|
||||||
|
eina_stringshare_del(etd->file);
|
||||||
|
free(etd);
|
||||||
|
}
|
||||||
|
eina_stringshare_del(tb->current_directory);
|
||||||
|
ethumb_client_disconnect(tb->ec);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue