Preferences dialog. Users can change the slideshow parameters, and tell ephoto to start from the last remembered dir, if it was started with no arguments
SVN revision: 52464
This commit is contained in:
parent
574483bb47
commit
ca05627df0
|
@ -192,18 +192,18 @@ AC_ARG_ENABLE([libexif],
|
||||||
AC_MSG_CHECKING([whether ethumb is built])
|
AC_MSG_CHECKING([whether ethumb is built])
|
||||||
AC_MSG_RESULT([${_ephoto_enable_libexif}])
|
AC_MSG_RESULT([${_ephoto_enable_libexif}])
|
||||||
|
|
||||||
have_libexif="no"
|
have_libexif="No"
|
||||||
|
|
||||||
if test "x${_ephoto_enable_libexif}" = "xyes" ; then
|
if test "x${_ephoto_enable_libexif}" = "xyes" ; then
|
||||||
PKG_CHECK_MODULES(EXIF, libexif, [
|
PKG_CHECK_MODULES(EXIF, libexif, [
|
||||||
have_libexif="yes"
|
have_libexif="Yes"
|
||||||
AC_DEFINE(HAVE_LIBEXIF, 1, [have libexif support])
|
AC_DEFINE(HAVE_LIBEXIF, 1, [have libexif support])
|
||||||
],[
|
],[
|
||||||
have_libexif="no"
|
have_libexif="No"
|
||||||
])
|
])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AM_CONDITIONAL(BUILD_LIBEXIF, test $have_libexif = yes)
|
AM_CONDITIONAL(BUILD_LIBEXIF, test $have_libexif = Yes)
|
||||||
|
|
||||||
AC_OUTPUT([
|
AC_OUTPUT([
|
||||||
Makefile
|
Makefile
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 3.7 KiB |
|
@ -9,6 +9,7 @@ ephoto_SOURCES = \
|
||||||
ephoto.c \
|
ephoto.c \
|
||||||
ephoto.h \
|
ephoto.h \
|
||||||
ephoto_config.c \
|
ephoto_config.c \
|
||||||
|
ephoto_preferences.c \
|
||||||
ephoto_flow_browser.c \
|
ephoto_flow_browser.c \
|
||||||
ephoto_main.c \
|
ephoto_main.c \
|
||||||
ephoto_slideshow.c \
|
ephoto_slideshow.c \
|
||||||
|
|
|
@ -54,17 +54,23 @@ main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
else if (ecore_file_is_dir(argv[1]))
|
else if (ecore_file_is_dir(argv[1]))
|
||||||
{
|
{
|
||||||
ephoto_create_main_window(argv[1], NULL);
|
char *real;
|
||||||
|
|
||||||
|
real = ecore_file_realpath(argv[1]);
|
||||||
|
ephoto_create_main_window(real, NULL);
|
||||||
|
free(real);
|
||||||
}
|
}
|
||||||
else if (ecore_file_exists(argv[1]))
|
else if (ecore_file_exists(argv[1]))
|
||||||
{
|
{
|
||||||
char *directory;
|
char *directory, *real;
|
||||||
const char *image;
|
const char *image;
|
||||||
|
|
||||||
image = eina_stringshare_add(argv[1]);
|
image = eina_stringshare_add(argv[1]);
|
||||||
directory = ecore_file_dir_get(argv[1]);
|
directory = ecore_file_dir_get(argv[1]);
|
||||||
ephoto_create_main_window(directory, image);
|
real = ecore_file_realpath(directory);
|
||||||
|
ephoto_create_main_window(real, image);
|
||||||
free(directory);
|
free(directory);
|
||||||
|
free(real);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,6 +37,9 @@ Eina_Bool ephoto_config_init(Ephoto *em);
|
||||||
void ephoto_config_save(Ephoto *em, Eina_Bool instant);
|
void ephoto_config_save(Ephoto *em, Eina_Bool instant);
|
||||||
void ephoto_config_free(Ephoto *em);
|
void ephoto_config_free(Ephoto *em);
|
||||||
|
|
||||||
|
/* Preferences */
|
||||||
|
void ephoto_show_preferences(Ephoto *em);
|
||||||
|
|
||||||
/*Ephoto Flow Browser*/
|
/*Ephoto Flow Browser*/
|
||||||
Evas_Object *ephoto_create_flow_browser(Evas_Object *parent);
|
Evas_Object *ephoto_create_flow_browser(Evas_Object *parent);
|
||||||
void ephoto_flow_browser_image_set(Evas_Object *obj, const char *current_image);
|
void ephoto_flow_browser_image_set(Evas_Object *obj, const char *current_image);
|
||||||
|
@ -52,7 +55,7 @@ void ephoto_hide_slideshow(void);
|
||||||
void ephoto_delete_slideshow(void);
|
void ephoto_delete_slideshow(void);
|
||||||
|
|
||||||
/*Ephoto Thumb Browser*/
|
/*Ephoto Thumb Browser*/
|
||||||
Evas_Object *ephoto_create_thumb_browser(Evas_Object *parent, const char *directory);
|
Evas_Object *ephoto_create_thumb_browser(Evas_Object *parent);
|
||||||
void ephoto_populate_thumbnails(Evas_Object *obj);
|
void ephoto_populate_thumbnails(Evas_Object *obj);
|
||||||
/* smart callbacks called:
|
/* smart callbacks called:
|
||||||
* "selected" - an item in the thumb browser is selected. The selected file is passed as event_info argument.
|
* "selected" - an item in the thumb browser is selected. The selected file is passed as event_info argument.
|
||||||
|
@ -80,6 +83,12 @@ struct _Ephoto_Config
|
||||||
int config_version;
|
int config_version;
|
||||||
|
|
||||||
int thumb_size;
|
int thumb_size;
|
||||||
|
|
||||||
|
int remember_directory;
|
||||||
|
const char *directory;
|
||||||
|
|
||||||
|
double slideshow_timeout;
|
||||||
|
const char *slideshow_transition;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*Ephoto Main Structure*/
|
/*Ephoto Main Structure*/
|
||||||
|
@ -92,9 +101,9 @@ struct _Ephoto
|
||||||
Evas_Object *flow_browser;
|
Evas_Object *flow_browser;
|
||||||
Evas_Object *slideshow;
|
Evas_Object *slideshow;
|
||||||
Evas_Object *thumb_browser;
|
Evas_Object *thumb_browser;
|
||||||
|
Evas_Object *prefs_win;
|
||||||
Eina_List *images;
|
Eina_List *images;
|
||||||
Ephoto_State state;
|
Ephoto_State state;
|
||||||
const char *cur_directory;
|
|
||||||
|
|
||||||
Ephoto_Config *config;
|
Ephoto_Config *config;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "ephoto.h"
|
#include "ephoto.h"
|
||||||
|
|
||||||
#define CONFIG_VERSION 1
|
#define CONFIG_VERSION 2
|
||||||
|
|
||||||
static int _ephoto_config_load(Ephoto *em);
|
static int _ephoto_config_load(Ephoto *em);
|
||||||
static Eina_Bool _ephoto_on_config_save(void *data);
|
static Eina_Bool _ephoto_on_config_save(void *data);
|
||||||
|
@ -10,7 +10,7 @@ ephoto_config_init(Ephoto *em)
|
||||||
{
|
{
|
||||||
Eet_Data_Descriptor_Class eddc;
|
Eet_Data_Descriptor_Class eddc;
|
||||||
|
|
||||||
if (!eet_eina_file_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!");
|
ERR("Unable to create the config data descriptor!");
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
@ -24,6 +24,10 @@ ephoto_config_init(Ephoto *em)
|
||||||
#define C_VAL(edd, type, member, dtype) EET_DATA_DESCRIPTOR_ADD_BASIC(edd, type, #member, member, dtype)
|
#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, config_version, EET_T_INT);
|
||||||
C_VAL(D, T, thumb_size, EET_T_INT);
|
C_VAL(D, T, thumb_size, EET_T_INT);
|
||||||
|
C_VAL(D, T, remember_directory, 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);
|
||||||
|
|
||||||
switch (_ephoto_config_load(em))
|
switch (_ephoto_config_load(em))
|
||||||
{
|
{
|
||||||
|
@ -31,8 +35,18 @@ ephoto_config_init(Ephoto *em)
|
||||||
/* Start a new config */
|
/* Start a new config */
|
||||||
em->config->config_version = CONFIG_VERSION;
|
em->config->config_version = CONFIG_VERSION;
|
||||||
em->config->thumb_size = 256;
|
em->config->thumb_size = 256;
|
||||||
|
em->config->remember_directory = 1;
|
||||||
|
em->config->slideshow_timeout = 4.0;
|
||||||
|
em->config->slideshow_transition = "fade";
|
||||||
break;
|
break;
|
||||||
case -1:
|
case -1:
|
||||||
|
if (em->config->config_version < 2)
|
||||||
|
{
|
||||||
|
em->config->remember_directory = 1;
|
||||||
|
em->config->slideshow_timeout = 4.0;
|
||||||
|
em->config->slideshow_transition = "fade";
|
||||||
|
}
|
||||||
|
|
||||||
/* Incremental additions */
|
/* Incremental additions */
|
||||||
em->config->config_version = CONFIG_VERSION;
|
em->config->config_version = CONFIG_VERSION;
|
||||||
break;
|
break;
|
||||||
|
@ -47,7 +61,10 @@ void
|
||||||
ephoto_config_save(Ephoto *em, Eina_Bool instant)
|
ephoto_config_save(Ephoto *em, Eina_Bool instant)
|
||||||
{
|
{
|
||||||
if (em->config_save)
|
if (em->config_save)
|
||||||
|
{
|
||||||
ecore_timer_del(em->config_save);
|
ecore_timer_del(em->config_save);
|
||||||
|
em->config_save = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (instant)
|
if (instant)
|
||||||
_ephoto_on_config_save(em);
|
_ephoto_on_config_save(em);
|
||||||
|
|
|
@ -304,7 +304,7 @@ _ephoto_go_back(void *data, Evas_Object *obj, void *event_info)
|
||||||
|
|
||||||
evas_object_smart_callback_call(ef->flow_browser, "delete,request", NULL);
|
evas_object_smart_callback_call(ef->flow_browser, "delete,request", NULL);
|
||||||
/* elm_toolbar_item_unselect_all(ef->toolbar); */
|
/* elm_toolbar_item_unselect_all(ef->toolbar); */
|
||||||
/* em->thumb_browser = ephoto_create_thumb_browser(em->layout, ecore_file_dir_get(ef->cur_image)); */
|
/* em->thumb_browser = ephoto_create_thumb_browser(em->layout); */
|
||||||
/* elm_layout_content_set(em->layout, "ephoto.content.swallow", em->thumb_browser); */
|
/* elm_layout_content_set(em->layout, "ephoto.content.swallow", em->thumb_browser); */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,23 +7,17 @@ Ephoto *em;
|
||||||
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_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);
|
static void _ephoto_thumb_browser_selected_cb(void *data, Evas_Object *obj, void *event_info);
|
||||||
static void _ephoto_thumb_browser_directory_changed_cb(void *data, Evas_Object *obj, void *event_info);
|
|
||||||
|
|
||||||
/* Objects Callbacks */
|
/* Objects Callbacks */
|
||||||
static void
|
static void
|
||||||
_ephoto_flow_browser_delete_cb(void *data, Evas_Object *obj, void *event_info)
|
_ephoto_flow_browser_delete_cb(void *data, Evas_Object *obj, void *event_info)
|
||||||
{
|
{
|
||||||
em->thumb_browser = ephoto_create_thumb_browser(em->layout, em->cur_directory);
|
em->thumb_browser = ephoto_create_thumb_browser(em->layout);
|
||||||
elm_layout_content_set(em->layout, "ephoto.content.swallow", em->thumb_browser);
|
elm_layout_content_set(em->layout, "ephoto.content.swallow", em->thumb_browser);
|
||||||
evas_object_smart_callback_add(em->thumb_browser,
|
evas_object_smart_callback_add(em->thumb_browser,
|
||||||
"selected",
|
"selected",
|
||||||
_ephoto_thumb_browser_selected_cb,
|
_ephoto_thumb_browser_selected_cb,
|
||||||
NULL);
|
NULL);
|
||||||
evas_object_smart_callback_add(em->thumb_browser,
|
|
||||||
"directory,changed",
|
|
||||||
_ephoto_thumb_browser_directory_changed_cb,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
em->state = EPHOTO_STATE_THUMB;
|
em->state = EPHOTO_STATE_THUMB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,19 +36,12 @@ _ephoto_thumb_browser_selected_cb(void *data, Evas_Object *obj, void *event_info
|
||||||
em->state = EPHOTO_STATE_FLOW;
|
em->state = EPHOTO_STATE_FLOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
_ephoto_thumb_browser_directory_changed_cb(void *data, Evas_Object *obj, void *event_info)
|
|
||||||
{
|
|
||||||
const char *dir = event_info;
|
|
||||||
|
|
||||||
eina_stringshare_del(em->cur_directory);
|
|
||||||
em->cur_directory = eina_stringshare_add(dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*Create the main ephoto window*/
|
/*Create the main ephoto window*/
|
||||||
void
|
void
|
||||||
ephoto_create_main_window(const char *directory, const char *image)
|
ephoto_create_main_window(const char *directory, const char *image)
|
||||||
{
|
{
|
||||||
|
char current_directory[PATH_MAX];
|
||||||
|
|
||||||
em = calloc(1, sizeof(Ephoto));
|
em = calloc(1, sizeof(Ephoto));
|
||||||
if (!ephoto_config_init(em))
|
if (!ephoto_config_init(em))
|
||||||
_ephoto_delete_main_window(NULL, NULL, NULL);
|
_ephoto_delete_main_window(NULL, NULL, NULL);
|
||||||
|
@ -89,11 +76,36 @@ ephoto_create_main_window(const char *directory, const char *image)
|
||||||
evas_object_show(em->layout);
|
evas_object_show(em->layout);
|
||||||
|
|
||||||
|
|
||||||
|
/* Prepare the slideshow beforehand, in order
|
||||||
|
* to obtain the list of transitions */
|
||||||
|
ephoto_create_slideshow();
|
||||||
|
|
||||||
|
if (!directory)
|
||||||
|
{
|
||||||
|
getcwd(current_directory, PATH_MAX);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!em->config->directory)
|
||||||
|
{
|
||||||
|
if (directory)
|
||||||
|
em->config->directory = eina_stringshare_add(directory);
|
||||||
|
else
|
||||||
|
em->config->directory = eina_stringshare_add(current_directory);
|
||||||
|
}
|
||||||
|
else if (directory || !em->config->remember_directory)
|
||||||
|
{
|
||||||
|
if (directory)
|
||||||
|
eina_stringshare_replace(&em->config->directory,
|
||||||
|
directory);
|
||||||
|
else
|
||||||
|
eina_stringshare_replace(&em->config->directory,
|
||||||
|
current_directory);
|
||||||
|
}
|
||||||
|
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
em->flow_browser = ephoto_create_flow_browser(em->layout);
|
em->flow_browser = ephoto_create_flow_browser(em->layout);
|
||||||
ephoto_flow_browser_image_set(em->flow_browser, image);
|
ephoto_flow_browser_image_set(em->flow_browser, image);
|
||||||
em->cur_directory = eina_stringshare_add(ecore_file_dir_get(image));
|
|
||||||
eina_stringshare_del(image);
|
eina_stringshare_del(image);
|
||||||
elm_layout_content_set(em->layout, "ephoto.content.swallow", em->flow_browser);
|
elm_layout_content_set(em->layout, "ephoto.content.swallow", em->flow_browser);
|
||||||
evas_object_smart_callback_add(em->flow_browser,
|
evas_object_smart_callback_add(em->flow_browser,
|
||||||
|
@ -104,18 +116,13 @@ ephoto_create_main_window(const char *directory, const char *image)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
em->thumb_browser = ephoto_create_thumb_browser(em->layout, directory);
|
em->thumb_browser = ephoto_create_thumb_browser(em->layout);
|
||||||
em->cur_directory = eina_stringshare_add(directory);
|
|
||||||
evas_object_show(em->thumb_browser);
|
evas_object_show(em->thumb_browser);
|
||||||
elm_layout_content_set(em->layout, "ephoto.content.swallow", em->thumb_browser);
|
elm_layout_content_set(em->layout, "ephoto.content.swallow", em->thumb_browser);
|
||||||
evas_object_smart_callback_add(em->thumb_browser,
|
evas_object_smart_callback_add(em->thumb_browser,
|
||||||
"selected",
|
"selected",
|
||||||
_ephoto_thumb_browser_selected_cb,
|
_ephoto_thumb_browser_selected_cb,
|
||||||
NULL);
|
NULL);
|
||||||
evas_object_smart_callback_add(em->thumb_browser,
|
|
||||||
"directory,changed",
|
|
||||||
_ephoto_thumb_browser_directory_changed_cb,
|
|
||||||
NULL);
|
|
||||||
em->state = EPHOTO_STATE_THUMB;
|
em->state = EPHOTO_STATE_THUMB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,153 @@
|
||||||
|
#include "ephoto.h"
|
||||||
|
|
||||||
|
static void _ephoto_preferences_pager_switch(void *data, Evas_Object *obj, void *event_info);
|
||||||
|
static void _ephoto_preferences_hide(void *data, Evas_Object *obj, void *event_info);
|
||||||
|
static void _ephoto_preferences_item_change(void *data, Evas_Object *obj, void *event_info);
|
||||||
|
static void _ephoto_preferences_slideshow_transition(void *data, Evas_Object *obj, void *event_info);
|
||||||
|
|
||||||
|
void
|
||||||
|
ephoto_show_preferences(Ephoto *em)
|
||||||
|
{
|
||||||
|
if (!em->prefs_win)
|
||||||
|
{
|
||||||
|
Evas_Object *o, *tb, *box, *pager, *pg1, *pg2, *pg3;
|
||||||
|
const Eina_List *transitions, *l;
|
||||||
|
const char *transition;
|
||||||
|
|
||||||
|
em->prefs_win = o = elm_win_inwin_add(em->win);
|
||||||
|
elm_object_style_set(o, "minimal");
|
||||||
|
|
||||||
|
box = elm_box_add(em->prefs_win);
|
||||||
|
evas_object_show(box);
|
||||||
|
evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
|
elm_win_inwin_content_set(o, box);
|
||||||
|
|
||||||
|
tb = elm_toolbar_add(box);
|
||||||
|
elm_toolbar_homogenous_set(tb, EINA_FALSE);
|
||||||
|
evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, 0.5);
|
||||||
|
|
||||||
|
elm_box_pack_end(box, tb);
|
||||||
|
evas_object_show(tb);
|
||||||
|
|
||||||
|
pager = elm_pager_add(box);
|
||||||
|
|
||||||
|
pg1 = elm_box_add(pager);
|
||||||
|
evas_object_size_hint_weight_set(pg1, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
|
evas_object_show(pg1);
|
||||||
|
elm_pager_content_push(pager, pg1);
|
||||||
|
elm_toolbar_item_add(tb, NULL, "General", _ephoto_preferences_pager_switch, pg1);
|
||||||
|
|
||||||
|
o = elm_check_add(pg1);
|
||||||
|
elm_check_label_set(o, "Remember last used directory");
|
||||||
|
elm_check_state_set(o, em->config->remember_directory);
|
||||||
|
evas_object_data_set(o, "config", "remember_directory");
|
||||||
|
evas_object_smart_callback_add(o, "changed",
|
||||||
|
_ephoto_preferences_item_change, em);
|
||||||
|
elm_box_pack_end(pg1, o);
|
||||||
|
evas_object_show(o);
|
||||||
|
|
||||||
|
elm_box_pack_end(box, pager);
|
||||||
|
evas_object_show(pager);
|
||||||
|
|
||||||
|
pg2 = elm_table_add(pager);
|
||||||
|
evas_object_size_hint_weight_set(pg2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
|
evas_object_show(pg2);
|
||||||
|
elm_pager_content_push(pager, pg2);
|
||||||
|
elm_toolbar_item_add(tb, NULL, "Slideshow", _ephoto_preferences_pager_switch, pg2);
|
||||||
|
|
||||||
|
o = elm_label_add(pg2);
|
||||||
|
elm_label_label_set(o, "Delay:");
|
||||||
|
evas_object_show(o);
|
||||||
|
elm_table_pack(pg2, o, 0, 0, 1, 1);
|
||||||
|
|
||||||
|
o = elm_spinner_add(pg2);
|
||||||
|
elm_spinner_label_format_set(o, "%1.1f seconds");
|
||||||
|
elm_spinner_step_set(o, 0.1);
|
||||||
|
elm_spinner_min_max_set(o, 1.0, 10.0);
|
||||||
|
elm_spinner_value_set(o, em->config->slideshow_timeout);
|
||||||
|
evas_object_data_set(o, "config", "slideshow_timeout");
|
||||||
|
evas_object_smart_callback_add(o, "delay,changed",
|
||||||
|
_ephoto_preferences_item_change, em);
|
||||||
|
evas_object_show(o);
|
||||||
|
elm_table_pack(pg2, o, 1, 0, 1, 1);
|
||||||
|
|
||||||
|
o = elm_label_add(pg2);
|
||||||
|
elm_label_label_set(o, "Transition:");
|
||||||
|
evas_object_show(o);
|
||||||
|
elm_table_pack(pg2, o, 0, 1, 1, 1);
|
||||||
|
|
||||||
|
/* XXX: The page cannot be the parent, since
|
||||||
|
* the items will be clipped to it */
|
||||||
|
o = elm_hoversel_add(em->win);
|
||||||
|
elm_hoversel_label_set(o, em->config->slideshow_transition);
|
||||||
|
transitions = elm_slideshow_transitions_get(em->slideshow);
|
||||||
|
EINA_LIST_FOREACH(transitions, l, transition)
|
||||||
|
{
|
||||||
|
elm_hoversel_item_add(o, transition, NULL, ELM_ICON_NONE, _ephoto_preferences_slideshow_transition, em);
|
||||||
|
}
|
||||||
|
evas_object_show(o);
|
||||||
|
elm_table_pack(pg2, o, 1, 1, 1, 1);
|
||||||
|
|
||||||
|
pg3 = elm_box_add(pager);
|
||||||
|
evas_object_size_hint_weight_set(pg3, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
|
evas_object_show(pg3);
|
||||||
|
elm_pager_content_push(pager, pg3);
|
||||||
|
elm_toolbar_item_add(tb, NULL, "External Editor", _ephoto_preferences_pager_switch, pg3);
|
||||||
|
|
||||||
|
o = elm_button_add(box);
|
||||||
|
elm_button_label_set(o, "Close");
|
||||||
|
evas_object_size_hint_align_set(o, 1.0, 0.5);
|
||||||
|
evas_object_smart_callback_add(o, "clicked", _ephoto_preferences_hide, em);
|
||||||
|
elm_box_pack_end(box, o);
|
||||||
|
evas_object_show(o);
|
||||||
|
|
||||||
|
elm_toolbar_item_select_first(tb);
|
||||||
|
elm_pager_content_promote(pager, pg1);
|
||||||
|
}
|
||||||
|
|
||||||
|
elm_win_inwin_activate(em->prefs_win);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_ephoto_preferences_pager_switch(void *data, Evas_Object *obj, void *event_info)
|
||||||
|
{
|
||||||
|
Evas_Object *o = data;
|
||||||
|
/* XXX: Useful function, but not currently exported as public */
|
||||||
|
Evas_Object *pager = elm_widget_parent_get(o);
|
||||||
|
|
||||||
|
elm_pager_content_promote(pager, o);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_ephoto_preferences_item_change(void *data, Evas_Object *obj, void *event_info)
|
||||||
|
{
|
||||||
|
Ephoto *em = data;
|
||||||
|
const char *key = evas_object_data_get(obj, "config");
|
||||||
|
|
||||||
|
if (!strcmp(key, "remember_directory"))
|
||||||
|
em->config->remember_directory = elm_check_state_get(obj);
|
||||||
|
else if (!strcmp(key, "slideshow_timeout"))
|
||||||
|
em->config->slideshow_timeout = elm_spinner_value_get(obj);
|
||||||
|
|
||||||
|
ephoto_config_save(em, EINA_FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_ephoto_preferences_slideshow_transition(void *data, Evas_Object *obj, void *event_info)
|
||||||
|
{
|
||||||
|
Ephoto *em = data;
|
||||||
|
Elm_Hoversel_Item *it = event_info;
|
||||||
|
const char *transition = elm_hoversel_item_label_get(it);
|
||||||
|
|
||||||
|
elm_hoversel_label_set(obj, transition);
|
||||||
|
em->config->slideshow_transition = transition;
|
||||||
|
ephoto_config_save(em, EINA_FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_ephoto_preferences_hide(void *data, Evas_Object *obj, void *event_info)
|
||||||
|
{
|
||||||
|
Ephoto *em = data;
|
||||||
|
|
||||||
|
evas_object_hide(em->prefs_win);
|
||||||
|
}
|
|
@ -14,7 +14,6 @@ ephoto_create_slideshow(void)
|
||||||
em->slideshow = elm_slideshow_add(em->win);
|
em->slideshow = elm_slideshow_add(em->win);
|
||||||
elm_slideshow_loop_set(em->slideshow, EINA_TRUE);
|
elm_slideshow_loop_set(em->slideshow, EINA_TRUE);
|
||||||
elm_slideshow_layout_set(em->slideshow, "fullscreen");
|
elm_slideshow_layout_set(em->slideshow, "fullscreen");
|
||||||
elm_slideshow_transition_set(em->slideshow, "fade");
|
|
||||||
evas_object_size_hint_weight_set(em->slideshow, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
evas_object_size_hint_weight_set(em->slideshow, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
evas_object_size_hint_align_set(em->slideshow, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
evas_object_size_hint_align_set(em->slideshow, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
evas_object_event_callback_add(em->slideshow, EVAS_CALLBACK_MOUSE_DOWN,
|
evas_object_event_callback_add(em->slideshow, EVAS_CALLBACK_MOUSE_DOWN,
|
||||||
|
@ -29,7 +28,8 @@ ephoto_show_slideshow(int view, const char *current_image)
|
||||||
const char *image;
|
const char *image;
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
|
|
||||||
ephoto_create_slideshow();
|
elm_slideshow_transition_set(em->slideshow, em->config->slideshow_transition);
|
||||||
|
elm_slideshow_timeout_set(em->slideshow, em->config->slideshow_timeout);
|
||||||
|
|
||||||
return_view = view;
|
return_view = view;
|
||||||
cur_image = current_image;
|
cur_image = current_image;
|
||||||
|
@ -48,14 +48,13 @@ ephoto_show_slideshow(int view, const char *current_image)
|
||||||
}
|
}
|
||||||
evas_object_show(em->slideshow);
|
evas_object_show(em->slideshow);
|
||||||
elm_win_resize_object_add(em->win, em->slideshow);
|
elm_win_resize_object_add(em->win, em->slideshow);
|
||||||
elm_slideshow_timeout_set(em->slideshow, 4);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Hide the slideshow object*/
|
/*Hide the slideshow object*/
|
||||||
void
|
void
|
||||||
ephoto_hide_slideshow(void)
|
ephoto_hide_slideshow(void)
|
||||||
{
|
{
|
||||||
ephoto_delete_slideshow();
|
evas_object_hide(em->slideshow);
|
||||||
// FIXME
|
// FIXME
|
||||||
/*
|
/*
|
||||||
if (return_view == 0)
|
if (return_view == 0)
|
||||||
|
|
|
@ -20,7 +20,6 @@ struct _Ephoto_Thumb_Browser
|
||||||
Evas_Object *fsel_win;
|
Evas_Object *fsel_win;
|
||||||
Elm_Gengrid_Item_Class eg;
|
Elm_Gengrid_Item_Class eg;
|
||||||
Ethumb_Client *ec;
|
Ethumb_Client *ec;
|
||||||
const char *current_directory;
|
|
||||||
Eio_File *list;
|
Eio_File *list;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -42,14 +41,14 @@ 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_preferences(void *data, Evas_Object *obj, void *event_info);
|
||||||
static void _ephoto_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
static void _ephoto_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||||
static void _ephoto_show_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
static void _ephoto_show_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||||
/*Create the thumbnail browser object*/
|
/*Create the thumbnail browser object*/
|
||||||
Evas_Object *
|
Evas_Object *
|
||||||
ephoto_create_thumb_browser(Evas_Object *parent, const char *directory)
|
ephoto_create_thumb_browser(Evas_Object *parent)
|
||||||
{
|
{
|
||||||
Evas_Object *o;
|
Evas_Object *o;
|
||||||
char buf[PATH_MAX];
|
|
||||||
Ephoto_Thumb_Browser *tb;
|
Ephoto_Thumb_Browser *tb;
|
||||||
|
|
||||||
tb = calloc(1, sizeof(Ephoto_Thumb_Browser));
|
tb = calloc(1, sizeof(Ephoto_Thumb_Browser));
|
||||||
|
@ -67,16 +66,6 @@ ephoto_create_thumb_browser(Evas_Object *parent, const char *directory)
|
||||||
evas_object_size_hint_fill_set(tb->layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
evas_object_size_hint_fill_set(tb->layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
evas_object_show(tb->layout);
|
evas_object_show(tb->layout);
|
||||||
|
|
||||||
if (!directory)
|
|
||||||
{
|
|
||||||
getcwd(buf, PATH_MAX);
|
|
||||||
tb->current_directory = eina_stringshare_add(buf);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
tb->current_directory = eina_stringshare_add(directory);
|
|
||||||
}
|
|
||||||
|
|
||||||
tb->thbox = elm_box_add(tb->layout);
|
tb->thbox = elm_box_add(tb->layout);
|
||||||
elm_box_horizontal_set(tb->thbox, EINA_TRUE);
|
elm_box_horizontal_set(tb->thbox, EINA_TRUE);
|
||||||
evas_object_size_hint_weight_set(tb->thbox, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
|
evas_object_size_hint_weight_set(tb->thbox, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
|
||||||
|
@ -84,7 +73,7 @@ ephoto_create_thumb_browser(Evas_Object *parent, const char *directory)
|
||||||
elm_layout_content_set(tb->layout, "ephoto.location.swallow", tb->thbox);
|
elm_layout_content_set(tb->layout, "ephoto.location.swallow", tb->thbox);
|
||||||
|
|
||||||
tb->dir_label = elm_label_add(tb->thbox);
|
tb->dir_label = elm_label_add(tb->thbox);
|
||||||
elm_label_label_set(tb->dir_label, tb->current_directory);
|
elm_label_label_set(tb->dir_label, em->config->directory);
|
||||||
evas_object_size_hint_weight_set(tb->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(tb->dir_label, 0.01, 0.5);
|
evas_object_size_hint_align_set(tb->dir_label, 0.01, 0.5);
|
||||||
elm_box_pack_end(tb->thbox, tb->dir_label);
|
elm_box_pack_end(tb->thbox, tb->dir_label);
|
||||||
|
@ -139,6 +128,10 @@ ephoto_create_thumb_browser(Evas_Object *parent, const char *directory)
|
||||||
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(tb->toolbar, o, "Play Slideshow", _ephoto_view_slideshow, tb);
|
elm_toolbar_item_add(tb->toolbar, o, "Play Slideshow", _ephoto_view_slideshow, tb);
|
||||||
|
|
||||||
|
o = elm_icon_add(tb->toolbar);
|
||||||
|
elm_icon_file_set(o, PACKAGE_DATA_DIR "/images/preferences.png", NULL);
|
||||||
|
elm_toolbar_item_add(tb->toolbar, o, "Preferences", _ephoto_preferences, tb);
|
||||||
|
|
||||||
tb->eg.item_style = "ephoto";
|
tb->eg.item_style = "ephoto";
|
||||||
tb->eg.func.label_get = _ephoto_get_label;
|
tb->eg.func.label_get = _ephoto_get_label;
|
||||||
tb->eg.func.icon_get = _ephoto_get_icon;
|
tb->eg.func.icon_get = _ephoto_get_icon;
|
||||||
|
@ -156,7 +149,10 @@ static void
|
||||||
_ephoto_show_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
_ephoto_show_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
|
|
||||||
{
|
{
|
||||||
Ephoto_Thumb_Browser *tb = evas_object_data_get(obj, "thumb_browser");
|
char *buffer;
|
||||||
|
int length;
|
||||||
|
|
||||||
|
/* Ephoto_Thumb_Browser *tb = evas_object_data_get(obj, "thumb_browser"); */
|
||||||
|
|
||||||
/* evas_object_show(tb->toolbar); */
|
/* evas_object_show(tb->toolbar); */
|
||||||
/* evas_object_show(tb->thumb_browser); */
|
/* evas_object_show(tb->thumb_browser); */
|
||||||
|
@ -164,18 +160,10 @@ _ephoto_show_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
/* evas_object_show(tb->thumb_slider); */
|
/* evas_object_show(tb->thumb_slider); */
|
||||||
/* evas_object_show(tb->thbox); */
|
/* evas_object_show(tb->thbox); */
|
||||||
|
|
||||||
if (tb->current_directory)
|
length = strlen(em->config->directory) + strlen("Ephoto - ") + 1;
|
||||||
{
|
buffer = alloca(length);
|
||||||
char *buffer;
|
snprintf(buffer, length, "Ephoto - %s", em->config->directory);
|
||||||
int length;
|
elm_win_title_set(em->win, buffer);
|
||||||
|
|
||||||
length = strlen(tb->current_directory) + strlen("Ephoto - ") + 1;
|
|
||||||
buffer = alloca(length);
|
|
||||||
snprintf(buffer, length, "Ephoto - %s", tb->current_directory);
|
|
||||||
elm_win_title_set(em->win, buffer);
|
|
||||||
} else {
|
|
||||||
elm_win_title_set(em->win, "Ephoto");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Use ecore thread facility to avoid lock completly */
|
/* Use ecore thread facility to avoid lock completly */
|
||||||
|
@ -243,12 +231,10 @@ ephoto_populate_thumbnails(Evas_Object *obj)
|
||||||
{
|
{
|
||||||
Ephoto_Thumb_Browser *tb = evas_object_data_get(obj, "thumb_browser");
|
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");
|
||||||
|
|
||||||
tb->list = eio_file_ls(tb->current_directory,
|
tb->list = eio_file_ls(em->config->directory,
|
||||||
_ephoto_populate_filter,
|
_ephoto_populate_filter,
|
||||||
_ephoto_populate_main,
|
_ephoto_populate_main,
|
||||||
_ephoto_populate_end,
|
_ephoto_populate_end,
|
||||||
|
@ -399,8 +385,7 @@ _ephoto_thumb_clicked(void *data, Evas_Object *obj, void *event_info)
|
||||||
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)
|
||||||
{
|
{
|
||||||
Ephoto_Thumb_Browser *tb = data;
|
elm_fileselector_path_set(obj, em->config->directory);
|
||||||
elm_fileselector_path_set(obj, tb->current_directory);
|
|
||||||
evas_render(em->e);
|
evas_render(em->e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,8 +401,11 @@ _ephoto_directory_chosen(void *data, Evas_Object *obj, void *event_info)
|
||||||
|
|
||||||
directory = elm_fileselector_selected_get(obj);
|
directory = elm_fileselector_selected_get(obj);
|
||||||
|
|
||||||
if ((directory) && (eina_stringshare_replace(&tb->current_directory, directory)))
|
if ((directory) && (eina_stringshare_replace(&em->config->directory, directory)))
|
||||||
{
|
{
|
||||||
|
char *buffer;
|
||||||
|
int length;
|
||||||
|
|
||||||
l = elm_gengrid_items_get(tb->thumb_browser);
|
l = elm_gengrid_items_get(tb->thumb_browser);
|
||||||
EINA_LIST_FOREACH(l, iter, item)
|
EINA_LIST_FOREACH(l, iter, item)
|
||||||
{
|
{
|
||||||
|
@ -430,23 +418,15 @@ _ephoto_directory_chosen(void *data, Evas_Object *obj, void *event_info)
|
||||||
eina_list_free(em->images);
|
eina_list_free(em->images);
|
||||||
em->images = NULL;
|
em->images = NULL;
|
||||||
ephoto_populate_thumbnails(tb->layout);
|
ephoto_populate_thumbnails(tb->layout);
|
||||||
elm_label_label_set(tb->dir_label, tb->current_directory);
|
elm_label_label_set(tb->dir_label, em->config->directory);
|
||||||
|
|
||||||
if (tb->current_directory)
|
length = strlen(em->config->directory) + strlen("Ephoto - ") + 1;
|
||||||
{
|
buffer = alloca(length);
|
||||||
char *buffer;
|
snprintf(buffer, length, "Ephoto - %s", em->config->directory);
|
||||||
int length;
|
elm_win_title_set(em->win, buffer);
|
||||||
|
|
||||||
length = strlen(tb->current_directory) + strlen("Ephoto - ") + 1;
|
|
||||||
buffer = alloca(length);
|
|
||||||
snprintf(buffer, length, "Ephoto - %s", tb->current_directory);
|
|
||||||
elm_win_title_set(em->win, buffer);
|
|
||||||
} else {
|
|
||||||
elm_win_title_set(em->win, "Ephoto");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
evas_object_smart_callback_call(tb->layout, "directory,changed", (char *)tb->current_directory);
|
evas_object_smart_callback_call(tb->layout, "directory,changed", (char *) em->config->directory);
|
||||||
|
|
||||||
evas_object_del(tb->fsel_win);
|
evas_object_del(tb->fsel_win);
|
||||||
elm_toolbar_item_unselect_all(tb->toolbar);
|
elm_toolbar_item_unselect_all(tb->toolbar);
|
||||||
|
@ -495,7 +475,7 @@ _ephoto_change_directory(void *data, Evas_Object *obj, void *event_info)
|
||||||
fsel = elm_fileselector_add(tb->fsel_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);
|
elm_fileselector_path_set(fsel, em->config->directory);
|
||||||
evas_object_event_callback_add(fsel, EVAS_CALLBACK_SHOW,
|
evas_object_event_callback_add(fsel, EVAS_CALLBACK_SHOW,
|
||||||
_ephoto_fileselector_shown, tb);
|
_ephoto_fileselector_shown, tb);
|
||||||
evas_object_smart_callback_add(fsel, "done",
|
evas_object_smart_callback_add(fsel, "done",
|
||||||
|
@ -519,6 +499,16 @@ _ephoto_view_slideshow(void *data, Evas_Object *obj, void *event_info)
|
||||||
elm_toolbar_item_unselect_all(tb->toolbar);
|
elm_toolbar_item_unselect_all(tb->toolbar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Show the preferences window */
|
||||||
|
static void
|
||||||
|
_ephoto_preferences(void *data, Evas_Object *obj, void *event_info)
|
||||||
|
{
|
||||||
|
Ephoto_Thumb_Browser *tb = data;
|
||||||
|
|
||||||
|
ephoto_show_preferences(em);
|
||||||
|
elm_toolbar_item_unselect_all(tb->toolbar);
|
||||||
|
}
|
||||||
|
|
||||||
/*Destroy the thumbnail browser object itself*/
|
/*Destroy the thumbnail browser object itself*/
|
||||||
static void
|
static void
|
||||||
_ephoto_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
_ephoto_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
|
@ -536,6 +526,5 @@ _ephoto_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
eina_stringshare_del(etd->file);
|
eina_stringshare_del(etd->file);
|
||||||
free(etd);
|
free(etd);
|
||||||
}
|
}
|
||||||
eina_stringshare_del(tb->current_directory);
|
|
||||||
ethumb_client_disconnect(tb->ec);
|
ethumb_client_disconnect(tb->ec);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue