diff --git a/experimental/ecdb/trunk/TODO b/experimental/ecdb/trunk/TODO index caf3e216..d8f38540 100644 --- a/experimental/ecdb/trunk/TODO +++ b/experimental/ecdb/trunk/TODO @@ -7,3 +7,4 @@ -> fix combo theme -> move callbacks to buttons instead of swallow (done except for welcome page) -> 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. diff --git a/experimental/ecdb/trunk/src/ecdb.c b/experimental/ecdb/trunk/src/ecdb.c index 1c7a63c7..20f75518 100644 --- a/experimental/ecdb/trunk/src/ecdb.c +++ b/experimental/ecdb/trunk/src/ecdb.c @@ -167,8 +167,6 @@ ecdb_setup(void) { em = NULL; em = calloc(1, sizeof(Ecdb_Main)); - em->drives = NULL; - em->drop_object = NULL; if (!ecore_file_mkdir("/tmp/ecdb")) { diff --git a/experimental/ecdb/trunk/src/ecdb.h b/experimental/ecdb/trunk/src/ecdb.h index 91fbe714..f96bceb1 100644 --- a/experimental/ecdb/trunk/src/ecdb.h +++ b/experimental/ecdb/trunk/src/ecdb.h @@ -35,8 +35,10 @@ struct _Ecdb_Main char theme_path[PATH_MAX]; Ecore_Evas *main_win_ee; Eina_List *drives; - Eina_List *dnd_candidates; - Evas_Object *drop_object; + Eina_List *evas_dnd_candidates; + Eina_List *ewl_dnd_candidates; + Evas_Object *evas_drop_object; + Ewl_Widget *ewl_drop_object; }; extern Ecdb_Main *em; diff --git a/experimental/ecdb/trunk/src/ecdb_burn.c b/experimental/ecdb/trunk/src/ecdb_burn.c index 6e25586d..fa4a1296 100644 --- a/experimental/ecdb/trunk/src/ecdb_burn.c +++ b/experimental/ecdb/trunk/src/ecdb_burn.c @@ -287,13 +287,17 @@ ecdb_burn_finished(void *data, int type, void *event) ecdb_audio_project_destroy(ECDB_AUDIO(proj->proj)); 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)); } FREE(proj); - ecdb_burn_image_cleanup(); - return TRUE; } diff --git a/experimental/ecdb/trunk/src/ecdb_burn_data_gui.c b/experimental/ecdb/trunk/src/ecdb_burn_data_gui.c index da2ac7d6..07ae9540 100644 --- a/experimental/ecdb/trunk/src/ecdb_burn_data_gui.c +++ b/experimental/ecdb/trunk/src/ecdb_burn_data_gui.c @@ -26,36 +26,21 @@ _button_cb_return(void *data, Evas_Object *obj, void *event_info) static void _button_cb_begin(void *data, Evas_Object *obj, void *event_info) { - /* Evas_Object *swallow, *gui, *o; Ecdb_Burn_Project *proj; - Ecdb_Source *iso_file; - char *file, buf[1024]; + Ewl_Widget *filelist; + char buf[1024]; Ecdb_Burn_Result burn_result; int drive, speed; 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_data_page"); - o = evas_object_name_find(ecore_evas_get(em->main_win_ee), - "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; - } + filelist = ewl_widget_name_find("ecdb/burn_data/filelist"); proj = ecdb_burn_project_new(); - ecdb_project_type_set(ECDB_PROJECT(proj), ECDB_IMAGE_PROJECT); - iso_file = ecdb_source_new(); - ecdb_source_data_set(iso_file, file); - FREE(file); - ecdb_source_child_append(proj->files, iso_file); + ecdb_source_destroy(proj->files); + ecdb_project_type_set(ECDB_PROJECT(proj), ECDB_BURN_PROJECT); o = evas_object_name_find(evas_object_evas_get(obj), "ecdb/burn_data/drive"); @@ -77,6 +62,10 @@ _button_cb_begin(void *data, Evas_Object *obj, void *event_info) else 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..."); edje_object_part_text_set(swallow, "progress_text", buf); 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_info_free(p->drive->tangible); ecdb_burn_project_destroy(proj); - */ } static void @@ -269,7 +257,6 @@ ecdb_burn_data_page_show(void) void ecdb_burn_data_cleanup(void) { - /* Evas_Object *swallow; const char *ids[] = {"ecdb/burn_data/return", "ecdb/burn_data/begin", "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), "burn_data_page"); 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"); - */ } diff --git a/experimental/ecdb/trunk/src/ecdb_filelist_custom.c b/experimental/ecdb/trunk/src/ecdb_filelist_custom.c index 63acf7c7..fdd9c38d 100644 --- a/experimental/ecdb/trunk/src/ecdb_filelist_custom.c +++ b/experimental/ecdb/trunk/src/ecdb_filelist_custom.c @@ -20,7 +20,6 @@ static void ecdb_custom_filelist_dnd_dropped_cb(Ewl_Widget *w, void *ev, Ewl_Widget * ecdb_custom_filelist_new(void) { - const char *dnd_types[] = {"text/uri-list", NULL}; Ewl_Widget *ret; ret = ewl_filelist_new(); @@ -32,7 +31,7 @@ ecdb_custom_filelist_new(void) ecdb_custom_filelist_view_widget_fetch); ewl_callback_append(ret, EWL_CALLBACK_DND_DATA_RECEIVED, 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_prepend(EWL_FILELIST(ret)->controller, EWL_CALLBACK_CLICKED, ecdb_custom_filelist_cb_clicked, ret); diff --git a/experimental/ecdb/trunk/src/ecdb_image.c b/experimental/ecdb/trunk/src/ecdb_image.c index 8270d8e9..cef37357 100644 --- a/experimental/ecdb/trunk/src/ecdb_image.c +++ b/experimental/ecdb/trunk/src/ecdb_image.c @@ -201,7 +201,8 @@ ecdb_image_project(Ecdb_Burn_Project *proj) } /* 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(); c = proj->files->children[0]; diff --git a/experimental/ecdb/trunk/src/ecdb_misc.c b/experimental/ecdb/trunk/src/ecdb_misc.c index 4fbd520a..e8e4639a 100644 --- a/experimental/ecdb/trunk/src/ecdb_misc.c +++ b/experimental/ecdb/trunk/src/ecdb_misc.c @@ -45,9 +45,13 @@ ecdb_shutdown(void *data, int type, void *event) { 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); @@ -169,6 +173,7 @@ ecdb_dnd_position(void *data, int type, void *event) Eina_List *l; Ecore_X_Event_Xdnd_Position *ev; Evas_Object *o; + Ewl_Widget *ew; Ecore_X_Rectangle rect; 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, &window_h); - em->dnd_candidates = eina_list_nth_list(em->dnd_candidates, 0); - EINA_LIST_FOREACH(em->dnd_candidates, l, o) + em->evas_dnd_candidates = eina_list_nth_list(em->evas_dnd_candidates, 0); + EINA_LIST_FOREACH(em->evas_dnd_candidates, l, o) { if (evas_object_visible_get(o)) { @@ -189,20 +194,42 @@ ecdb_dnd_position(void *data, int type, void *event) x += window_x; y += window_y; - if ((ev->position.x >= x) && (ev->position.x <= (x+w)) + 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->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); 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.y = window_y; rect.width = window_w; @@ -215,7 +242,7 @@ ecdb_dnd_position(void *data, int type, void *event) int 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_evas_software_x11_window_get(em->main_win_ee), @@ -228,24 +255,41 @@ int ecdb_dnd_selection(void *data, int type, void *event) { Ecore_X_Event_Selection_Notify *ev; + Ecore_X_Selection_Data *d; Ecore_X_Selection_Data_Files *files; void (*call_func)(Evas_Object *, Ecore_X_Selection_Data_Files *) = NULL; ev = event; - if ((!em->drop_object) || (ev->selection != ECORE_X_SELECTION_XDND) - || (!(files = ev->data)) || (files->num_files <= 0)) + if (((!em->evas_drop_object) && (!em->ewl_drop_object)) || + (ev->selection != ECORE_X_SELECTION_XDND) || (!(files = ev->data)) || + (!(d = ev->data)) || (files->num_files <= 0)) { ecore_x_dnd_send_finished(); return 1; } - call_func = evas_object_data_get(em->drop_object, "dnd_call_func"); - if (call_func != NULL) + if (em->evas_drop_object) { - call_func(em->drop_object, files); + call_func = evas_object_data_get(em->evas_drop_object, "dnd_call_func"); + if (call_func != NULL) + { + 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(); return 1; } diff --git a/experimental/ecdb/trunk/src/ecdb_widgets.c b/experimental/ecdb/trunk/src/ecdb_widgets.c index db049efb..4501b912 100644 --- a/experimental/ecdb/trunk/src/ecdb_widgets.c +++ b/experimental/ecdb/trunk/src/ecdb_widgets.c @@ -355,7 +355,7 @@ ecdb_entry_add(Evas_Object *parent, const char *name) e = ecdb_widget_add(parent, name); 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); edje_object_signal_callback_add(e, "clicked", "ecdb", _entry_click_cb_call, e);