Added some _very_ rough code for the burn list. Ewl needs some work here in a couple areas, so off to do that

This commit is contained in:
Jaime Thomas 2008-06-17 04:06:21 +00:00
parent 2249a53666
commit 853d42f6de
6 changed files with 51 additions and 26 deletions

View File

@ -10,6 +10,7 @@ ecdb_SOURCES = \
ecdb_misc.c ecdb_misc.h \ ecdb_misc.c ecdb_misc.h \
ecdb_audio.c ecdb_audio.h \ ecdb_audio.c ecdb_audio.h \
ecdb_gui.c ecdb_gui.h \ ecdb_gui.c ecdb_gui.h \
ecdb_filelist_custom.c ecdb_filelist_custom.h \
ecdb_common.h ecdb_common.h
ecdb_CFLAGS = @ECDB_CFLAGS@ ecdb_CFLAGS = @ECDB_CFLAGS@

View File

@ -45,6 +45,7 @@ extern int ECDB_DRIVE_ACTION_UPDATE;
#include "ecdb_burn.h" #include "ecdb_burn.h"
#include "ecdb_misc.h" #include "ecdb_misc.h"
#include "ecdb_audio.h" #include "ecdb_audio.h"
#include "ecdb_filelist_custom.h"
#include "ecdb_gui.h" #include "ecdb_gui.h"
#endif #endif

View File

@ -68,8 +68,8 @@ typedef struct _Ecdb_Source Ecdb_Source;
struct _Ecdb_Source struct _Ecdb_Source
{ {
char *dst; char *dst;
unsigned char rec:1; unsigned char dir:1;
unsigned char num_children; unsigned int num_children;
Ecdb_Source **children; Ecdb_Source **children;
Ecdb_Source *parent; Ecdb_Source *parent;
IsoNode *node; IsoNode *node;

View File

@ -142,18 +142,23 @@ static Ewl_Widget
{ {
Ewl_Widget *box, *filelist; Ewl_Widget *box, *filelist;
Ecdb_Burn_Project *proj; Ecdb_Burn_Project *proj;
const char *dnd_types[] = {"text/uri-list", NULL};
proj = ecdb_burn_project_new(); proj = ecdb_burn_project_new();
box = ewl_vbox_new(); box = ewl_vbox_new();
ewl_widget_data_set(box, "proj_data", proj); 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); _destroy_data_page_cb, proj);
ewl_widget_show(box); ewl_widget_show(box);
filelist = ewl_filelist_new(); filelist = ewl_filelist_new();
ewl_filelist_multiselect_set(EWL_FILELIST(filelist), TRUE); 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_container_child_append(EWL_CONTAINER(box), filelist);
ewl_widget_data_set(filelist, "source", proj->files);
ewl_widget_show(filelist); ewl_widget_show(filelist);
return box; return box;

View File

@ -1,6 +1,7 @@
#include "ecdb.h" #include "ecdb.h"
int ecdb_source_init(Ecdb_Source *src); int ecdb_source_init(Ecdb_Source *src);
void ecdb_source_add_directory_recursive(Ecdb_Source *parent);
Ecdb_Source * Ecdb_Source *
ecdb_source_new(void) ecdb_source_new(void)
@ -22,7 +23,7 @@ ecdb_source_new(void)
int int
ecdb_source_init(Ecdb_Source *src) ecdb_source_init(Ecdb_Source *src)
{ {
src->rec = FALSE; src->dir = FALSE;
src->num_children = 0; src->num_children = 0;
src->children = calloc(1, sizeof(Ecdb_Source)); src->children = calloc(1, sizeof(Ecdb_Source));
if (!src->children) if (!src->children)
@ -52,13 +53,37 @@ ecdb_source_destroy(Ecdb_Source *src)
} }
void 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) if (!src)
return; return;
src->dst = strdup(dst); 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 void
@ -128,29 +153,23 @@ ecdb_source_add_children_rec(Ecdb_Source *parent, IsoImage *image)
i = 0; i = 0;
while ((cs = parent->children[i])) while ((cs = parent->children[i]))
{ {
/* If recursive, let library add for us */ if (cs->dir)
if (cs->rec)
{ {
iso_tree_add_new_dir(ISO_DIR(parent->node), iso_tree_add_new_dir(ISO_DIR(parent->node),
ecore_file_file_get(cs->dst), &cd); ecore_file_file_get(cs->dst),
iso_tree_add_dir_rec(image, cd, cs->dst); &cd);
} cs->node = ISO_NODE(cd);
/* If the source has children, find the node from above /* If the source has children, find the node from above
* (if applicable), and recursively add to it */ * (if applicable), and recursively add to it */
if (cs->num_children) if (cs->num_children > 0)
{ {
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); ecdb_source_add_children_rec(cs, image);
} }
}
/* file */ /* file */
if ((!cs->rec) && (!cs->num_children)) else
{ {
iso_tree_add_node(image, ISO_DIR(parent->node), iso_tree_add_node(image, ISO_DIR(parent->node),
cs->dst, NULL); cs->dst, NULL);

View File

@ -3,8 +3,7 @@
Ecdb_Source *ecdb_source_new(void); Ecdb_Source *ecdb_source_new(void);
void ecdb_source_destroy(Ecdb_Source *src); void ecdb_source_destroy(Ecdb_Source *src);
void ecdb_source_data_set(Ecdb_Source *src, const char *dst, void ecdb_source_data_set(Ecdb_Source *src, const char *dst);
unsigned char rec);
void ecdb_source_child_append(Ecdb_Source *src, Ecdb_Source *child); void ecdb_source_child_append(Ecdb_Source *src, Ecdb_Source *child);
void ecdb_source_child_remove(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); BurnSource *ecdb_image_project(Ecdb_Burn_Project *proj);