A bit of reorganization.

This commit is contained in:
Jaime Thomas
2008-11-03 14:56:30 +00:00
parent a096cfc587
commit 7b07c374a1
7 changed files with 122 additions and 89 deletions

View File

@@ -52,37 +52,6 @@ ecdb_burn_project_init(Ecdb_Burn_Project *proj)
return TRUE;
}
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_burn_project_destroy(Ecdb_Burn_Project *proj)
{
@@ -99,14 +68,6 @@ ecdb_burn_project_destroy(Ecdb_Burn_Project *proj)
free(proj);
}
void
ecdb_erase_project_destroy(Ecdb_Erase_Project *proj)
{
ecdb_project_destroy(ECDB_PROJECT(proj));
free(proj);
}
/* Erase and Burn Function */
int
ecdb_burn_project(Ecdb_Burn_Project *proj)
{
@@ -189,53 +150,7 @@ ecdb_burn_project(Ecdb_Burn_Project *proj)
return TRUE;
}
int
ecdb_erase_disc(Ecdb_Erase_Project *proj)
{
BurnDriveStatus disc_state;
pthread_t progress_update;
disc_state = burn_disc_get_status(ECDB_PROJECT(proj)->drive->
tangible[0].drive);
if (disc_state == BURN_DISC_BLANK)
{
printf("Disc is already blank!\n");
return FALSE;
}
else if (disc_state == BURN_DISC_EMPTY)
{
printf("No disc!\n");
return FALSE;
}
else if (!burn_disc_erasable(ECDB_PROJECT(proj)->drive->
tangible[0].drive))
{
printf("Not able to erase!\n");
return FALSE;
}
else if (disc_state == BURN_DISC_FULL || BURN_DISC_APPENDABLE)
{
printf("Beginning to erase disc!\n");
burn_disc_erase(ECDB_PROJECT(proj)->drive->
tangible[0].drive, proj->quick);
pthread_create(&progress_update, NULL, _progress_update,
proj);
pthread_detach(progress_update);
ecore_timer_add(0.5, _progress_gui_update, proj);
return TRUE;
}
else
{
printf("Not of erasable type\n");
return FALSE;
}
}
/* Hopefully at some point EFL will become thread-safe, or ecore_timer will
* work with burn_drive_get_status without segfaulting. At that point we can
* do away with this.
*/
/* TODO: Replace this with ecore_point */
/* Event handlers */
void *
_progress_update(void *d)