2011-02-24 14:26:47 -08:00
|
|
|
#include "ephoto.h"
|
|
|
|
|
2016-08-07 20:54:08 -07:00
|
|
|
#define CONFIG_VERSION 20
|
2011-02-24 14:26:47 -08:00
|
|
|
|
|
|
|
static int _ephoto_config_load(Ephoto *ephoto);
|
|
|
|
static Eina_Bool _ephoto_on_config_save(void *data);
|
|
|
|
|
|
|
|
static Eet_Data_Descriptor *edd = NULL;
|
|
|
|
|
2015-11-02 21:37:35 -08:00
|
|
|
static void
|
2016-01-22 13:24:32 -08:00
|
|
|
_config_save_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
2015-11-24 14:21:21 -08:00
|
|
|
void *event_info EINA_UNUSED)
|
2015-11-02 21:37:35 -08:00
|
|
|
{
|
|
|
|
Evas_Object *popup = data;
|
|
|
|
Ephoto *ephoto = evas_object_data_get(popup, "ephoto");
|
|
|
|
const char *path;
|
|
|
|
const char *text = elm_object_text_get(ephoto->config->open_dir);
|
|
|
|
|
|
|
|
if (!strcmp(text, _("Root Directory")))
|
2015-11-24 14:21:21 -08:00
|
|
|
path = "/";
|
2015-11-02 21:37:35 -08:00
|
|
|
else if (!strcmp(text, _("Home Directory")))
|
2015-11-24 14:21:21 -08:00
|
|
|
path = getenv("HOME");
|
2015-11-02 21:37:35 -08:00
|
|
|
else if (!strcmp(text, _("Last Open Directory")))
|
2015-11-24 14:21:21 -08:00
|
|
|
path = "Last";
|
2015-11-02 21:37:35 -08:00
|
|
|
else
|
2015-11-24 14:21:21 -08:00
|
|
|
path = elm_object_text_get(ephoto->config->open_dir_custom);
|
2015-11-02 21:37:35 -08:00
|
|
|
|
|
|
|
if (ecore_file_is_dir(path) || !strcmp(path, "Last"))
|
2015-11-24 14:21:21 -08:00
|
|
|
eina_stringshare_replace(&ephoto->config->open, path);
|
2016-08-03 20:37:54 -07:00
|
|
|
if (strcmp(path, ephoto->config->directory) && strcmp(path, "Last") &&
|
|
|
|
ecore_file_exists(path))
|
2016-08-03 14:05:48 -07:00
|
|
|
{
|
2017-02-10 12:12:43 -08:00
|
|
|
char *realpath = ecore_file_realpath(path);
|
2016-08-03 14:05:48 -07:00
|
|
|
ephoto_directory_browser_clear(ephoto);
|
|
|
|
ephoto_thumb_browser_clear(ephoto);
|
2017-02-10 12:12:43 -08:00
|
|
|
eina_stringshare_replace(&ephoto->config->directory, realpath);
|
2016-08-03 14:05:48 -07:00
|
|
|
ephoto_directory_browser_top_dir_set(ephoto, ephoto->config->directory);
|
|
|
|
ephoto_directory_browser_initialize_structure(ephoto);
|
2017-02-10 12:12:43 -08:00
|
|
|
free(realpath);
|
2016-08-03 14:05:48 -07:00
|
|
|
}
|
2015-11-24 14:21:21 -08:00
|
|
|
ephoto->config->prompts = elm_check_state_get(ephoto->config->show_prompts);
|
|
|
|
ephoto->config->drop = elm_check_state_get(ephoto->config->move_drop);
|
2016-07-21 15:12:29 -07:00
|
|
|
ephoto->config->movess = elm_check_state_get(ephoto->config->slide_move);
|
2016-08-04 14:36:58 -07:00
|
|
|
ephoto->config->smooth = elm_check_state_get(ephoto->config->smooth_scale);
|
2016-08-07 20:54:08 -07:00
|
|
|
ephoto->config->folders = elm_check_state_get(ephoto->config->show_folders);
|
2016-01-13 13:48:11 -08:00
|
|
|
if (elm_spinner_value_get(ephoto->config->slide_time) > 0)
|
|
|
|
ephoto->config->slideshow_timeout =
|
|
|
|
elm_spinner_value_get(ephoto->config->slide_time);
|
|
|
|
if (elm_object_text_get(ephoto->config->slide_trans))
|
|
|
|
eina_stringshare_replace(&ephoto->config->slideshow_transition,
|
|
|
|
elm_object_text_get(ephoto->config->slide_trans));
|
2016-03-10 20:24:01 -08:00
|
|
|
|
|
|
|
evas_object_del(popup);
|
2016-04-01 13:29:46 -07:00
|
|
|
elm_object_focus_set(ephoto->pager, EINA_TRUE);
|
2015-11-02 21:37:35 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_open_hv_select(void *data, Evas_Object *obj, void *event_info)
|
|
|
|
{
|
|
|
|
Ephoto *ephoto = data;
|
|
|
|
|
|
|
|
elm_object_text_set(obj, elm_object_item_text_get(event_info));
|
|
|
|
|
2015-11-24 14:21:21 -08:00
|
|
|
if (!strcmp(elm_object_item_text_get(event_info), _("Custom Directory")))
|
|
|
|
elm_object_disabled_set(ephoto->config->open_dir_custom, EINA_FALSE);
|
2015-11-02 21:37:35 -08:00
|
|
|
else
|
2015-11-24 14:21:21 -08:00
|
|
|
elm_object_disabled_set(ephoto->config->open_dir_custom, EINA_TRUE);
|
2015-11-02 21:37:35 -08:00
|
|
|
}
|
|
|
|
|
2016-04-11 17:21:52 -07:00
|
|
|
static void
|
2016-04-08 09:49:40 -07:00
|
|
|
_config_general(Ephoto *ephoto, Evas_Object *parent)
|
2015-11-02 21:37:35 -08:00
|
|
|
{
|
2016-10-11 10:09:47 -07:00
|
|
|
Evas_Object *table, *check, *hoversel, *entry, *label;
|
2015-11-02 21:37:35 -08:00
|
|
|
|
2016-10-11 10:09:47 -07:00
|
|
|
table = elm_table_add(parent);
|
2017-03-28 10:09:18 -07:00
|
|
|
EPHOTO_EXPAND(table);
|
|
|
|
EPHOTO_FILL(table);
|
2016-10-11 10:09:47 -07:00
|
|
|
elm_box_pack_end(parent, table);
|
2015-11-02 21:37:35 -08:00
|
|
|
evas_object_show(table);
|
|
|
|
|
2016-08-07 20:54:08 -07:00
|
|
|
check = elm_check_add(table);
|
|
|
|
elm_object_text_set(check, _("Show Folders On Start"));
|
2017-03-29 11:18:22 -07:00
|
|
|
EPHOTO_ALIGN(check, EVAS_HINT_FILL, 0.5);
|
2016-08-07 20:54:08 -07:00
|
|
|
elm_check_state_set(check, ephoto->config->folders);
|
2016-10-11 10:09:47 -07:00
|
|
|
elm_table_pack(table, check, 0, 0, 1, 1);
|
2016-08-07 20:54:08 -07:00
|
|
|
evas_object_show(check);
|
|
|
|
ephoto->config->show_folders = check;
|
|
|
|
|
2015-11-24 14:21:21 -08:00
|
|
|
check = elm_check_add(table);
|
|
|
|
elm_object_text_set(check, _("Prompt Before Changing The Filesystem"));
|
2017-03-28 10:09:18 -07:00
|
|
|
EPHOTO_FILL(check);
|
2015-11-24 14:21:21 -08:00
|
|
|
elm_check_state_set(check, ephoto->config->prompts);
|
2016-10-11 10:09:47 -07:00
|
|
|
elm_table_pack(table, check, 0, 1, 1, 1);
|
2015-11-24 14:21:21 -08:00
|
|
|
evas_object_show(check);
|
|
|
|
ephoto->config->show_prompts = check;
|
|
|
|
|
|
|
|
check = elm_check_add(table);
|
|
|
|
elm_object_text_set(check, _("Move Files When Dropped"));
|
2017-03-28 10:09:18 -07:00
|
|
|
EPHOTO_FILL(check);
|
2015-11-24 14:21:21 -08:00
|
|
|
elm_check_state_set(check, ephoto->config->drop);
|
2016-10-11 10:09:47 -07:00
|
|
|
elm_table_pack(table, check, 0, 2, 1, 1);
|
2015-11-24 14:21:21 -08:00
|
|
|
evas_object_show(check);
|
|
|
|
ephoto->config->move_drop = check;
|
|
|
|
|
2016-08-04 14:36:58 -07:00
|
|
|
check = elm_check_add(table);
|
|
|
|
elm_object_text_set(check, _("Smooth Scale Images"));
|
2017-03-28 10:09:18 -07:00
|
|
|
EPHOTO_FILL(check);
|
2016-08-04 14:36:58 -07:00
|
|
|
elm_check_state_set(check, ephoto->config->smooth);
|
2016-10-11 10:09:47 -07:00
|
|
|
elm_table_pack(table, check, 0, 3, 1, 1);
|
2016-08-04 14:36:58 -07:00
|
|
|
evas_object_show(check);
|
|
|
|
ephoto->config->smooth_scale = check;
|
|
|
|
|
2016-08-05 13:53:27 -07:00
|
|
|
label = elm_label_add(table);
|
2016-08-29 09:11:50 -07:00
|
|
|
elm_object_text_set(label, _("Top Level Directory"));
|
2017-03-28 10:09:18 -07:00
|
|
|
EPHOTO_ALIGN(label, 0.5, 0.5);
|
2016-10-11 10:09:47 -07:00
|
|
|
elm_table_pack(table, label, 0, 4, 1, 1);
|
2016-10-10 22:41:45 -07:00
|
|
|
evas_object_show(label);
|
2016-08-05 13:53:27 -07:00
|
|
|
|
2015-11-02 21:37:35 -08:00
|
|
|
hoversel = elm_hoversel_add(table);
|
|
|
|
elm_hoversel_hover_parent_set(hoversel, ephoto->win);
|
2015-11-24 14:21:21 -08:00
|
|
|
elm_hoversel_item_add(hoversel, _("Root Directory"), NULL, 0,
|
|
|
|
_open_hv_select, ephoto);
|
|
|
|
elm_hoversel_item_add(hoversel, _("Home Directory"), NULL, 0,
|
|
|
|
_open_hv_select, ephoto);
|
|
|
|
elm_hoversel_item_add(hoversel, _("Last Open Directory"), NULL, 0,
|
|
|
|
_open_hv_select, ephoto);
|
|
|
|
elm_hoversel_item_add(hoversel, _("Custom Directory"), NULL, 0,
|
|
|
|
_open_hv_select, ephoto);
|
2016-08-03 14:09:52 -07:00
|
|
|
elm_object_text_set(hoversel, ephoto->config->open);
|
2015-11-02 21:37:35 -08:00
|
|
|
evas_object_data_set(hoversel, "ephoto", ephoto);
|
2017-03-29 11:18:22 -07:00
|
|
|
EPHOTO_WEIGHT(hoversel, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
|
2017-03-28 10:09:18 -07:00
|
|
|
EPHOTO_FILL(hoversel);
|
2016-10-11 10:09:47 -07:00
|
|
|
elm_table_pack(table, hoversel, 0, 5, 1, 1);
|
2015-11-02 21:37:35 -08:00
|
|
|
evas_object_show(hoversel);
|
|
|
|
ephoto->config->open_dir = hoversel;
|
|
|
|
|
|
|
|
entry = elm_entry_add(table);
|
|
|
|
elm_entry_single_line_set(entry, EINA_TRUE);
|
|
|
|
elm_entry_scrollable_set(entry, EINA_TRUE);
|
|
|
|
elm_object_text_set(entry, _("Custom Directory"));
|
|
|
|
elm_object_disabled_set(entry, EINA_TRUE);
|
2015-11-24 14:21:21 -08:00
|
|
|
elm_scroller_policy_set(entry, ELM_SCROLLER_POLICY_OFF,
|
|
|
|
ELM_SCROLLER_POLICY_OFF);
|
2017-03-28 10:09:18 -07:00
|
|
|
EPHOTO_EXPAND(entry);
|
|
|
|
EPHOTO_FILL(entry);
|
2016-10-11 10:09:47 -07:00
|
|
|
elm_table_pack(table, entry, 0, 6, 1, 1);
|
2015-11-02 21:37:35 -08:00
|
|
|
evas_object_show(entry);
|
|
|
|
ephoto->config->open_dir_custom = entry;
|
2014-11-21 14:40:09 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-01-18 14:47:32 -08:00
|
|
|
_hv_select(void *data EINA_UNUSED, Evas_Object *obj, void *event_info)
|
2014-11-21 14:40:09 -08:00
|
|
|
{
|
|
|
|
elm_object_text_set(obj, elm_object_item_text_get(event_info));
|
|
|
|
}
|
|
|
|
|
2015-08-11 08:15:31 -07:00
|
|
|
static void
|
2015-11-24 14:21:21 -08:00
|
|
|
_spinner_changed(void *data EINA_UNUSED, Evas_Object *obj,
|
|
|
|
void *event_info EINA_UNUSED)
|
2015-08-11 08:15:31 -07:00
|
|
|
{
|
|
|
|
double val;
|
|
|
|
char buf[PATH_MAX];
|
|
|
|
|
|
|
|
val = elm_spinner_value_get(obj);
|
|
|
|
snprintf(buf, PATH_MAX, "%%1.0f %s", ngettext("second", "seconds", val));
|
|
|
|
elm_spinner_label_format_set(obj, buf);
|
|
|
|
}
|
|
|
|
|
2016-07-21 15:12:29 -07:00
|
|
|
static Eina_List *
|
|
|
|
_ephoto_transitions_list_get(const char *str)
|
|
|
|
{
|
|
|
|
Eina_List *list = NULL;
|
|
|
|
const char *s, *b;
|
|
|
|
if (!str) return NULL;
|
|
|
|
for (b = s = str; 1; s++)
|
|
|
|
{
|
|
|
|
if ((*s == ' ') || (!*s))
|
|
|
|
{
|
|
|
|
char *t = malloc(s - b + 1);
|
|
|
|
if (t)
|
|
|
|
{
|
|
|
|
strncpy(t, b, s - b);
|
|
|
|
t[s - b] = 0;
|
|
|
|
list = eina_list_append(list, eina_stringshare_add(t));
|
|
|
|
free(t);
|
|
|
|
}
|
|
|
|
b = s + 1;
|
|
|
|
}
|
|
|
|
if (!*s) break;
|
|
|
|
}
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
2016-04-11 17:21:52 -07:00
|
|
|
static void
|
2016-04-08 09:49:40 -07:00
|
|
|
_config_slideshow(Ephoto *ephoto, Evas_Object *parent)
|
2014-11-19 14:50:56 -08:00
|
|
|
{
|
2016-07-21 15:12:29 -07:00
|
|
|
Eina_List *transitions;
|
2016-10-11 10:09:47 -07:00
|
|
|
Evas_Object *table, *check, *label, *spinner, *hoversel;
|
2014-11-21 14:40:09 -08:00
|
|
|
const Eina_List *l;
|
|
|
|
const char *transition;
|
2015-08-10 13:58:16 -07:00
|
|
|
char buf[PATH_MAX];
|
2014-11-19 14:50:56 -08:00
|
|
|
|
2016-10-11 10:09:47 -07:00
|
|
|
table = elm_table_add(parent);
|
2017-03-28 10:09:18 -07:00
|
|
|
EPHOTO_EXPAND(table);
|
|
|
|
EPHOTO_FILL(table);
|
2016-10-11 10:09:47 -07:00
|
|
|
elm_box_pack_end(parent, table);
|
2014-11-21 14:40:09 -08:00
|
|
|
evas_object_show(table);
|
|
|
|
|
2016-07-25 09:05:08 -07:00
|
|
|
check = elm_check_add(table);
|
|
|
|
elm_object_text_set(check, _("Moving Slideshow"));
|
2017-03-28 10:09:18 -07:00
|
|
|
EPHOTO_ALIGN(check, 0.5, 0.5);
|
2016-07-25 09:05:08 -07:00
|
|
|
elm_check_state_set(check, ephoto->config->movess);
|
|
|
|
elm_table_pack(table, check, 0, 0, 2, 1);
|
|
|
|
evas_object_show(check);
|
|
|
|
ephoto->config->slide_move = check;
|
|
|
|
|
2014-11-21 14:40:09 -08:00
|
|
|
label = elm_label_add(table);
|
2015-08-10 13:58:16 -07:00
|
|
|
memset(buf, 0, PATH_MAX);
|
2015-11-24 14:21:21 -08:00
|
|
|
snprintf(buf, PATH_MAX, "%s:", _("Show Each Slide For"));
|
2015-08-10 13:58:16 -07:00
|
|
|
elm_object_text_set(label, buf);
|
2017-03-28 10:09:18 -07:00
|
|
|
EPHOTO_FILL(label);
|
2016-07-25 09:05:08 -07:00
|
|
|
elm_table_pack(table, label, 0, 1, 1, 1);
|
2014-11-21 14:40:09 -08:00
|
|
|
evas_object_show(label);
|
|
|
|
|
|
|
|
spinner = elm_spinner_add(table);
|
|
|
|
elm_spinner_editable_set(spinner, EINA_TRUE);
|
2015-08-10 14:46:35 -07:00
|
|
|
memset(buf, 0, PATH_MAX);
|
|
|
|
snprintf(buf, PATH_MAX, "%%1.0f %s", _("seconds"));
|
2015-08-11 08:15:31 -07:00
|
|
|
evas_object_smart_callback_add(spinner, "changed", _spinner_changed, NULL);
|
2015-08-10 14:46:35 -07:00
|
|
|
elm_spinner_label_format_set(spinner, buf);
|
2014-11-21 14:40:09 -08:00
|
|
|
elm_spinner_step_set(spinner, 1);
|
|
|
|
elm_spinner_value_set(spinner, ephoto->config->slideshow_timeout);
|
|
|
|
elm_spinner_min_max_set(spinner, 1, 60);
|
2016-07-25 09:05:08 -07:00
|
|
|
elm_table_pack(table, spinner, 1, 1, 1, 1);
|
2014-11-21 14:40:09 -08:00
|
|
|
evas_object_show(spinner);
|
|
|
|
ephoto->config->slide_time = spinner;
|
|
|
|
|
|
|
|
label = elm_label_add(table);
|
2015-08-10 13:58:16 -07:00
|
|
|
memset(buf, 0, PATH_MAX);
|
2015-11-24 14:21:21 -08:00
|
|
|
snprintf(buf, PATH_MAX, "%s:", _("Slide Transition"));
|
2015-08-10 13:58:16 -07:00
|
|
|
elm_object_text_set(label, buf);
|
2017-03-28 10:09:18 -07:00
|
|
|
EPHOTO_FILL(label);
|
2016-07-25 09:05:08 -07:00
|
|
|
elm_table_pack(table, label, 0, 2, 1, 1);
|
2014-11-21 14:40:09 -08:00
|
|
|
evas_object_show(label);
|
|
|
|
|
2016-07-21 15:12:29 -07:00
|
|
|
transitions = _ephoto_transitions_list_get(edje_object_data_get(elm_layout_edje_get
|
|
|
|
(ephoto->slideshow), "transitions"));
|
|
|
|
|
2014-11-21 14:40:09 -08:00
|
|
|
hoversel = elm_hoversel_add(table);
|
2015-10-30 12:42:13 -07:00
|
|
|
elm_hoversel_hover_parent_set(hoversel, ephoto->win);
|
2016-07-21 15:12:29 -07:00
|
|
|
EINA_LIST_FOREACH(transitions, l,
|
2015-11-24 14:21:21 -08:00
|
|
|
transition) elm_hoversel_item_add(hoversel, transition, NULL, 0,
|
|
|
|
_hv_select, transition);
|
2016-07-22 10:10:15 -07:00
|
|
|
elm_hoversel_item_add(hoversel, "none", NULL, 0, _hv_select, NULL);
|
2014-11-21 14:40:09 -08:00
|
|
|
elm_object_text_set(hoversel, ephoto->config->slideshow_transition);
|
2017-03-28 10:09:18 -07:00
|
|
|
EPHOTO_EXPAND(hoversel);
|
|
|
|
EPHOTO_FILL(hoversel);
|
2016-07-25 09:05:08 -07:00
|
|
|
elm_table_pack(table, hoversel, 1, 2, 1, 1);
|
2014-11-21 14:40:09 -08:00
|
|
|
evas_object_show(hoversel);
|
|
|
|
ephoto->config->slide_trans = hoversel;
|
2016-04-11 17:21:52 -07:00
|
|
|
}
|
|
|
|
|
2016-10-11 10:09:47 -07:00
|
|
|
|
|
|
|
|
2016-04-11 17:21:52 -07:00
|
|
|
static Evas_Object *
|
2016-10-11 10:09:47 -07:00
|
|
|
_config_settings(Ephoto *ephoto, Evas_Object *parent, Eina_Bool slideshow)
|
2016-04-11 17:21:52 -07:00
|
|
|
{
|
2016-10-11 10:09:47 -07:00
|
|
|
Evas_Object *frame, *vbox;
|
2014-11-21 14:40:09 -08:00
|
|
|
|
2016-10-11 10:09:47 -07:00
|
|
|
frame = elm_frame_add(parent);
|
|
|
|
if (!slideshow)
|
|
|
|
elm_object_text_set(frame, _("General"));
|
|
|
|
else
|
|
|
|
elm_object_text_set(frame, _("Slideshow"));
|
2017-03-28 10:09:18 -07:00
|
|
|
EPHOTO_EXPAND(frame);
|
|
|
|
EPHOTO_FILL(frame);
|
2016-10-11 10:09:47 -07:00
|
|
|
evas_object_show(frame);
|
2016-04-11 17:21:52 -07:00
|
|
|
|
2016-10-11 10:09:47 -07:00
|
|
|
vbox = elm_box_add(frame);
|
2016-04-11 17:21:52 -07:00
|
|
|
elm_box_horizontal_set(vbox, EINA_FALSE);
|
2017-03-28 10:09:18 -07:00
|
|
|
EPHOTO_EXPAND(vbox);
|
|
|
|
EPHOTO_FILL(vbox);
|
2016-10-11 10:09:47 -07:00
|
|
|
elm_object_content_set(frame, vbox);
|
2016-04-11 17:21:52 -07:00
|
|
|
evas_object_show(vbox);
|
|
|
|
|
2016-10-11 10:09:47 -07:00
|
|
|
if (!slideshow)
|
|
|
|
_config_general(ephoto, vbox);
|
|
|
|
else
|
|
|
|
_config_slideshow(ephoto, vbox);
|
2016-08-03 14:05:48 -07:00
|
|
|
|
2016-10-11 10:09:47 -07:00
|
|
|
return frame;
|
2015-02-20 08:07:50 -08:00
|
|
|
}
|
2014-11-19 14:50:56 -08:00
|
|
|
|
2015-12-01 21:03:50 -08:00
|
|
|
static void
|
|
|
|
_link_anchor_bt(void *data, Evas_Object *obj,
|
|
|
|
void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
char buf[PATH_MAX];
|
|
|
|
Evas_Object *av = data;
|
|
|
|
const char *link = evas_object_data_get(obj, "link");
|
|
|
|
|
|
|
|
elm_entry_anchor_hover_end(av);
|
|
|
|
snprintf(buf, PATH_MAX, "xdg-open %s", link);
|
|
|
|
ecore_exe_run(buf, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_copy_anchor_bt(void *data, Evas_Object *obj,
|
|
|
|
void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
char buf[PATH_MAX];
|
|
|
|
Evas_Object *av = data;
|
|
|
|
const char *link = evas_object_data_get(obj, "link");
|
|
|
|
|
|
|
|
elm_entry_anchor_hover_end(av);
|
|
|
|
snprintf(buf, PATH_MAX, "%s", link);
|
|
|
|
elm_cnp_selection_set(av, ELM_SEL_TYPE_CLIPBOARD, ELM_SEL_FORMAT_MARKUP,
|
|
|
|
buf, strlen(buf));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_link_anchor(void *data, Evas_Object *obj, void *event_info)
|
|
|
|
{
|
|
|
|
Evas_Object *av = data;
|
|
|
|
Evas_Object *button;
|
|
|
|
Elm_Entry_Anchor_Hover_Info *ei = event_info;
|
|
|
|
|
|
|
|
button = elm_button_add(obj);
|
|
|
|
elm_object_text_set(button, _("Open Link In Browser"));
|
|
|
|
elm_object_part_content_set(ei->hover, "middle", button);
|
|
|
|
evas_object_smart_callback_add(button, "clicked", _link_anchor_bt,
|
|
|
|
av);
|
|
|
|
evas_object_data_set(button, "link", strdup(ei->anchor_info->name));
|
|
|
|
evas_object_show(button);
|
|
|
|
|
|
|
|
button = elm_button_add(obj);
|
|
|
|
elm_object_text_set(button, _("Copy Link"));
|
|
|
|
elm_object_part_content_set(ei->hover, "bottom", button);
|
|
|
|
evas_object_smart_callback_add(button, "clicked", _copy_anchor_bt,
|
|
|
|
av);
|
|
|
|
evas_object_data_set(button, "link", strdup(ei->anchor_info->name));
|
|
|
|
evas_object_show(button);
|
|
|
|
}
|
|
|
|
|
2016-03-10 20:24:01 -08:00
|
|
|
static Evas_Object *
|
2016-10-11 10:09:47 -07:00
|
|
|
_config_bindings(Evas_Object *parent)
|
2016-03-10 20:24:01 -08:00
|
|
|
{
|
2016-10-11 10:09:47 -07:00
|
|
|
Evas_Object *frame, *box, *scroller, *entry;
|
2016-03-10 20:24:01 -08:00
|
|
|
Eina_Strbuf *sbuf = eina_strbuf_new();
|
|
|
|
|
2016-10-11 10:09:47 -07:00
|
|
|
frame = elm_frame_add(parent);
|
|
|
|
elm_object_text_set(frame, _("Bindings"));
|
2017-03-28 10:09:18 -07:00
|
|
|
EPHOTO_EXPAND(frame);
|
|
|
|
EPHOTO_FILL(frame);
|
2016-10-11 10:09:47 -07:00
|
|
|
evas_object_show(frame);
|
|
|
|
|
2016-03-10 20:24:01 -08:00
|
|
|
box = elm_box_add(parent);
|
|
|
|
elm_box_horizontal_set(box, EINA_FALSE);
|
2017-03-28 10:09:18 -07:00
|
|
|
EPHOTO_EXPAND(box);
|
|
|
|
EPHOTO_FILL(box);
|
2016-10-11 10:09:47 -07:00
|
|
|
elm_object_content_set(frame, box);
|
2016-03-10 20:24:01 -08:00
|
|
|
evas_object_show(box);
|
|
|
|
|
|
|
|
scroller = elm_scroller_add(box);
|
2017-03-28 10:09:18 -07:00
|
|
|
EPHOTO_EXPAND(scroller);
|
|
|
|
EPHOTO_FILL(scroller);
|
2016-03-10 20:24:01 -08:00
|
|
|
elm_box_pack_end(box, scroller);
|
|
|
|
evas_object_show(scroller);
|
|
|
|
|
|
|
|
entry = elm_entry_add(scroller);
|
|
|
|
elm_entry_editable_set(entry, EINA_FALSE);
|
|
|
|
elm_entry_line_wrap_set(entry, ELM_WRAP_NONE);
|
2017-03-29 11:18:22 -07:00
|
|
|
EPHOTO_WEIGHT(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
2017-03-28 10:09:18 -07:00
|
|
|
EPHOTO_FILL(entry);
|
2016-03-10 20:24:01 -08:00
|
|
|
eina_strbuf_append_printf(sbuf,
|
|
|
|
_("<b><hilight>General Bindings</hilight></b><br/>"
|
|
|
|
"<b>F1:</b> Settings Panel<br/>"
|
|
|
|
"<b>F5:</b> Start Slideshow<br/>"
|
2016-05-26 15:44:43 -07:00
|
|
|
"<b>F11:</b> Toggle Fullscreen<br/>"
|
|
|
|
"<b>Ctrl+Shift+f:</b> Toggle File Selector<br/><br/>"
|
2016-03-10 20:24:01 -08:00
|
|
|
"<b><hilight>Thumbnail Browser Bindings</hilight></b><br/>"
|
|
|
|
"<b>Ctrl++:</b> Zoom In<br/>"
|
|
|
|
"<b>Ctrl+-:</b> Zoom Out<br/>"
|
|
|
|
"<b>Ctrl+Tab:</b> View Image<br/>"
|
|
|
|
"<b>Ctrl+c:</b> Copy Image<br/>"
|
|
|
|
"<b>Ctrl+x:</b> Cut Image<br/>"
|
|
|
|
"<b>Ctrl+v:</b> Paste Image<br/>"
|
|
|
|
"<b>Ctrl+a:</b> Select All<br/>"
|
|
|
|
"<b>Ctrl+f:</b> Toggle Search<br/>"
|
|
|
|
"<b>Ctrl+Delete:</b> Delete Image<br/>"
|
|
|
|
"<b>F2:</b> Rename Image<br/>"
|
|
|
|
"<b>Escape:</b> Clear Selection<br/><br/>"
|
|
|
|
"<b><hilight>Single Browser Bindings</hilight></b><br/>"
|
|
|
|
"<b>Ctrl+Shift+0:</b> Zoom 1:1<br/>"
|
|
|
|
"<b>Ctrl++:</b> Zoom In<br/>"
|
|
|
|
"<b>Ctrl+-:</b> Zoom Out<br/>"
|
|
|
|
"<b>Ctrl+0:</b> Zoom Fit<br/>"
|
|
|
|
"<b>Ctrl+Shift+l:</b> Rotate Counter Clockwise<br/>"
|
|
|
|
"<b>Ctrl+l:</b> Flip Horizontal<br/>"
|
|
|
|
"<b>Ctrl+Shift+r:</b> Rotate Clockwise<br/>"
|
|
|
|
"<b>Ctrl+r:</b> Flip Vertical<br/>"
|
|
|
|
"<b>Ctrl+Shift+s:</b> Save Image As<br/>"
|
|
|
|
"<b>Ctrl+s:</b> Save Image<br/>"
|
|
|
|
"<b>Ctrl+u:</b> Reset Image<br/>"
|
2016-08-05 10:29:39 -07:00
|
|
|
"<b>Ctrl+y:</b> Redo<br/>"
|
|
|
|
"<b>Ctrl+Shift+z:</b> Redo<br/>"
|
|
|
|
"<b>Ctrl+z:</b> Undo<br/>"
|
2016-03-10 20:24:01 -08:00
|
|
|
"<b>Home:</b> Navigate First<br/>"
|
|
|
|
"<b>Left Arrow:</b> Navigate Previous<br/>"
|
|
|
|
"<b>Right Arrow:</b> Navigate Next<br/>"
|
2016-11-07 12:02:09 -08:00
|
|
|
"<b>Space:</b> Navigate Next<br />"
|
2016-03-10 20:24:01 -08:00
|
|
|
"<b>End:</b> Navigate Last<br/>"
|
2016-04-13 18:02:23 -07:00
|
|
|
"<b>Ctrl+Delete:</b> Delete Image<br/>"
|
|
|
|
"<b>F2</b> Rename Image<br/>"
|
2016-03-10 20:24:01 -08:00
|
|
|
"<b>Escape:</b> Return to Thumbnail Browser<br/><br/>"
|
|
|
|
"<b><hilight>Slideshow Bindings</hilight></b><br/>"
|
|
|
|
"<b>Space:</b> Play/Pause Slideshow<br/>"
|
|
|
|
"<b>Home:</b> Navigate First<br/>"
|
|
|
|
"<b>Left Arrow:</b> Navigate Previous<br/>"
|
|
|
|
"<b>Right Arrow:</b> Navigate Next<br/>"
|
|
|
|
"<b>End:</b> Navigate Last<br/>"
|
|
|
|
"<b>Escape:</b> Quit Slideshow<br/>"));
|
|
|
|
elm_object_text_set(entry, eina_strbuf_string_get(sbuf));
|
|
|
|
elm_object_content_set(scroller, entry);
|
|
|
|
evas_object_show(entry);
|
|
|
|
|
2016-10-11 10:09:47 -07:00
|
|
|
return frame;
|
2016-03-10 20:24:01 -08:00
|
|
|
}
|
|
|
|
|
2016-01-13 13:48:11 -08:00
|
|
|
static Evas_Object *
|
2016-10-11 10:09:47 -07:00
|
|
|
_config_about(Evas_Object *parent)
|
2014-11-20 18:28:55 -08:00
|
|
|
{
|
2016-10-11 10:09:47 -07:00
|
|
|
Evas_Object *frame, *box, *entry, *img, *lbl;
|
2017-03-29 11:18:22 -07:00
|
|
|
Evas_Object *scroller;
|
2015-03-04 14:29:21 -08:00
|
|
|
Eina_Strbuf *sbuf = eina_strbuf_new();
|
2016-03-22 09:00:09 -07:00
|
|
|
char ver[PATH_MAX];
|
2015-03-04 14:29:21 -08:00
|
|
|
FILE *f;
|
2014-11-20 18:28:55 -08:00
|
|
|
|
2016-10-11 10:09:47 -07:00
|
|
|
frame = elm_frame_add(parent);
|
|
|
|
elm_object_text_set(frame, _("About"));
|
2017-03-28 10:09:18 -07:00
|
|
|
EPHOTO_EXPAND(frame);
|
|
|
|
EPHOTO_FILL(frame);
|
2016-10-11 10:09:47 -07:00
|
|
|
evas_object_show(frame);
|
|
|
|
|
2017-03-29 11:18:22 -07:00
|
|
|
scroller = elm_scroller_add(frame);
|
|
|
|
EPHOTO_EXPAND(scroller);
|
|
|
|
EPHOTO_FILL(scroller);
|
|
|
|
elm_object_content_set(frame, scroller);
|
|
|
|
evas_object_show(scroller);
|
|
|
|
|
2016-10-11 10:09:47 -07:00
|
|
|
box = elm_box_add(frame);
|
2014-11-20 18:28:55 -08:00
|
|
|
elm_box_horizontal_set(box, EINA_FALSE);
|
2017-03-28 10:09:18 -07:00
|
|
|
EPHOTO_EXPAND(box);
|
|
|
|
EPHOTO_FILL(box);
|
2017-03-29 11:18:22 -07:00
|
|
|
elm_object_content_set(scroller, box);
|
2015-10-29 15:45:36 -07:00
|
|
|
evas_object_show(box);
|
2015-02-20 08:07:50 -08:00
|
|
|
|
2016-03-22 08:36:22 -07:00
|
|
|
img = elm_image_add(box);
|
2016-08-23 18:46:30 -07:00
|
|
|
evas_object_image_size_set(elm_image_object_get(img), 100, 100);
|
2016-05-31 14:04:41 -07:00
|
|
|
evas_object_size_hint_min_set(img, 200, 100);
|
|
|
|
evas_object_size_hint_max_set(img, 200, 100);
|
|
|
|
elm_image_preload_disabled_set(img, EINA_FALSE);
|
2016-03-22 08:36:22 -07:00
|
|
|
elm_image_file_set(img, PACKAGE_DATA_DIR "/images/ephoto.png", NULL);
|
|
|
|
elm_box_pack_end(box, img);
|
|
|
|
evas_object_show(img);
|
|
|
|
|
2016-08-23 18:46:30 -07:00
|
|
|
snprintf(ver, PATH_MAX, "<hilight><b>Ephoto<br/>Version: %s</b></hilight>", VERSION);
|
2016-03-22 09:00:09 -07:00
|
|
|
|
|
|
|
lbl = elm_label_add(box);
|
|
|
|
elm_object_text_set(lbl, ver);
|
2017-03-28 10:09:18 -07:00
|
|
|
EPHOTO_EXPAND(lbl);
|
|
|
|
EPHOTO_FILL(lbl);
|
2016-03-22 09:00:09 -07:00
|
|
|
elm_box_pack_end(box, lbl);
|
|
|
|
evas_object_show(lbl);
|
|
|
|
|
2016-01-13 13:48:11 -08:00
|
|
|
entry = elm_entry_add(box);
|
2015-12-01 21:03:50 -08:00
|
|
|
elm_entry_anchor_hover_style_set(entry, "popout");
|
2016-01-13 13:48:11 -08:00
|
|
|
elm_entry_anchor_hover_parent_set(entry, parent);
|
2015-12-01 21:03:50 -08:00
|
|
|
elm_entry_editable_set(entry, EINA_FALSE);
|
|
|
|
elm_entry_context_menu_disabled_set(entry, EINA_TRUE);
|
2017-03-29 11:18:22 -07:00
|
|
|
elm_entry_line_wrap_set(entry, ELM_WRAP_WORD);
|
|
|
|
EPHOTO_WEIGHT(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
2017-03-28 10:09:18 -07:00
|
|
|
EPHOTO_FILL(entry);
|
2015-10-30 12:42:13 -07:00
|
|
|
eina_strbuf_append_printf(sbuf,
|
2017-03-29 11:18:22 -07:00
|
|
|
_("Ephoto is a comprehensive image viewer based on the EFL. For more"
|
2016-03-15 14:45:20 -07:00
|
|
|
"information, please visit the Ephoto project page:<br/>"
|
2015-12-08 13:26:33 -08:00
|
|
|
"<a href=http://www.smhouston.us/ephoto/>"
|
|
|
|
"http://www.smhouston.us/ephoto/</a><br/><br/>"
|
|
|
|
"Ephoto also has a page on the Enlightenment wiki:<br/>"
|
2015-12-01 21:03:50 -08:00
|
|
|
"<a href=https://phab.enlightenment.org/w/projects/ephoto>"
|
|
|
|
"https://phab.enlightenment.org/w/projects/ephoto</a><br/><br/>"
|
2015-11-24 14:21:21 -08:00
|
|
|
"Ephoto's source can be found through Enlightenment's git:<br/>"
|
2015-12-01 21:03:50 -08:00
|
|
|
"<a href=http://git.enlightenment.org/apps/ephoto.git>"
|
|
|
|
"http://git.enlightenment.org/apps/ephoto.git</a><br/><br/>"
|
2015-11-24 14:21:21 -08:00
|
|
|
"<b>Authors:</b><br/>"));
|
2015-03-04 14:29:21 -08:00
|
|
|
f = fopen(PACKAGE_DATA_DIR "/AUTHORS", "r");
|
|
|
|
if (f)
|
|
|
|
{
|
2015-11-24 14:21:21 -08:00
|
|
|
char buf[PATH_MAX];
|
|
|
|
|
|
|
|
while (fgets(buf, sizeof(buf), f))
|
|
|
|
{
|
|
|
|
int len;
|
|
|
|
|
|
|
|
len = strlen(buf);
|
|
|
|
if (len > 0)
|
|
|
|
{
|
|
|
|
if (buf[len - 1] == '\n')
|
|
|
|
{
|
|
|
|
buf[len - 1] = 0;
|
|
|
|
len--;
|
|
|
|
}
|
|
|
|
if (len > 0)
|
|
|
|
{
|
|
|
|
char *p;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
p = strchr(buf, '<');
|
|
|
|
if (p)
|
|
|
|
*p = 0;
|
|
|
|
}
|
|
|
|
while (p);
|
|
|
|
do
|
|
|
|
{
|
|
|
|
p = strchr(buf, '>');
|
|
|
|
if (p)
|
|
|
|
*p = 0;
|
|
|
|
}
|
|
|
|
while (p);
|
2015-12-01 21:03:50 -08:00
|
|
|
eina_strbuf_append_printf(sbuf, "%s<br/>", buf);
|
2015-11-24 14:21:21 -08:00
|
|
|
}
|
|
|
|
if (len == 0)
|
2015-12-01 21:03:50 -08:00
|
|
|
eina_strbuf_append_printf(sbuf, "<br/>");
|
2015-11-24 14:21:21 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
fclose(f);
|
2015-03-04 14:29:21 -08:00
|
|
|
}
|
2015-12-01 21:03:50 -08:00
|
|
|
elm_object_text_set(entry, eina_strbuf_string_get(sbuf));
|
|
|
|
evas_object_smart_callback_add(entry, "anchor,hover,opened",
|
|
|
|
_link_anchor, entry);
|
2016-01-13 13:48:11 -08:00
|
|
|
elm_box_pack_end(box, entry);
|
2015-12-01 21:03:50 -08:00
|
|
|
evas_object_show(entry);
|
2014-11-20 18:28:55 -08:00
|
|
|
|
2016-10-11 10:09:47 -07:00
|
|
|
return frame;
|
2016-01-13 13:48:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2016-10-11 10:09:47 -07:00
|
|
|
_list_clicked(void *data, Evas_Object *o, void *event EINA_UNUSED)
|
2016-01-13 13:48:11 -08:00
|
|
|
{
|
2016-10-11 10:09:47 -07:00
|
|
|
Evas_Object *page = data;
|
|
|
|
|
2016-04-11 17:21:52 -07:00
|
|
|
Evas_Object *settings = evas_object_data_get(o, "settings");
|
2016-10-11 10:09:47 -07:00
|
|
|
Evas_Object *slideshow = evas_object_data_get(o, "slideshow");
|
2016-03-10 20:24:01 -08:00
|
|
|
Evas_Object *kb = evas_object_data_get(o, "bindings");
|
2016-01-13 13:48:11 -08:00
|
|
|
Evas_Object *about = evas_object_data_get(o, "about");
|
2016-10-11 10:09:47 -07:00
|
|
|
|
2016-04-11 17:21:52 -07:00
|
|
|
evas_object_hide(settings);
|
2016-10-11 10:09:47 -07:00
|
|
|
evas_object_hide(slideshow);
|
2016-03-10 20:24:01 -08:00
|
|
|
evas_object_hide(kb);
|
2016-01-13 13:48:11 -08:00
|
|
|
evas_object_hide(about);
|
|
|
|
evas_object_show(page);
|
|
|
|
}
|
|
|
|
|
2016-04-08 09:49:40 -07:00
|
|
|
static int
|
|
|
|
_ephoto_config_load(Ephoto *ephoto)
|
|
|
|
{
|
|
|
|
Eet_File *ef;
|
2016-08-29 13:13:00 -07:00
|
|
|
char buf[4096], buf2[4096];
|
2016-04-08 09:49:40 -07:00
|
|
|
|
2016-08-29 13:13:00 -07:00
|
|
|
snprintf(buf2, sizeof(buf2), "%s/ephoto", efreet_config_home_get());
|
2016-04-08 09:49:40 -07:00
|
|
|
ecore_file_mkpath(buf2);
|
|
|
|
snprintf(buf, sizeof(buf), "%s/ephoto.cfg", buf2);
|
|
|
|
|
|
|
|
ef = eet_open(buf, EET_FILE_MODE_READ);
|
|
|
|
if (!ef)
|
|
|
|
{
|
|
|
|
ephoto_config_free(ephoto);
|
|
|
|
ephoto->config = calloc(1, sizeof(Ephoto_Config));
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
ephoto->config = eet_data_read(ef, edd, "config");
|
|
|
|
eet_close(ef);
|
|
|
|
|
|
|
|
if (!ephoto->config || 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)
|
|
|
|
{
|
|
|
|
ecore_file_unlink(buf);
|
|
|
|
ephoto_config_free(ephoto);
|
|
|
|
ephoto->config = calloc(1, sizeof(Ephoto_Config));
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_ephoto_on_config_save(void *data)
|
|
|
|
{
|
|
|
|
Ephoto *ephoto = data;
|
|
|
|
Eet_File *ef;
|
2016-08-29 13:13:00 -07:00
|
|
|
char buf[4096], buf2[4096];
|
2016-04-08 09:49:40 -07:00
|
|
|
|
2016-08-29 13:13:00 -07:00
|
|
|
snprintf(buf, sizeof(buf), "%s/ephoto/ephoto.cfg", efreet_config_home_get());
|
2016-04-08 09:49:40 -07:00
|
|
|
snprintf(buf2, sizeof(buf2), "%s.tmp", buf);
|
|
|
|
|
|
|
|
ef = eet_open(buf2, EET_FILE_MODE_WRITE);
|
|
|
|
if (!ef)
|
|
|
|
goto save_end;
|
|
|
|
|
|
|
|
eet_data_write(ef, edd, "config", ephoto->config, 1);
|
|
|
|
if (eet_close(ef))
|
|
|
|
goto save_end;
|
|
|
|
|
|
|
|
if (!ecore_file_mv(buf2, buf))
|
|
|
|
goto save_end;
|
|
|
|
|
|
|
|
save_end:
|
|
|
|
ecore_file_unlink(buf2);
|
|
|
|
|
|
|
|
return ECORE_CALLBACK_CANCEL;
|
|
|
|
}
|
|
|
|
|
2016-01-13 13:48:11 -08:00
|
|
|
void
|
|
|
|
ephoto_config_main(Ephoto *ephoto)
|
|
|
|
{
|
2016-10-11 10:09:47 -07:00
|
|
|
Evas_Object *popup, *table, *list, *ic;
|
|
|
|
Evas_Object *slideshow, *settings, *kb, *about;
|
|
|
|
Elm_Object_Item *slideshowi, *settingsi, *kbi, *abouti;
|
2016-01-13 13:48:11 -08:00
|
|
|
|
|
|
|
popup = elm_popup_add(ephoto->win);
|
|
|
|
elm_popup_scrollable_set(popup, EINA_TRUE);
|
|
|
|
elm_object_part_text_set(popup, "title,text", _("Settings Panel"));
|
|
|
|
elm_popup_orient_set(popup, ELM_POPUP_ORIENT_CENTER);
|
2016-10-11 10:09:47 -07:00
|
|
|
evas_object_smart_callback_add(popup, "block,clicked", _config_save_cb, popup);
|
2016-01-13 13:48:11 -08:00
|
|
|
|
|
|
|
table = elm_table_add(popup);
|
|
|
|
elm_table_homogeneous_set(table, EINA_FALSE);
|
2017-03-28 10:09:18 -07:00
|
|
|
EPHOTO_EXPAND(table);
|
|
|
|
EPHOTO_FILL(table);
|
2016-01-13 13:48:11 -08:00
|
|
|
|
2016-10-11 10:09:47 -07:00
|
|
|
settings = _config_settings(ephoto, table, EINA_FALSE);
|
|
|
|
elm_table_pack(table, settings, 1, 0, 1, 1);
|
|
|
|
kb = _config_bindings(table);
|
|
|
|
elm_table_pack(table, kb, 1, 0, 1, 1);
|
|
|
|
about = _config_about(table);
|
|
|
|
elm_table_pack(table, about, 1, 0, 1, 1);
|
|
|
|
slideshow = _config_settings(ephoto, table, EINA_TRUE);
|
|
|
|
elm_table_pack(table, slideshow, 1, 0, 1, 1);
|
|
|
|
|
|
|
|
list = elm_list_add(table);
|
|
|
|
elm_list_select_mode_set(list, ELM_OBJECT_SELECT_MODE_ALWAYS);
|
|
|
|
elm_scroller_content_min_limit(list, 1, 1);
|
2017-03-28 10:09:18 -07:00
|
|
|
EPHOTO_EXPAND(list);
|
|
|
|
EPHOTO_FILL(list);
|
2016-10-11 10:09:47 -07:00
|
|
|
elm_table_pack(table, list, 0, 0, 1, 1);
|
|
|
|
evas_object_show(list);
|
|
|
|
|
|
|
|
evas_object_data_set(list, "settings", settings);
|
|
|
|
evas_object_data_set(list, "slideshow", slideshow);
|
|
|
|
evas_object_data_set(list, "bindings", kb);
|
|
|
|
evas_object_data_set(list, "about", about);
|
|
|
|
|
|
|
|
ic = elm_icon_add(list);
|
2016-01-13 13:48:11 -08:00
|
|
|
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
|
|
|
|
elm_icon_standard_set(ic, "preferences-system");
|
|
|
|
evas_object_show(ic);
|
2016-10-11 10:09:47 -07:00
|
|
|
settingsi = elm_list_item_append(list, _("General"), ic, NULL,
|
|
|
|
_list_clicked, settings);
|
2016-01-13 13:48:11 -08:00
|
|
|
|
2016-10-11 10:09:47 -07:00
|
|
|
ic = elm_icon_add(list);
|
|
|
|
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
|
|
|
|
elm_icon_standard_set(ic, "media-playback-start");
|
|
|
|
evas_object_show(ic);
|
|
|
|
slideshowi = elm_list_item_append(list, _("Slideshow"), ic, NULL,
|
|
|
|
_list_clicked, slideshow);
|
|
|
|
|
|
|
|
ic = elm_icon_add(list);
|
2016-03-10 20:24:01 -08:00
|
|
|
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
|
|
|
|
elm_icon_standard_set(ic, "input-keyboard");
|
|
|
|
evas_object_show(ic);
|
2016-10-11 10:09:47 -07:00
|
|
|
kbi = elm_list_item_append(list, _("Bindings"), ic, NULL,
|
|
|
|
_list_clicked, kb);
|
2016-03-10 20:24:01 -08:00
|
|
|
|
2016-10-11 10:09:47 -07:00
|
|
|
ic = elm_icon_add(list);
|
2016-01-13 13:48:11 -08:00
|
|
|
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
|
|
|
|
elm_icon_standard_set(ic, "help-about");
|
|
|
|
evas_object_show(ic);
|
2016-10-11 10:09:47 -07:00
|
|
|
abouti = elm_list_item_append(list, _("About"), ic, NULL,
|
|
|
|
_list_clicked, about);
|
2016-01-13 13:48:11 -08:00
|
|
|
|
2016-10-11 10:09:47 -07:00
|
|
|
elm_list_go(list);
|
2016-01-13 13:48:11 -08:00
|
|
|
|
2016-04-11 17:21:52 -07:00
|
|
|
elm_object_item_data_set(settingsi, settings);
|
2016-10-11 10:09:47 -07:00
|
|
|
elm_object_item_data_set(slideshowi, slideshow);
|
2016-03-10 20:24:01 -08:00
|
|
|
elm_object_item_data_set(kbi, kb);
|
2016-01-13 13:48:11 -08:00
|
|
|
elm_object_item_data_set(abouti, about);
|
2016-10-11 10:09:47 -07:00
|
|
|
evas_object_hide(slideshow);
|
2016-03-10 20:24:01 -08:00
|
|
|
evas_object_hide(kb);
|
2016-01-13 13:48:11 -08:00
|
|
|
evas_object_hide(about);
|
2016-10-11 10:09:47 -07:00
|
|
|
|
|
|
|
elm_list_item_selected_set(settingsi, EINA_TRUE);
|
2016-01-13 13:48:11 -08:00
|
|
|
|
|
|
|
evas_object_show(table);
|
|
|
|
elm_object_content_set(popup, table);
|
2015-10-30 12:42:13 -07:00
|
|
|
evas_object_data_set(popup, "ephoto", ephoto);
|
|
|
|
evas_object_show(popup);
|
2016-08-03 14:05:48 -07:00
|
|
|
|
|
|
|
if (ephoto->config->firstrun)
|
2016-10-11 10:09:47 -07:00
|
|
|
elm_list_item_selected_set(abouti, EINA_TRUE);
|
2014-11-20 18:28:55 -08:00
|
|
|
}
|
|
|
|
|
2016-04-08 09:49:40 -07:00
|
|
|
void
|
|
|
|
ephoto_config_save(Ephoto *ephoto)
|
2011-02-24 14:26:47 -08:00
|
|
|
{
|
2016-04-08 09:49:40 -07:00
|
|
|
_ephoto_on_config_save(ephoto);
|
|
|
|
}
|
2011-02-24 14:26:47 -08:00
|
|
|
|
2016-04-08 09:49:40 -07:00
|
|
|
void
|
|
|
|
ephoto_config_free(Ephoto *ephoto)
|
|
|
|
{
|
|
|
|
free(ephoto->config);
|
|
|
|
ephoto->config = NULL;
|
2011-02-24 14:26:47 -08:00
|
|
|
}
|
|
|
|
|
2016-04-08 09:49:40 -07:00
|
|
|
Eina_Bool
|
|
|
|
ephoto_config_init(Ephoto *ephoto)
|
2011-02-24 14:26:47 -08:00
|
|
|
{
|
2016-04-08 09:49:40 -07:00
|
|
|
Eet_Data_Descriptor_Class eddc;
|
2011-02-24 14:26:47 -08:00
|
|
|
|
2016-04-08 09:49:40 -07:00
|
|
|
if (!eet_eina_stream_data_descriptor_class_set(&eddc, sizeof(eddc),
|
|
|
|
"Ephoto_Config", sizeof(Ephoto_Config)))
|
|
|
|
{
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2011-02-24 14:26:47 -08:00
|
|
|
|
2016-04-08 09:49:40 -07:00
|
|
|
if (!edd)
|
|
|
|
edd = eet_data_descriptor_stream_new(&eddc);
|
2011-02-24 14:26:47 -08:00
|
|
|
|
2016-04-08 09:49:40 -07:00
|
|
|
#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)
|
2011-02-24 14:26:47 -08:00
|
|
|
|
2016-04-08 09:49:40 -07:00
|
|
|
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, window_width, EET_T_INT);
|
|
|
|
C_VAL(D, T, window_height, EET_T_INT);
|
|
|
|
C_VAL(D, T, fsel_hide, EET_T_INT);
|
|
|
|
C_VAL(D, T, lpane_size, EET_T_DOUBLE);
|
|
|
|
C_VAL(D, T, open, EET_T_STRING);
|
|
|
|
C_VAL(D, T, prompts, EET_T_INT);
|
|
|
|
C_VAL(D, T, drop, EET_T_INT);
|
2016-07-21 15:12:29 -07:00
|
|
|
C_VAL(D, T, movess, EET_T_INT);
|
2016-08-07 20:54:08 -07:00
|
|
|
C_VAL(D, T, smooth, EET_T_INT);
|
|
|
|
C_VAL(D, T, firstrun, EET_T_INT);
|
|
|
|
C_VAL(D, T, folders, EET_T_INT);
|
2016-04-08 09:49:40 -07:00
|
|
|
switch (_ephoto_config_load(ephoto))
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
/* Start a new config */
|
|
|
|
ephoto->config->config_version = CONFIG_VERSION;
|
|
|
|
ephoto->config->slideshow_timeout = 4.0;
|
|
|
|
ephoto->config->slideshow_transition = eina_stringshare_add("fade");
|
2016-10-29 07:51:12 -07:00
|
|
|
ephoto->config->window_width = 900*elm_config_scale_get();
|
|
|
|
ephoto->config->window_height = 500*elm_config_scale_get();
|
2016-04-08 09:49:40 -07:00
|
|
|
ephoto->config->fsel_hide = 0;
|
|
|
|
ephoto->config->lpane_size = .15;
|
|
|
|
ephoto->config->open = eina_stringshare_add(getenv("HOME"));
|
|
|
|
ephoto->config->prompts = 1;
|
|
|
|
ephoto->config->drop = 0;
|
2016-07-21 15:12:29 -07:00
|
|
|
ephoto->config->movess = 1;
|
2016-08-04 14:36:58 -07:00
|
|
|
ephoto->config->smooth = 1;
|
2016-08-03 14:05:48 -07:00
|
|
|
ephoto->config->firstrun = 1;
|
2016-08-07 20:54:08 -07:00
|
|
|
ephoto->config->folders = 1;
|
2016-04-08 09:49:40 -07:00
|
|
|
break;
|
2011-02-24 14:26:47 -08:00
|
|
|
|
2016-04-08 09:49:40 -07:00
|
|
|
default:
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
2011-02-24 14:26:47 -08:00
|
|
|
|
2016-04-08 09:49:40 -07:00
|
|
|
ephoto_config_save(ephoto);
|
|
|
|
return EINA_TRUE;
|
2011-02-24 14:26:47 -08:00
|
|
|
}
|
2016-04-08 09:49:40 -07:00
|
|
|
|