Commit the version of Ephoto that has always been the most working and preferred. I will bugfix this version and release it. Any of thousands of rewrites I love to do will have to come for another version somewhere well done the road. Lets just take this and make it solid and release it. Shout out to cedric, bluebugs, captainigloo, k-s, otavio, and any others who contributed to this version.

SVN revision: 60775
This commit is contained in:
Stephen Houston 2011-06-28 22:26:16 +00:00
parent 9967da59b3
commit 962910db6b
33 changed files with 2119 additions and 594 deletions

View File

@ -164,6 +164,7 @@ Makefile
ephoto.spec
data/Makefile
data/desktop/Makefile
data/images/Makefile
data/themes/Makefile
data/themes/default/Makefile
data/themes/default/images/Makefile

View File

@ -1,2 +1,2 @@
MAINTAINERCLEANFILES = Makefile.in Makefile
SUBDIRS = themes desktop
SUBDIRS = desktop images themes

20
data/images/Makefile.am Normal file
View File

@ -0,0 +1,20 @@
MAINTAINERCLEANFILES = Makefile.in Makefile
IMAGES = \
back.png \
back_grid.png \
first.png \
folder.png \
forward.png \
grid.png \
last.png \
single.png \
slideshow.png \
up.png \
zoom-fit.png \
zoom-in.png \
zoom-original.png \
zoom-out.png
imagesdir = $(pkgdatadir)/images
images_DATA = $(IMAGES)

