273 lines
5.2 KiB
C
273 lines
5.2 KiB
C
|
/* vim: set sw=3 ts=3 sts=3 expandtab: */
|
||
|
#include "ecdb.h"
|
||
|
|
||
|
int ecdb_project_init(Ecdb_Project *proj);
|
||
|
int ecdb_burn_project_init(Ecdb_Burn_Project *proj);
|
||
|
int ecdb_erase_project_init(Ecdb_Erase_Project *proj);
|
||
|
int ecdb_audio_project_init(Ecdb_Audio_Project *proj);
|
||
|
int ecdb_data_project_init(Ecdb_Data_Project *proj);
|
||
|
int ecdb_image_project_init(Ecdb_Image_Project *proj);
|
||
|
|
||
|
Ecdb_Project *
|
||
|
ecdb_project_new(void)
|
||
|
{
|
||
|
Ecdb_Project *proj;
|
||
|
|
||
|
proj = calloc(1, sizeof(Ecdb_Project));
|
||
|
if (!proj)
|
||
|
{
|
||
|
return NULL;
|
||
|
}
|
||
|
if (!ecdb_project_init(proj))
|
||
|
{
|
||
|
FREE(proj);
|
||
|
return NULL;
|
||
|
}
|
||
|
|
||
|
return proj;
|
||
|
}
|
||
|
|
||
|
int
|
||
|
ecdb_project_init(Ecdb_Project *proj)
|
||
|
{
|
||
|
return TRUE;
|
||
|
}
|
||
|
|
||
|
void
|
||
|
ecdb_project_destroy(Ecdb_Project *proj)
|
||
|
{
|
||
|
FREE(proj->drive);
|
||
|
if (proj->ev_handler) ecore_event_handler_del(proj->ev_handler);
|
||
|
if (proj->pipe) ecore_pipe_del(proj->pipe);
|
||
|
if (proj->ret) evas_object_destroy(proj->ret);
|
||
|
if (proj->begin) evas_object_destroy(proj->begin);
|
||
|
if (proj->begin) evas_object_destroy(proj->drive);
|
||
|
printf("Destroying base project\n");
|
||
|
}
|
||
|
|
||
|
void
|
||
|
ecdb_project_type_set(Ecdb_Project *proj, unsigned int t)
|
||
|
{
|
||
|
proj->type = t;
|
||
|
}
|
||
|
|
||
|
Ecdb_Burn_Project *
|
||
|
ecdb_burn_project_new(void)
|
||
|
{
|
||
|
Ecdb_Burn_Project *proj;
|
||
|
|
||
|
proj = calloc(1, sizeof(Ecdb_Burn_Project));
|
||
|
if (!proj)
|
||
|
return NULL;
|
||
|
if (!ecdb_burn_project_init(proj))
|
||
|
{
|
||
|
FREE(proj);
|
||
|
return NULL;
|
||
|
}
|
||
|
|
||
|
return proj;
|
||
|
}
|
||
|
|
||
|
int
|
||
|
ecdb_burn_project_init(Ecdb_Burn_Project *proj)
|
||
|
{
|
||
|
if (!ecdb_project_init(ECDB_PROJECT(proj)))
|
||
|
return FALSE;
|
||
|
|
||
|
/* Create some sane defaults */
|
||
|
ecdb_project_type_set(ECDB_PROJECT(proj), ECDB_BURN_PROJECT);
|
||
|
proj->burn_mode = BURN_MODE1;
|
||
|
proj->fifo_chunksize = 2048;
|
||
|
proj->fifo_chunks = 2048;
|
||
|
proj->underrun_proof = TRUE;
|
||
|
proj->opc = TRUE;
|
||
|
proj->multi = TRUE;
|
||
|
|
||
|
return TRUE;
|
||
|
}
|
||
|
|
||
|
void
|
||
|
ecdb_burn_project_destroy(Ecdb_Burn_Project *proj)
|
||
|
{
|
||
|
if (proj->files) ecdb_source_destroy(proj->files);
|
||
|
if (proj->speed_combo) evas_object_destroy(proj->speed_combo);
|
||
|
ecdb_project_destroy(ECDB_PROJECT(proj));
|
||
|
printf("Destroying burn project\n");
|
||
|
}
|
||
|
|
||
|
Ecdb_Erase_Project *
|
||
|
ecdb_erase_project_new(void)
|
||
|
{
|
||
|
Ecdb_Erase_Project *proj;
|
||
|
|
||
|
proj = calloc(1, sizeof(Ecdb_Erase_Project));
|
||
|
if (!proj)
|
||
|
{
|
||
|
return NULL;
|
||
|
}
|
||
|
|
||
|
if (!ecdb_erase_project_init(proj))
|
||
|
{
|
||
|
FREE(proj);
|
||
|
return NULL;
|
||
|
}
|
||
|
|
||
|
return proj;
|
||
|
}
|
||
|
|
||
|
int
|
||
|
ecdb_erase_project_init(Ecdb_Erase_Project *proj)
|
||
|
{
|
||
|
if (!ecdb_project_init(ECDB_PROJECT(proj)))
|
||
|
{
|
||
|
return FALSE;
|
||
|
}
|
||
|
|
||
|
/* Proper defaults */
|
||
|
ecdb_project_type_set(ECDB_PROJECT(proj), ECDB_ERASE_PROJECT);
|
||
|
proj->quick = TRUE;
|
||
|
proj->format = FALSE;
|
||
|
|
||
|
return TRUE;
|
||
|
}
|
||
|
|
||
|
void
|
||
|
ecdb_erase_project_destroy(Ecdb_Erase_Project *proj)
|
||
|
{
|
||
|
if (proj->speed) evas_object_destroy(proj->speed);
|
||
|
ecdb_project_destroy(ECDB_PROJECT(proj));
|
||
|
FREE(proj);
|
||
|
}
|
||
|
|
||
|
Ecdb_Audio_Project *
|
||
|
ecdb_audio_project_new(void)
|
||
|
{
|
||
|
Ecdb_Audio_Project *proj;
|
||
|
|
||
|
proj = calloc(1, sizeof(Ecdb_Audio_Project));
|
||
|
if (!proj)
|
||
|
{
|
||
|
return NULL;
|
||
|
}
|
||
|
if (!ecdb_audio_project_init(proj))
|
||
|
{
|
||
|
FREE(proj);
|
||
|
return NULL;
|
||
|
}
|
||
|
|
||
|
return proj;
|
||
|
}
|
||
|
|
||
|
int
|
||
|
ecdb_audio_project_init(Ecdb_Audio_Project *proj)
|
||
|
{
|
||
|
if (!ecdb_burn_project_init(ECDB_BURN(proj)))
|
||
|
{
|
||
|
return FALSE;
|
||
|
}
|
||
|
|
||
|
ecdb_project_type_set(ECDB_PROJECT(proj), ECDB_AUDIO_PROJECT);
|
||
|
|
||
|
return TRUE;
|
||
|
}
|
||
|
|
||
|
void
|
||
|
ecdb_audio_project_destroy(Ecdb_Audio_Project *proj)
|
||
|
{
|
||
|
ecdb_burn_project_destroy(ECDB_PROJECT(proj));
|
||
|
FREE(proj);
|
||
|
}
|
||
|
|
||
|
Ecdb_Data_Project *
|
||
|
ecdb_data_project_new(void)
|
||
|
{
|
||
|
Ecdb_Data_Project *proj;
|
||
|
|
||
|
proj = calloc(1, sizeof(Ecdb_Data_Project));
|
||
|
if (!proj)
|
||
|
{
|
||
|
return NULL;
|
||
|
}
|
||
|
if (!ecdb_data_project_init(proj))
|
||
|
{
|
||
|
FREE(proj);
|
||
|
return NULL;
|
||
|
}
|
||
|
|
||
|
return proj;
|
||
|
}
|
||
|
|
||
|
int
|
||
|
ecdb_data_project_init(Ecdb_Data_Project *proj)
|
||
|
{
|
||
|
if (!ecdb_burn_project_init(ECDB_BURN(proj)))
|
||
|
{
|
||
|
return FALSE;
|
||
|
}
|
||
|
|
||
|
ecdb_project_type_set(ECDB_PROJECT(proj), ECDB_DATA_PROJECT);
|
||
|
proj->use_joliet = TRUE;
|
||
|
proj->use_rockridge = TRUE;
|
||
|
proj->iso_level = 3;
|
||
|
|
||
|
return TRUE;
|
||
|
}
|
||
|
|
||
|
void
|
||
|
ecdb_data_project_destroy(Ecdb_Data_Project *proj)
|
||
|
{
|
||
|
if (proj->capacity) evas_object_destroy(proj->capacity);
|
||
|
if (proj->settings) evas_object_destroy(proj->settings);
|
||
|
if (proj->filelist_swallow) evas_object_destroy(proj->filelist_swallow);
|
||
|
if (proj->filelist) ewl_widget_destroy(filelist);
|
||
|
FREE(volume_id);
|
||
|
FREE(publisher_id);
|
||
|
FREE(data_preparer_id);
|
||
|
FREE(system_id);
|
||
|
FREE(application_id);
|
||
|
FREE(copywrite_id);
|
||
|
FREE(abstract_id);
|
||
|
FREE(biblio_id);
|
||
|
ecdb_burn_project_destroy(ECDB_BURN(proj));
|
||
|
FREE(proj);
|
||
|
}
|
||
|
|
||
|
Ecdb_Image_Project *
|
||
|
ecdb_image_project_new(void)
|
||
|
{
|
||
|
Ecdb_Image_Project *proj;
|
||
|
|
||
|
proj = calloc(1, sizeof(Ecdb_Image_Project));
|
||
|
if (!proj)
|
||
|
{
|
||
|
return NULL;
|
||
|
}
|
||
|
if (!ecdb_image_project_init(proj))
|
||
|
{
|
||
|
FREE(proj);
|
||
|
return NULL;
|
||
|
}
|
||
|
|
||
|
return proj;
|
||
|
}
|
||
|
|
||
|
int
|
||
|
ecdb_image_project_init(Ecdb_Image_Project *proj)
|
||
|
{
|
||
|
if (!ecdb_burn_project_init(ECDB_BURN(proj)))
|
||
|
return FALSE;
|
||
|
|
||
|
ecdb_project_type_set(ECDB_PROJECT(proj), ECDB_IMAGE_PROJECT);
|
||
|
|
||
|
return TRUE;
|
||
|
}
|
||
|
|
||
|
void
|
||
|
ecdb_image_project_destroy(Ecdb_Image_Project *proj)
|
||
|
{
|
||
|
if (proj->entry) evas_object_destroy(proj->entry);
|
||
|
ecdb_burn_project_destroy(ECDB_BURN(proj));
|
||
|
FREE(proj);
|
||
|
}
|
||
|
|