Data burn actually burns the cd now. Woot! Now just for gui cleanups, etc.

This commit is contained in:
Jaime Thomas 2008-12-23 22:42:15 +00:00
parent 21bcd8dfa1
commit fd9c83c719
9 changed files with 83 additions and 48 deletions

View File

@ -7,3 +7,4 @@
-> fix combo theme -> fix combo theme
-> move callbacks to buttons instead of swallow (done except for welcome page) -> move callbacks to buttons instead of swallow (done except for welcome page)
-> send combo popup children the focus out signal -> send combo popup children the focus out signal
-> figure out what to do about dnd, should it be consolidated into one system, how to handle internel, etc.

View File

@ -167,8 +167,6 @@ ecdb_setup(void)
{ {
em = NULL; em = NULL;
em = calloc(1, sizeof(Ecdb_Main)); em = calloc(1, sizeof(Ecdb_Main));
em->drives = NULL;
em->drop_object = NULL;
if (!ecore_file_mkdir("/tmp/ecdb")) if (!ecore_file_mkdir("/tmp/ecdb"))
{ {

View File

@ -35,8 +35,10 @@ struct _Ecdb_Main
char theme_path[PATH_MAX]; char theme_path[PATH_MAX];
Ecore_Evas *main_win_ee; Ecore_Evas *main_win_ee;
Eina_List *drives; Eina_List *drives;
Eina_List *dnd_candidates; Eina_List *evas_dnd_candidates;
Evas_Object *drop_object; Eina_List *ewl_dnd_candidates;
Evas_Object *evas_drop_object;
Ewl_Widget *ewl_drop_object;
}; };
extern Ecdb_Main *em; extern Ecdb_Main *em;

View File

@ -287,13 +287,17 @@ ecdb_burn_finished(void *data, int type, void *event)
ecdb_audio_project_destroy(ECDB_AUDIO(proj->proj)); ecdb_audio_project_destroy(ECDB_AUDIO(proj->proj));
break; break;
default: case ECDB_BURN_PROJECT:
ecdb_burn_project_destroy(ECDB_BURN(proj->proj));
ecdb_burn_data_cleanup();
break;
case ECDB_IMAGE_PROJECT:
ecdb_burn_image_cleanup();
ecdb_burn_project_destroy(ECDB_BURN(proj->proj)); ecdb_burn_project_destroy(ECDB_BURN(proj->proj));
} }
FREE(proj); FREE(proj);
ecdb_burn_image_cleanup();
return TRUE; return TRUE;
} }

View File

