A bit of reorganization.
This commit is contained in:
parent
a096cfc587
commit
7b07c374a1
@ -10,6 +10,7 @@ ecdb_SOURCES = \
|
||||
ecdb_misc.c ecdb_misc.h \
|
||||
ecdb_audio.c ecdb_audio.h \
|
||||
ecdb_gui.c ecdb_gui.h \
|
||||
ecdb_erase.c ecdb_erase.h \
|
||||
ecdb_common.h
|
||||
|
||||
ecdb_CFLAGS = @ECDB_CFLAGS@
|
||||
|
@ -55,6 +55,7 @@ extern int ECDB_DRIVE_ACTION_UPDATE;
|
||||
#include "ecdb_drives.h"
|
||||
#include "ecdb_image.h"
|
||||
#include "ecdb_burn.h"
|
||||
#include "ecdb_erase.h"
|
||||
#include "ecdb_misc.h"
|
||||
#include "ecdb_audio.h"
|
||||
#include "ecdb_gui.h"
|
||||
|
@ -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)
|
||||
|
@ -2,10 +2,7 @@
|
||||
#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);
|
||||
void ecdb_burn_project_destroy(Ecdb_Burn_Project *proj);
|
||||
void ecdb_erase_project_destroy(Ecdb_Erase_Project *proj);
|
||||
|
||||
#endif
|
||||
|
87
experimental/ecdb/trunk/src/ecdb_erase.c
Normal file
87
experimental/ecdb/trunk/src/ecdb_erase.c
Normal file
@ -0,0 +1,87 @@
|
||||
#include "ecdb.h"
|
||||
|
||||
int ecdb_erase_project_init(Ecdb_Erase_Project *proj);
|
||||
|
||||
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)
|
||||
{
|
||||
ecdb_project_destroy(ECDB_PROJECT(proj));
|
||||
free(proj);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
9
experimental/ecdb/trunk/src/ecdb_erase.h
Normal file
9
experimental/ecdb/trunk/src/ecdb_erase.h
Normal file
@ -0,0 +1,9 @@
|
||||
#ifndef ECDB_ERASE_H
|
||||
#define ECDB_ERASE_H
|
||||
|
||||
void ecdb_erase_project_start(Ecdb_Erase_Project *proj);
|
||||
int ecdb_erase_disc(Ecdb_Erase_Project *proj);
|
||||
Ecdb_Erase_Project *ecdb_erase_project_new();
|
||||
void ecdb_erase_project_destroy(Ecdb_Erase_Project *proj);
|
||||
|
||||
#endif
|
@ -359,6 +359,29 @@ ecdb_cb_erase_page_buttons_clicked(void *data, Evas_Object *o,
|
||||
}
|
||||
else if (!strcmp(source, "ecdb/erase/begin"))
|
||||
{
|
||||
int speed;
|
||||
Ecdb_Erase_Project *proj;
|
||||
proj = ecdb_erase_project_new();
|
||||
|
||||
if (!ecdb_aquire_drive(ECDB_PROJECT(proj), 0))
|
||||
{
|
||||
printf("Couldn't grab drive!\n");
|
||||
ecdb_erase_project_destroy(proj);
|
||||
}
|
||||
|
||||
if (!ecdb_erase_disc(proj))
|
||||
{
|
||||
printf("Couldn't begin burn!\n");
|
||||
ecdb_erase_project_destroy(proj);
|
||||
}
|
||||
|
||||
/* 1) Disable buttons...
|
||||
* 2) Start erase
|
||||
* 3) Grab a drive
|
||||
* 4) Start burn
|
||||
* 5) Set up progress callback
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
else if (!strcmp(source, "ecdb/erage/speed"))
|
||||
|
Loading…
Reference in New Issue
Block a user