okra pushed a commit to branch master. http://git.enlightenment.org/apps/ephoto.git/commit/?id=28a4d401bf65e3634e01f16fb701d0db416971da
commit 28a4d401bf65e3634e01f16fb701d0db416971da Author: Stephen Houston <smhousto...@gmail.com> Date: Wed Nov 19 16:50:56 2014 -0600 Add the beginning stages of a config dialog. --- src/bin/ephoto.h | 1 + src/bin/ephoto_config.c | 37 +++++++++++++++++++++++++++++++++++++ src/bin/ephoto_main.c | 3 --- src/bin/ephoto_single_browser.c | 12 ++++++++++++ src/bin/ephoto_thumb_browser.c | 10 ++++++++++ 5 files changed, 60 insertions(+), 3 deletions(-) diff --git a/src/bin/ephoto.h b/src/bin/ephoto.h index 14a7db2..dfdd9da 100644 --- a/src/bin/ephoto.h +++ b/src/bin/ephoto.h @@ -42,6 +42,7 @@ Ephoto_Orient ephoto_file_orient_get(const char *path); Eina_Bool ephoto_config_init(Ephoto *em); void ephoto_config_save(Ephoto *em); void ephoto_config_free(Ephoto *em); +void ephoto_config_window(Ephoto *em); Evas_Object *ephoto_single_browser_add(Ephoto *ephoto, Evas_Object *parent); void ephoto_single_browser_entry_set(Evas_Object *obj, Ephoto_Entry *entry); diff --git a/src/bin/ephoto_config.c b/src/bin/ephoto_config.c index b09290a..d801162 100644 --- a/src/bin/ephoto_config.c +++ b/src/bin/ephoto_config.c @@ -75,6 +75,43 @@ ephoto_config_free(Ephoto *ephoto) ephoto->config = NULL; } +void +_close(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *o = data; + + evas_object_del(o); +} + +void +ephoto_config_window(Ephoto *ephoto) +{ + Evas_Object *win, *box, *button, *label; + + win = elm_win_inwin_add(ephoto->win); + evas_object_show(win); + + box = elm_box_add(win); + elm_box_horizontal_set(box, EINA_FALSE); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_win_resize_object_add(win, box); + + label = elm_label_add(box); + elm_object_text_set(label, "Settings Dialog Coming Soon!"); + elm_box_pack_end(box, label); + evas_object_show(label); + + button = elm_button_add(box); + elm_object_text_set(button, "Close"); + evas_object_smart_callback_add(button, "clicked", _close, win); + elm_box_pack_end(box, button); + evas_object_show(button); + + elm_win_inwin_content_set(win, box); + evas_object_show(box); +} + static int _ephoto_config_load(Ephoto *ephoto) { diff --git a/src/bin/ephoto_main.c b/src/bin/ephoto_main.c index 14ce279..48a65c1 100644 --- a/src/bin/ephoto_main.c +++ b/src/bin/ephoto_main.c @@ -259,7 +259,6 @@ ephoto_window_add(const char *path) ephoto->state = EPHOTO_STATE_SINGLE; } - /* TODO restore size from last run as well? */ evas_object_resize(ephoto->win, ephoto->config->window_width, ephoto->config->window_height); evas_object_show(ephoto->win); @@ -342,7 +341,6 @@ _ephoto_populate_error(void *data, Eio_File *handler, int error) Ephoto *ephoto = data; if (error) ERR("could not populate: %s", strerror(error)); - /* XXX: Perhaps it would be better to _not_ emit POPULATE_END here */ ecore_event_add(EPHOTO_EVENT_POPULATE_ERROR, NULL, NULL, NULL); _ephoto_populate_end(ephoto, handler); } @@ -350,7 +348,6 @@ _ephoto_populate_error(void *data, Eio_File *handler, int error) static void _ephoto_populate_entries(Ephoto *ephoto) { - /* Edje_External_Param param; */ DBG("populate from '%s'", ephoto->config->directory); ephoto_entries_free(ephoto); diff --git a/src/bin/ephoto_single_browser.c b/src/bin/ephoto_single_browser.c index 511b742..b9c7c18 100644 --- a/src/bin/ephoto_single_browser.c +++ b/src/bin/ephoto_single_browser.c @@ -688,6 +688,15 @@ _back(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__) } static void +_settings(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__) +{ + Ephoto_Single_Browser *sb = data; + + if (sb->ephoto) + ephoto_config_window(sb->ephoto); +} + +static void _key_down(void *data, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *event_info) { Ephoto_Single_Browser *sb = data; @@ -876,6 +885,9 @@ ephoto_single_browser_add(Ephoto *ephoto, Evas_Object *parent) icon = elm_toolbar_item_append(sb->bar, "go-last", "Last", _go_last, sb); elm_toolbar_item_priority_set(icon, 60); + icon = elm_toolbar_item_append(sb->bar, "emblem-system", "Settings", _settings, sb); + elm_toolbar_item_priority_set(icon, 50); + elm_object_content_set(sb->panel, sb->bar); evas_object_show(sb->bar); diff --git a/src/bin/ephoto_thumb_browser.c b/src/bin/ephoto_thumb_browser.c index 1fbeb6b..cfd14cf 100644 --- a/src/bin/ephoto_thumb_browser.c +++ b/src/bin/ephoto_thumb_browser.c @@ -246,6 +246,15 @@ _slideshow(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__) } static void +_settings(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__) +{ + Ephoto_Thumb_Browser *tb = data; + + if (tb->ephoto) + ephoto_config_window(tb->ephoto); +} + +static void _key_down(void *data, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *event_info) { Ephoto_Thumb_Browser *tb = data; @@ -469,6 +478,7 @@ ephoto_thumb_browser_add(Ephoto *ephoto, Evas_Object *parent) min = elm_object_item_widget_get(icon); evas_object_data_set(max, "min", min); evas_object_data_set(min, "max", max); + elm_toolbar_item_append(tb->bar, "emblem-system", "Settings", _settings, tb); elm_object_content_set(tb->panel, tb->bar); evas_object_show(tb->bar); --