@ -26,36 +26,21 @@ _button_cb_return(void *data, Evas_Object *obj, void *event_info)
static void static void
_button_cb_begin(void *data, Evas_Object *obj, void *event_info) _button_cb_begin(void *data, Evas_Object *obj, void *event_info)
{ {
/*
Evas_Object *swallow, *gui, *o; Evas_Object *swallow, *gui, *o;
Ecdb_Burn_Project *proj; Ecdb_Burn_Project *proj;
Ecdb_Source *iso_file; Ewl_Widget *filelist;
char *file, buf[1024]; char buf[1024];
Ecdb_Burn_Result burn_result; Ecdb_Burn_Result burn_result;
int drive, speed; int drive, speed;
gui = evas_object_name_find(ecore_evas_get(em->main_win_ee), "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), swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee),
"burn_data_page"); "burn_data_page");
o = evas_object_name_find(ecore_evas_get(em->main_win_ee), filelist = ewl_widget_name_find("ecdb/burn_data/filelist");
"ecdb/burn_data/file");
file = ecdb_entry_text_get(o);
// Make sure that file actually exists
if (!ecore_file_exists(file))
{
edje_object_part_text_set(swallow, "progress_text", "File doesn't "
"exists!");
FREE(file);
return;
}
proj = ecdb_burn_project_new(); proj = ecdb_burn_project_new();
ecdb_project_type_set(ECDB_PROJECT(proj), ECDB_IMAGE_PROJECT); ecdb_source_destroy(proj->files);
iso_file = ecdb_source_new(); ecdb_project_type_set(ECDB_PROJECT(proj), ECDB_BURN_PROJECT);
ecdb_source_data_set(iso_file, file);
FREE(file);
ecdb_source_child_append(proj->files, iso_file);
o = evas_object_name_find(evas_object_evas_get(obj), o = evas_object_name_find(evas_object_evas_get(obj),
"ecdb/burn_data/drive"); "ecdb/burn_data/drive");
@ -77,6 +62,10 @@ _button_cb_begin(void *data, Evas_Object *obj, void *event_info)
else else
proj->speed = speed; proj->speed = speed;
proj->files = ewl_widget_data_get(filelist, "source");
while (proj->files->parent)
proj->files = proj->files->parent;
snprintf(buf, sizeof(buf), "Commencing..."); snprintf(buf, sizeof(buf), "Commencing...");
edje_object_part_text_set(swallow, "progress_text", buf); edje_object_part_text_set(swallow, "progress_text", buf);
if (!ecdb_aquire_drive(ECDB_PROJECT(proj), drive)) if (!ecdb_aquire_drive(ECDB_PROJECT(proj), drive))
@ -121,7 +110,6 @@ _button_cb_begin(void *data, Evas_Object *obj, void *event_info)
burn_drive_release(p->drive->tangible[0].drive, 1); burn_drive_release(p->drive->tangible[0].drive, 1);
burn_drive_info_free(p->drive->tangible); burn_drive_info_free(p->drive->tangible);
ecdb_burn_project_destroy(proj); ecdb_burn_project_destroy(proj);
*/
} }
static void static void
@ -269,7 +257,6 @@ ecdb_burn_data_page_show(void)
void void
ecdb_burn_data_cleanup(void) ecdb_burn_data_cleanup(void)
{ {
/*
Evas_Object *swallow; Evas_Object *swallow;
const char *ids[] = {"ecdb/burn_data/return", "ecdb/burn_data/begin", const char *ids[] = {"ecdb/burn_data/return", "ecdb/burn_data/begin",
"ecdb/burn_data/file", "ecdb/burn_data/drive" "ecdb/burn_data/file", "ecdb/burn_data/drive"
@ -277,8 +264,7 @@ ecdb_burn_data_cleanup(void)
swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee), swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee),
"burn_data_page"); "burn_data_page");
edje_object_part_text_set(swallow, "progress_text", "Burn Complete!"); edje_object_part_text_set(swallow, "progress_text", "Burn Complete!");
ecdb_gui_controls_enable(ids, 3); ecdb_gui_controls_enable(ids, 5);
edje_object_signal_emit(swallow, "ecdb,burn_data,done", "ecdb"); edje_object_signal_emit(swallow, "ecdb,burn_data,done", "ecdb");
*/
} }

View File

