2010-07-01 11:49:22 -07:00
|
|
|
#include "ephoto.h"
|
|
|
|
|
|
|
|
/*Ephoto Main Global*/
|
|
|
|
Ephoto *em;
|
|
|
|
|
|
|
|
/*Inline Callbacks*/
|
|
|
|
static void _ephoto_delete_main_window(void *data, Evas_Object *obj, void *event_info);
|
2010-07-02 14:35:51 -07:00
|
|
|
static void _ephoto_free_hash(void *data);
|
2010-07-01 11:49:22 -07:00
|
|
|
|
|
|
|
/*Create the main ephoto window*/
|
|
|
|
void ephoto_create_main_window(void)
|
|
|
|
{
|
|
|
|
em = calloc(1, sizeof(Ephoto));
|
2010-07-02 14:35:51 -07:00
|
|
|
em->thumbs_images = eina_hash_string_superfast_new(_ephoto_free_hash);
|
2010-07-01 11:49:22 -07:00
|
|
|
|
|
|
|
/*Setup the main window*/
|
|
|
|
em->win = elm_win_add(NULL, "ephoto", ELM_WIN_BASIC);
|
|
|
|
elm_win_title_set(em->win, "Ephoto");
|
|
|
|
evas_object_resize(em->win, 840, 530);
|
|
|
|
evas_object_show(em->win);
|
|
|
|
|
|
|
|
/*Callback to close the main window*/
|
|
|
|
evas_object_smart_callback_add(em->win, "delete,request",
|
|
|
|
_ephoto_delete_main_window, NULL);
|
|
|
|
|
|
|
|
/*Grab the main evas canvas we are working with*/
|
|
|
|
em->e = evas_object_evas_get(em->win);
|
|
|
|
|
|
|
|
/*Set a custom background for the window*/
|
|
|
|
em->bg = elm_bg_add(em->win);
|
|
|
|
elm_win_resize_object_add(em->win, em->bg);
|
|
|
|
evas_object_size_hint_weight_set(em->bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_show(em->bg);
|
|
|
|
|
|
|
|
em->box = elm_box_add(em->win);
|
|
|
|
elm_win_resize_object_add(em->win, em->box);
|
|
|
|
evas_object_size_hint_weight_set(em->box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_fill_set(em->box, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
evas_object_show(em->box);
|
|
|
|
|
|
|
|
ephoto_create_thumb_browser();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*Delete the main ephoto window*/
|
|
|
|
static void _ephoto_delete_main_window(void *data, Evas_Object *obj, void *event_info)
|
|
|
|
{
|
|
|
|
ephoto_delete_thumb_browser();
|
|
|
|
evas_object_del(em->box);
|
|
|
|
evas_object_del(em->bg);
|
|
|
|
evas_object_del(em->win);
|
2010-07-02 14:35:51 -07:00
|
|
|
if (em->thumbs_images)
|
|
|
|
eina_hash_free(em->thumbs_images);
|
|
|
|
if (em->images)
|
2010-07-01 11:49:22 -07:00
|
|
|
eina_list_free(em->images);
|
|
|
|
free(em);
|
|
|
|
elm_exit();
|
|
|
|
}
|
|
|
|
|
2010-07-02 14:35:51 -07:00
|
|
|
/*Free the eina hash*/
|
|
|
|
static void _ephoto_free_hash(void *data)
|
|
|
|
{
|
|
|
|
char *item;
|
|
|
|
|
|
|
|
item = data;
|
|
|
|
free(item);
|
|
|
|
}
|
|
|
|
|