Clean up headers a bit, and begin to add the improved image creation

This commit is contained in:
Jaime Thomas 2008-05-19 05:00:55 +00:00
parent 0c369c5033
commit fe6613d7b9
9 changed files with 127 additions and 17 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -1,10 +1,9 @@
#ifndef ECDB_BURN_H
#define ECDB_BURN_H
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);
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);
#endif

View File

@ -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

View File

@ -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);

View File

@ -1,8 +1,8 @@
#ifndef ECDB_DRIVES_H
#define ECDB_DRIVES_H
int ecdb_aquire_drive_info(void);
void ecdb_print_drive_info(void);
int ecdb_aquire_drive(Ecdb_Project *proj, unsigned int idx);
int ecdb_aquire_drive_info(void);
void ecdb_print_drive_info(void);
int ecdb_aquire_drive(Ecdb_Project *proj, unsigned int idx);
#endif

View File

@ -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 *

View File

@ -1,7 +1,11 @@
#ifndef ECDB_IMAGE_H
#define ECDB_IMAGE_H
BurnSource *ecdb_image_project(Ecdb_Burn_Project *proj);
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

View File

@ -1,10 +1,10 @@
#ifndef ECDB_MISC_H
#define ECDB_MISC_H
Ecdb_Project *ecdb_project_new(void);
int ecdb_project_init(Ecdb_Project *proj);
int ecdb_shutdown(void *data, int type, void *event);
void ecdb_burn_init(void);
void ecdb_image_init(void);
Ecdb_Project *ecdb_project_new(void);
int ecdb_project_init(Ecdb_Project *proj);
int ecdb_shutdown(void *data, int type, void *event);
void ecdb_burn_init(void);
void ecdb_image_init(void);
#endif