diff --git a/experimental/ecdb/trunk/src/Makefile.am b/experimental/ecdb/trunk/src/Makefile.am index 0b335794..bc3e3d7f 100644 --- a/experimental/ecdb/trunk/src/Makefile.am +++ b/experimental/ecdb/trunk/src/Makefile.am @@ -10,6 +10,7 @@ ecdb_SOURCES = \ ecdb_misc.c ecdb_misc.h \ ecdb_audio.c ecdb_audio.h \ ecdb_gui.c ecdb_gui.h \ + ecdb_filelist_custom.c ecdb_filelist_custom.h \ ecdb_common.h ecdb_CFLAGS = @ECDB_CFLAGS@ diff --git a/experimental/ecdb/trunk/src/ecdb.h b/experimental/ecdb/trunk/src/ecdb.h index 0f9227aa..f3c4d0c0 100644 --- a/experimental/ecdb/trunk/src/ecdb.h +++ b/experimental/ecdb/trunk/src/ecdb.h @@ -45,6 +45,7 @@ extern int ECDB_DRIVE_ACTION_UPDATE; #include "ecdb_burn.h" #include "ecdb_misc.h" #include "ecdb_audio.h" +#include "ecdb_filelist_custom.h" #include "ecdb_gui.h" #endif diff --git a/experimental/ecdb/trunk/src/ecdb_common.h b/experimental/ecdb/trunk/src/ecdb_common.h index d197563c..9fc480da 100644 --- a/experimental/ecdb/trunk/src/ecdb_common.h +++ b/experimental/ecdb/trunk/src/ecdb_common.h @@ -68,8 +68,8 @@ typedef struct _Ecdb_Source Ecdb_Source; struct _Ecdb_Source { char *dst; - unsigned char rec:1; - unsigned char num_children; + unsigned char dir:1; + unsigned int num_children; Ecdb_Source **children; Ecdb_Source *parent; IsoNode *node; diff --git a/experimental/ecdb/trunk/src/ecdb_gui.c b/experimental/ecdb/trunk/src/ecdb_gui.c index af985e3a..5ab150c5 100644 --- a/experimental/ecdb/trunk/src/ecdb_gui.c +++ b/experimental/ecdb/trunk/src/ecdb_gui.c @@ -142,18 +142,23 @@ static Ewl_Widget { Ewl_Widget *box, *filelist; Ecdb_Burn_Project *proj; + const char *dnd_types[] = {"text/uri-list", NULL}; proj = ecdb_burn_project_new(); box = ewl_vbox_new(); ewl_widget_data_set(box, "proj_data", proj); - ewl_callback_append(box, EWL_CALLBACK_DESTROY, + ewl_callback_prepend(box, EWL_CALLBACK_DESTROY, _destroy_data_page_cb, proj); ewl_widget_show(box); filelist = ewl_filelist_new(); ewl_filelist_multiselect_set(EWL_FILELIST(filelist), TRUE); + ewl_dnd_accepted_types_set(filelist, dnd_types); + ewl_callback_append(filelist, EWL_CALLBACK_DND_DATA_RECEIVED, + ecdb_filelist_dnd_dropped_cb, NULL); ewl_container_child_append(EWL_CONTAINER(box), filelist); + ewl_widget_data_set(filelist, "source", proj->files); ewl_widget_show(filelist); return box; diff --git a/experimental/ecdb/trunk/src/ecdb_image.c b/experimental/ecdb/trunk/src/ecdb_image.c index eaf1bc54..a9672dd9 100644 --- a/experimental/ecdb/trunk/src/ecdb_image.c +++ b/experimental/ecdb/trunk/src/ecdb_image.c @@ -1,6 +1,7 @@ #include "ecdb.h" int ecdb_source_init(Ecdb_Source *src); +void ecdb_source_add_directory_recursive(Ecdb_Source *parent); Ecdb_Source * ecdb_source_new(void) @@ -22,7 +23,7 @@ ecdb_source_new(void) int ecdb_source_init(Ecdb_Source *src) { - src->rec = FALSE; + src->dir = FALSE; src->num_children = 0; src->children = calloc(1, sizeof(Ecdb_Source)); if (!src->children) @@ -52,13 +53,37 @@ ecdb_source_destroy(Ecdb_Source *src) } void -ecdb_source_data_set(Ecdb_Source *src, const char *dst, unsigned char rec) +ecdb_source_data_set(Ecdb_Source *src, const char *dst) { if (!src) return; src->dst = strdup(dst); - src->rec = rec; + + /* Add the files recursively here */ + if (ecore_file_is_dir(src->dst)) + { + src->dir = TRUE; + ecdb_source_add_directory_recursive(src); + } +} + +void +ecdb_source_add_directory_recursive(Ecdb_Source *parent) +{ + Ecore_List *files; + Ecdb_Source *child; + char *src; + + files = ecore_file_ls(parent->dst); + + while ((src = ecore_list_first_remove(files))) + { + child = ecdb_source_new(); + ecdb_source_data_set(child, src); + ecdb_source_child_append(parent, child); + free(src); + } } void @@ -128,29 +153,23 @@ ecdb_source_add_children_rec(Ecdb_Source *parent, IsoImage *image) i = 0; while ((cs = parent->children[i])) { - /* If recursive, let library add for us */ - if (cs->rec) + if (cs->dir) { iso_tree_add_new_dir(ISO_DIR(parent->node), - ecore_file_file_get(cs->dst), &cd); - iso_tree_add_dir_rec(image, cd, cs->dst); + ecore_file_file_get(cs->dst), + &cd); + cs->node = ISO_NODE(cd); + /* If the source has children, find the node from above + * (if applicable), and recursively add to it */ + if (cs->num_children > 0) + { + ecdb_source_add_children_rec(cs, image); + } + } - /* If the source has children, find the node from above - * (if applicable), and recursively add to it */ - if (cs->num_children) - { - if (!cd) - { - iso_tree_add_new_dir(ISO_DIR(parent->node), - ecore_file_file_get(cs->dst), &cd); - } - cs->node = ISO_NODE(cd); - ecdb_source_add_children_rec(cs, image); - } - /* file */ - if ((!cs->rec) && (!cs->num_children)) + else { iso_tree_add_node(image, ISO_DIR(parent->node), cs->dst, NULL); diff --git a/experimental/ecdb/trunk/src/ecdb_image.h b/experimental/ecdb/trunk/src/ecdb_image.h index 1d505ab9..dc3189de 100644 --- a/experimental/ecdb/trunk/src/ecdb_image.h +++ b/experimental/ecdb/trunk/src/ecdb_image.h @@ -3,8 +3,7 @@ Ecdb_Source *ecdb_source_new(void); void ecdb_source_destroy(Ecdb_Source *src); -void ecdb_source_data_set(Ecdb_Source *src, const char *dst, - unsigned char rec); +void ecdb_source_data_set(Ecdb_Source *src, const char *dst); void ecdb_source_child_append(Ecdb_Source *src, Ecdb_Source *child); void ecdb_source_child_remove(Ecdb_Source *src, Ecdb_Source *child); BurnSource *ecdb_image_project(Ecdb_Burn_Project *proj);