Add the beginning stages of a config dialog.

This commit is contained in:
Stephen Houston 2014-11-19 16:50:56 -06:00
parent 74471f29b3
commit 28a4d401bf
5 changed files with 60 additions and 3 deletions

View File

@ -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);

View File

@ -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)
{

View File

@ -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);

View File

@ -687,6 +687,15 @@ _back(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
evas_object_smart_callback_call(sb->main, "back", sb->entry);
}
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)
{
@ -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);

View File

@ -245,6 +245,15 @@ _slideshow(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
evas_object_smart_callback_call(tb->main, "slideshow", entry);
}
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)
{
@ -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);