2008-06-06 03:02:27 +00:00
|
|
|
#include "ecdb.h"
|
|
|
|
|
2008-08-06 03:25:11 +00:00
|
|
|
static void
|
2008-08-04 23:28:43 +00:00
|
|
|
ecdb_cb_enter(Ecore_Evas *ee)
|
|
|
|
{
|
|
|
|
Evas_Object *gui;
|
|
|
|
gui = evas_object_name_find(ecore_evas_get(ee), "gui");
|
|
|
|
edje_object_signal_emit(gui, "ecdb,window,enter", "ecdb");
|
|
|
|
}
|
|
|
|
|
2008-08-06 03:25:11 +00:00
|
|
|
static void
|
2008-08-04 23:28:43 +00:00
|
|
|
ecdb_cb_leave(Ecore_Evas *ee)
|
2008-06-06 03:02:27 +00:00
|
|
|
{
|
2008-08-04 23:28:43 +00:00
|
|
|
Evas_Object *gui;
|
|
|
|
gui = evas_object_name_find(ecore_evas_get(ee), "gui");
|
2008-08-06 03:25:11 +00:00
|
|
|
edje_object_signal_emit(gui, "ecdb,window,exit", "ecdb");
|
2008-06-06 03:02:27 +00:00
|
|
|
}
|
|
|
|
|
2008-08-06 03:25:11 +00:00
|
|
|
static void
|
2008-08-04 23:28:43 +00:00
|
|
|
ecdb_cb_resize(Ecore_Evas *ee)
|
|
|
|
{
|
|
|
|
int w, h;
|
|
|
|
Evas_Object *gui;
|
|
|
|
|
|
|
|
ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
|
|
|
|
gui = evas_object_name_find(ecore_evas_get(ee), "gui");
|
|
|
|
evas_object_resize(gui, w, h);
|
|
|
|
}
|
|
|
|
|
2008-08-06 03:25:11 +00:00
|
|
|
static void
|
|
|
|
_cb_filelist_mouse_in(Ewl_Widget *w, void *ev __UNUSED__, void *data)
|
|
|
|
{
|
|
|
|
Evas_Object *gui = data;
|
|
|
|
edje_object_signal_emit(gui, "ecdb,filelist,in", "ecdb");
|
|
|
|
printf("Emitting signal\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_cb_filelist_mouse_out(Ewl_Widget *w, void *ev __UNUSED__, void *data)
|
|
|
|
{
|
|
|
|
Evas_Object *gui = data;
|
|
|
|
edje_object_signal_emit(gui, "ecdb,filelist,out", "ecdb");
|
|
|
|
printf("Emitting signal\n");
|
|
|
|
}
|
|
|
|
|
2008-08-04 23:28:43 +00:00
|
|
|
int
|
|
|
|
ecdb_create_main_gui(void)
|
|
|
|
{
|
2008-08-05 03:12:24 +00:00
|
|
|
Evas_Object *gui;
|
2008-08-06 02:21:20 +00:00
|
|
|
Evas_Object *swallow;
|
|
|
|
Ewl_Widget *embed, *filelist;
|
|
|
|
Evas_Coord x, y, w, h;
|
2008-08-05 03:12:24 +00:00
|
|
|
|
2008-08-04 23:28:43 +00:00
|
|
|
em->main_win_ee = ecore_evas_software_x11_new(0, 0, 0, 0, 255, 255);
|
|
|
|
|
|
|
|
if (!em->main_win_ee)
|
|
|
|
{
|
|
|
|
printf("Cannot create main window!\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
ecore_evas_title_set(em->main_win_ee, "ECDB");
|
|
|
|
ecore_evas_name_class_set(em->main_win_ee, "ECDB", "ECDB");
|
|
|
|
|
|
|
|
ecore_evas_callback_delete_request_set(em->main_win_ee, ecdb_shutdown);
|
|
|
|
ecore_evas_callback_destroy_set(em->main_win_ee, ecdb_shutdown);
|
|
|
|
ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, ecdb_shutdown, NULL);
|
|
|
|
|
|
|
|
ecore_evas_callback_mouse_in_set(em->main_win_ee, ecdb_cb_enter);
|
|
|
|
ecore_evas_callback_mouse_out_set(em->main_win_ee, ecdb_cb_leave);
|
|
|
|
ecore_evas_callback_resize_set(em->main_win_ee, ecdb_cb_resize);
|
|
|
|
|
|
|
|
edje_frametime_set(1.0 / 60.0);
|
|
|
|
ecore_evas_show(em->main_win_ee);
|
|
|
|
|
2008-08-05 03:12:24 +00:00
|
|
|
gui = edje_object_add(ecore_evas_get(em->main_win_ee));
|
|
|
|
evas_object_name_set(gui, "gui");
|
|
|
|
evas_object_move(gui, 0, 0);
|
|
|
|
evas_object_show(gui);
|
|
|
|
|
2008-08-04 23:28:43 +00:00
|
|
|
ecdb_set_main_theme(NULL, "ecdb/window");
|
|
|
|
|
2008-08-06 02:21:20 +00:00
|
|
|
/* Set up the filelist swallow */
|
|
|
|
embed = ewl_embed_new();
|
|
|
|
ewl_object_fill_policy_set(EWL_OBJECT(embed), EWL_FLAG_FILL_ALL);
|
|
|
|
swallow = ewl_embed_canvas_set(EWL_EMBED(embed),
|
|
|
|
ecore_evas_get(em->main_win_ee),
|
|
|
|
(void *)(long) ecore_evas_software_x11_window_get
|
|
|
|
(em->main_win_ee));
|
|
|
|
ewl_embed_focus_set(EWL_EMBED(embed), TRUE);
|
|
|
|
ewl_widget_show(embed);
|
|
|
|
|
|
|
|
filelist = ewl_filelist_new();
|
|
|
|
ewl_container_child_append(EWL_CONTAINER(embed), filelist);
|
|
|
|
ewl_filelist_directory_set(EWL_FILELIST(filelist), getenv("HOME"));
|
2008-08-06 03:25:11 +00:00
|
|
|
ewl_callback_append(filelist, EWL_CALLBACK_MOUSE_IN,
|
|
|
|
_cb_filelist_mouse_in, gui);
|
|
|
|
ewl_callback_append(filelist, EWL_CALLBACK_MOUSE_OUT,
|
|
|
|
_cb_filelist_mouse_out, gui);
|
2008-08-06 02:21:20 +00:00
|
|
|
ewl_widget_show(filelist);
|
|
|
|
|
|
|
|
edje_object_part_geometry_get(gui, "filelist", &x, &y, &w, &h);
|
|
|
|
evas_object_move(swallow, x, y);
|
|
|
|
evas_object_resize(swallow, x, y);
|
|
|
|
edje_object_part_swallow(gui, "filelist", swallow);
|
|
|
|
evas_object_show(swallow);
|
|
|
|
|
2008-08-04 23:28:43 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2008-08-04 22:18:34 +00:00
|
|
|
ecdb_create_data_tab(void)
|
2008-06-21 02:51:16 +00:00
|
|
|
{
|
2008-08-04 22:18:34 +00:00
|
|
|
printf("Creating data tab\n");
|
2008-08-04 23:28:43 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ecdb_set_main_theme(const char *theme_name, const char *group)
|
|
|
|
{
|
|
|
|
Evas_Coord mw, mh;
|
|
|
|
Evas_Object *gui;
|
|
|
|
|
|
|
|
gui = evas_object_name_find(ecore_evas_get(em->main_win_ee), "gui");
|
|
|
|
|
|
|
|
if ((!group) || (!gui))
|
|
|
|
{
|
|
|
|
printf("Fail on group or object!\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!theme_name)
|
|
|
|
{
|
2008-08-05 03:12:24 +00:00
|
|
|
if (!edje_object_file_set(gui, PACKAGE_DATA_DIR
|
|
|
|
"/themes/default.edj", group))
|
2008-08-04 23:28:43 +00:00
|
|
|
{
|
2008-08-05 03:12:24 +00:00
|
|
|
printf("Error setting default theme: %s\n",
|
|
|
|
PACKAGE_DATA_DIR"/themes/default/edj");
|
2008-08-04 23:28:43 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (!edje_object_file_set(gui, theme_name, group))
|
|
|
|
{
|
|
|
|
printf("Error setting theme to: %s\n", theme_name);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
edje_object_size_min_get(gui, &mw, &mh);
|
|
|
|
if ((mw <= 0) && (mh <= 0))
|
|
|
|
{
|
|
|
|
mw = 255;
|
|
|
|
mh = 255;
|
|
|
|
}
|
|
|
|
|
|
|
|
evas_object_resize(gui, mw, mh);
|
|
|
|
ecore_evas_resize(em->main_win_ee, mw, mh);
|
|
|
|
ecore_evas_size_min_set(em->main_win_ee, mw, mh);
|
2008-06-21 02:51:16 +00:00
|
|
|
}
|