parent
24c98b891b
commit
11ee1079e1
|
@ -22,6 +22,57 @@ static const char *toolbar_items[] = {
|
||||||
"Slideshow"
|
"Slideshow"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void
|
||||||
|
_ephoto_set_title(const char *file)
|
||||||
|
{
|
||||||
|
char *buffer;
|
||||||
|
int length;
|
||||||
|
|
||||||
|
length = strlen(file) + strlen("Ephoto - ") + 1;
|
||||||
|
buffer = alloca(length);
|
||||||
|
snprintf(buffer, length, "Ephoto - %s", file);
|
||||||
|
elm_win_title_set(em->win, buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_ephoto_go_update(void)
|
||||||
|
{
|
||||||
|
const char *file_type;
|
||||||
|
char *buffer;
|
||||||
|
int length;
|
||||||
|
|
||||||
|
efreet_mime_init();
|
||||||
|
|
||||||
|
elm_box_unpack(em->flow_browser, image);
|
||||||
|
elm_box_unpack(em->flow_browser, image2);
|
||||||
|
elm_box_unpack(em->flow_browser, toolbar);
|
||||||
|
evas_object_hide(image);
|
||||||
|
evas_object_hide(image2);
|
||||||
|
|
||||||
|
file_type = efreet_mime_type_get(cur_image);
|
||||||
|
if (file_type && !strcmp(file_type, "image/jpeg"))
|
||||||
|
{
|
||||||
|
elm_photocam_file_set(image, cur_image);
|
||||||
|
elm_box_pack_end(em->flow_browser, image);
|
||||||
|
evas_object_show(image);
|
||||||
|
} else {
|
||||||
|
elm_image_file_set(image2, cur_image, NULL);
|
||||||
|
elm_box_pack_end(em->flow_browser, image2);
|
||||||
|
evas_object_show(image2);
|
||||||
|
}
|
||||||
|
|
||||||
|
elm_box_pack_end(em->flow_browser, toolbar);
|
||||||
|
|
||||||
|
elm_toolbar_item_unselect_all(toolbar);
|
||||||
|
|
||||||
|
efreet_mime_shutdown();
|
||||||
|
|
||||||
|
length = strlen(cur_image) + strlen("Ephoto - ") + 1;
|
||||||
|
buffer = alloca(length);
|
||||||
|
snprintf(buffer, length, "Ephoto - %s", cur_image);
|
||||||
|
elm_win_title_set(em->win, buffer);
|
||||||
|
}
|
||||||
|
|
||||||
/*Create the flow browser*/
|
/*Create the flow browser*/
|
||||||
void
|
void
|
||||||
ephoto_create_flow_browser(void)
|
ephoto_create_flow_browser(void)
|
||||||
|
@ -98,23 +149,9 @@ ephoto_show_flow_browser(const char *current_image)
|
||||||
elm_toolbar_item_disabled_set(o, !iter ? EINA_TRUE : EINA_FALSE);
|
elm_toolbar_item_disabled_set(o, !iter ? EINA_TRUE : EINA_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
elm_box_unpack(em->flow_browser, image);
|
fprintf(stderr, "iter: %p\n", iter);
|
||||||
elm_box_unpack(em->flow_browser, image2);
|
|
||||||
elm_box_unpack(em->flow_browser, toolbar);
|
|
||||||
|
|
||||||
file_type = strrchr(current_image, '.');
|
_ephoto_go_update();
|
||||||
if (strncasecmp(file_type, ".jpg", 4) && strncasecmp(file_type, ".jpeg", 5))
|
|
||||||
{
|
|
||||||
elm_image_file_set(image2, current_image, NULL);
|
|
||||||
elm_box_pack_end(em->flow_browser, image2);
|
|
||||||
evas_object_show(image2);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
elm_photocam_file_set(image, current_image);
|
|
||||||
elm_box_pack_end(em->flow_browser, image);
|
|
||||||
evas_object_show(image);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -182,7 +219,6 @@ _ephoto_key_pressed(void *data, Evas *e, Evas_Object *obj, void *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(NULL, NULL, NULL);
|
||||||
printf("%s\n", eku->keyname);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Go back to the thumbnail viewer*/
|
/*Go back to the thumbnail viewer*/
|
||||||
|
@ -199,34 +235,10 @@ _ephoto_go_back(void *data, Evas_Object *obj, void *event_info)
|
||||||
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)
|
||||||
{
|
{
|
||||||
const char *file_type;
|
iter = em->images;
|
||||||
|
|
||||||
iter = eina_list_nth_list(em->images, 0);
|
|
||||||
|
|
||||||
elm_box_unpack(em->flow_browser, image);
|
|
||||||
elm_box_unpack(em->flow_browser, image2);
|
|
||||||
elm_box_unpack(em->flow_browser, toolbar);
|
|
||||||
evas_object_hide(image);
|
|
||||||
evas_object_hide(image2);
|
|
||||||
|
|
||||||
file_type = strrchr(eina_list_data_get(iter), '.');
|
|
||||||
if (strncasecmp(file_type, ".jpg", 4) && strncasecmp(file_type, ".jpeg", 5))
|
|
||||||
{
|
|
||||||
elm_image_file_set(image2, eina_list_data_get(iter), NULL);
|
|
||||||
elm_box_pack_end(em->flow_browser, image2);
|
|
||||||
evas_object_show(image2);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
elm_photocam_file_set(image, eina_list_data_get(iter));
|
|
||||||
elm_box_pack_end(em->flow_browser, image);
|
|
||||||
evas_object_show(image);
|
|
||||||
}
|
|
||||||
cur_image = eina_list_data_get(iter);
|
cur_image = eina_list_data_get(iter);
|
||||||
|
_ephoto_go_update();
|
||||||
elm_box_pack_end(em->flow_browser, toolbar);
|
|
||||||
|
|
||||||
elm_toolbar_item_unselect_all(toolbar);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Go to the very last image in the list*/
|
/*Go to the very last image in the list*/
|
||||||
|
@ -236,31 +248,9 @@ _ephoto_go_last(void *data, Evas_Object *obj, void *event_info)
|
||||||
const char *file_type;
|
const char *file_type;
|
||||||
|
|
||||||
iter = eina_list_last(em->images);
|
iter = eina_list_last(em->images);
|
||||||
|
|
||||||
elm_box_unpack(em->flow_browser, image);
|
|
||||||
elm_box_unpack(em->flow_browser, image2);
|
|
||||||
elm_box_unpack(em->flow_browser, toolbar);
|
|
||||||
evas_object_hide(image);
|
|
||||||
evas_object_hide(image2);
|
|
||||||
|
|
||||||
file_type = strrchr(eina_list_data_get(iter), '.');
|
|
||||||
if (strncasecmp(file_type, ".jpg", 4) && strncasecmp(file_type, ".jpeg", 5))
|
|
||||||
{
|
|
||||||
elm_image_file_set(image2, eina_list_data_get(iter), NULL);
|
|
||||||
elm_box_pack_end(em->flow_browser, image2);
|
|
||||||
evas_object_show(image2);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
elm_photocam_file_set(image, eina_list_data_get(iter));
|
|
||||||
elm_box_pack_end(em->flow_browser, image);
|
|
||||||
evas_object_show(image);
|
|
||||||
}
|
|
||||||
cur_image = eina_list_data_get(iter);
|
cur_image = eina_list_data_get(iter);
|
||||||
|
|
||||||
elm_box_pack_end(em->flow_browser, toolbar);
|
_ephoto_go_update();
|
||||||
|
|
||||||
elm_toolbar_item_unselect_all(toolbar);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Go to the next image in the list*/
|
/*Go to the next image in the list*/
|
||||||
|
@ -269,34 +259,12 @@ _ephoto_go_next(void *data, Evas_Object *obj, void *event_info)
|
||||||
{
|
{
|
||||||
const char *file_type;
|
const char *file_type;
|
||||||
|
|
||||||
iter = iter->next;
|
iter = eina_list_next(iter);
|
||||||
if (!iter)
|
if (!iter) iter = em->images;
|
||||||
iter = eina_list_nth_list(em->images, 0);
|
|
||||||
|
|
||||||
elm_box_unpack(em->flow_browser, image);
|
|
||||||
elm_box_unpack(em->flow_browser, image2);
|
|
||||||
elm_box_unpack(em->flow_browser, toolbar);
|
|
||||||
evas_object_hide(image);
|
|
||||||
evas_object_hide(image2);
|
|
||||||
|
|
||||||
file_type = strrchr(eina_list_data_get(iter), '.');
|
|
||||||
if (strncasecmp(file_type, ".jpg", 4) && strncasecmp(file_type, ".jpeg", 5))
|
|
||||||
{
|
|
||||||
elm_image_file_set(image2, eina_list_data_get(iter), NULL);
|
|
||||||
elm_box_pack_end(em->flow_browser, image2);
|
|
||||||
evas_object_show(image2);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
elm_photocam_file_set(image, eina_list_data_get(iter));
|
|
||||||
elm_box_pack_end(em->flow_browser, image);
|
|
||||||
evas_object_show(image);
|
|
||||||
}
|
|
||||||
cur_image = eina_list_data_get(iter);
|
cur_image = eina_list_data_get(iter);
|
||||||
|
|
||||||
elm_box_pack_end(em->flow_browser, toolbar);
|
_ephoto_go_update();
|
||||||
|
|
||||||
elm_toolbar_item_unselect_all(toolbar);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Go to the previous image in the list*/
|
/*Go to the previous image in the list*/
|
||||||
|
@ -305,34 +273,13 @@ _ephoto_go_previous(void *data, Evas_Object *obj, void *event_info)
|
||||||
{
|
{
|
||||||
const char *file_type;
|
const char *file_type;
|
||||||
|
|
||||||
iter = iter->prev;
|
iter = eina_list_prev(iter);
|
||||||
if (!iter)
|
if (!iter)
|
||||||
iter = eina_list_last(em->images);
|
iter = eina_list_last(em->images);
|
||||||
|
|
||||||
elm_box_unpack(em->flow_browser, image);
|
|
||||||
elm_box_unpack(em->flow_browser, image2);
|
|
||||||
elm_box_unpack(em->flow_browser, toolbar);
|
|
||||||
evas_object_hide(image);
|
|
||||||
evas_object_hide(image2);
|
|
||||||
|
|
||||||
file_type = strrchr(eina_list_data_get(iter), '.');
|
|
||||||
if (strncasecmp(file_type, ".jpg", 4) && strncasecmp(file_type, ".jpeg", 5))
|
|
||||||
{
|
|
||||||
elm_image_file_set(image2, eina_list_data_get(iter), NULL);
|
|
||||||
elm_box_pack_end(em->flow_browser, image2);
|
|
||||||
evas_object_show(image2);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
elm_photocam_file_set(image, eina_list_data_get(iter));
|
|
||||||
elm_box_pack_end(em->flow_browser, image);
|
|
||||||
evas_object_show(image);
|
|
||||||
}
|
|
||||||
cur_image = eina_list_data_get(iter);
|
cur_image = eina_list_data_get(iter);
|
||||||
|
|
||||||
elm_box_pack_end(em->flow_browser, toolbar);
|
_ephoto_go_update();
|
||||||
|
|
||||||
elm_toolbar_item_unselect_all(toolbar);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Go to the slideshow*/
|
/*Go to the slideshow*/
|
||||||
|
|
|
@ -75,6 +75,8 @@ _ephoto_get_image(void *data, Evas_Object *obj)
|
||||||
{
|
{
|
||||||
char *file;
|
char *file;
|
||||||
Evas_Object *image;
|
Evas_Object *image;
|
||||||
|
char *buffer;
|
||||||
|
int length;
|
||||||
|
|
||||||
file = data;
|
file = data;
|
||||||
|
|
||||||
|
@ -83,6 +85,11 @@ _ephoto_get_image(void *data, Evas_Object *obj)
|
||||||
elm_photo_fill_inside_set(image, EINA_TRUE);
|
elm_photo_fill_inside_set(image, EINA_TRUE);
|
||||||
elm_object_style_set(image, "shadow");
|
elm_object_style_set(image, "shadow");
|
||||||
|
|
||||||
|
length = strlen(file) + strlen("Ephoto - ") + 1;
|
||||||
|
buffer = alloca(length);
|
||||||
|
snprintf(buffer, length, "Ephoto - %s", file);
|
||||||
|
elm_win_title_set(em->win, buffer);
|
||||||
|
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -127,6 +127,19 @@ ephoto_show_thumb_browser(void)
|
||||||
evas_object_show(dir_label);
|
evas_object_show(dir_label);
|
||||||
evas_object_show(thumb_slider);
|
evas_object_show(thumb_slider);
|
||||||
evas_object_show(thbox);
|
evas_object_show(thbox);
|
||||||
|
|
||||||
|
if (current_directory)
|
||||||
|
{
|
||||||
|
char *buffer;
|
||||||
|
int length;
|
||||||
|
|
||||||
|
length = strlen(current_directory) + strlen("Ephoto - ") + 1;
|
||||||
|
buffer = alloca(length);
|
||||||
|
snprintf(buffer, length, "Ephoto - %s", current_directory);
|
||||||
|
elm_win_title_set(em->win, buffer);
|
||||||
|
} else {
|
||||||
|
elm_win_title_set(em->win, "Ephoto");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Hide the thumbnail browser*/
|
/*Hide the thumbnail browser*/
|
||||||
|
@ -179,7 +192,6 @@ _ephoto_populate_filter(const void *data, const char *file)
|
||||||
{
|
{
|
||||||
const char *type;
|
const char *type;
|
||||||
|
|
||||||
printf("%s\n", file);
|
|
||||||
if (!(type = efreet_mime_type_get(file)))
|
if (!(type = efreet_mime_type_get(file)))
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
if (!strncmp(type, "image", 5))
|
if (!strncmp(type, "image", 5))
|
||||||
|
@ -197,6 +209,15 @@ _ephoto_populate_end(const void *data)
|
||||||
efreet_mime_shutdown();
|
efreet_mime_shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_ephoto_populate_error(int error, const void *data)
|
||||||
|
{
|
||||||
|
/* We don't handle error case in ephoto */
|
||||||
|
list = NULL;
|
||||||
|
|
||||||
|
efreet_mime_shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
/* Build the interface component after detection from main thread */
|
/* Build the interface component after detection from main thread */
|
||||||
static void
|
static void
|
||||||
_ephoto_populate_main(const void *data, const char *file)
|
_ephoto_populate_main(const void *data, const char *file)
|
||||||
|
@ -232,7 +253,7 @@ ephoto_populate_thumbnails(void)
|
||||||
_ephoto_populate_filter,
|
_ephoto_populate_filter,
|
||||||
_ephoto_populate_main,
|
_ephoto_populate_main,
|
||||||
_ephoto_populate_end,
|
_ephoto_populate_end,
|
||||||
_ephoto_populate_end, /* We don't handle error case in ephoto */
|
_ephoto_populate_error,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -413,6 +434,19 @@ _ephoto_directory_chosen(void *data, Evas_Object *obj, void *event_info)
|
||||||
em->images = NULL;
|
em->images = NULL;
|
||||||
ephoto_populate_thumbnails();
|
ephoto_populate_thumbnails();
|
||||||
elm_label_label_set(dir_label, current_directory);
|
elm_label_label_set(dir_label, current_directory);
|
||||||
|
|
||||||
|
if (current_directory)
|
||||||
|
{
|
||||||
|
char *buffer;
|
||||||
|
int length;
|
||||||
|
|
||||||
|
length = strlen(current_directory) + strlen("Ephoto - ") + 1;
|
||||||
|
buffer = alloca(length);
|
||||||
|
snprintf(buffer, length, "Ephoto - %s", current_directory);
|
||||||
|
elm_win_title_set(em->win, buffer);
|
||||||
|
} else {
|
||||||
|
elm_win_title_set(em->win, "Ephoto");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
evas_object_del(obj);
|
evas_object_del(obj);
|
||||||
evas_object_del(win);
|
evas_object_del(win);
|
||||||
|
|
Loading…
Reference in New Issue