|
|
|
#include "ephoto.h"
|
|
|
|
|
|
|
|
int EPHOTO_EVENT_ENTRY_CREATE = 0;
|
|
|
|
int EPHOTO_EVENT_POPULATE_START = 0;
|
|
|
|
int EPHOTO_EVENT_POPULATE_END = 0;
|
|
|
|
int EPHOTO_EVENT_POPULATE_ERROR = 0;
|
|
|
|
int EPHOTO_EVENT_EDITOR_RESET = 0;
|
|
|
|
int EPHOTO_EVENT_EDITOR_APPLY = 0;
|
|
|
|
int EPHOTO_EVENT_EDITOR_CANCEL = 0;
|
|
|
|
int EPHOTO_EVENT_EDITOR_BACK = 0;
|
|
|
|
|
|
|
|
typedef struct _Ephoto_Entry_Free_Listener Ephoto_Entry_Free_Listener;
|
|
|
|
struct _Ephoto_Entry_Free_Listener
|
|
|
|
{
|
|
|
|
void (*cb)(void *data, const Ephoto_Entry *dead);
|
|
|
|
const void *data;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _Ephoto_Dir_Data Ephoto_Dir_Data;
|
|
|
|
struct _Ephoto_Dir_Data
|
|
|
|
{
|
|
|
|
Ephoto *ephoto;
|
|
|
|
Elm_Object_Item *expanded;
|
|
|
|
Eina_Bool dirs_only;
|
|
|
|
Eina_Bool thumbs_only;
|
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
|
|
|
_ephoto_state_set(Ephoto *ephoto, Ephoto_State state)
|
|
|
|
{
|
|
|
|
ephoto->prev_state = ephoto->state;
|
|
|
|
ephoto->state = state;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_ephoto_thumb_browser_show(Ephoto *ephoto, Ephoto_Entry *entry)
|
|
|
|
{
|
|
|
|
evas_object_hide(ephoto->slideshow);
|
|
|
|
evas_object_hide(ephoto->single_browser);
|
|
|
|
evas_object_show(ephoto->thumb_browser);
|
|
|
|
elm_object_focus_set(ephoto->thumb_browser, EINA_TRUE);
|
|
|
|
_ephoto_state_set(ephoto, EPHOTO_STATE_THUMB);
|
|
|
|
ephoto_title_set(ephoto, ephoto->config->directory);
|
|
|
|
ephoto_thumb_browser_update_info_label(ephoto);
|
|
|
|
evas_object_show(ephoto->statusbar);
|
|
|
|
elm_box_clear(ephoto->controls_left);
|
|
|
|
elm_box_clear(ephoto->controls_right);
|
|
|
|
ephoto_thumb_browser_show_controls(ephoto);
|
|
|
|
evas_object_freeze_events_set(ephoto->single_browser, EINA_TRUE);
|
|
|
|
evas_object_freeze_events_set(ephoto->slideshow, EINA_TRUE);
|
|
|
|
evas_object_freeze_events_set(ephoto->thumb_browser, EINA_FALSE);
|
|
|
|
if ((entry) && (entry->item))
|
|
|
|
{
|
|
|
|
Eina_List *l;
|
|
|
|
Elm_Object_Item *it;
|
|
|
|
|
|
|
|
l = eina_list_clone(elm_gengrid_selected_items_get(entry->gengrid));
|
|
|
|
if (eina_list_count(l) <= 1)
|
|
|
|
{
|
|
|
|
EINA_LIST_FREE(l, it)
|
|
|
|
elm_gengrid_item_selected_set(it, EINA_FALSE);
|
|
|
|
elm_gengrid_item_bring_in(entry->item, ELM_GENGRID_ITEM_SCROLLTO_IN);
|
|
|
|
elm_gengrid_item_selected_set(entry->item, EINA_TRUE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ephoto_single_browser_entry_set(ephoto->single_browser, NULL);
|
|
|
|
ephoto_slideshow_entry_set(ephoto->slideshow, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_ephoto_single_browser_show(Ephoto *ephoto, Ephoto_Entry *entry)
|
|
|
|
{
|
|
|
|
if (ephoto->selentries)
|
|
|
|
ephoto_single_browser_entries_set(ephoto->single_browser,
|
|
|
|
ephoto->selentries);
|
|
|
|
else if (ephoto->searchentries)
|
|
|
|
ephoto_single_browser_entries_set(ephoto->single_browser,
|
|
|
|
ephoto->searchentries);
|
|
|
|
else
|
|
|
|
ephoto_single_browser_entries_set(ephoto->single_browser,
|
|
|
|
ephoto->entries);
|
|
|
|
|
|
|
|
ephoto_single_browser_entry_set(ephoto->single_browser, entry);
|
|
|
|
evas_object_hide(ephoto->slideshow);
|
|
|
|
evas_object_show(ephoto->single_browser);
|
|
|
|
evas_object_hide(ephoto->thumb_browser);
|
|
|
|
elm_object_focus_set(ephoto->single_browser, EINA_TRUE);
|
|
|
|
_ephoto_state_set(ephoto, EPHOTO_STATE_SINGLE);
|
|
|
|
evas_object_show(ephoto->statusbar);
|
|
|
|
elm_box_clear(ephoto->controls_left);
|
|
|
|
elm_box_clear(ephoto->controls_right);
|
|
|
|
ephoto_single_browser_show_controls(ephoto);
|
|
|
|
evas_object_freeze_events_set(ephoto->thumb_browser, EINA_TRUE);
|
|
|
|
evas_object_freeze_events_set(ephoto->slideshow, EINA_TRUE);
|
|
|
|
evas_object_freeze_events_set(ephoto->single_browser, EINA_FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_ephoto_slideshow_show(Ephoto *ephoto, Ephoto_Entry *entry)
|
|
|
|
{
|
|
|
|
_ephoto_state_set(ephoto, EPHOTO_STATE_SLIDESHOW);
|
|
|
|
ephoto_slideshow_show_controls(ephoto);
|
|
|
|
if (ephoto->selentries)
|
|
|
|
ephoto_slideshow_entries_set(ephoto->slideshow, ephoto->selentries);
|
|
|
|
else if (ephoto->searchentries)
|
|
|
|
ephoto_slideshow_entries_set(ephoto->slideshow, ephoto->searchentries);
|
|
|
|
else
|
|
|
|
ephoto_slideshow_entries_set(ephoto->slideshow, ephoto->entries);
|
|
|
|
ephoto_slideshow_entry_set(ephoto->slideshow, entry);
|
|
|
|
evas_object_show(ephoto->slideshow);
|
|
|
|
evas_object_hide(ephoto->single_browser);
|
|
|
|
evas_object_hide(ephoto->thumb_browser);
|
|
|
|
elm_object_focus_set(ephoto->slideshow, EINA_TRUE);
|
|
|
|
elm_table_unpack(ephoto->main, ephoto->statusbar);
|
|
|
|
evas_object_hide(ephoto->dir_browser);
|
|
|
|
elm_box_unpack(ephoto->layout, ephoto->dir_browser);
|
|
|
|
evas_object_hide(ephoto->statusbar);
|
|
|
|
evas_object_freeze_events_set(ephoto->single_browser, EINA_TRUE);
|
|
|
|
evas_object_freeze_events_set(ephoto->thumb_browser, EINA_TRUE);
|
|
|
|
evas_object_freeze_events_set(ephoto->slideshow, EINA_FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_ephoto_single_browser_back(void *data, Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info)
|
|
|
|
{
|
|
|
|
Ephoto *ephoto = data;
|
|
|
|
Ephoto_Entry *entry = event_info;
|
|
|
|
|
|
|
|
ephoto->selentries = NULL;
|
|
|
|
_ephoto_thumb_browser_show(ephoto, entry);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_ephoto_slideshow_back(void *data, Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info)
|
|
|
|
{
|
|
|
|
Ephoto *ephoto = data;
|
|
|
|
Ephoto_Entry *entry = event_info;
|
|
|
|
|
|
|
|
switch (ephoto->prev_state)
|
|
|
|
{
|
|
|
|
case EPHOTO_STATE_SINGLE:
|
|
|
|
_ephoto_single_browser_show(ephoto, entry);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EPHOTO_STATE_THUMB:
|
|
|
|
ephoto->selentries = NULL;
|
|
|
|
_ephoto_thumb_browser_show(ephoto, entry);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
ephoto->selentries = NULL;
|
|
|
|
_ephoto_thumb_browser_show(ephoto, entry);
|
|
|
|
}
|
|
|
|
if (ephoto->folders_toggle)
|
|
|
|
{
|
|
|
|
evas_object_show(ephoto->dir_browser);
|
|
|
|
elm_box_pack_start(ephoto->layout, ephoto->dir_browser);
|
|
|
|
}
|
|
|
|
elm_table_pack(ephoto->main, ephoto->statusbar, 0, 2, 1, 1);
|
|
|
|
evas_object_show(ephoto->statusbar);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_ephoto_thumb_browser_view(void *data, Evas_Object *obj EINA_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 EINA_UNUSED, void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Ephoto *ephoto = data;
|
|
|
|
|
|
|
|
ephoto->selentries = NULL;
|
|
|
|
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 EINA_UNUSED,
|
|
|
|
void *event_info)
|
|
|
|
{
|
|
|
|
Ephoto *ephoto = data;
|
|
|
|
Ephoto_Entry *entry = event_info;
|
|
|
|
|
|
|
|
_ephoto_slideshow_show(ephoto, entry);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_ephoto_single_browser_slideshow(void *data, Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info)
|
|
|
|
{
|
|
|
|
Ephoto *ephoto = data;
|
|
|
|
Ephoto_Entry *entry = event_info;
|
|
|
|
|
|
|
|
_ephoto_slideshow_show(ephoto, entry);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_win_free(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Ephoto *ephoto = data;
|
|
|
|
Ecore_Event_Handler *handler;
|
|
|
|
|
|
|
|
if (ephoto->file_thread)
|
|
|
|
ecore_thread_cancel(ephoto->file_thread);
|
|
|
|
if (eina_list_count(ephoto->file_pos))
|
|
|
|
eina_list_free(ephoto->file_pos);
|
|
|
|
if (ephoto->upload_handlers)
|
|
|
|
EINA_LIST_FREE(ephoto->upload_handlers, handler)
|
|
|
|
ecore_event_handler_del(handler);
|
|
|
|
if (ephoto->url_up)
|
|
|
|
ecore_con_url_free(ephoto->url_up);
|
|
|
|
if (ephoto->url_ret)
|
|
|
|
free(ephoto->url_ret);
|
|
|
|
if (ephoto->upload_error)
|
|
|
|
free(ephoto->upload_error);
|
|
|
|
if (ephoto->top_directory)
|
|
|
|
eina_stringshare_del(ephoto->top_directory);
|
|
|
|
if (ephoto->config_path)
|
|
|
|
eina_stringshare_del(ephoto->config_path);
|
|
|
|
if (ephoto->trash_path)
|
|
|
|
eina_stringshare_del(ephoto->trash_path);
|
|
|
|
if (ephoto->timer.thumb_regen)
|
|
|
|
ecore_timer_del(ephoto->timer.thumb_regen);
|
|
|
|
if (ephoto->monitor)
|
|
|
|
{
|
|
|
|
eio_monitor_del(ephoto->monitor);
|
|
|
|
EINA_LIST_FREE(ephoto->monitor_handlers, handler)
|
|
|
|
ecore_event_handler_del(handler);
|
|
|
|
}
|
|
|
|
ephoto_entries_free(ephoto);
|
|
|
|
ephoto_config_save(ephoto);
|
|
|
|
free(ephoto->config);
|
|
|
|
free(ephoto);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_resize_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Ephoto *ephoto = data;
|
|
|
|
Evas_Coord w, h;
|
|
|
|
|
|
|
|
if (elm_win_fullscreen_get(ephoto->win))
|
|
|
|
return;
|
|
|
|
evas_object_geometry_get(ephoto->win, 0, 0, &w, &h);
|
|
|
|
if (w && h)
|
|
|
|
{
|
|
|
|
ephoto->config->window_width = w;
|
|
|
|
ephoto->config->window_height = h;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_folder_icon_clicked(void *data, Evas_Object *obj,
|
|
|
|
void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Ephoto *ephoto = data;
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
if (!ephoto->folders_toggle)
|
|
|
|
{
|
|
|
|
evas_object_show(ephoto->dir_browser);
|
|
|
|
elm_box_pack_start(ephoto->layout, ephoto->dir_browser);
|
|
|
|
ephoto->folders_toggle = EINA_TRUE;
|
|
|
|
ret = elm_icon_standard_set(ephoto->folders_icon, "folder-open");
|
|
|
|
if (!ret)
|
|
|
|
elm_object_text_set(obj, _("Hide Folders"));
|
|
|
|
elm_object_tooltip_text_set(obj, _("Hide Folders"));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_object_hide(ephoto->dir_browser);
|
|
|
|
elm_box_unpack(ephoto->layout, ephoto->dir_browser);
|
|
|
|
ephoto->folders_toggle = EINA_FALSE;
|
|
|
|
ret = elm_icon_standard_set(ephoto->folders_icon, "folder");
|
|
|
|
if (!ret)
|
|
|
|
elm_object_text_set(obj, _("Show Folders"));
|
|
|
|
elm_object_tooltip_text_set(obj, _("Show Folders"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*Ephoto Thumb Browser Main Callbacks*/
|
|
|
|
static void
|
|
|
|
_slideshow_icon_clicked(void *data, Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Ephoto *ephoto = data;
|
|
|
|
|
|
|
|
if (ephoto->state == EPHOTO_STATE_THUMB)
|
|
|
|
ephoto_thumb_browser_slideshow(ephoto->thumb_browser);
|
|
|
|
else if (ephoto->state == EPHOTO_STATE_SINGLE)
|
|
|
|
ephoto_single_browser_slideshow(ephoto->single_browser);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_settings_icon_clicked(void *data, Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Ephoto *ephoto = data;
|
|
|
|
|
|
|
|
ephoto_config_main(ephoto);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_exit_icon_clicked(void *data, Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Ephoto *ephoto = data;
|
|
|
|
|
|
|
|
evas_object_del(ephoto->win);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*Toggle determines whether to toggle folder visibility, or just force visible*/
|
|
|
|
void
|
|
|
|
ephoto_show_folders(Ephoto *ephoto, Eina_Bool toggle)
|
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
if (!ephoto->folders_toggle || !toggle)
|
|
|
|
{
|
|
|
|
evas_object_show(ephoto->dir_browser);
|
|
|
|
elm_box_pack_end(ephoto->layout, ephoto->dir_browser);
|
|
|
|
ephoto->folders_toggle = EINA_TRUE;
|
|
|
|
ret = elm_icon_standard_set(ephoto->folders_icon, "folder-open");
|
|
|
|
if (!ret)
|
|
|
|
elm_object_text_set(ephoto->folders_button, _("Hide Folders"));
|
|
|
|
elm_object_tooltip_text_set(ephoto->folders_button, _("Hide Folders"));
|
|
|
|
}
|
|
|
|
else if (ephoto->folders_toggle)
|
|
|
|
{
|
|
|
|
evas_object_hide(ephoto->dir_browser);
|
|
|
|
elm_box_unpack(ephoto->layout, ephoto->dir_browser);
|
|
|
|
ephoto->folders_toggle = EINA_FALSE;
|
|
|
|
ret = elm_icon_standard_set(ephoto->folders_icon, "folder");
|
|
|
|
if (!ret)
|
|
|
|
elm_object_text_set(ephoto->folders_button, _("Show Folders"));
|
|
|
|
elm_object_tooltip_text_set(ephoto->folders_button, _("Show Folders"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Evas_Object *
|
|
|
|
ephoto_window_add(const char *path)
|
|
|
|
{
|
|
|
|
Ephoto *ephoto = calloc(1, sizeof(Ephoto));
|
|
|
|
Evas_Object *ic, *but;
|
|
|
|
char buf[PATH_MAX], config[PATH_MAX], trash[PATH_MAX];
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(ephoto, NULL);
|
|
|
|
|
|
|
|
EPHOTO_EVENT_ENTRY_CREATE = ecore_event_type_new();
|
|
|
|
EPHOTO_EVENT_POPULATE_START = ecore_event_type_new();
|
|
|
|
EPHOTO_EVENT_POPULATE_END = ecore_event_type_new();
|
|
|
|
EPHOTO_EVENT_POPULATE_ERROR = ecore_event_type_new();
|
|
|
|
EPHOTO_EVENT_EDITOR_RESET = ecore_event_type_new();
|
|
|
|
EPHOTO_EVENT_EDITOR_APPLY = ecore_event_type_new();
|
|
|
|
EPHOTO_EVENT_EDITOR_CANCEL = ecore_event_type_new();
|
|
|
|
EPHOTO_EVENT_EDITOR_BACK = ecore_event_type_new();
|
|
|
|
|
|
|
|
ephoto->selentries = NULL;
|
|
|
|
ephoto->folders_toggle = EINA_FALSE;
|
|
|
|
ephoto->entries = NULL;
|
|
|
|
ephoto->sort = EPHOTO_SORT_ALPHABETICAL_ASCENDING;
|
|
|
|
ephoto->win = elm_win_util_standard_add("ephoto", "Ephoto");
|
|
|
|
if (!ephoto->win)
|
|
|
|
{
|
|
|
|
free(ephoto);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
evas_object_event_callback_add(ephoto->win, EVAS_CALLBACK_FREE,
|
|
|
|
_win_free, ephoto);
|
|
|
|
evas_object_event_callback_add(ephoto->win, EVAS_CALLBACK_RESIZE,
|
|
|
|
_resize_cb, ephoto);
|
|
|
|
elm_win_autodel_set(ephoto->win, EINA_TRUE);
|
|
|
|
|
|
|
|
if (!ephoto_config_init(ephoto))
|
|
|
|
{
|
|
|
|
evas_object_del(ephoto->win);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((ephoto->config->thumb_gen_size != 128) &&
|
|
|
|
(ephoto->config->thumb_gen_size != 256) &&
|
|
|
|
(ephoto->config->thumb_gen_size != 512))
|
|
|
|
ephoto_thumb_size_set(ephoto, ephoto->config->thumb_size);
|
|
|
|
|
|
|
|
ephoto->main = elm_table_add(ephoto->win);
|
|
|
|
elm_table_homogeneous_set(ephoto->main, EINA_FALSE);
|
|
|
|
EPHOTO_EXPAND(ephoto->main);
|
|
|
|
EPHOTO_FILL(ephoto->main);
|
|
|
|
elm_win_resize_object_add(ephoto->win, ephoto->main);
|
|
|
|
evas_object_show(ephoto->main);
|
|
|
|
|
|
|
|
ephoto->layout = elm_box_add(ephoto->main);
|
|
|
|
elm_box_horizontal_set(ephoto->layout, EINA_TRUE);
|
|
|
|
elm_box_homogeneous_set(ephoto->layout, EINA_FALSE);
|
|
|
|
EPHOTO_EXPAND(ephoto->layout);
|
|
|
|
EPHOTO_FILL(ephoto->layout);
|
|
|
|
elm_table_pack(ephoto->main, ephoto->layout, 0, 0, 1, 2);
|
|
|
|
evas_object_show(ephoto->layout);
|
|
|
|
|
|
|
|
ephoto->pager = elm_table_add(ephoto->layout);
|
|
|
|
EPHOTO_EXPAND(ephoto->pager);
|
|
|
|
EPHOTO_FILL(ephoto->pager);
|
|
|
|
elm_box_pack_end(ephoto->layout, ephoto->pager);
|
|
|
|
evas_object_show(ephoto->pager);
|
|
|
|
|
|
|
|
ephoto->thumb_browser = ephoto_thumb_browser_add(ephoto, ephoto->layout);
|
|
|
|
if (!ephoto->thumb_browser)
|
|
|
|
{
|
|
|
|
evas_object_del(ephoto->win);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
elm_table_pack(ephoto->pager, ephoto->thumb_browser, 0, 0, 1, 1);
|
|
|
|
evas_object_smart_callback_add(ephoto->thumb_browser, "view",
|
|
|
|
_ephoto_thumb_browser_view, ephoto);
|
|
|
|
evas_object_smart_callback_add(ephoto->thumb_browser, "changed,directory",
|
|
|
|
_ephoto_thumb_browser_changed_directory, ephoto);
|
|
|
|
evas_object_smart_callback_add(ephoto->thumb_browser, "slideshow",
|
|
|
|
_ephoto_thumb_browser_slideshow, ephoto);
|
|
|
|
|
|
|
|
ephoto->single_browser = ephoto_single_browser_add(ephoto, ephoto->layout);
|
|
|
|
if (!ephoto->single_browser)
|
|
|
|
{
|
|
|
|
evas_object_del(ephoto->win);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
elm_table_pack(ephoto->pager, ephoto->single_browser, 0, 0, 1, 1);
|
|
|
|
evas_object_smart_callback_add(ephoto->single_browser, "back",
|
|
|
|
_ephoto_single_browser_back, ephoto);
|
|
|
|
evas_object_smart_callback_add(ephoto->single_browser, "slideshow",
|
|
|
|
_ephoto_single_browser_slideshow, ephoto);
|
|
|
|
ephoto->slideshow = ephoto_slideshow_add(ephoto, ephoto->layout);
|
|
|
|
if (!ephoto->slideshow)
|
|
|
|
{
|
|
|
|
evas_object_del(ephoto->win);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
elm_table_pack(ephoto->pager, ephoto->slideshow, 0, 0, 1, 1);
|
|
|
|
evas_object_smart_callback_add(ephoto->slideshow, "back",
|
|
|
|
_ephoto_slideshow_back, ephoto);
|
|
|
|
|
|
|
|
ephoto->dir_browser = ephoto_directory_browser_add(ephoto, ephoto->layout);
|
|
|
|
EPHOTO_WEIGHT(ephoto->dir_browser, ephoto->config->left_size, EVAS_HINT_EXPAND);
|
|
|
|
EPHOTO_FILL(ephoto->dir_browser);
|
|
|
|
elm_box_pack_start(ephoto->layout, ephoto->dir_browser);
|
|
|
|
evas_object_show(ephoto->dir_browser);
|
|
|
|
|
|
|
|
ephoto->statusbar = elm_box_add(ephoto->main);
|
|
|
|
evas_object_size_hint_min_set(ephoto->statusbar, 20 * elm_config_scale_get(),
|
|
|
|
20 * elm_config_scale_get());
|
|
|
|
elm_box_horizontal_set(ephoto->statusbar, EINA_TRUE);
|
|
|
|
EPHOTO_WEIGHT(ephoto->statusbar, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
|
|
|
|
EPHOTO_FILL(ephoto->statusbar);
|
|
|
|
elm_table_pack(ephoto->main, ephoto->statusbar, 0, 2, 1, 1);
|
|
|
|
evas_object_show(ephoto->statusbar);
|
|
|
|
|
|
|
|
ic = elm_icon_add(ephoto->statusbar);
|
|
|
|
evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(),
|
|
|
|
20 * elm_config_scale_get());
|
|
|
|
ret = elm_icon_standard_set(ic, "folder");
|
|
|
|
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
|
|
|
|
ephoto->folders_icon = ic;
|
|
|
|
|
|
|
|
but = elm_button_add(ephoto->statusbar);
|
|
|
|
elm_object_part_content_set(but, "icon", ic);
|
|
|
|
if (!ret)
|
|
|
|
elm_object_text_set(but, _("Show Folders"));
|
|
|
|
evas_object_smart_callback_add(but, "clicked", _folder_icon_clicked, ephoto);
|
|
|
|
elm_object_tooltip_text_set(but, _("Show Folders"));
|
|
|
|
elm_object_tooltip_orient_set(but, ELM_TOOLTIP_ORIENT_RIGHT);
|
|
|
|
elm_box_pack_end(ephoto->statusbar, but);
|
|
|
|
evas_object_show(but);
|
|
|
|
ephoto->folders_button = but;
|
|
|
|
|
|
|
|
ephoto->controls_left = elm_box_add(ephoto->statusbar);
|
|
|
|
elm_box_horizontal_set(ephoto->controls_left, EINA_TRUE);
|
|
|
|
EPHOTO_WEIGHT(ephoto->controls_left, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
EPHOTO_FILL(ephoto->controls_left);
|
|
|
|
elm_box_pack_end(ephoto->statusbar, ephoto->controls_left);
|
|
|
|
evas_object_show(ephoto->controls_left);
|
|
|
|
|
|
|
|
ephoto->infolabel = elm_label_add(ephoto->statusbar);
|
|
|
|
elm_object_style_set(ephoto->infolabel, "info");
|
|
|
|
elm_label_line_wrap_set(ephoto->infolabel, ELM_WRAP_MIXED);
|
|
|
|
elm_label_ellipsis_set(ephoto->infolabel, EINA_TRUE);
|
|
|
|
elm_object_text_set(ephoto->infolabel, _("Information"));
|
|
|
|
EPHOTO_EXPAND(ephoto->infolabel);
|
|
|
|
EPHOTO_FILL(ephoto->infolabel);
|
|
|
|
|
|
|
|
elm_box_pack_end(ephoto->statusbar, ephoto->infolabel);
|
|
|
|
evas_object_show(ephoto->infolabel);
|
|
|
|
|
|
|
|
ephoto->controls_right = elm_box_add(ephoto->statusbar);
|
|
|
|
elm_box_horizontal_set(ephoto->controls_right, EINA_TRUE);
|
|
|
|
EPHOTO_WEIGHT(ephoto->controls_right, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
EPHOTO_FILL(ephoto->controls_right);
|
|
|
|
elm_box_pack_end(ephoto->statusbar, ephoto->controls_right);
|
|
|
|
evas_object_show(ephoto->controls_right);
|
|
|
|
|
|
|
|
ic = elm_icon_add(ephoto->statusbar);
|
|
|
|
evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(),
|
|
|
|
20 * elm_config_scale_get());
|
|
|
|
ret = elm_icon_standard_set(ic, "media-playback-start");
|
|
|
|
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
|
|
|
|
|
|
|
|
but = elm_button_add(ephoto->statusbar);
|
|
|
|
elm_object_part_content_set(but, "icon", ic);
|
|
|
|
if (!ret)
|
|
|
|
elm_object_text_set(but, _("Slideshow"));
|
|
|
|
evas_object_smart_callback_add(but, "clicked",
|
|
|
|
_slideshow_icon_clicked, ephoto);
|
|
|
|
elm_object_tooltip_text_set(but, _("Slideshow"));
|
|
|
|
elm_object_tooltip_orient_set(but, ELM_TOOLTIP_ORIENT_TOP);
|
|
|
|
elm_box_pack_end(ephoto->statusbar, but);
|
|
|
|
evas_object_show(but);
|
|
|
|
|
|
|
|
ic = elm_icon_add(ephoto->statusbar);
|
|
|
|
evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(),
|
|
|
|
20 * elm_config_scale_get());
|
|
|
|
ret = elm_icon_standard_set(ic, "preferences-other");
|
|
|
|
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
|
|
|
|
|
|
|
|
but = elm_button_add(ephoto->statusbar);
|
|
|
|
elm_object_part_content_set(but, "icon", ic);
|
|
|
|
if (!ret)
|
|
|
|
elm_object_text_set(but, _("Settings"));
|
|
|
|
evas_object_smart_callback_add(but, "clicked",
|
|
|
|
_settings_icon_clicked, ephoto);
|
|
|
|
elm_object_tooltip_text_set(but, _("Settings"));
|
|
|
|
elm_object_tooltip_orient_set(but, ELM_TOOLTIP_ORIENT_TOP);
|
|
|
|
elm_box_pack_end(ephoto->statusbar, but);
|
|
|
|
evas_object_show(but);
|
|
|
|
|
|
|
|
ic = elm_icon_add(ephoto->statusbar);
|
|
|
|
evas_object_size_hint_min_set(ic, 20 * elm_config_scale_get(),
|
|
|
|
20 * elm_config_scale_get());
|
|
|
|
ret = elm_icon_standard_set(ic, "application-exit");
|
|
|
|
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
|
|
|
|
|
|
|
|
ephoto->exit = elm_button_add(ephoto->statusbar);
|
|
|
|
elm_object_part_content_set(ephoto->exit, "icon", ic);
|
|
|
|
if (!ret)
|
|
|
|
elm_object_text_set(ephoto->exit, _("Exit"));
|
|
|
|
evas_object_smart_callback_add(ephoto->exit, "clicked",
|
|
|
|
_exit_icon_clicked, ephoto);
|
|
|
|
elm_object_tooltip_text_set(ephoto->exit, _("Exit"));
|
|
|
|
elm_object_tooltip_orient_set(ephoto->exit, ELM_TOOLTIP_ORIENT_TOP);
|
|
|
|
evas_object_hide(ephoto->exit);
|
|
|
|
|
|
|
|
if ((!path) || (!ecore_file_exists(path)))
|
|
|
|
{
|
|
|
|
if (ephoto->config->open)
|
|
|
|
{
|
|
|
|
if (!strcmp(ephoto->config->open, "Last"))
|
|
|
|
path = ephoto->config->directory;
|
|
|
|
else
|
|
|
|
path = ephoto->config->open;
|
|
|
|
if ((path) && (!ecore_file_exists(path)))
|
|
|
|
path = NULL;
|
|
|
|
}
|
|
|