Clean up headers a bit, and begin to add the improved image creation
This commit is contained in:
parent
0c369c5033
commit
fe6613d7b9
@ -97,9 +97,9 @@ ecdb_setup(void)
|
||||
if (!ecdb_aquire_drive_info())
|
||||
{
|
||||
printf("Aquiring drives failed!\n");
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return 1;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -315,5 +315,5 @@ ecdb_burn_finished(void *data, int type, void *event)
|
||||
FREE(t);
|
||||
FREE(proj);
|
||||
ecore_event_add(ECORE_EVENT_SIGNAL_EXIT, NULL, NULL, NULL);
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
int ecdb_burn_project(Ecdb_Burn_Project *proj);
|
||||
int ecdb_erase_disc(Ecdb_Erase_Project *proj);
|
||||
|
||||
Ecdb_Burn_Project *ecdb_burn_project_new(void);
|
||||
Ecdb_Erase_Project *ecdb_erase_project_new(void);
|
||||
|
||||
|
@ -111,4 +111,17 @@ struct _Ecdb_Erase_Project
|
||||
/* Typecast a pointer to an Ecdb_Erase_Project */
|
||||
#define ECDB_ERASE(proj) ((Ecdb_Erase_Project *) proj)
|
||||
|
||||
/* Typecast a pointer to an Ecdb_Source */
|
||||
#define ECDB_SOURCE(src) ((Ecdb_Source *) src)
|
||||
|
||||
typedef struct _Ecdb_Source Ecdb_Source;
|
||||
struct _Ecdb_Source
|
||||
{
|
||||
const char *dst;
|
||||
unsigned char rec:1;
|
||||
unsigned char num_children;
|
||||
Ecdb_Source **children;
|
||||
IsoNode *node;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -28,6 +28,9 @@ ecdb_aquire_drive_info(void)
|
||||
|
||||
drive = calloc(1, sizeof(Ecdb_Drive_Info));
|
||||
|
||||
if (!drive)
|
||||
return FALSE;
|
||||
|
||||
/* It would be nice if there was an easier way to do this */
|
||||
drive->product = strdup(drives_current[i].product);
|
||||
drive->vendor = strdup(drives_current[i].vendor);
|
||||
|
@ -1,5 +1,96 @@
|
||||
#include "ecdb.h"
|
||||
|
||||
int ecdb_source_init(Ecdb_Source *src);
|
||||
|
||||
Ecdb_Source *
|
||||
ecdb_source_new(void)
|
||||
{
|
||||
Ecdb_Source *src;
|
||||
|
||||
src = calloc(1, sizeof(Ecdb_Source));
|
||||
if (!src)
|
||||
return NULL;
|
||||
if (!ecdb_source_init(src))
|
||||
{
|
||||
FREE(src);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return src;
|
||||
}
|
||||
|
||||
int
|
||||
ecdb_source_init(Ecdb_Source *src)
|
||||
{
|
||||
src->rec = FALSE;
|
||||
src->num_children = 0;
|
||||
src->children = calloc(1, sizeof(Ecdb_Source));
|
||||
if (!src->children)
|
||||
return FALSE;
|
||||
src->children[src->num_children] = NULL;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
ecdb_source_data_set(Ecdb_Source *src, const char *dst, unsigned char rec)
|
||||
{
|
||||
if (!src)
|
||||
return;
|
||||
|
||||
src->dst = dst;
|
||||
src->rec = rec;
|
||||
}
|
||||
|
||||
void
|
||||
ecdb_source_child_append(Ecdb_Source *src, Ecdb_Source *child)
|
||||
{
|
||||
src->num_children++;
|
||||
src->children = realloc(src->children, sizeof(Ecdb_Source) *
|
||||
(src->num_children + 1));
|
||||
src->children[src->num_children] = child;
|
||||
src->children[src->num_children + 1] = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
ecdb_source_add_children_rec(Ecdb_Source *parent, IsoImage *image)
|
||||
{
|
||||
IsoDir *cd;
|
||||
IsoNode *cn;
|
||||
Ecdb_Source *cs;
|
||||
int i;
|
||||
|
||||
if ((!parent) || (!image))
|
||||
return;
|
||||
|
||||
i = 0;
|
||||
while ((cs = parent->children[i]))
|
||||
{
|
||||
if (cs->rec)
|
||||
iso_tree_add_dir_rec(image, ISO_DIR(parent->node),
|
||||
cs->dst);
|
||||
if (cs->num_children)
|
||||
{
|
||||
/* If not created above, make one here */
|
||||
if (!iso_tree_path_to_node(image, cs->dst, &cn))
|
||||
{
|
||||
iso_tree_add_new_dir(ISO_DIR(parent->node),
|
||||
cs->dst, &cd);
|
||||
cs->node = ISO_NODE(cd);
|
||||
}
|
||||
else
|
||||
cs->node = cn;
|
||||
ecdb_source_add_children_rec(cs, image);
|
||||
}
|
||||
|
||||
/* file */
|
||||
if ((!cs->rec) && (!cs->num_children))
|
||||
iso_tree_add_node(image, ISO_DIR(parent->node),
|
||||
cs->dst, NULL);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
/* Deprecated code */
|
||||
|
||||
/* Some limitations here need to be worked out
|
||||
* Handle: audio, etc */
|
||||
BurnSource *
|
||||
|
@ -1,6 +1,10 @@
|
||||
#ifndef ECDB_IMAGE_H
|
||||
#define ECDB_IMAGE_H
|
||||
|
||||
Ecdb_Source *ecdb_source_new(void);
|
||||
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);
|
||||
BurnSource *ecdb_image_project(Ecdb_Burn_Project *proj);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user