Fix a bunch of mistakes I made before.

This commit is contained in:
Jaime Thomas 2009-02-17 22:48:11 +00:00
parent 894f4d59f5
commit 2c8a5fb139
11 changed files with 183 additions and 175 deletions

View File

@ -8,7 +8,7 @@ struct Burn_Data
BurnSession *session; BurnSession *session;
Eina_List *sources; Eina_List *sources;
Eina_List *tracks; Eina_List *tracks;
Ecdb_Project *proj; Ecdb_Project *proj;
Ecdb_Page *page; Ecdb_Page *page;
}; };
@ -37,7 +37,7 @@ ecdb_burn_project(Ecdb_Burn_Project *proj, Ecdb_Page *page)
printf("Error: Cannot create burn data structure!\n"); printf("Error: Cannot create burn data structure!\n");
return FALSE; return FALSE;
} }
data->proj = ECDB_PROJECT(proj); data->proj = ECDB_PROJECT(proj);
data->page = page; data->page = page;
if (proj->burn_mode != BURN_AUDIO) if (proj->burn_mode != BURN_AUDIO)
@ -158,7 +158,7 @@ static void
ecdb_burn_progress_handler(void *data, void *buffer, unsigned int nbyte) ecdb_burn_progress_handler(void *data, void *buffer, unsigned int nbyte)
{ {
BurnProgress *p; BurnProgress *p;
Evas_Object *swallow; Evas_Object *swallow;
Burn_Data *bdata; Burn_Data *bdata;
static int last_sector = 0; static int last_sector = 0;
int percent; int percent;
@ -189,38 +189,38 @@ ecdb_burn_progress_handler(void *data, void *buffer, unsigned int nbyte)
else else
{ {
last_sector = p->sectors; last_sector = p->sectors;
} }
bdata = data; bdata = data;
if (!bdata) if (!bdata)
{ {
printf("ecdb_burn_progress_handler: NULL bdata!\n"); printf("ecdb_burn_progress_handler: NULL bdata!\n");
return; return;
} }
if ((!bdata->page) || (!bdata->proj)) if ((!bdata->page) || (!bdata->proj))
{ {
printf("ecdb_burn_progress_handler: NULL page or proj!\n"); printf("ecdb_burn_progress_handler: NULL page or proj!\n");
return; return;
} }
switch (proj->type) switch (bdata->proj->type)
{ {
case ECDB_AUDIO_PROJECT: case ECDB_AUDIO_PROJECT:
swallow = page->audio; swallow = bdata->page->audio;
break; break;
case: ECDB_DATA_PROJECT: case ECDB_DATA_PROJECT:
swallow = page->data; swallow = bdata->page->data;
break; break;
case: ECDB_IMAGE_PROJECT: case ECDB_IMAGE_PROJECT:
swallow = page->image; swallow = bdata->page->image;
break; break;
default: default:
printf("ecdb_burn_progress_handler: Unrecognized project type!\n"); printf("ecdb_burn_progress_handler: Unrecognized project type!\n");
return; return;
} }
percent = (int)((double)(last_sector + 1) / (double)p->sectors * 100.0); percent = (int)((double)(last_sector + 1) / (double)p->sectors * 100.0);
@ -262,15 +262,15 @@ ecdb_burn_finished(void *data, int type, void *event)
burn_drive_info_free(proj->proj->drive->tangible); burn_drive_info_free(proj->proj->drive->tangible);
printf("Burn Complete\n"); printf("Burn Complete\n");
ecore_event_handler_del(proj->proj->ev_handler); ecore_event_handler_del(proj->proj->ev_handler);
proj->proj->ev_handler = NULL; proj->proj->ev_handler = NULL;
ecore_pipe_del(proj->proj->pipe); ecore_pipe_del(proj->proj->pipe);
proj->proj->pipe = NULL; proj->proj->pipe = NULL;
switch (proj->proj->type) switch (proj->proj->type)
{ {
case ECDB_AUDIO_PROJECT: case ECDB_AUDIO_PROJECT:
print("How in the world did you get here?\n"); printf("How in the world did you get here?\n");
//ecdb_burn_audio_cleanup(proj->page); //ecdb_burn_audio_cleanup(proj->page);
break; break;
@ -279,10 +279,10 @@ ecdb_burn_finished(void *data, int type, void *event)
break; break;
case ECDB_IMAGE_PROJECT: case ECDB_IMAGE_PROJECT:
ecdb_burn_image_cleanup(proj->page); ecdb_burn_image_cleanup(proj->page);
break; break;
default: default:
printf("ecdb_burn_finished: unknown project type!\n"); printf("ecdb_burn_finished: unknown project type!\n");
} }
FREE(proj); FREE(proj);

View File

@ -688,30 +688,30 @@ void
ecdb_burn_data_cleanup(Ecdb_Page *page) ecdb_burn_data_cleanup(Ecdb_Page *page)
{ {
Ewl_Widget *filelist; Ewl_Widget *filelist;
Ecdb_Source *src; Ecdb_Source *src;
Ecdb_Burn_Data_Project *proj; Ecdb_Data_Project *proj;
int i; int i;
if (!page) if (!page)
{ {
printf("ecdb_burn_data_cleanup: NULL page!\n"); printf("ecdb_burn_data_cleanup: NULL page!\n");
return; return;
} }
proj = evas_object_data_get(page->data, "proj"); proj = evas_object_data_get(page->data, "proj");
if (!proj) if (!proj)
{ {
printf("ecdb_burn_data_cleanup: NULL proj!\n"); printf("ecdb_burn_data_cleanup: NULL proj!\n");
return; return;
} }
Evas_Object *objs[] = {proj->capacity, proj->settings, Evas_Object *objs[] = {proj->capacity, proj->settings,
proj->filelist_swallow, ECDB_BURN(proj)->speed_combo, proj->filelist_swallow, ECDB_BURN(proj)->speed_combo,
ECDB_PROJECT(proj)->ret, ECDB_PROJECT(proj)->begin, ECDB_PROJECT(proj)->ret, ECDB_PROJECT(proj)->begin,
NULL}; NULL};
for (i = 0; objs[i]; i++) for (i = 0; objs[i]; i++)
edje_object_signal_emit(objs[idx], "ecdb,disable", "ecdb"); edje_object_signal_emit(objs[i], "ecdb,disable", "ecdb");
edje_object_signal_emit(page->data, "ecdb,burn_data,start", "ecdb"); edje_object_signal_emit(page->data, "ecdb,burn_data,start", "ecdb");
edje_object_part_text_set(page->data, "progress_text", "Burn Complete!"); edje_object_part_text_set(page->data, "progress_text", "Burn Complete!");
edje_object_signal_emit(page->data, "ecdb,burn_data,done", "ecdb"); edje_object_signal_emit(page->data, "ecdb,burn_data,done", "ecdb");

View File

@ -3,6 +3,6 @@
#define ECDB_BURN_DATA_GUI_H #define ECDB_BURN_DATA_GUI_H
void ecdb_burn_data_page_show(Ecdb_Page *page); void ecdb_burn_data_page_show(Ecdb_Page *page);
void ecdb_burn_data_cleanup(Ecdb_Burn_Project *proj); void ecdb_burn_data_cleanup(Ecdb_Page *page);
#endif #endif

View File

@ -108,7 +108,7 @@ _button_cb_begin(void *data, Evas_Object *obj __UNUSED__,
return; return;
} }
burn_result = ecdb_burn_project(ECDB_BURN(proj)); burn_result = ecdb_burn_project(ECDB_BURN(proj), page);
switch (burn_result) switch (burn_result)
{ {
case ECDB_ERROR_NONE: case ECDB_ERROR_NONE:
@ -280,33 +280,33 @@ ecdb_burn_image_page_show(Ecdb_Page *page)
void void
ecdb_burn_image_cleanup(Ecdb_Page *page) ecdb_burn_image_cleanup(Ecdb_Page *page)
{ {
Ecdb_Burn_Image_Project *proj; Ecdb_Image_Project *proj;
int idx; int idx;
if (!page)
{
printf("ecdb_burn_image_cleanup: NULL page!\n");
return;
}
proj = evas_object_data_get(page->image, "proj");
if (!proj)
{
printf("ecdb_burn_image_cleanup: NULL proj!\n");
return;
}
Evas_Object *objs[] = {proj->entry, ECDB_PROJECT(proj)->ret, if (!page)
ECDB_PROJECT(proj)->begin, ECDB_PROJECT(proj)->drive_combo, {
printf("ecdb_burn_image_cleanup: NULL page!\n");
return;
}
proj = evas_object_data_get(page->image, "proj");
if (!proj)
{
printf("ecdb_burn_image_cleanup: NULL proj!\n");
return;
}
Evas_Object *objs[] = {proj->entry, ECDB_PROJECT(proj)->ret,
ECDB_PROJECT(proj)->begin, ECDB_PROJECT(proj)->drive_combo,
ECDB_BURN(proj)->speed_combo, NULL}; ECDB_BURN(proj)->speed_combo, NULL};
for (idx = 0; objs[idx]; idx++) for (idx = 0; objs[idx]; idx++)
edje_object_signal_emit(objs[i], "ecdb,enable", "ecdb"); edje_object_signal_emit(objs[idx], "ecdb,enable", "ecdb");
edje_object_part_text_set(page->image, "progress_text", "Burn Complete!"); edje_object_part_text_set(page->image, "progress_text", "Burn Complete!");
edje_object_signal_emit(page->image, "ecdb,burn_image,done", "ecdb"); edje_object_signal_emit(page->image, "ecdb,burn_image,done", "ecdb");
// Set project attributes back to normal // Set project attributes back to normal
ecdb_entry_text_set(proj->entry, NULL); ecdb_entry_text_set(proj->entry, NULL);
} }

View File

@ -84,7 +84,7 @@ struct _Ecdb_Project_Info
Ecdb_Drive_Info *drive; Ecdb_Drive_Info *drive;
Ecore_Event_Handler *ev_handler; Ecore_Event_Handler *ev_handler;
Ecore_Pipe *pipe; Ecore_Pipe *pipe;
unsigned int type; Ecdb_Project_Type type;
/* Every project has these */ /* Every project has these */
Evas_Object *ret; Evas_Object *ret;

View File

@ -1,12 +1,12 @@
/* vim: set sw=3 ts=3 sts=3 expandtab: */ /* vim: set sw=3 ts=3 sts=3 expandtab: */
#include "ecdb.h" #include "ecdb.h"
typedef struct Erase_Data Erase_Data; typedef struct Erase_Data Erase_Data;
struct Erase_Data struct Erase_Data
{ {
Ecdb_Project *proj; Ecdb_Project *proj;
Ecdb_Page *page; Ecdb_Page *page;
}; };
static void ecdb_erase_progress_handler(void *data, void *buffer, static void ecdb_erase_progress_handler(void *data, void *buffer,
unsigned int nbyte); unsigned int nbyte);
@ -17,16 +17,16 @@ int
ecdb_erase_disc(Ecdb_Erase_Project *proj, Ecdb_Page *page) ecdb_erase_disc(Ecdb_Erase_Project *proj, Ecdb_Page *page)
{ {
BurnDriveStatus disc_state; BurnDriveStatus disc_state;
pthread_t progress_update; pthread_t progress_update;
Erase_Disc *data; Erase_Data *data;
data = calloc(1, sizeof(Erase_Data)); data = calloc(1, sizeof(Erase_Data));
if (!data) if (!data)
{ {
printf("ecdb_erase_disc: NULL data!\n"); printf("ecdb_erase_disc: NULL data!\n");
return FALSE; return FALSE;
} }
data->proj = proj; data->proj = ECDB_PROJECT(proj);
data->page = page; data->page = page;
disc_state = burn_disc_get_status(ECDB_PROJECT(proj)->drive-> disc_state = burn_disc_get_status(ECDB_PROJECT(proj)->drive->
@ -71,7 +71,7 @@ static void
ecdb_erase_progress_handler(void *data, void *buffer, unsigned int nbyte) ecdb_erase_progress_handler(void *data, void *buffer, unsigned int nbyte)
{ {
BurnProgress *p; BurnProgress *p;
Evas_Object *swallow; Evas_Object *swallow;
Erase_Data *edata; Erase_Data *edata;
static int last_sector = 0; static int last_sector = 0;
Edje_Message_Int_Set *progress_msg; Edje_Message_Int_Set *progress_msg;
@ -101,30 +101,30 @@ ecdb_erase_progress_handler(void *data, void *buffer, unsigned int nbyte)
else else
{ {
last_sector = p->sectors; last_sector = p->sectors;
} }
edata = data; edata = data;
if (!edata) if (!edata)
{ {
printf("ecdb_erase_progress_handler: NULL edata!\n"); printf("ecdb_erase_progress_handler: NULL edata!\n");
return; return;
} }
if ((!edata->page) || (!edata->proj)) if ((!edata->page) || (!edata->proj))
{ {
printf("ecdb_erase_progress_handler: NULL page or proj!\n"); printf("ecdb_erase_progress_handler: NULL page or proj!\n");
return; return;
} }
switch (proj->type) switch (edata->proj->type)
{ {
case ECDB_ERASE_PROJECT: case ECDB_ERASE_PROJECT:
swallow = page->erase; swallow = edata->page->erase;
break; break;
default: default:
printf("ecdb_erase_progress_handler: Unrecognized project type!\n") printf("ecdb_erase_progress_handler: Unrecognized project type!\n");
return; return;
} }
progress_msg = alloca(sizeof(Edje_Message_Int_Set) + (2 * sizeof(int))); progress_msg = alloca(sizeof(Edje_Message_Int_Set) + (2 * sizeof(int)));
@ -138,18 +138,19 @@ ecdb_erase_progress_handler(void *data, void *buffer, unsigned int nbyte)
int int
ecdb_erase_finished(void *data, int type, void *event) ecdb_erase_finished(void *data, int type, void *event)
{ {
Erase_Data *ed; Erase_Data *ed;
Ecdb_Erase_Project *proj; Ecdb_Erase_Project *proj;
ed = data; ed = data;
proj = ed->proj; proj = ECDB_ERASE(ed->proj);
burn_drive_release(ECDB_PROJECT(proj)->drive->tangible[0].drive, 0); burn_drive_release(ECDB_PROJECT(proj)->drive->tangible[0].drive, 0);
burn_drive_info_free(ECDB_PROJECT(proj)->drive->tangible); burn_drive_info_free(ECDB_PROJECT(proj)->drive->tangible);
ecore_event_handler_del(ECDB_PROJECT(proj)->ev_handler); ecore_event_handler_del(ECDB_PROJECT(proj)->ev_handler);
ecore_pipe_del(ECDB_PROJECT(proj)->pipe); ecore_pipe_del(ECDB_PROJECT(proj)->pipe);
ecdb_erase_cleanup(ed->page); ecdb_erase_cleanup(ed->page);
FREE(ed);
return TRUE; return TRUE;
} }

View File

@ -3,6 +3,7 @@
#define ECDB_ERASE_H #define ECDB_ERASE_H
void ecdb_erase_project_start(Ecdb_Erase_Project *proj); void ecdb_erase_project_start(Ecdb_Erase_Project *proj);
int ecdb_erase_disc(Ecdb_Erase_Project *proj); int ecdb_erase_disc(Ecdb_Erase_Project *proj,
Ecdb_Page *page);
#endif #endif

View File

@ -79,9 +79,9 @@ _button_cb_begin(void *data, Evas_Object *o __UNUSED__,
return; return;
} }
proj->quick = ecdb_check_checked_get(proj->speed); proj->quick = ecdb_check_checked_get(proj->speed);
// TODO: Error Messages here // TODO: Error Messages here
if (!ecdb_erase_disc(proj)) if (!ecdb_erase_disc(proj, page))
{ {
printf("Disc not erasable!\n"); printf("Disc not erasable!\n");
snprintf(buf, sizeof(buf), "Disc not erasable!"); snprintf(buf, sizeof(buf), "Disc not erasable!");
@ -176,34 +176,34 @@ ecdb_erase_page_show(Ecdb_Page *page)
void void
ecdb_erase_cleanup(Ecdb_Page *page) ecdb_erase_cleanup(Ecdb_Page *page)
{ {
Ecdb_Erase_Project *proj; Ecdb_Erase_Project *proj;
int idx; int idx;
if (!page) if (!page)
{ {
printf("ecdb_erase_cleanup: NULL page!\n"); printf("ecdb_erase_cleanup: NULL page!\n");
return; return;
} }
proj = evas_object_data_get(proj->erase, "proj"); proj = evas_object_data_get(page->erase, "proj");
if (!proj) if (!proj)
{ {
printf("ecdb_erase_cleanup: NULL proj!\n"); printf("ecdb_erase_cleanup: NULL proj!\n");
return; return;
} }
Evas_Object *objs[] = {proj->speed, ECDB_PROJECT(proj)->ret, Evas_Object *objs[] = {proj->speed, ECDB_PROJECT(proj)->ret,
ECDB_PROJECT(proj)->begin, ECDB_PROJECT(proj)->begin,
ECDB_PROJECT(proj)->drive_combo, NULL}; ECDB_PROJECT(proj)->drive_combo, NULL};
for (idx = 0; objs[idx] != NULL; idx++) for (idx = 0; objs[idx] != NULL; idx++)
edje_object_signal_emit(objs[idx], "ecdb,disable", "ecdb"); edje_object_signal_emit(objs[idx], "ecdb,disable", "ecdb");
edje_object_part_text_set(page->erase, "progress_text", "Erase Complete!"); edje_object_part_text_set(page->erase, "progress_text", "Erase Complete!");
edje_object_signal_emit(page->erase, "ecdb,erase,done", "ecdb"); edje_object_signal_emit(page->erase, "ecdb,erase,done", "ecdb");
// Set attributes back to normal // Set attributes back to normal
ecdb_check_checked_set(proj->speed, 0); ecdb_check_checked_set(proj->speed, 0);
proj->speed = 0; proj->speed = 0;
} }

View File

@ -3,6 +3,6 @@
#define ECDB_ERASE_GUI_H #define ECDB_ERASE_GUI_H
void ecdb_erase_page_show(Ecdb_Page *page); void ecdb_erase_page_show(Ecdb_Page *page);
void ecdb_erase_cleanup(void); void ecdb_erase_cleanup(Ecdb_Page *page);
#endif #endif

View File

@ -50,13 +50,15 @@ ecdb_source_destroy(Ecdb_Source *src)
/* free the non-recursive stuff */ /* free the non-recursive stuff */
if (src->dst) eina_stringshare_del(src->dst); if (src->dst) eina_stringshare_del(src->dst);
if (src->node) iso_node_unref(src->node); if (src->node) iso_node_unref(src->node);
if (src->children)
for (i = 0; src->children[i]; i++)
{ {
child = src->children[i]; for (i = 0; src->children[i]; i++)
ecdb_source_destroy(child); {
child = src->children[i];
ecdb_source_destroy(child);
}
FREE(src->children);
} }
FREE(src->children);
FREE(src); FREE(src);
} }
@ -253,7 +255,7 @@ ecdb_image_project(Ecdb_Burn_Project *bp)
efreet_mime_shutdown(); efreet_mime_shutdown();
} }
if (ECDB_PROJECT(bp)->type != ECDB_DATA_PROJECT) if (ECDB_PROJECT(bp)->type == ECDB_DATA_PROJECT)
{ {
proj = ECDB_DATA(bp); proj = ECDB_DATA(bp);
} }

View File

@ -38,7 +38,7 @@ ecdb_project_destroy(Ecdb_Project *proj)
{ {
if (proj->ev_handler) ecore_event_handler_del(proj->ev_handler); if (proj->ev_handler) ecore_event_handler_del(proj->ev_handler);
if (proj->pipe) ecore_pipe_del(proj->pipe); if (proj->pipe) ecore_pipe_del(proj->pipe);
printf("Destroying base project\n"); printf("base\n");
} }
void void
@ -86,9 +86,9 @@ ecdb_burn_project_init(Ecdb_Burn_Project *proj)
void void
ecdb_burn_project_destroy(Ecdb_Burn_Project *proj) ecdb_burn_project_destroy(Ecdb_Burn_Project *proj)
{ {
printf("burn --> ");
if (proj->files) ecdb_source_destroy(proj->files); if (proj->files) ecdb_source_destroy(proj->files);
ecdb_project_destroy(ECDB_PROJECT(proj)); ecdb_project_destroy(ECDB_PROJECT(proj));
printf("Destroying burn project\n");
} }
Ecdb_Erase_Project * Ecdb_Erase_Project *
@ -130,6 +130,7 @@ ecdb_erase_project_init(Ecdb_Erase_Project *proj)
void void
ecdb_erase_project_destroy(Ecdb_Erase_Project *proj) ecdb_erase_project_destroy(Ecdb_Erase_Project *proj)
{ {
printf("Destroying: erase --> ");
ecdb_project_destroy(ECDB_PROJECT(proj)); ecdb_project_destroy(ECDB_PROJECT(proj));
FREE(proj); FREE(proj);
} }
@ -169,6 +170,7 @@ ecdb_audio_project_init(Ecdb_Audio_Project *proj)
void void
ecdb_audio_project_destroy(Ecdb_Audio_Project *proj) ecdb_audio_project_destroy(Ecdb_Audio_Project *proj)
{ {
printf("Destroying: audio --> ");
ecdb_burn_project_destroy(ECDB_BURN(proj)); ecdb_burn_project_destroy(ECDB_BURN(proj));
FREE(proj); FREE(proj);
} }
@ -211,6 +213,7 @@ ecdb_data_project_init(Ecdb_Data_Project *proj)
void void
ecdb_data_project_destroy(Ecdb_Data_Project *proj) ecdb_data_project_destroy(Ecdb_Data_Project *proj)
{ {
printf("Destroying: data --> ");
FREE(proj->volume_id); FREE(proj->volume_id);
FREE(proj->publisher_id); FREE(proj->publisher_id);
FREE(proj->data_preparer_id); FREE(proj->data_preparer_id);
@ -256,6 +259,7 @@ ecdb_image_project_init(Ecdb_Image_Project *proj)
void void
ecdb_image_project_destroy(Ecdb_Image_Project *proj) ecdb_image_project_destroy(Ecdb_Image_Project *proj)
{ {
printf("Destroying: image --> ");
ecdb_burn_project_destroy(ECDB_BURN(proj)); ecdb_burn_project_destroy(ECDB_BURN(proj));
FREE(proj); FREE(proj);
} }