Use ecore_pipe to communicate with the burn progress thread instead of the bad way before.

This commit is contained in:
Jaime Thomas
2008-11-03 15:56:34 +00:00
parent 7b07c374a1
commit 7b840adb90
4 changed files with 35 additions and 37 deletions

View File

@@ -1,6 +1,7 @@
#include "ecdb.h"
int ecdb_erase_project_init(Ecdb_Erase_Project *proj);
static void ecdb_erase_progress_handler(void *data, void *buffer, int nbyte);
Ecdb_Erase_Project *
ecdb_erase_project_new(void)
@@ -44,7 +45,7 @@ int
ecdb_erase_disc(Ecdb_Erase_Project *proj)
{
BurnDriveStatus disc_state;
//pthread_t progress_update;
pthread_t progress_update;
disc_state = burn_disc_get_status(ECDB_PROJECT(proj)->drive->
tangible[0].drive);
@@ -67,15 +68,15 @@ ecdb_erase_disc(Ecdb_Erase_Project *proj)
else if (disc_state == BURN_DISC_FULL || BURN_DISC_APPENDABLE)
{
printf("Beginning to erase disc!\n");
ECDB_PROJECT(proj)->pipe = ecore_pipe_add
(ecdb_erase_progress_handler,
NULL);
burn_disc_erase(ECDB_PROJECT(proj)->drive->
tangible[0].drive, proj->quick);
/*
pthread_create(&progress_update, NULL, _progress_update,
proj);
pthread_create(&progress_update, NULL,
ecdb_drive_progress_update, proj);
pthread_detach(progress_update);
ecore_timer_add(0.5, _progress_gui_update, proj);
*/
return TRUE;
}
else
@@ -85,3 +86,10 @@ ecdb_erase_disc(Ecdb_Erase_Project *proj)
}
}
static void
ecdb_erase_progress_handler(void *data, void *buffer, int nbyte)
{
BurnProgress *p = buffer;
printf("Sector %d of %d\n", p->sector, p->sectors);
}