@ -20,7 +20,6 @@ static void ecdb_custom_filelist_dnd_dropped_cb(Ewl_Widget *w, void *ev,
Ewl_Widget * Ewl_Widget *
ecdb_custom_filelist_new(void) ecdb_custom_filelist_new(void)
{ {
const char *dnd_types[] = {"text/uri-list", NULL};
Ewl_Widget *ret; Ewl_Widget *ret;
ret = ewl_filelist_new(); ret = ewl_filelist_new();
@ -32,7 +31,7 @@ ecdb_custom_filelist_new(void)
ecdb_custom_filelist_view_widget_fetch); ecdb_custom_filelist_view_widget_fetch);
ewl_callback_append(ret, EWL_CALLBACK_DND_DATA_RECEIVED, ewl_callback_append(ret, EWL_CALLBACK_DND_DATA_RECEIVED,
ecdb_custom_filelist_dnd_dropped_cb, NULL); ecdb_custom_filelist_dnd_dropped_cb, NULL);
ewl_dnd_accepted_types_set(ret, dnd_types); em->ewl_dnd_candidates = eina_list_append(em->ewl_dnd_candidates, ret);
ewl_callback_del_type(EWL_FILELIST(ret)->controller, EWL_CALLBACK_CLICKED); ewl_callback_del_type(EWL_FILELIST(ret)->controller, EWL_CALLBACK_CLICKED);
ewl_callback_prepend(EWL_FILELIST(ret)->controller, EWL_CALLBACK_CLICKED, ewl_callback_prepend(EWL_FILELIST(ret)->controller, EWL_CALLBACK_CLICKED,
ecdb_custom_filelist_cb_clicked, ret); ecdb_custom_filelist_cb_clicked, ret);

View File

@ -201,7 +201,8 @@ ecdb_image_project(Ecdb_Burn_Project *proj)
} }
/* To handle already-suplied image files */ /* To handle already-suplied image files */
if (proj->files->num_children == 1) if ((proj->files->num_children == 1) && (ECDB_PROJECT(proj)->type ==
ECDB_IMAGE_PROJECT))
{ {
efreet_mime_init(); efreet_mime_init();
c = proj->files->children[0]; c = proj->files->children[0];

View File

@ -45,9 +45,13 @@ ecdb_shutdown(void *data, int type, void *event)
{ {
ecdb_drive_info_list_free(em->drives); ecdb_drive_info_list_free(em->drives);
} }
if (em->dnd_candidates) if (em->evas_dnd_candidates)
{ {
eina_list_free(em->dnd_candidates); eina_list_free(em->evas_dnd_candidates);
}
if (em->ewl_dnd_candidates)
{
eina_list_free(em->ewl_dnd_candidates);
} }
FREE(em); FREE(em);
@ -169,6 +173,7 @@ ecdb_dnd_position(void *data, int type, void *event)
Eina_List *l; Eina_List *l;
Ecore_X_Event_Xdnd_Position *ev; Ecore_X_Event_Xdnd_Position *ev;
Evas_Object *o; Evas_Object *o;
Ewl_Widget *ew;
Ecore_X_Rectangle rect; Ecore_X_Rectangle rect;
Evas_Coord window_x, window_y, window_w, window_h, x, y, w, h; Evas_Coord window_x, window_y, window_w, window_h, x, y, w, h;
@ -180,8 +185,8 @@ ecdb_dnd_position(void *data, int type, void *event)
ecore_evas_geometry_get(em->main_win_ee, &window_x, &window_y, &window_w, ecore_evas_geometry_get(em->main_win_ee, &window_x, &window_y, &window_w,
&window_h); &window_h);
em->dnd_candidates = eina_list_nth_list(em->dnd_candidates, 0); em->evas_dnd_candidates = eina_list_nth_list(em->evas_dnd_candidates, 0);
EINA_LIST_FOREACH(em->dnd_candidates, l, o) EINA_LIST_FOREACH(em->evas_dnd_candidates, l, o)
{ {
if (evas_object_visible_get(o)) if (evas_object_visible_get(o))
{ {
@ -196,13 +201,35 @@ ecdb_dnd_position(void *data, int type, void *event)
rect.y = y; rect.y = y;
rect.width = w; rect.width = w;
rect.height = h; rect.height = h;
em->drop_object = o; em->evas_drop_object = o;
em->ewl_drop_object = NULL;
ecore_x_dnd_send_status(1, 1, rect, ECORE_X_DND_ACTION_PRIVATE); ecore_x_dnd_send_status(1, 1, rect, ECORE_X_DND_ACTION_PRIVATE);
return 1; return 1;
} }
} }
} }
em->ewl_dnd_candidates = eina_list_nth_list(em->ewl_dnd_candidates, 0);
EINA_LIST_FOREACH(em->ewl_dnd_candidates, l, ew)
{
ewl_object_current_geometry_get(EWL_OBJECT(ew), &x, &y, &w, &h);
x += window_x;
y += window_y;
if ((ev->position.x >= x) && (ev->position.x <= (x + w))
&& (ev->position.y >= y) && (ev->position.y <= (y + h)))
{
rect.x = x;
rect.y = y;
rect.width = w;
rect.height = h;
em->ewl_drop_object = ew;
em->evas_drop_object = NULL;
ecore_x_dnd_send_status(1, 1, rect, ECORE_X_DND_ACTION_PRIVATE);
return 1;
}
}
rect.x = window_x; rect.x = window_x;
rect.y = window_y; rect.y = window_y;
rect.width = window_w; rect.width = window_w;
@ -215,7 +242,7 @@ ecdb_dnd_position(void *data, int type, void *event)
int int
ecdb_dnd_drop(void *data, int type, void *event) ecdb_dnd_drop(void *data, int type, void *event)
{ {
if (em->drop_object) if ((em->evas_drop_object) || (em->ewl_drop_object))
{ {
ecore_x_selection_xdnd_request ecore_x_selection_xdnd_request
(ecore_evas_software_x11_window_get(em->main_win_ee), (ecore_evas_software_x11_window_get(em->main_win_ee),
@ -228,24 +255,41 @@ int
ecdb_dnd_selection(void *data, int type, void *event) ecdb_dnd_selection(void *data, int type, void *event)
{ {
Ecore_X_Event_Selection_Notify *ev; Ecore_X_Event_Selection_Notify *ev;
Ecore_X_Selection_Data *d;
Ecore_X_Selection_Data_Files *files; Ecore_X_Selection_Data_Files *files;
void (*call_func)(Evas_Object *, Ecore_X_Selection_Data_Files *) = NULL; void (*call_func)(Evas_Object *, Ecore_X_Selection_Data_Files *) = NULL;
ev = event; ev = event;
if ((!em->drop_object) || (ev->selection != ECORE_X_SELECTION_XDND) if (((!em->evas_drop_object) && (!em->ewl_drop_object)) ||
|| (!(files = ev->data)) || (files->num_files <= 0)) (ev->selection != ECORE_X_SELECTION_XDND) || (!(files = ev->data)) ||
(!(d = ev->data)) || (files->num_files <= 0))
{ {
ecore_x_dnd_send_finished(); ecore_x_dnd_send_finished();
return 1; return 1;
} }
call_func = evas_object_data_get(em->drop_object, "dnd_call_func"); if (em->evas_drop_object)
{
call_func = evas_object_data_get(em->evas_drop_object, "dnd_call_func");
if (call_func != NULL) if (call_func != NULL)
{ {
call_func(em->drop_object, files); call_func(em->evas_drop_object, files);
}
}
else
{
Ewl_Event_Dnd_Data_Received ewl_ev;
ewl_ev.type = ev->target;
ewl_ev.data = files->files;
ewl_ev.len = files->num_files;
ewl_ev.format = d->format;
ewl_callback_call_with_event_data(em->ewl_drop_object,
EWL_CALLBACK_DND_DATA_RECEIVED, &ewl_ev);
} }
em->drop_object = NULL; em->evas_drop_object = NULL;
em->ewl_drop_object = NULL;
ecore_x_dnd_send_finished(); ecore_x_dnd_send_finished();
return 1; return 1;
} }

View File

@ -355,7 +355,7 @@ ecdb_entry_add(Evas_Object *parent, const char *name)
e = ecdb_widget_add(parent, name); e = ecdb_widget_add(parent, name);
edje_object_file_set(e, em->theme_path, "ecdb/entry"); edje_object_file_set(e, em->theme_path, "ecdb/entry");
em->dnd_candidates = eina_list_append(em->dnd_candidates, e); em->evas_dnd_candidates = eina_list_append(em->evas_dnd_candidates, e);
evas_object_data_set(e, "dnd_call_func", ecdb_dnd_entry_dnd_set); evas_object_data_set(e, "dnd_call_func", ecdb_dnd_entry_dnd_set);
edje_object_signal_callback_add(e, "clicked", "ecdb", _entry_click_cb_call, edje_object_signal_callback_add(e, "clicked", "ecdb", _entry_click_cb_call,
e); e);