BIN
data/images/back.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
data/images/back_grid.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
data/images/first.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
data/images/folder.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
data/images/forward.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
data/images/grid.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
data/images/last.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
data/images/single.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
data/images/slideshow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
data/images/up.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
data/images/zoom-fit.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
data/images/zoom-in.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
data/images/zoom-out.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -1,212 +1,603 @@
externals {
external: "elm";
external: "elm";
}
collections {
images
{
}
group
{
name: "ephoto/layout/single/browser";
parts
{
part
{
name: "ephoto.swallow.content";
group { name: "elm/layout/ephoto/orient";
parts {
part { name: "elm.swallow.content";
type: SWALLOW;
description
{
rel1.relative: 0.0 0.0;
rel1.offset: 0 0;
rel2.relative: 1.0 1.0;
rel2.offset: -1 -1;
description { state: "default" 0.0;
}
}
}
}
group
{
name: "elm/layout/ephoto/orient";
parts
{
part
{
name: "elm.swallow.content";
type: SWALLOW;
description
{
state: "default" 0.0;
}
description
{
state: "rotate_0" 0.0;
description { state: "rotate_0" 0.0;
inherit: "default" 0.0;
map
{
map {
on: 1;
rotation.z : 0;
rotation.z: 0;
}
}
description
{
state: "rotate_90" 0.0;
description { state: "rotate_90" 0.0;
inherit: "default" 0.0;
map
{
map {
on: 1;
rotation.z : 90;
rotation.z: 90;
}
}
description
{
state: "rotate_180" 0.0;
description { state: "rotate_180" 0.0;
inherit: "default" 0.0;
map
{
map {
on: 1;
rotation.z : 180;
rotation.z: 180;
}
}
description
{
state: "rotate_270" 0.0;
description { state: "rotate_270" 0.0;
inherit: "default" 0.0;
map
{
map {
on: 1;
rotation.z : 270;
rotation.z: 270;
}
}
description
{
state: "flip_horiz" 0.0;
description { state: "flip_horiz" 0.0;
inherit: "default" 0.0;
map
{
map {
on: 1;
rotation.y : 180;
rotation.y: 180;
}
}
description
{
state: "flip_vert" 0.0;
description { state: "flip_vert" 0.0;
inherit: "default" 0.0;
map
{
map {
on: 1;
rotation.x : 180;
rotation.x: 180;
}
}
description
{
state: "flip_horiz_90" 0.0;
description { state: "flip_horiz_90" 0.0;
inherit: "default" 0.0;
map
{
map {
on: 1;
rotation
{
rotation {
z: 90;
y: 180;
}
}
}
description
{
state: "flip_vert_90" 0.0;
description { state: "flip_vert_90" 0.0;
inherit: "default" 0.0;
map
{
map {
on: 1;
rotation
{
rotation {
z: 90;
x: 180;
}
}
}
}
programs
{
program
{
signal: "state,rotate,0";
source: "ephoto";
action: STATE_SET "rotate_0" 0.0;
target: "elm.swallow.content";
programs {
program {
signal: "state,rotate,0";
source: "ephoto";
action: STATE_SET "rotate_0" 0.0;
target: "elm.swallow.content";
}
program
{
signal: "state,rotate,90";
source: "ephoto";
action: STATE_SET "rotate_90" 0.0;
target: "elm.swallow.content";
program {
signal: "state,rotate,90";
source: "ephoto";
action: STATE_SET "rotate_90" 0.0;
target: "elm.swallow.content";
}
program
{
signal: "state,rotate,180";
source: "ephoto";
action: STATE_SET "rotate_180" 0.0;
target: "elm.swallow.content";
program {
signal: "state,rotate,180";
source: "ephoto";
action: STATE_SET "rotate_180" 0.0;
target: "elm.swallow.content";
}
program
{
signal: "state,rotate,270";
source: "ephoto";
action: STATE_SET "rotate_270" 0.0;
target: "elm.swallow.content";
program {
signal: "state,rotate,270";
source: "ephoto";
action: STATE_SET "rotate_270" 0.0;
target: "elm.swallow.content";
}
program
{
signal: "state,flip,horiz";
source: "ephoto";
action: STATE_SET "flip_horiz" 0.0;
target: "elm.swallow.content";
program {
signal: "state,flip,horiz";
source: "ephoto";
action: STATE_SET "flip_horiz" 0.0;
target: "elm.swallow.content";
}
program
{
signal: "state,flip,vert";
source: "ephoto";
action: STATE_SET "flip_vert" 0.0;
target: "elm.swallow.content";
program {
signal: "state,flip,vert";
source: "ephoto";
action: STATE_SET "flip_vert" 0.0;
target: "elm.swallow.content";
}
program
{
signal: "state,flip,horiz,90";
source: "ephoto";
action: STATE_SET "flip_horiz_90" 0.0;
target: "elm.swallow.content";
program {
signal: "state,flip,horiz,90";
source: "ephoto";
action: STATE_SET "flip_horiz_90" 0.0;
target: "elm.swallow.content";
}
program
{
signal: "state,flip,vert,90";
source: "ephoto";
action: STATE_SET "flip_vert_90" 0.0;
target: "elm.swallow.content";
program {
signal: "state,flip,vert,90";
source: "ephoto";
action: STATE_SET "flip_vert_90" 0.0;
target: "elm.swallow.content";
}
}
}
}
group
{
name: "ephoto,thumb,grid";
parts
{
part
{
name: "ephoto.swallow.content.thumb";
type: SWALLOW;
mouse_events: 1;
description
{
state: "default" 0.0;
rel1.relative : 0.0 0.0;
rel1.offset : 0 0;
rel2.relative : 1.0 1.0;
rel2.offset : -1 -1;
group { name: "elm/gengrid/item/ephoto-album-preview/default";
data.item: "labels" "elm.text";
data.item: "icons" "elm.swallow.icon.1 elm.swallow.icon.2 elm.swallow.icon.3";
data.item: "states" "have_files";
images {
image: "bt_sm_base1.png" COMP;
image: "bt_sm_shine.png" COMP;
image: "bt_sm_hilight.png" COMP;
image: "directory-512.png" COMP;
}
parts {
part { name: "event";
type: RECT;
repeat_events: 1;
description { state: "default" 0.0;
color: 0 0 0 0;
}
}
part { name: "bg";
clip_to: "disclip";
mouse_events: 0;
description { state: "default" 0.0;
visible: 0;
color: 255 255 255 0;
rel1.offset: -3 -3;
rel2.offset: 2 2;
image {
normal: "bt_sm_base1.png";
border: 6 6 6 6;
middle: SOLID;
}
}
description { state: "selected" 0.0;
inherit: "default" 0.0;
visible: 1;
color: 255 255 255 255;
}
}
part { name: "image";
type: IMAGE;
mouse_events: 0;
description { state: "default" 0.0;
aspect_preference: BOTH;
aspect: 1.0 1.0;
image.normal: "directory-512.png";
rel2 {
to_y: "elm.text";
relative: 1.0 0.0;
offset: -1 -2;
}
}
}
part { name: "have-files-clipper";
type: RECT;
description { state: "default" 0.0;
color: 255 255 255 0;
visible: 0;
}
description { state: "visible" 0.0;
inherit: "default" 0.0;
color: 255 255 255 255;
visible: 1;
}
}
part { name: "icon_box_margin";
type: RECT;
mouse_events: 0;
clip_to: "have-files-clipper";
description { state: "default" 0.0;
color: 255 255 255 0;
rel1 {
to: "icon_box";
offset: -1 -1;
}
rel2 {
to: "icon_box";
offset: 0 0;
}
}
}
part { name: "icon_box";
type: RECT;
mouse_events: 0;
clip_to: "have-files-clipper";
description { state: "default" 0.0;
color: 255 255 255 0;
align: 1.0 1.0;
min: 32 32;
rel1 {
to: "image";
relative: 0.0 0.0;
offset: 0 20;
}
rel2 {
to: "image";
relative: 1.0 1.0;
offset: -1 -1;
}
}
}
part { name: "elm.swallow.icon.1";
type: SWALLOW;
mouse_events: 0;
clip_to: "have-files-clipper";
description { state: "default" 0.0;
color: 255 0 0 255;
map {
on: 0;
rotation {
z: 0;
}
}
rel1 {
relative: 0.2 0.2;
to: "icon_box";
}
rel2 {
relative: 0.8 0.8;
offset: -1 -1;
to: "icon_box";
}
}
}
part { name: "elm.swallow.icon.2";
type: SWALLOW;
mouse_events: 0;
clip_to: "have-files-clipper";
description { state: "default" 0.0;
color: 255 0 0 255;
map {
on: 1;
rotation {
z: 15;
}
}
rel1 {
relative: 0.2 0.2;
to: "icon_box";
}
rel2 {
relative: 0.8 0.8;
offset: -1 -1;
to: "icon_box";
}
}
}
part { name: "elm.swallow.icon.3";
type: SWALLOW;
mouse_events: 0;
clip_to: "have-files-clipper";
description { state: "default" 0.0;
color: 255 0 0 255;
map {
on: 1;
rotation {
z: -15;
}
}
rel1 {
relative: 0.2 0.2;
to: "icon_box";
}
rel2 {
relative: 0.8 0.8;
offset: -1 -1;
to: "icon_box";
}
}
}
part { name: "elm.text";
clip_to: "disclip";
type: TEXT;
effect: SOFT_SHADOW;
mouse_events: 0;
scale: 1;
description { state: "default" 0.0;
rel1 {
relative: 0.0 1.0;
offset: 20 -30;
}
rel2 {
relative: 1.0 1.0;
offset: -21 -15;
}
color: 0 0 0 255;
color3: 0 0 0 0;
text {
font: "Sans";
size: 10;
min: 0 1;
align: 0.5 0.0;
text_class: "grid_item";
}
}
description { state: "selected" 0.0;
inherit: "default" 0.0;
color: 255 255 255 255;
}
}
part { name: "fg1";
clip_to: "disclip";
mouse_events: 0;
description { state: "default" 0.0;
visible: 0;
color: 255 255 255 0;
rel1.offset: -3 -3;
rel2 {
relative: 1.0 0.5;
offset: 2 -1;
}
image {
normal: "bt_sm_hilight.png";
border: 6 6 6 0;
}
}
description { state: "selected" 0.0;
inherit: "default" 0.0;
visible: 1;
color: 255 255 255 255;
}
}
part { name: "fg2";
clip_to: "disclip";
mouse_events: 0;
description { state: "default" 0.0;
visible: 0;
color: 255 255 255 0;
rel1.offset: -3 -3;
rel2.offset: 2 2;
image {
normal: "bt_sm_shine.png";
border: 6 6 6 0;
}
}
description { state: "selected" 0.0;
inherit: "default" 0.0;
visible: 1;
color: 255 255 255 255;
}
}
part { name: "disclip";
type: RECT;
description { state: "default" 0.0;
rel1.to: "bg";
rel2.to: "bg";
}
description { state: "disabled" 0.0;
inherit: "default" 0.0;
color: 255 255 255 64;
}
}
}
programs {
program { name: "load";
signal: "load";
// script {
// new Float:val;
// custom_state(PART:"elm.swallow.icon.3", "default", 0.0);
// custom_state(PART:"elm.swallow.icon.1", "default", 0.0);
// val = randf();
// val = 40 * val - 20;
// set_state_val(PART:"elm.swallow.icon.3", STATE_MAP_ROT_Z, val);
// val = randf();
// val = 40 * val - 20;
// set_state_val(PART:"elm.swallow.icon.1", STATE_MAP_ROT_Z, val);
//set_state(PART:"elm.swallow.icon.1", "custom", 0.0);
// set_state(PART:"elm.swallow.icon.3", "custom", 0.0);
//}
}
program { name: "go_active";
signal: "elm,state,selected";
source: "elm";
action: STATE_SET "selected" 0.0;
target: "bg";
target: "fg1";
target: "fg2";
target: "elm.text";
}
program { name: "go_passive";
signal: "elm,state,unselected";
source: "elm";
action: STATE_SET "default" 0.0;
target: "bg";
target: "fg1";
target: "fg2";
target: "elm.text";
transition: LINEAR 0.1;
}
program { name: "go_disabled";
signal: "elm,state,disabled";
source: "elm";
action: STATE_SET "disabled" 0.0;
target: "disclip";
}
program { name: "go_enabled";
signal: "elm,state,enabled";
source: "elm";
action: STATE_SET "default" 0.0;
target: "disclip";
}
program {
signal: "elm,state,have_files,active";
source: "elm";
action: STATE_SET "visible" 0.0;
target: "have-files-clipper";
}
}
}
group { name: "elm/gengrid/item/ephoto-up/default";
data.item: "labels" "elm.text";
images {
image: "bt_sm_base1.png" COMP;
image: "bt_sm_shine.png" COMP;
image: "bt_sm_hilight.png" COMP;
image: "directory-up-512.png" COMP;
}
parts {
part { name: "event";
type: RECT;
repeat_events: 1;
description { state: "default" 0.0;
color: 0 0 0 0;
}
}
part { name: "bg";
clip_to: "disclip";
mouse_events: 0;
description { state: "default" 0.0;
visible: 0;
color: 255 255 255 0;
rel1.offset: -3 -3;
rel2.offset: 2 2;
image {
normal: "bt_sm_base1.png";
border: 6 6 6 6;
middle: SOLID;
}
}
description { state: "selected" 0.0;
inherit: "default" 0.0;
visible: 1;
color: 255 255 255 255;
}
}
part { name: "image";
type: IMAGE;
mouse_events: 0;
description { state: "default" 0.0;
aspect_preference: BOTH;
aspect: 1.0 1.0;
image.normal: "directory-up-512.png";
rel2 {
to_y: "elm.text";
relative: 1.0 0.0;
offset: -1 -2;
}
}
}
part { name: "elm.text";
clip_to: "disclip";
type: TEXT;
effect: SOFT_SHADOW;
mouse_events: 0;
scale: 1;
description { state: "default" 0.0;
rel1 {
relative: 0.0 1.0;
offset: 20 -30;
}
rel2 {
relative: 1.0 1.0;
offset: -21 -15;
}
color: 0 0 0 255;
color3: 0 0 0 0;
text {
font: "Sans";
size: 10;
min: 0 1;
align: 0.5 0.0;
text_class: "grid_item";
}
}
description { state: "selected" 0.0;
inherit: "default" 0.0;
color: 255 255 255 255;
}
}
part { name: "fg1";
clip_to: "disclip";
mouse_events: 0;
description { state: "default" 0.0;
visible: 0;
color: 255 255 255 0;
rel1.offset: -3 -3;
rel2 {
relative: 1.0 0.5;
offset: 2 -1;
}
image {
normal: "bt_sm_hilight.png";
border: 6 6 6 0;
}
}
description { state: "selected" 0.0;
inherit: "default" 0.0;
visible: 1;
color: 255 255 255 255;
}
}
part { name: "fg2";
clip_to: "disclip";
mouse_events: 0;
description { state: "default" 0.0;
visible: 0;
color: 255 255 255 0;
rel1.offset: -3 -3;
rel2.offset: 2 2;
image {
normal: "bt_sm_shine.png";
border: 6 6 6 0;
}
}
description { state: "selected" 0.0;
inherit: "default" 0.0;
visible: 1;
color: 255 255 255 255;
}
}
part { name: "disclip";
type: RECT;
description { state: "default" 0.0;
rel1.to: "bg";
rel2.to: "bg";
}
description { state: "disabled" 0.0;
inherit: "default" 0.0;
color: 255 255 255 64;
}
}
}
programs {
program { name: "go_active";
signal: "elm,state,selected";
source: "elm";
action: STATE_SET "selected" 0.0;
target: "bg";
target: "fg1";
target: "fg2";
target: "elm.text";
}
program { name: "go_passive";
signal: "elm,state,unselected";
source: "elm";
action: STATE_SET "default" 0.0;
target: "bg";
target: "fg1";
target: "fg2";
target: "elm.text";
transition: LINEAR 0.1;
}
program { name: "go_disabled";
signal: "elm,state,disabled";
source: "elm";
action: STATE_SET "disabled" 0.0;
target: "disclip";
}
program { name: "go_enabled";
signal: "elm,state,enabled";
source: "elm";
action: STATE_SET "default" 0.0;
target: "disclip";
}
}
}
}

View File

@ -1,2 +1,9 @@
MAINTAINERCLEANFILES = Makefile.in
EXTRA_DIST = \
thumb_shadow.png \
bt_sm_base1.png \
bt_sm_shine.png \
bt_sm_hilight.png \
directory-512.png \
directory-up-512.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 477 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

View File

@ -17,9 +17,10 @@ _sources = \
ephoto.c \
ephoto_main.c \
ephoto_config.c \
ephoto_list_browser.c \
ephoto_directory_thumb.c \
ephoto_thumb_browser.c \
ephoto_single_browser.c
ephoto_single_browser.c \
ephoto_slideshow.c
_libs = @ELEMENTARY_LIBS@ @EFREET_MIME_LIBS@ @EIO_LIBS@ @EXIF_LIBS@ @EET_LIBS@

View File

@ -29,7 +29,7 @@ elm_main(int argc, char **argv)
elm_need_ethumb();
elm_init(argc, argv);
elm_theme_extension_add(NULL, THEME_FILE);
elm_theme_extension_add(NULL, PACKAGE_DATA_DIR"/themes/default/ephoto.edj");
if (!efreet_mime_init())
fprintf(stderr, "Could not init efreet_mime!\n");

View File

@ -24,7 +24,6 @@
#define THEME_FILE PACKAGE_DATA_DIR"/themes/default/ephoto.edj"
/*Typedefs*/
typedef struct _Ephoto_Config Ephoto_Config;
typedef struct _Ephoto Ephoto;
typedef struct _Ephoto_Entry Ephoto_Entry;
@ -33,50 +32,48 @@ typedef struct _Ephoto_Event_Entry_Create Ephoto_Event_Entry_Create;
typedef enum _Ephoto_State Ephoto_State;
typedef enum _Ephoto_Orient Ephoto_Orient;
/*Main Gui Functions/Callbacks*/
Evas_Object *ephoto_window_add(const char *path);
void ephoto_title_set(Ephoto *ephoto, const char *title);
void ephoto_thumb_size_set(Ephoto *ephoto, int size);
Evas_Object *ephoto_thumb_add(Ephoto *ephoto, Evas_Object *parent, const char *path);
void ephoto_thumb_path_set(Evas_Object *o, const char *path);
Evas_Object *ephoto_list_icon_add(Ephoto *ephoto, Evas_Object *parent, const char *standard);
void ephoto_directory_set(Ephoto *ephoto, const char *path);
void ephoto_promote_list_browser(Ephoto *ephoto);
void ephoto_promote_thumb_browser(Ephoto *ephoto);
void ephoto_promote_single_browser(Ephoto *ephoto, Ephoto_Entry *e);
/*Get the exif orientation of a JPEG*/
Ephoto_Orient ephoto_file_orient_get(const char *path);
/*Config Functions/Callbacks*/
Eina_Bool ephoto_config_init(Ephoto *em);
void ephoto_config_save(Ephoto *em, Eina_Bool instant);
void ephoto_config_free(Ephoto *em);
/*List Browser*/
Evas_Object *ephoto_list_browser_add(Ephoto *ephoto, Evas_Object *parent);
void ephoto_list_browser_entry_set(Evas_Object *obj, Ephoto_Entry *entry);
/*Thumb Browser*/
Evas_Object *ephoto_thumb_browser_add(Ephoto *ephoto, Evas_Object *parent);
void ephoto_thumb_browser_entry_set(Evas_Object *obj, Ephoto_Entry *entry);
/*Single Browser*/
Evas_Object *ephoto_single_browser_add(Ephoto *ephoto, Evas_Object *parent);
void ephoto_single_browser_entry_set(Evas_Object *obj, Ephoto_Entry *entry);
void ephoto_single_browser_path_pending_set(Evas_Object *obj, const char *path);
/* smart callbacks called:
* "back" - the user want to go back to the previous screen.
*/
Evas_Object *ephoto_slideshow_add(Ephoto *ephoto, Evas_Object *parent);
void ephoto_slideshow_entry_set(Evas_Object *obj, Ephoto_Entry *entry);
/* smart callbacks called:
* "back" - the user want to go back to the previous screen.
*/
Evas_Object *ephoto_directory_thumb_add(Evas_Object *parent, Ephoto_Entry *e);
Evas_Object *ephoto_thumb_browser_add(Ephoto *ephoto, Evas_Object *parent);
/* smart callbacks called:
* "selected" - an item in the thumb browser is selected. The selected Ephoto_Entry is passed as event_info argument.
*/
/*Ephoto View*/
enum _Ephoto_State
{
EPHOTO_STATE_LIST,
EPHOTO_STATE_THUMB,
EPHOTO_STATE_SINGLE,
EPHOTO_STATE_SLIDESHOW
};
/*Ephoto Orientation*/
enum _Ephoto_Orient
enum _Ephoto_Orient /* matches with exif orientation tag */
{
EPHOTO_ORIENT_0 = 1,
EPHOTO_ORIENT_FLIP_HORIZ = 2,
@ -88,40 +85,41 @@ enum _Ephoto_Orient
EPHOTO_ORIENT_270 = 8
};
/*Ephoto Config*/
/* TODO: split into window & global config, allow multi window
*
* This also requires single instance, as 2 instances changing the
* same configuration will lead to problems.
*
* Single instance is better done as DBus, using FDO standard methods.
*/
struct _Ephoto_Config
{
int config_version;
int autohide_toolbar;
int best_fit_images;
const char *editor;
double slideshow_timeout;
const char *slideshow_transition;
/* these should be per-window */
int thumb_size;
int thumb_gen_size;
double slideshow_timeout;
const char *directory;
const char *slideshow_transition;
};
/*Ephoto Main*/
struct _Ephoto
{
Evas_Object *win;
Evas_Object *bg;
Evas_Object *overlay;
Evas_Object *layout;
Evas_Object *edje;
Evas_Object *pager;
Evas_Object *help_but;
Evas_Object *list_browser;
Evas_Object *thumb_browser;
Evas_Object *single_browser;
Evas_Object *slideshow;
Eina_List *entries;
Eina_List *thumbs;
Eina_List *dirs;
Eina_List *thumbs; /* live thumbs that need to be regenerated on changes */
int thumb_gen_size;
int thumb_gen_size; /* pending value for thumb_regen */
struct {
Ecore_Timer *thumb_regen;
} timer;
@ -137,16 +135,18 @@ struct _Ephoto
Ephoto_Config *config;
};
/*Ephoto Entry*/
struct _Ephoto_Entry
{
const char *path;
const char *basename;
const char *basename; /* pointer inside path */
const char *label;
Ephoto *ephoto;
Elm_Gengrid_Item *item;
Elm_Genlist_Item *list_item;
Eina_List *free_listeners;
Eina_List *dir_files; /* if dir, here contain files with preview */
Eina_Bool dir_files_checked : 1;
Eina_Bool is_dir : 1;
Eina_Bool is_up : 1;
};
struct _Ephoto_Event_Entry_Create
@ -154,24 +154,21 @@ struct _Ephoto_Event_Entry_Create
Ephoto_Entry *entry;
};
/*Ephoto Entry Functions/Callbacks*/
Ephoto_Entry *ephoto_entry_new(Ephoto *ephoto, const char *path, const char *label);
void ephoto_entry_free(Ephoto_Entry *entry);
void ephoto_entry_free_listener_add(Ephoto_Entry *entry, void (*cb)(void *data, const Ephoto_Entry *entry), const void *data);
void ephoto_entry_free_listener_del(Ephoto_Entry *entry, void (*cb)(void *data, const Ephoto_Entry *entry), const void *data);
void ephoto_entries_free(Ephoto *ephoto);
/*Ephoto Logging*/
extern int __log_domain;
#define DBG(...) EINA_LOG_DOM_DBG(__log_domain, __VA_ARGS__)
#define INF(...) EINA_LOG_DOM_INFO(__log_domain, __VA_ARGS__)
#define ERR(...) EINA_LOG_DOM_ERR(__log_domain, __VA_ARGS__)
/*Checks to determine if a file is an image*/
static inline Eina_Bool
_ephoto_eina_file_direct_info_image_useful(const Eina_File_Direct_Info *info)
{
const char *bname, *ext;
const char /* *type, */ *bname, *ext;
bname = info->path + info->name_start;
if (bname[0] == '.') return EINA_FALSE;
@ -185,23 +182,17 @@ _ephoto_eina_file_direct_info_image_useful(const Eina_File_Direct_Info *info)
ext++;
if ((strcasecmp(ext, "jpg") == 0) ||
(strcasecmp(ext, "jpeg") == 0) ||
(strcasecmp(ext, "png") == 0) ||
(strcasecmp(ext, "svg") == 0) ||
(strcasecmp(ext, "svgz") == 0) ||
(strcasecmp(ext, "bmp") == 0) ||
(strcasecmp(ext, "dib") == 0) ||
(strcasecmp(ext, "tiff") == 0) ||
(strcasecmp(ext, "tif") == 0) ||
(strcasecmp(ext, "psd") == 0))
(strcasecmp(ext, "png") == 0))
return EINA_TRUE;
}
return EINA_FALSE;
/* seems that this does not play nice with threads */
//if (!(type = efreet_mime_type_get(info->path))) return EINA_FALSE;
//return strncmp(type, "image/", sizeof("image/") - 1) == 0;
}
/*Ephoto Event Handlers*/
extern int EPHOTO_EVENT_ENTRY_CREATE_DIR;
extern int EPHOTO_EVENT_ENTRY_CREATE_THUMB;
extern int EPHOTO_EVENT_ENTRY_CREATE;
extern int EPHOTO_EVENT_POPULATE_START;
extern int EPHOTO_EVENT_POPULATE_END;
extern int EPHOTO_EVENT_POPULATE_ERROR;

View File

@ -1,6 +1,6 @@
#include "ephoto.h"
#define CONFIG_VERSION 6
#define CONFIG_VERSION 5
static int _ephoto_config_load(Ephoto *ephoto);
static Eina_Bool _ephoto_on_config_save(void *data);
@ -13,42 +13,52 @@ ephoto_config_init(Ephoto *ephoto)
{
Eet_Data_Descriptor_Class eddc;
if (!eet_eina_stream_data_descriptor_class_set
(&eddc, sizeof (eddc), "Ephoto_Config", sizeof(Ephoto_Config)))
if (!eet_eina_stream_data_descriptor_class_set(&eddc, sizeof (eddc), "Ephoto_Config", sizeof(Ephoto_Config)))
{
ERR("Unable to create the config data descriptor!");
return EINA_FALSE;
}
if (!edd) edd = eet_data_descriptor_stream_new(&eddc);
EET_DATA_DESCRIPTOR_ADD_BASIC
(edd, Ephoto_Config, "config_version", config_version, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC
(edd, Ephoto_Config, "autohide_toolbar", autohide_toolbar, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC
(edd, Ephoto_Config, "best_fit_images", best_fit_images, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC
(edd, Ephoto_Config, "thumb_gen_size", thumb_gen_size, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC
(edd, Ephoto_Config, "thumb_size", thumb_size, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC
(edd, Ephoto_Config, "slideshow_timeout", slideshow_timeout, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC
(edd, Ephoto_Config, "directory", directory, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC
(edd, Ephoto_Config, "slideshow_transition", slideshow_transition, EET_T_STRING);
#undef T
#undef D
#define T Ephoto_Config
#define D edd
#define C_VAL(edd, type, member, dtype) EET_DATA_DESCRIPTOR_ADD_BASIC(edd, type, #member, member, dtype)
C_VAL(D, T, config_version, EET_T_INT);
C_VAL(D, T, thumb_size, EET_T_INT);
C_VAL(D, T, thumb_gen_size, EET_T_INT);
C_VAL(D, T, directory, EET_T_STRING);
C_VAL(D, T, slideshow_timeout, EET_T_DOUBLE);
C_VAL(D, T, slideshow_transition, EET_T_STRING);
C_VAL(D, T, editor, EET_T_STRING);
switch (_ephoto_config_load(ephoto))
{
case 0:
/* Start a new config */
ephoto->config->config_version = CONFIG_VERSION;
ephoto->config->autohide_toolbar = 0;
ephoto->config->best_fit_images = 0;
ephoto->config->thumb_gen_size = 256;
ephoto->config->thumb_size = 256;
ephoto->config->thumb_gen_size = 256;
ephoto->config->slideshow_timeout = 4.0;
ephoto->config->slideshow_transition = eina_stringshare_add("fade");
ephoto->config->editor = eina_stringshare_add("gimp %s");
break;
case -1:
/* Incremental additions */
if (ephoto->config->config_version < 2)
{
ephoto->config->slideshow_timeout = 4.0;
ephoto->config->slideshow_transition = eina_stringshare_add("fade");
}
if (ephoto->config->config_version < 3)
ephoto->config->editor = eina_stringshare_add("gimp %s");
if (ephoto->config->config_version < 5)
ephoto->config->thumb_gen_size = 256;
ephoto->config->config_version = CONFIG_VERSION;
break;
default:
@ -102,25 +112,16 @@ _ephoto_config_load(Ephoto *ephoto)
ephoto->config = eet_data_read(ef, edd, "config");
eet_close(ef);
if (!ephoto->config)
{
DBG("Warning! No configuration found! Writing a new"
"default configuration!\n");
return 0;
}
else if (ephoto->config->config_version > CONFIG_VERSION)
if (ephoto->config->config_version > CONFIG_VERSION)
{
ephoto_config_free(ephoto);
ephoto->config = calloc(1, sizeof(Ephoto_Config));
return 0;
}
else if (ephoto->config->config_version < CONFIG_VERSION)
{
ephoto_config_free(ephoto);
ephoto->config = calloc(1, sizeof(Ephoto_Config));
return 0;
}
if (ephoto->config->config_version < CONFIG_VERSION)
return -1;
return 1;
}

View File

@ -0,0 +1,176 @@
#include "ephoto.h"
typedef struct _Ephoto_Directory_Thumb Ephoto_Directory_Thumb;
struct _Ephoto_Directory_Thumb
{
Eio_File *ls;
Eina_List *objs;
Ephoto_Entry *entry;
Eina_Bool canceled:1;
};
static Eina_Hash *_pending_dirs = NULL;
static void
_entry_free(void *data, const Ephoto_Entry *entry __UNUSED__)
{
Ephoto_Directory_Thumb *dt = data;
dt->entry = NULL;
}
static void
_ephoto_directory_thumb_free(Ephoto_Directory_Thumb *dt)
{
if (dt->entry)
{
ephoto_entry_free_listener_del(dt->entry, _entry_free, dt);
eina_hash_del(_pending_dirs, dt->entry->path, dt);
dt->entry = NULL;
}
if (dt->ls)
{
dt->canceled = EINA_TRUE;
eio_file_cancel(dt->ls);
return;
}
free(dt);
if (_pending_dirs)
{
if (!eina_hash_population(_pending_dirs))
{
eina_hash_free(_pending_dirs);
_pending_dirs = NULL;
}
}
}
static void
_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
{
Ephoto_Directory_Thumb *dt = data;
dt->objs = eina_list_remove(dt->objs, obj);
if (!dt->objs)
{
dt->canceled = EINA_TRUE;
_ephoto_directory_thumb_free(dt);
}
}
static Eina_Bool
_populate_filter(void *data __UNUSED__, Eio_File *handler __UNUSED__, const Eina_File_Direct_Info *info)
{
return _ephoto_eina_file_direct_info_image_useful(info);
}
static void
_populate_end(void *data, Eio_File *handler __UNUSED__)
{
Ephoto_Directory_Thumb *dt = data;
Evas_Object *obj;
dt->ls = NULL;
EINA_LIST_FREE(dt->objs, obj)
evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL, _obj_del, dt);
if (dt->entry)
{
dt->entry->dir_files_checked = EINA_TRUE;
if ((dt->entry->item) && (!dt->canceled))
elm_gengrid_item_update(dt->entry->item);
}
_ephoto_directory_thumb_free(dt);
}
static void
_populate_error(void *data, Eio_File *handler, int error)
{
Ephoto_Directory_Thumb *dt = data;
if (error) ERR("could not populate: %s", strerror(error));
_populate_end(dt, handler);
}
static void
_populate_main(void *data, Eio_File *handler __UNUSED__, const Eina_File_Direct_Info *info)
{
Ephoto_Directory_Thumb *dt = data;
Evas_Object *obj;
const char *file;
if (!dt->objs) return;
if (!dt->entry) return;
obj = dt->objs->data;
file = eina_stringshare_add(info->path);
DBG("populate thumbnail %p with path '%s'", obj, file);
dt->objs = eina_list_remove_list(dt->objs, dt->objs);
dt->entry->dir_files = eina_list_append(dt->entry->dir_files, file);
ephoto_thumb_path_set(obj, file);
evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL, _obj_del, dt);
if ((!dt->objs) && (dt->ls))
{
eio_file_cancel(dt->ls);
dt->ls = NULL;
}
}
Evas_Object *
ephoto_directory_thumb_add(Evas_Object *parent, Ephoto_Entry *entry)
{
Ephoto_Directory_Thumb *dt;
Evas_Object *obj;
if (_pending_dirs)
dt = eina_hash_find(_pending_dirs, entry->path);
else
{
dt = NULL;
_pending_dirs = eina_hash_stringshared_new(NULL);
EINA_SAFETY_ON_NULL_RETURN_VAL(_pending_dirs, NULL);
}
obj = ephoto_thumb_add(entry->ephoto, parent, NULL);
EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
if (!dt)
{
dt = calloc(1, sizeof(Ephoto_Directory_Thumb));
if (!dt)
{
ERR("could not allocate memory for Ephoto_Directory_Thumb");
evas_object_del(obj);
return NULL;
}
ephoto_entry_free_listener_add(entry, _entry_free, dt);
dt->entry = entry;
dt->ls = eio_file_direct_ls(entry->path,
_populate_filter,
_populate_main,
_populate_end,
_populate_error,
dt);
if (!dt->ls)
{
ERR("could not create eio_file_direct_ls(%s)", entry->path);
evas_object_del(obj);
free(dt);
return NULL;
}
eina_hash_add(_pending_dirs, entry->path, dt);
DBG("start thread to lookup inside '%s' for thumbnails.", entry->path);
}
else
DBG("thread already started, wait for thumbnails in '%s'", entry->path);
dt->objs = eina_list_append(dt->objs, obj);
evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _obj_del, dt);
return obj;
}

View File

@ -1,7 +1,6 @@
#include "ephoto.h"
int EPHOTO_EVENT_ENTRY_CREATE_DIR = 0;
int EPHOTO_EVENT_ENTRY_CREATE_THUMB = 0;
int EPHOTO_EVENT_ENTRY_CREATE = 0;
int EPHOTO_EVENT_POPULATE_START = 0;
int EPHOTO_EVENT_POPULATE_END = 0;
int EPHOTO_EVENT_POPULATE_ERROR = 0;
@ -21,18 +20,93 @@ _ephoto_state_set(Ephoto *ephoto, Ephoto_State state)
}
static void
_back_clicked(void *data, Evas_Object *o __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
_ephoto_thumb_browser_show(Ephoto *ephoto, Ephoto_Entry *entry)
{
DBG("entry '%s'", entry ? entry->path : "");
ephoto_single_browser_entry_set(ephoto->single_browser, NULL);
ephoto_slideshow_entry_set(ephoto->slideshow, NULL);
elm_pager_content_promote(ephoto->pager, ephoto->thumb_browser);
_ephoto_state_set(ephoto, EPHOTO_STATE_THUMB);
if ((entry) && (entry->item)) elm_gengrid_item_bring_in(entry->item);
}
static void
_ephoto_single_browser_show(Ephoto *ephoto, Ephoto_Entry *entry)
{
DBG("entry '%s'", entry->path);
ephoto_single_browser_entry_set(ephoto->single_browser, entry);
elm_pager_content_promote(ephoto->pager, ephoto->single_browser);
_ephoto_state_set(ephoto, EPHOTO_STATE_SINGLE);
}
static void
_ephoto_slideshow_show(Ephoto *ephoto, Ephoto_Entry *entry)
{
DBG("entry '%s'", entry->path);
ephoto_slideshow_entry_set(ephoto->slideshow, entry);
elm_pager_content_promote(ephoto->pager, ephoto->slideshow);
_ephoto_state_set(ephoto, EPHOTO_STATE_SLIDESHOW);
}
static void
_ephoto_single_browser_back(void *data, Evas_Object *obj __UNUSED__, void *event_info)
{
Ephoto *ephoto = data;
Ephoto_Entry *entry = event_info;
_ephoto_thumb_browser_show(ephoto, entry);
}
switch (ephoto->state)
static void
_ephoto_slideshow_back(void *data, Evas_Object *obj __UNUSED__, void *event_info)
{
Ephoto *ephoto = data;
Ephoto_Entry *entry = event_info;
switch (ephoto->prev_state)
{
case EPHOTO_STATE_SINGLE : ephoto_promote_thumb_browser(ephoto); break;
case EPHOTO_STATE_THUMB : ephoto_promote_list_browser(ephoto); break;
case EPHOTO_STATE_LIST : break;
default : break;
case EPHOTO_STATE_SINGLE:
_ephoto_single_browser_show(ephoto, entry);
break;
case EPHOTO_STATE_THUMB:
_ephoto_thumb_browser_show(ephoto, entry);
break;
default:
ERR("unhandled previous state %d", ephoto->prev_state);
}
ephoto_title_set(ephoto, ephoto->config->directory);
elm_win_fullscreen_set(ephoto->win, EINA_FALSE);
}
static void
_ephoto_thumb_browser_view(void *data, Evas_Object *obj __UNUSED__, void *event_info)
{
Ephoto *ephoto = data;
Ephoto_Entry *entry = event_info;
_ephoto_single_browser_show(ephoto, entry);
}
static void
_ephoto_thumb_browser_changed_directory(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
Ephoto *ephoto = data;
ephoto_single_browser_entry_set(ephoto->single_browser, NULL);
ephoto_slideshow_entry_set(ephoto->slideshow, NULL);
}
static void
_ephoto_thumb_browser_slideshow(void *data, Evas_Object *obj __UNUSED__, void *event_info)
{
Ephoto *ephoto = data;