2008-12-09 19:46:00 +00:00
|
|
|
/* vim: set sw=3 ts=3 sts=3 expandtab: */
|
2008-06-06 03:02:27 +00:00
|
|
|
#include "ecdb.h"
|
|
|
|
|
2008-09-12 20:13:57 +00:00
|
|
|
static void ecdb_handle_typebuf(Evas_Object *gui);
|
2008-11-05 14:54:58 +00:00
|
|
|
static void ecdb_cb_controls_focused(void *data, Evas_Object *o,
|
2008-09-22 15:02:49 +00:00
|
|
|
const char *emission, const char *source);
|
|
|
|
static void ecdb_cb_welcome_page_buttons_clicked(void *data, Evas_Object *o,
|
2008-12-09 05:47:59 +00:00
|
|
|
const char *emission, const char *source);
|
2008-10-31 14:54:37 +00:00
|
|
|
static void ecdb_cb_erase_page_buttons_clicked(void *data, Evas_Object *o,
|
2008-12-09 05:47:59 +00:00
|
|
|
const char *emission, const char *source);
|
2008-12-09 01:12:16 +00:00
|
|
|
static void ecdb_cb_burn_image_page_buttons_clicked(void *data, Evas_Object *o,
|
2008-12-09 05:47:59 +00:00
|
|
|
const char *emission, const char *source);
|
2008-09-24 18:52:11 +00:00
|
|
|
static void ecdb_cb_page_hide_finished(void *data, Evas_Object *o,
|
2008-12-09 05:47:59 +00:00
|
|
|
const char *emission, const char *source);
|
2008-11-06 19:04:00 +00:00
|
|
|
static void ecdb_gui_controls_disable(const char **ids, int n);
|
|
|
|
static void ecdb_gui_controls_enable(const char **ids, int n);
|
2008-09-24 15:50:18 +00:00
|
|
|
static void ecdb_filelist_show(void);
|
|
|
|
static void ecdb_welcome_page_show(void);
|
2008-09-24 18:52:11 +00:00
|
|
|
static void ecdb_erase_page_show(void);
|
2008-12-09 01:12:16 +00:00
|
|
|
static void ecdb_burn_image_page_show(void);
|
2008-09-24 18:52:11 +00:00
|
|
|
static void ecdb_page_hide(const char *pname);
|
2008-12-09 23:17:57 +00:00
|
|
|
static void ecdb_filelist_focus_handle(int action, Evas_Object *fl);
|
2008-09-12 20:13:57 +00:00
|
|
|
|
2008-08-06 03:25:11 +00:00
|
|
|
static void
|
2008-08-04 23:28:43 +00:00
|
|
|
ecdb_cb_enter(Ecore_Evas *ee)
|
|
|
|
{
|
2008-12-09 05:47:59 +00:00
|
|
|
Evas_Object *gui;
|
|
|
|
gui = evas_object_name_find(ecore_evas_get(ee), "gui");
|
|
|
|
edje_object_signal_emit(gui, "ecdb,window,enter", "ecdb");
|
2008-08-04 23:28:43 +00:00
|
|
|
}
|
|
|
|
|
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-12-09 05:47:59 +00:00
|
|
|
Evas_Object *gui;
|
|
|
|
gui = evas_object_name_find(ecore_evas_get(ee), "gui");
|
|
|
|
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)
|
|
|
|
{
|
2008-12-09 05:47:59 +00:00
|
|
|
int w, h;
|
|
|
|
Evas_Object *gui;
|
2008-08-04 23:28:43 +00:00
|
|
|
|
2008-12-09 05:47:59 +00:00
|
|
|
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-04 23:28:43 +00:00
|
|
|
}
|
|
|
|
|
2008-12-09 23:17:57 +00:00
|
|
|
static void ecdb_filelist_focus_handle(int action, Evas_Object *fl)
|
|
|
|
{
|
|
|
|
static Evas_Object *old_focus;
|
|
|
|
Evas_Object *gui;
|
|
|
|
|
|
|
|
if (action == IN)
|
|
|
|
{
|
|
|
|
old_focus = evas_focus_get(ecore_evas_get(em->main_win_ee));
|
|
|
|
edje_object_signal_emit(old_focus, "ecdb,focus,out", "ecdb");
|
|
|
|
evas_object_focus_set(fl, 1);
|
|
|
|
}
|
|
|
|
else if (old_focus)
|
|
|
|
{
|
|
|
|
edje_object_signal_emit(old_focus, "ecdb,focus,in", "ecdb");
|
|
|
|
evas_object_focus_set(old_focus, 1);
|
|
|
|
old_focus = NULL;
|
|
|
|
|
|
|
|
gui = evas_object_name_find(ecore_evas_get(em->main_win_ee), "gui");
|
|
|
|
edje_object_signal_emit(gui, "ecdb,filelist_overlay,deactivate", "ecdb");
|
|
|
|
edje_object_part_text_set(gui, "filelist_overlay_text", NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_cb_filelist_mouse_in(void *data, Evas *e __UNUSED__, Evas_Object *eo,
|
|
|
|
void *ev_data __UNUSED__)
|
|
|
|
{
|
|
|
|
ecdb_filelist_focus_handle(IN, eo);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_cb_filelist_mouse_out(void *data, Evas *e __UNUSED__, Evas_Object *eo,
|
|
|
|
void *ev_data __UNUSED__)
|
|
|
|
{
|
|
|
|
ecdb_filelist_focus_handle(OUT, eo);
|
|
|
|
}
|
|
|
|
|
2008-08-06 23:09:30 +00:00
|
|
|
static void
|
2008-08-07 04:09:47 +00:00
|
|
|
_cb_filelist_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *eo,
|
2008-12-09 05:47:59 +00:00
|
|
|
void *ev_data __UNUSED__)
|
2008-08-06 23:09:30 +00:00
|
|
|
{
|
2008-12-09 05:47:59 +00:00
|
|
|
Evas_Object *gui = data;
|
|
|
|
evas_object_focus_set(eo, TRUE);
|
2008-08-07 04:09:47 +00:00
|
|
|
|
2008-12-09 05:47:59 +00:00
|
|
|
edje_object_signal_emit(gui, "ecdb,filelist_overlay,deactivate", "ecdb");
|
|
|
|
edje_object_part_text_set(gui, "filelist_overlay_text", NULL);
|
2008-08-07 04:09:47 +00:00
|
|
|
|
2008-08-06 23:09:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-08-07 04:09:47 +00:00
|
|
|
_cb_filelist_key_down(void *data, Evas *e __UNUSED__,
|
2008-12-09 05:47:59 +00:00
|
|
|
Evas_Object *eo __UNUSED__, void *ev_data)
|
2008-08-06 23:09:30 +00:00
|
|
|
{
|
2008-12-09 05:47:59 +00:00
|
|
|
Evas_Event_Key_Down *ek = ev_data;
|
|
|
|
Evas_Object *gui = data;
|
|
|
|
|
|
|
|
if (!strcmp(ek->key, "Escape"))
|
|
|
|
{
|
|
|
|
edje_object_signal_emit(gui, "ecdb,filelist_overlay,deactivate", "ecdb");
|
|
|
|
edje_object_part_text_set(gui, "filelist_overlay_text", NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (!strcmp(ek->key, "Return"))
|
|
|
|
{
|
|
|
|
ecdb_handle_typebuf(gui);
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (!strcmp(ek->key, "BackSpace"))
|
|
|
|
{
|
|
|
|
int len;
|
|
|
|
const char *t;
|
|
|
|
char *text;
|
|
|
|
|
|
|
|
t = edje_object_part_text_get(gui, "filelist_overlay_text");
|
|
|
|
text = (t) ? (strdup(t)) : NULL;
|
|
|
|
|
|
|
|
if ((!text) || (!*text)) return;
|
|
|
|
|
|
|
|
len = strlen(text);
|
|
|
|
text = realloc(text, len);
|
|
|
|
text[len - 1] = '\0';
|
|
|
|
|
|
|
|
if (len == 1)
|
|
|
|
{
|
|
|
|
edje_object_signal_emit(gui, "ecdb,filelist_overlay,deactivate",
|
|
|
|
"ecdb");
|
|
|
|
}
|
|
|
|
edje_object_part_text_set(gui, "filelist_overlay_text", text);
|
|
|
|
FREE(text);
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int len;
|
|
|
|
const char *t, *append;
|
|
|
|
char *text;
|
|
|
|
|
|
|
|
t = edje_object_part_text_get(gui, "filelist_overlay_text");
|
|
|
|
|
|
|
|
text = (t) ? (strdup(t)) : NULL;
|
|
|
|
|
|
|
|
if ((text) && (strlen(text) >= PATH_MAX))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if ((ek->string) && (*ek->string) && (!ek->string[1]))
|
|
|
|
{
|
|
|
|
append = ek->string;
|
|
|
|
}
|
|
|
|
else if ((ek->keyname) && (*ek->keyname) && (!ek->key[1]))
|
|
|
|
{
|
|
|
|
append = ek->keyname;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (text)
|
|
|
|
free(text);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!text)
|
|
|
|
{
|
|
|
|
text = strdup(append);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
len = strlen(text) + 2;
|
|
|
|
text = realloc(text, len);
|
|
|
|
ecore_strlcat(text, append, len);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Avoid sending the same signal twice... seems to skip the
|
|
|
|
* transition in that case
|
|
|
|
*/
|
|
|
|
if (strlen(text) == 1)
|
|
|
|
{
|
|
|
|
edje_object_signal_emit(gui, "ecdb,filelist_overlay,activate", "ecdb");
|
|
|
|
}
|
|
|
|
edje_object_part_text_set(gui, "filelist_overlay_text", text);
|
|
|
|
FREE(text);
|
|
|
|
}
|
2008-08-06 23:09:30 +00:00
|
|
|
}
|
|
|
|
|
2008-08-04 23:28:43 +00:00
|
|
|
int
|
|
|
|
ecdb_create_main_gui(void)
|
|
|
|
{
|
2008-12-09 05:47:59 +00:00
|
|
|
Evas_Object *gui;
|
|
|
|
Evas_Coord mw, mh;
|
|
|
|
|
|
|
|
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_avoid_damage_set(em->main_win_ee, 1);
|
|
|
|
ecore_x_dnd_aware_set(ecore_evas_software_x11_window_get(em->main_win_ee),
|
|
|
|
1);
|
|
|
|
ecore_x_dnd_type_set(ecore_evas_software_x11_window_get(em->main_win_ee),
|
|
|
|
"*", 1);
|
|
|
|
|
|
|
|
ecore_evas_callback_delete_request_set(em->main_win_ee, ecdb_shutdown);
|
|
|
|
ecore_evas_callback_destroy_set(em->main_win_ee, ecdb_shutdown);
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
/* Make this configurable at some point */
|
|
|
|
ecdb_set_main_theme(NULL);
|
|
|
|
|
|
|
|
gui = edje_object_add(ecore_evas_get(em->main_win_ee));
|
|
|
|
edje_object_file_set(gui, em->theme_path, "ecdb/window");
|
|
|
|
edje_object_size_min_get(gui, &mw, &mh);
|
|
|
|
if (mw <= 0) mw = 400;
|
|
|
|
if (mh <= 0) mh = 300;
|
|
|
|
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);
|
|
|
|
evas_object_name_set(gui, "gui");
|
|
|
|
evas_object_move(gui, 0, 0);
|
|
|
|
evas_object_show(gui);
|
|
|
|
|
|
|
|
ecdb_welcome_page_show();
|
|
|
|
return TRUE;
|
2008-08-04 23:28:43 +00:00
|
|
|
}
|
|
|
|
|
2008-09-24 18:52:11 +00:00
|
|
|
/* This needs some work. Where should user themes go? */
|
2008-08-04 23:28:43 +00:00
|
|
|
void
|
2008-09-24 15:50:18 +00:00
|
|
|
ecdb_set_main_theme(const char *theme_name)
|
2008-08-04 23:28:43 +00:00
|
|
|
{
|
2008-12-09 05:47:59 +00:00
|
|
|
if (!theme_name)
|
|
|
|
{
|
|
|
|
snprintf(em->theme_path, PATH_MAX, "%s/%s", PACKAGE_DATA_DIR,
|
|
|
|
"themes/default.edj");
|
|
|
|
evas_font_path_append(ecore_evas_get(em->main_win_ee),
|
|
|
|
PACKAGE_DATA_DIR"/font");
|
|
|
|
}
|
2008-06-21 02:51:16 +00:00
|
|
|
}
|
2008-09-12 20:13:57 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
ecdb_handle_typebuf(Evas_Object *gui)
|
|
|
|
{
|
2008-12-09 05:47:59 +00:00
|
|
|
Ewl_Widget *fl;
|
|
|
|
Ewl_Filelist_Filter *filter;
|
|
|
|
const char *ext;
|
|
|
|
|
|
|
|
if (!(ext = edje_object_part_text_get(gui, "filelist_overlay_text")))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
fl = ewl_widget_name_find("main_filelist");
|
|
|
|
|
|
|
|
/* Check for a 'cd' first */
|
|
|
|
if (!ecdb_match_keyword(ext, "cd", 2))
|
|
|
|
{
|
|
|
|
char *dir;
|
|
|
|
|
|
|
|
/* What to do about multi-word directories? */
|
|
|
|
dir = ecdb_strip_string(ext);
|
|
|
|
|
|
|
|
if ((dir) && (dir[0] == '/'))
|
|
|
|
{
|
|
|
|
if (ecore_file_exists(dir))
|
|
|
|
{
|
|
|
|
ewl_filelist_directory_set(EWL_FILELIST(fl), dir);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (dir[0] == '~')
|
|
|
|
{
|
|
|
|
char path[PATH_MAX];
|
|
|
|
|
|
|
|
snprintf(path, PATH_MAX, "%s%s", getenv("HOME"), &dir[1]);
|
|
|
|
|
|
|
|
if (ecore_file_exists(path))
|
|
|
|
{
|
|
|
|
ewl_filelist_directory_set(EWL_FILELIST(fl), path);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (dir)
|
|
|
|
{
|
|
|
|
/* Try to concate it to our current directory */
|
|
|
|
char path[PATH_MAX];
|
|
|
|
|
|
|
|
snprintf(path, PATH_MAX, "%s/%s", ewl_filelist_directory_get
|
|
|
|
(EWL_FILELIST(fl)), dir);
|
|
|
|
|
|
|
|
if (ecore_file_exists(path))
|
|
|
|
{
|
|
|
|
ewl_filelist_directory_set(EWL_FILELIST(fl), path);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dir)
|
|
|
|
{
|
|
|
|
FREE(dir);
|
|
|
|
}
|
|
|
|
|
2008-12-09 23:17:57 +00:00
|
|
|
edje_object_signal_emit(gui, "ecdb,filelist_overlay,deactivate", "ecdb");
|
2008-12-09 05:47:59 +00:00
|
|
|
edje_object_part_text_set(gui, "filelist_overlay_text", NULL);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if (!ecdb_match_keyword(ext, "exit", 4))
|
|
|
|
{
|
|
|
|
/* This creates an ewl error... */
|
|
|
|
ecore_event_add(ECORE_EVENT_SIGNAL_EXIT, NULL, NULL, NULL);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
filter = ewl_filelist_filter_get(EWL_FILELIST(fl));
|
|
|
|
if (!filter)
|
|
|
|
{
|
|
|
|
filter = calloc(sizeof(Ewl_Filelist_Filter), 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (filter->extension)
|
|
|
|
{
|
|
|
|
if (strcmp(filter->extension, ext))
|
|
|
|
{
|
|
|
|
FREE(filter->extension);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
filter->extension = strdup(ext);
|
|
|
|
ewl_filelist_filter_set(EWL_FILELIST(fl), filter);
|
|
|
|
ewl_filelist_refresh(EWL_FILELIST(fl));
|
|
|
|
edje_object_signal_emit(gui, "ecdb,filelist_overlay,deactivate", "ecdb");
|
|
|
|
edje_object_part_text_set(gui, "filelist_overlay_text", NULL);
|
2008-09-12 20:13:57 +00:00
|
|
|
}
|
|
|
|
|
2008-09-19 16:24:47 +00:00
|
|
|
|
|
|
|
static void
|
2008-12-09 05:47:59 +00:00
|
|
|
ecdb_cb_controls_focused(void *data, Evas_Object *o, const char *emission,
|
2008-12-09 05:48:27 +00:00
|
|
|
const char *source)
|
2008-09-19 16:24:47 +00:00
|
|
|
{
|
2008-12-09 05:47:59 +00:00
|
|
|
static char *old_source;
|
2008-12-09 23:17:57 +00:00
|
|
|
Evas_Object *eo;
|
2008-12-09 05:47:59 +00:00
|
|
|
|
|
|
|
if ((old_source) && (strcmp(old_source, source)))
|
|
|
|
{
|
2008-12-09 23:17:57 +00:00
|
|
|
eo = evas_object_name_find(ecore_evas_get(em->main_win_ee), old_source);
|
|
|
|
edje_object_signal_emit(eo, "ecdb,focus,out", "ecdb");
|
2008-12-09 05:47:59 +00:00
|
|
|
FREE(old_source);
|
|
|
|
old_source = strdup(source);
|
|
|
|
}
|
|
|
|
else if (!old_source)
|
|
|
|
{
|
|
|
|
old_source = strdup(source);
|
|
|
|
}
|
2008-12-09 23:17:57 +00:00
|
|
|
|
|
|
|
// Send focus to the freshly clicked widget
|
|
|
|
eo = evas_object_name_find(ecore_evas_get(em->main_win_ee), source);
|
|
|
|
evas_object_focus_set(eo, 1);
|
2008-09-19 16:24:47 +00:00
|
|
|
}
|
2008-09-22 15:02:49 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
ecdb_cb_welcome_page_buttons_clicked(void *data, Evas_Object *o,
|
2008-12-09 05:47:59 +00:00
|
|
|
const char *emission, const char *source)
|
2008-09-22 15:02:49 +00:00
|
|
|
{
|
2008-12-09 05:47:59 +00:00
|
|
|
Evas_Object *swallow, *gui;
|
|
|
|
|
|
|
|
gui = evas_object_name_find(ecore_evas_get(em->main_win_ee), "gui");
|
|
|
|
swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee),
|
|
|
|
"main_filelist");
|
|
|
|
|
|
|
|
/* Actually get this to do some stuff, instead of just for show like
|
|
|
|
* now
|
|
|
|
*/
|
|
|
|
if (!strcmp(source, "ecdb/burn_data"))
|
|
|
|
{
|
|
|
|
ecdb_filelist_show();
|
|
|
|
}
|
|
|
|
else if (!strcmp(source, "ecdb/erase"))
|
|
|
|
{
|
|
|
|
swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee),
|
|
|
|
"welcome_page");
|
|
|
|
edje_object_signal_emit(swallow, "ecdb,welcome_page,hide", "ecdb");
|
|
|
|
ecdb_erase_page_show();
|
|
|
|
}
|
|
|
|
else if (!strcmp(source, "ecdb/burn_image"))
|
|
|
|
{
|
|
|
|
ecdb_filelist_show();
|
|
|
|
swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee),
|
|
|
|
"welcome_page");
|
|
|
|
edje_object_signal_emit(swallow, "ecdb,welcome_page,hide", "ecdb");
|
|
|
|
ecdb_burn_image_page_show();
|
|
|
|
}
|
|
|
|
else if (swallow)
|
|
|
|
{
|
|
|
|
edje_object_signal_emit(gui, "ecdb,filelist,hide", "ecdb");
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("Action: %s\n", source);
|
2008-09-22 15:02:49 +00:00
|
|
|
}
|
|
|
|
|
2008-10-31 14:54:37 +00:00
|
|
|
static void
|
|
|
|
ecdb_cb_erase_page_buttons_clicked(void *data, Evas_Object *o,
|
2008-12-09 05:47:59 +00:00
|
|
|
const char *emission, const char *source)
|
2008-10-31 14:54:37 +00:00
|
|
|
{
|
2008-12-09 05:47:59 +00:00
|
|
|
Evas_Object *swallow, *gui;
|
|
|
|
static int speed = 0;
|
|
|
|
|
|
|
|
gui = evas_object_name_find(ecore_evas_get(em->main_win_ee), "gui");
|
|
|
|
swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee),
|
|
|
|
"erase_page");
|
|
|
|
if (!strcmp(source, "ecdb/erase/return"))
|
|
|
|
{
|
|
|
|
char *signal;
|
|
|
|
|
|
|
|
edje_object_part_text_set(swallow, "progress_text", "Begin Erase");
|
|
|
|
edje_object_part_text_set(swallow, "progress_percent", "0%");
|
|
|
|
signal = evas_object_data_get(swallow, "hide_signal");
|
|
|
|
edje_object_signal_emit(swallow, signal, "ecdb");
|
|
|
|
ecdb_welcome_page_show();
|
|
|
|
}
|
|
|
|
else if (!strcmp(source, "ecdb/erase/begin"))
|
|
|
|
{
|
|
|
|
Ecdb_Erase_Project *proj;
|
|
|
|
proj = ecdb_erase_project_new();
|
|
|
|
char buf[1024];
|
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "Commencing...");
|
|
|
|
edje_object_part_text_set(swallow, "progress_text", buf);
|
|
|
|
if (!ecdb_aquire_drive(ECDB_PROJECT(proj), 0))
|
|
|
|
{
|
|
|
|
printf("Couldn't grab drive!\n");
|
|
|
|
ecdb_erase_project_destroy(proj);
|
|
|
|
edje_object_part_text_set(swallow, "progress_text",
|
|
|
|
"Couldn't grab the drive!");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
proj->quick = speed;
|
|
|
|
if (!ecdb_erase_disc(proj))
|
|
|
|
{
|
|
|
|
Ecdb_Project *p = ECDB_PROJECT(proj);
|
|
|
|
|
|
|
|
printf("Disc not erasable!\n");
|
|
|
|
snprintf(buf, sizeof(buf), "Disc not erasable!");
|
|
|
|
edje_object_part_text_set(swallow, "progress_text", buf);
|
|
|
|
burn_drive_release(p->drive->tangible[0].drive, 0);
|
|
|
|
burn_drive_info_free(p->drive->tangible);
|
|
|
|
ecdb_erase_project_destroy(proj);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
speed = 0;
|
|
|
|
edje_object_signal_emit(swallow, "ecdb,erase,start", "ecdb");
|
|
|
|
const char *ids[] = {"ecdb/erase/return", "ecdb/erase/begin",
|
|
|
|
"ecdb/erase/speed"};
|
|
|
|
ecdb_gui_controls_disable(ids, 3);
|
|
|
|
}
|
|
|
|
else if (!strcmp(source, "ecdb/erase/speed"))
|
|
|
|
{
|
|
|
|
speed = !speed;
|
|
|
|
printf("Burn speed: %d\n", speed);
|
|
|
|
}
|
2008-10-31 14:54:37 +00:00
|
|
|
}
|
|
|
|
|
2008-12-09 01:12:16 +00:00
|
|
|
static void
|
|
|
|
ecdb_cb_burn_image_page_buttons_clicked(void *data, Evas_Object *o,
|
2008-12-09 05:47:59 +00:00
|
|
|
const char *emission, const char *source)
|
2008-12-09 01:12:16 +00:00
|
|
|
{
|
2008-12-09 05:47:59 +00:00
|
|
|
Evas_Object *swallow, *gui;
|
|
|
|
|
|
|
|
gui = evas_object_name_find(ecore_evas_get(em->main_win_ee), "gui");
|
|
|
|
swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee),
|
|
|
|
"burn_image_page");
|
|
|
|
|
|
|
|
if (!strcmp(source, "ecdb/burn_image/return"))
|
|
|
|
{
|
|
|
|
char *signal;
|
|
|
|
|
|
|
|
edje_object_part_text_set(swallow, "progress_text", "Begin Burn");
|
|
|
|
edje_object_part_text_set(swallow, "progress_percent", "0%");
|
|
|
|
signal = evas_object_data_get(swallow, "hide_signal");
|
|
|
|
edje_object_signal_emit(swallow, signal, "ecdb");
|
|
|
|
ecdb_welcome_page_show();
|
|
|
|
|
|
|
|
/* Hide the filelist to be nice */
|
|
|
|
edje_object_signal_emit(gui, "ecdb,filelist,hide", "ecdb");
|
|
|
|
}
|
|
|
|
else if (!strcmp(source, "ecdb/burn_image/begin"))
|
|
|
|
{
|
|
|
|
Ecdb_Burn_Project *proj;
|
|
|
|
Evas_Object *entry;
|
|
|
|
Ecdb_Source *iso_file;
|
|
|
|
const char *file;
|
|
|
|
char *sanitized_file;
|
|
|
|
char buf[1024];
|
|
|
|
Ecdb_Burn_Result burn_result;
|
|
|
|
|
|
|
|
entry = evas_object_name_find(ecore_evas_get(em->main_win_ee),
|
|
|
|
"ecdb/burn_image/file");
|
|
|
|
file = edje_object_part_text_get(entry, "label");
|
|
|
|
|
|
|
|
//Textblock returns a <br> at the end, so chop that off
|
2008-12-09 19:46:00 +00:00
|
|
|
if (!strcmp(&file[strlen(file) - 4], "<br>"))
|
|
|
|
{
|
|
|
|
sanitized_file = alloca(sizeof(char) * (strlen(file) - 3));
|
|
|
|
sanitized_file[0] = '\0';
|
|
|
|
ecore_strlcpy(sanitized_file, file, strlen(file) - 3);
|
|
|
|
printf("Sanitized_file: %s\n", sanitized_file);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// We aren't altering sanitized_file after this
|
|
|
|
sanitized_file = (char *)file;
|
|
|
|
}
|
2008-12-09 05:47:59 +00:00
|
|
|
|
2008-12-09 19:46:00 +00:00
|
|
|
// Make sure that file actually exists
|
|
|
|
if (!ecore_file_exists(sanitized_file))
|
|
|
|
{
|
|
|
|
edje_object_part_text_set(swallow, "progress_text", "File doesn't "
|
|
|
|
"exists!");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
proj = ecdb_burn_project_new();
|
|
|
|
ecdb_project_type_set(ECDB_PROJECT(proj), ECDB_IMAGE_PROJECT);
|
2008-12-09 05:47:59 +00:00
|
|
|
iso_file = ecdb_source_new();
|
|
|
|
ecdb_source_data_set(iso_file, sanitized_file);
|
|
|
|
ecdb_source_child_append(proj->files, iso_file);
|
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "Commencing...");
|
|
|
|
edje_object_part_text_set(swallow, "progress_text", buf);
|
|
|
|
if (!ecdb_aquire_drive(ECDB_PROJECT(proj), 0))
|
|
|
|
{
|
|
|
|
printf("Couldn't grab drive!\n");
|
|
|
|
ecdb_burn_project_destroy(proj);
|
|
|
|
edje_object_part_text_set(swallow, "progress_text",
|
|
|
|
"Couldn't grab the drive!");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
burn_result = ecdb_burn_project(proj);
|
|
|
|
switch (burn_result)
|
|
|
|
{
|
|
|
|
case ECDB_ERROR_NONE:
|
|
|
|
edje_object_signal_emit(gui,
|
|
|
|
"ecdb,filelist,hide", "ecdb");
|
|
|
|
edje_object_signal_emit(swallow, "ecdb,burn_image,start", "ecdb");
|
|
|
|
const char *ids[] = {"ecdb/burn_image/return",
|
|
|
|
"ecdb/burn_image/begin",
|
|
|
|
"ecdb/burn_image/file"};
|
|
|
|
ecdb_gui_controls_disable(ids, 3);
|
|
|
|
return;
|
|
|
|
|
|
|
|
case ECDB_ERROR_IMAGE_CREATE:
|
|
|
|
snprintf(buf, sizeof(buf), "Invalid file!");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ECDB_ERROR_SOURCE_ATTACH:
|
|
|
|
snprintf(buf, sizeof(buf), "Couldn't attach source data!");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ECDB_ERROR_WRITE_MODE:
|
|
|
|
snprintf(buf, sizeof(buf), "No suitable burn mode!");
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
snprintf(buf, sizeof(buf), "Unknown error :-(");
|
|
|
|
}
|
|
|
|
|
|
|
|
edje_object_part_text_set(swallow, "progress_text", buf);
|
|
|
|
Ecdb_Project *p = ECDB_PROJECT(proj);
|
|
|
|
burn_drive_release(p->drive->tangible[0].drive, 1);
|
|
|
|
burn_drive_info_free(p->drive->tangible);
|
|
|
|
ecdb_burn_project_destroy(proj);
|
|
|
|
}
|
|
|
|
else if (!strcmp(source, "ecdb/burn_image/file"))
|
|
|
|
{
|
2008-12-09 21:44:52 +00:00
|
|
|
// o is not the entry, it is the burn_image_page!
|
|
|
|
swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee),
|
|
|
|
"ecdb/burn_image/file");
|
|
|
|
evas_object_focus_set(swallow, 1);
|
2008-12-09 05:47:59 +00:00
|
|
|
}
|
2008-12-09 01:12:16 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2008-09-24 15:50:18 +00:00
|
|
|
static void
|
|
|
|
ecdb_welcome_page_show(void)
|
|
|
|
{
|
2008-12-09 05:47:59 +00:00
|
|
|
Evas_Object *gui, *swallow;
|
|
|
|
|
|
|
|
gui = evas_object_name_find(ecore_evas_get(em->main_win_ee), "gui");
|
|
|
|
swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee),
|
|
|
|
"welcome_page");
|
|
|
|
|
|
|
|
if (!swallow)
|
|
|
|
{
|
|
|
|
Evas_Coord x, y, w, h;
|
|
|
|
|
|
|
|
swallow = edje_object_add(ecore_evas_get(em->main_win_ee));
|
|
|
|
evas_object_name_set(swallow, "welcome_page");
|
|
|
|
edje_object_file_set(swallow, em->theme_path, "ecdb/welcome_page");
|
|
|
|
edje_object_part_geometry_get(gui, "active_area", &x, &y, &w, &h);
|
|
|
|
evas_object_move(swallow, x, y);
|
|
|
|
evas_object_resize(swallow, w, h);
|
|
|
|
edje_object_part_swallow(gui, "action_area", swallow);
|
|
|
|
edje_object_signal_callback_add(swallow, "mouse,down,1", "ecdb/*",
|
|
|
|
ecdb_cb_controls_focused, NULL);
|
|
|
|
edje_object_signal_callback_add(swallow, "mouse,clicked,1", "ecdb/*",
|
|
|
|
ecdb_cb_welcome_page_buttons_clicked, NULL);
|
|
|
|
edje_object_signal_callback_add(swallow, "hide,finished", "welcome_page",
|
|
|
|
ecdb_cb_page_hide_finished, NULL);
|
|
|
|
evas_object_show(swallow);
|
|
|
|
|
|
|
|
Evas_Object *b;
|
|
|
|
int i;
|
|
|
|
char *labels[] = {"Burn Data CD", "Burn Audio CD", "Burn Image",
|
|
|
|
"Erase Re-writable Disc"};
|
|
|
|
char *ids[] = {"ecdb/burn_data", "ecdb/burn_audio", "ecdb/burn_image",
|
|
|
|
"ecdb/erase"};
|
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
{
|
|
|
|
b = edje_object_add(ecore_evas_get(em->main_win_ee));
|
|
|
|
evas_object_name_set(b, ids[i]);
|
|
|
|
edje_object_file_set(b, em->theme_path, "ecdb/button");
|
|
|
|
edje_object_part_geometry_get(swallow, ids[i], &x, &y, &w, &h);
|
|
|
|
edje_object_part_text_set(b, "label", labels[i]);
|
|
|
|
evas_object_move(b, x, y);
|
|
|
|
evas_object_resize(b, w, h);
|
|
|
|
edje_object_part_swallow(swallow, ids[i], b);
|
|
|
|
evas_object_show(b);
|
|
|
|
|
|
|
|
/* Place this after */
|
|
|
|
ecdb_button_icon_swallow(ecore_evas_get(em->main_win_ee), b, ids[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (edje_object_part_swallow_get(gui, "action_area") != swallow)
|
|
|
|
{
|
|
|
|
/* All that is needed here? */
|
|
|
|
edje_object_part_swallow(gui, "action_area", swallow);
|
|
|
|
evas_object_show(swallow);
|
|
|
|
}
|
|
|
|
|
|
|
|
edje_object_signal_emit(gui, "ecdb,welcome_page,show", "ecdb");
|
|
|
|
edje_object_signal_emit(swallow, "ecdb,welcome_page,show", "ecdb");
|
2008-09-24 15:50:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ecdb_filelist_show(void)
|
|
|
|
{
|
2008-12-09 05:47:59 +00:00
|
|
|
Evas_Object *gui, *swallow;
|
|
|
|
|
|
|
|
gui = evas_object_name_find(ecore_evas_get(em->main_win_ee), "gui");
|
|
|
|
swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee),
|
|
|
|
"main_filelist");
|
|
|
|
|
|
|
|
if (!swallow)
|
|
|
|
{
|
|
|
|
Evas_Coord x, y, w, h;
|
|
|
|
Ewl_Widget *embed, *filelist;
|
|
|
|
|
|
|
|
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_widget_name_set(EWL_WIDGET(filelist), "main_filelist");
|
|
|
|
ewl_container_child_append(EWL_CONTAINER(embed), filelist);
|
|
|
|
ewl_filelist_directory_set(EWL_FILELIST(filelist), getenv("HOME"));
|
|
|
|
ewl_widget_show(filelist);
|
|
|
|
|
|
|
|
edje_object_part_geometry_get(gui, "filelist", &x, &y, &w, &h);
|
|
|
|
evas_object_name_set(swallow, "main_filelist");
|
|
|
|
evas_object_move(swallow, x, y);
|
|
|
|
evas_object_resize(swallow, w, h);
|
|
|
|
edje_object_part_swallow(gui, "filelist", swallow);
|
|
|
|
evas_object_event_callback_add(swallow, EVAS_CALLBACK_MOUSE_DOWN,
|
|
|
|
_cb_filelist_mouse_down, gui);
|
|
|
|
evas_object_event_callback_add(swallow, EVAS_CALLBACK_KEY_DOWN,
|
|
|
|
_cb_filelist_key_down, gui);
|
2008-12-09 23:17:57 +00:00
|
|
|
evas_object_event_callback_add(swallow, EVAS_CALLBACK_MOUSE_IN,
|
|
|
|
_cb_filelist_mouse_in, gui);
|
|
|
|
evas_object_event_callback_add(swallow, EVAS_CALLBACK_MOUSE_OUT,
|
|
|
|
_cb_filelist_mouse_out, gui);
|
2008-12-09 05:47:59 +00:00
|
|
|
evas_object_show(swallow);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Assume here that it is the active projects job to hide itself and
|
|
|
|
* call this show function
|
|
|
|
*/
|
|
|
|
else if (edje_object_part_swallow_get(gui, "filelist") != swallow)
|
|
|
|
{
|
|
|
|
/* Is this all that is neccessary? */
|
|
|
|
edje_object_part_swallow(gui, "filelist", swallow);
|
|
|
|
evas_object_show(swallow);
|
|
|
|
}
|
|
|
|
|
|
|
|
edje_object_signal_emit(gui, "ecdb,filelist,visible", "ecdb");
|
|
|
|
edje_object_signal_emit(swallow, "ecdb,filelist,visible", "ecdb");
|
2008-09-24 18:52:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* This should be triggered by the theme, once it is done with its
|
|
|
|
* nice fancy animations
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
ecdb_page_hide(const char *pname)
|
|
|
|
{
|
2008-12-09 05:47:59 +00:00
|
|
|
Evas_Object *swallow, *gui;
|
2008-09-24 18:52:11 +00:00
|
|
|
|
2008-12-09 05:47:59 +00:00
|
|
|
swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee), pname);
|
|
|
|
gui = evas_object_name_find(ecore_evas_get(em->main_win_ee), "gui");
|
2008-09-24 18:52:11 +00:00
|
|
|
|
2008-12-09 05:47:59 +00:00
|
|
|
if (gui)
|
|
|
|
{
|
|
|
|
edje_object_part_unswallow(gui, swallow);
|
|
|
|
evas_object_hide(swallow);
|
|
|
|
}
|
2008-09-24 18:52:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ecdb_erase_page_show(void)
|
|
|
|
{
|
2008-12-09 05:47:59 +00:00
|
|
|
Evas_Object *swallow, *gui;
|
|
|
|
|
|
|
|
gui = evas_object_name_find(ecore_evas_get(em->main_win_ee), "gui");
|
|
|
|
swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee),
|
|
|
|
"erase_page");
|
|
|
|
|
|
|
|
/* Hide the filelist as it isn't needed to erase a disc */
|
|
|
|
edje_object_signal_emit(gui, "ecdb,filelist,hide", "ecdb");
|
|
|
|
|
|
|
|
if (!swallow)
|
|
|
|
{
|
|
|
|
Evas_Coord x, y, w, h;
|
|
|
|
|
|
|
|
swallow = edje_object_add(ecore_evas_get(em->main_win_ee));
|
|
|
|
edje_object_file_set(swallow, em->theme_path, "ecdb/erase_page");
|
|
|
|
evas_object_name_set(swallow, "erase_page");
|
|
|
|
evas_object_data_set(swallow, "hide_signal", "ecdb,erase_page,hide");
|
|
|
|
edje_object_part_geometry_get(gui, "active_area", &x, &y, &w, &h);
|
|
|
|
evas_object_move(swallow, x, y);
|
|
|
|
evas_object_resize(swallow, w, h);
|
|
|
|
edje_object_part_swallow(gui, "action_area", swallow);
|
|
|
|
evas_object_show(swallow);
|
|
|
|
edje_object_signal_callback_add(swallow, "mouse,down,1", "ecdb/*",
|
|
|
|
ecdb_cb_controls_focused, NULL);
|
|
|
|
edje_object_signal_callback_add(swallow, "mouse,clicked,1",
|
|
|
|
"ecdb/erase/*",
|
|
|
|
ecdb_cb_erase_page_buttons_clicked, NULL);
|
|
|
|
edje_object_signal_callback_add(swallow, "hide,finished", "erase_page",
|
|
|
|
ecdb_cb_page_hide_finished, NULL);
|
|
|
|
evas_object_show(swallow);
|
|
|
|
|
|
|
|
int i;
|
|
|
|
char *labels[] = {"Return to Main Page", "Start Erase",
|
|
|
|
"Quick Erase"};
|
|
|
|
char *ids[] = {"ecdb/erase/return", "ecdb/erase/begin",
|
|
|
|
"ecdb/erase/speed"};
|
|
|
|
char *wtype[] = {"ecdb/button", "ecdb/button", "ecdb/check"};
|
|
|
|
|
|
|
|
for (i = 0; i < 3; i++)
|
|
|
|
{
|
|
|
|
Evas_Object *b;
|
|
|
|
b = edje_object_add(ecore_evas_get(em->main_win_ee));
|
|
|
|
evas_object_name_set(b, ids[i]);
|
|
|
|
edje_object_file_set(b, em->theme_path, wtype[i]);
|
|
|
|
edje_object_part_geometry_get(swallow, ids[i], &x, &y, &w, &h);
|
|
|
|
evas_object_move(b, x, y);
|
|
|
|
evas_object_resize(b, w, h);
|
|
|
|
edje_object_part_text_set(b, "label", labels[i]);
|
|
|
|
edje_object_part_swallow(swallow, ids[i], b);
|
|
|
|
evas_object_show(b);
|
|
|
|
|
|
|
|
if (!strcmp("ecdb/button", wtype[i]))
|
|
|
|
{
|
|
|
|
ecdb_button_icon_swallow(ecore_evas_get(em->main_win_ee), b,
|
|
|
|
ids[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (edje_object_part_swallow_get(gui, "action_area") != swallow)
|
|
|
|
{
|
|
|
|
edje_object_part_swallow(gui, "action_area", swallow);
|
|
|
|
evas_object_show(swallow);
|
|
|
|
}
|
|
|
|
|
|
|
|
edje_object_signal_emit(gui, "ecdb,erase_page,visible", "ecdb");
|
|
|
|
edje_object_signal_emit(swallow, "ecdb,erase_page,visible", "ecdb");
|
2008-09-24 18:52:11 +00:00
|
|
|
}
|
|
|
|
|
2008-12-09 01:12:16 +00:00
|
|
|
static void
|
|
|
|
ecdb_burn_image_page_show(void)
|
|
|
|
{
|
2008-12-09 05:47:59 +00:00
|
|
|
Evas_Object *swallow, *gui;
|
|
|
|
|
|
|
|
gui = evas_object_name_find(ecore_evas_get(em->main_win_ee), "gui");
|
|
|
|
swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee),
|
|
|
|
"burn_image_page");
|
|
|
|
|
|
|
|
if (!swallow)
|
|
|
|
{
|
|
|
|
Evas_Coord x, y, w, h;
|
|
|
|
|
|
|
|
swallow = edje_object_add(ecore_evas_get(em->main_win_ee));
|
|
|
|
edje_object_file_set(swallow, em->theme_path, "ecdb/burn_image_page");
|
|
|
|
evas_object_name_set(swallow, "burn_image_page");
|
|
|
|
evas_object_data_set(swallow, "hide_signal", "ecdb,burn_image_page,hide");
|
|
|
|
edje_object_part_geometry_get(gui, "active_area", &x, &y, &w, &h);
|
|
|
|
evas_object_move(swallow, x, y);
|
|
|
|
evas_object_resize(swallow, w, h);
|
|
|
|
edje_object_part_swallow(gui, "action_area", swallow);
|
|
|
|
evas_object_show(swallow);
|
|
|
|
edje_object_signal_callback_add(swallow, "mouse,down,1", "ecdb/*",
|
|
|
|
ecdb_cb_controls_focused, NULL);
|
|
|
|
edje_object_signal_callback_add(swallow, "mouse,clicked,1",
|
|
|
|
"ecdb/burn_image/*",
|
|
|
|
ecdb_cb_burn_image_page_buttons_clicked,
|
|
|
|
NULL);
|
|
|
|
edje_object_signal_callback_add(swallow, "hide,finished",
|
|
|
|
"burn_image_page",
|
|
|
|
ecdb_cb_page_hide_finished, NULL);
|
|
|
|
evas_object_show(swallow);
|
|
|
|
|
|
|
|
int i;
|
|
|
|
char *labels[] = {"Return to Main Page", "Start Burn", "Burn File"};
|
|
|
|
char *ids[] = {"ecdb/burn_image/return", "ecdb/burn_image/begin",
|
|
|
|
"ecdb/burn_image/file"};
|
|
|
|
char *wtype[] = {"ecdb/button", "ecdb/button", "ecdb/entry"};
|
|
|
|
|
|
|
|
for (i = 0; i < 3; i++)
|
|
|
|
{
|
|
|
|
Evas_Object *b;
|
|
|
|
b = edje_object_add(ecore_evas_get(em->main_win_ee));
|
|
|
|
evas_object_name_set(b, ids[i]);
|
|
|
|
edje_object_file_set(b, em->theme_path, wtype[i]);
|
|
|
|
edje_object_part_geometry_get(swallow, ids[i], &x, &y, &w, &h);
|
|
|
|
evas_object_move(b, x, y);
|
|
|
|
evas_object_resize(b, w, h);
|
|
|
|
edje_object_part_text_set(b, "label", labels[i]);
|
|
|
|
edje_object_part_swallow(swallow, ids[i], b);
|
|
|
|
evas_object_show(b);
|
|
|
|
|
|
|
|
if (!strcmp("ecdb/button", wtype[i]))
|
2008-12-09 01:12:16 +00:00
|
|
|
{
|
2008-12-09 05:47:59 +00:00
|
|
|
ecdb_button_icon_swallow(ecore_evas_get(em->main_win_ee), b,
|
|
|
|
ids[i]);
|
2008-12-09 01:12:16 +00:00
|
|
|
}
|
2008-12-09 05:47:59 +00:00
|
|
|
else if (!strcmp("ecdb/entry", wtype[i]))
|
|
|
|
{
|
2008-12-18 18:54:50 +00:00
|
|
|
em->dnd_candidates = eina_list_append(em->dnd_candidates, b);
|
2008-12-09 05:47:59 +00:00
|
|
|
evas_object_data_set(b, "dnd_call_func", ecdb_dnd_entry_dnd_set);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (edje_object_part_swallow_get(gui, "action_area") != swallow)
|
|
|
|
{
|
|
|
|
edje_object_part_swallow(gui, "action_area", swallow);
|
|
|
|
evas_object_show(swallow);
|
|
|
|
}
|
|
|
|
|
|
|
|
edje_object_signal_emit(gui, "ecdb,burn_image_page,visible", "ecdb");
|
|
|
|
edje_object_signal_emit(swallow, "ecdb,burn_image_page,visible", "ecdb");
|
2008-12-09 01:12:16 +00:00
|
|
|
}
|
|
|
|
|
2008-09-24 18:52:11 +00:00
|
|
|
/* Hurrah! Fancyness */
|
|
|
|
static void
|
|
|
|
ecdb_cb_page_hide_finished(void *data, Evas_Object *o, const char *emission,
|
2008-12-09 05:47:59 +00:00
|
|
|
const char *source)
|
2008-09-24 18:52:11 +00:00
|
|
|
{
|
2008-12-09 05:47:59 +00:00
|
|
|
ecdb_page_hide(source);
|
2008-09-24 15:50:18 +00:00
|
|
|
}
|
2008-09-25 17:39:40 +00:00
|
|
|
|
2008-11-06 19:04:00 +00:00
|
|
|
static void
|
|
|
|
ecdb_gui_controls_disable(const char **ids, int n)
|
|
|
|
{
|
2008-12-09 05:47:59 +00:00
|
|
|
Evas_Object *obj;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < n; i++)
|
|
|
|
{
|
|
|
|
obj = evas_object_name_find(ecore_evas_get(em->main_win_ee), ids[i]);
|
|
|
|
edje_object_signal_emit(obj, "ecdb,disable", "ecdb");
|
|
|
|
}
|
2008-11-06 19:04:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ecdb_gui_controls_enable(const char **ids, int n)
|
|
|
|
{
|
2008-12-09 05:47:59 +00:00
|
|
|
Evas_Object *obj;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < n; i++)
|
|
|
|
{
|
|
|
|
obj = evas_object_name_find(ecore_evas_get(em->main_win_ee), ids[i]);
|
|
|
|
edje_object_signal_emit(obj, "ecdb,enable", "ecdb");
|
|
|
|
}
|
2008-11-06 19:04:00 +00:00
|
|
|
}
|
|
|
|
|
2008-11-12 16:06:29 +00:00
|
|
|
void
|
|
|
|
ecdb_gui_erase_cleanup(void)
|
|
|
|
{
|
2008-12-09 05:47:59 +00:00
|
|
|
Evas_Object *swallow;
|
|
|
|
const char *ids[] = {"ecdb/erase/return", "ecdb/erase/begin",
|
|
|
|
"ecdb/erase/speed"};
|
|
|
|
|
|
|
|
swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee),
|
|
|
|
"erase_page");
|
|
|
|
edje_object_part_text_set(swallow, "progress_text", "Erase Complete!");
|
|
|
|
ecdb_gui_controls_enable(ids, 3);
|
|
|
|
edje_object_signal_emit(swallow, "ecdb,erase,done", "ecdb");
|
2008-11-12 16:06:29 +00:00
|
|
|
}
|
|
|
|
|
2008-12-09 01:12:16 +00:00
|
|
|
void
|
|
|
|
ecdb_gui_burn_image_cleanup(void)
|
|
|
|
{
|
2008-12-09 05:47:59 +00:00
|
|
|
Evas_Object *swallow;
|
|
|
|
const char *ids[] = {"ecdb/burn_image/return", "ecdb/burn_image/begin",
|
|
|
|
"ecdb/burn_image/file"};
|
|
|
|
swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee),
|
|
|
|
"burn_image_page");
|
|
|
|
edje_object_part_text_set(swallow, "progress_text", "Burn Complete!");
|
|
|
|
ecdb_gui_controls_enable(ids, 3);
|
|
|
|
edje_object_signal_emit(swallow, "ecdb,burn_image,done", "ecdb");
|
2008-12-09 01:12:16 +00:00
|
|
|
}
|
|
|
|
|