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;
Eina_List *sources;
Eina_List *tracks;
Ecdb_Project *proj;
Ecdb_Project *proj;
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");
return FALSE;
}
data->proj = ECDB_PROJECT(proj);
data->proj = ECDB_PROJECT(proj);
data->page = page;
if (proj->burn_mode != BURN_AUDIO)
@ -158,7 +158,7 @@ static void
ecdb_burn_progress_handler(void *data, void *buffer, unsigned int nbyte)
{
BurnProgress *p;
Evas_Object *swallow;
Evas_Object *swallow;
Burn_Data *bdata;
static int last_sector = 0;
int percent;
@ -189,38 +189,38 @@ ecdb_burn_progress_handler(void *data, void *buffer, unsigned int nbyte)
else
{
last_sector = p->sectors;
}
bdata = data;
if (!bdata)
{
printf("ecdb_burn_progress_handler: NULL bdata!\n");
return;
}
if ((!bdata->page) || (!bdata->proj))
{
printf("ecdb_burn_progress_handler: NULL page or proj!\n");
return;
}
switch (proj->type)
{
case ECDB_AUDIO_PROJECT:
swallow = page->audio;
break;
case: ECDB_DATA_PROJECT:
swallow = page->data;
break;
case: ECDB_IMAGE_PROJECT:
swallow = page->image;
break;
default:
printf("ecdb_burn_progress_handler: Unrecognized project type!\n");
return;
}
bdata = data;
if (!bdata)
{
printf("ecdb_burn_progress_handler: NULL bdata!\n");
return;
}
if ((!bdata->page) || (!bdata->proj))
{
printf("ecdb_burn_progress_handler: NULL page or proj!\n");
return;
}
switch (bdata->proj->type)
{
case ECDB_AUDIO_PROJECT:
swallow = bdata->page->audio;
break;
case ECDB_DATA_PROJECT:
swallow = bdata->page->data;
break;
case ECDB_IMAGE_PROJECT:
swallow = bdata->page->image;
break;
default:
printf("ecdb_burn_progress_handler: Unrecognized project type!\n");
return;
}
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);
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;
ecore_pipe_del(proj->proj->pipe);
ecore_pipe_del(proj->proj->pipe);
proj->proj->pipe = NULL;
switch (proj->proj->type)
{
case ECDB_AUDIO_PROJECT:
print("How in the world did you get here?\n");
case ECDB_AUDIO_PROJECT:
printf("How in the world did you get here?\n");
//ecdb_burn_audio_cleanup(proj->page);
break;
@ -279,10 +279,10 @@ ecdb_burn_finished(void *data, int type, void *event)
break;
case ECDB_IMAGE_PROJECT:
ecdb_burn_image_cleanup(proj->page);
break;
default:
ecdb_burn_image_cleanup(proj->page);
break;
default:
printf("ecdb_burn_finished: unknown project type!\n");
}
FREE(proj);

View File

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

View File

@ -3,6 +3,6 @@
#define ECDB_BURN_DATA_GUI_H
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

View File

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

View File

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

View File

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

View File

@ -3,6 +3,7 @@
#define ECDB_ERASE_H
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

View File

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

View File

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

View File

@ -50,13 +50,15 @@ ecdb_source_destroy(Ecdb_Source *src)
/* free the non-recursive stuff */
if (src->dst) eina_stringshare_del(src->dst);
if (src->node) iso_node_unref(src->node);
for (i = 0; src->children[i]; i++)
if (src->children)
{
child = src->children[i];
ecdb_source_destroy(child);
for (i = 0; src->children[i]; i++)
{
child = src->children[i];
ecdb_source_destroy(child);
}
FREE(src->children);
}
FREE(src->children);
FREE(src);
}
@ -253,7 +255,7 @@ ecdb_image_project(Ecdb_Burn_Project *bp)
efreet_mime_shutdown();
}
if (ECDB_PROJECT(bp)->type != ECDB_DATA_PROJECT)
if (ECDB_PROJECT(bp)->type == ECDB_DATA_PROJECT)
{
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->pipe) ecore_pipe_del(proj->pipe);
printf("Destroying base project\n");
printf("base\n");
}
void
@ -86,9 +86,9 @@ ecdb_burn_project_init(Ecdb_Burn_Project *proj)
void
ecdb_burn_project_destroy(Ecdb_Burn_Project *proj)
{
printf("burn --> ");
if (proj->files) ecdb_source_destroy(proj->files);
ecdb_project_destroy(ECDB_PROJECT(proj));
printf("Destroying burn project\n");
}
Ecdb_Erase_Project *
@ -130,6 +130,7 @@ ecdb_erase_project_init(Ecdb_Erase_Project *proj)
void
ecdb_erase_project_destroy(Ecdb_Erase_Project *proj)
{
printf("Destroying: erase --> ");
ecdb_project_destroy(ECDB_PROJECT(proj));
FREE(proj);
}
@ -169,6 +170,7 @@ ecdb_audio_project_init(Ecdb_Audio_Project *proj)
void
ecdb_audio_project_destroy(Ecdb_Audio_Project *proj)
{
printf("Destroying: audio --> ");
ecdb_burn_project_destroy(ECDB_BURN(proj));
FREE(proj);
}
@ -211,6 +213,7 @@ ecdb_data_project_init(Ecdb_Data_Project *proj)
void
ecdb_data_project_destroy(Ecdb_Data_Project *proj)
{
printf("Destroying: data --> ");
FREE(proj->volume_id);
FREE(proj->publisher_id);
FREE(proj->data_preparer_id);
@ -256,6 +259,7 @@ ecdb_image_project_init(Ecdb_Image_Project *proj)
void
ecdb_image_project_destroy(Ecdb_Image_Project *proj)
{
printf("Destroying: image --> ");
ecdb_burn_project_destroy(ECDB_BURN(proj));
FREE(proj);
}