Update unmount and TODO.

This commit is contained in:
Jaime Thomas 2009-04-30 00:04:43 +00:00
parent d54838db08
commit d036801e85
3 changed files with 133 additions and 48 deletions

View File

@ -6,6 +6,8 @@ Enflame
TODO TODO
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
-> unbreak appending to discs
-> reset burn data gui better following a burn
-> More graceful handling of errors -> More graceful handling of errors
-> ffmpeg as an alternative backend to gstreamer -> ffmpeg as an alternative backend to gstreamer
-> finish interface -> finish interface

View File

@ -51,6 +51,10 @@ static void _page_hide_finished(void *data, Evas_Object *o,
const char *emission, const char *emission,
const char *source); const char *source);
// Burn callbacks and functions
static void _ecdb_burn_data_do_burn(Ecdb_Page *page, Ecdb_Data_Project *proj);
void _ecdb_burn_data_unmount_cb(void *data, void *reply_data, DBusError *err);
static void static void
_page_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *ev __UNUSED__) _page_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *ev __UNUSED__)
{ {
@ -139,9 +143,7 @@ _button_cb_begin(void *data, Evas_Object *obj __UNUSED__,
{ {
Ecdb_Data_Project *proj; Ecdb_Data_Project *proj;
Ecdb_Page *page; Ecdb_Page *page;
char *buf; int drive, speed;
Ecdb_Burn_Result burn_result;
int drive, speed, idx;
page = data; page = data;
proj = evas_object_data_get(page->data, "proj"); proj = evas_object_data_get(page->data, "proj");
@ -188,52 +190,16 @@ _button_cb_begin(void *data, Evas_Object *obj __UNUSED__,
return; return;
} }
if (!ecdb_aquire_drive(ECDB_PROJECT(proj))) if (!(ECDB_PROJECT(proj)->drive->status & ECDB_DISC_BLANK))
{ {
EINA_ERROR_PWARN("Couldn't grab drive!\n"); ecdb_hal_request_unmount(ECDB_PROJECT(proj)->drive,
edje_object_part_text_set(page->data, "progress_text", _ecdb_burn_data_unmount_cb,
"Couldn't grab the drive!"); page);
return;
} }
else
edje_object_part_text_set(page->data, "progress_text", "Commencing...");
burn_result = ecdb_burn_project(ECDB_BURN(proj), page);
switch (burn_result)
{ {
case ECDB_ERROR_NONE: _ecdb_burn_data_do_burn(page, proj);
edje_object_signal_emit(page->gui, "ecdb,filelist,hide", "ecdb");
edje_object_signal_emit(page->data, "ecdb,burn_data,start", "ecdb");
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 (idx = 0; objs[idx] != NULL; idx++)
{
edje_object_signal_emit(objs[idx], "ecdb,disable", "ecdb");
printf("disabling controls...\n");
}
return;
case ECDB_ERROR_IMAGE_CREATE:
buf = "Invalid file!";
break;
case ECDB_ERROR_SOURCE_ATTACH:
buf = "Couldn't attach source data!";
break;
case ECDB_ERROR_WRITE_MODE:
buf = "No suitable burn mode!";
break;
default:
buf = "Unknown error :-(";
} }
edje_object_part_text_set(page->data, "progress_text", buf);
burn_drive_release(ECDB_PROJECT(proj)->drive->tangible[0].drive, 0);
burn_drive_info_free(ECDB_PROJECT(proj)->drive->tangible);
} }
static void static void
@ -755,3 +721,112 @@ ecdb_burn_data_cleanup(Ecdb_Page *page)
src); src);
} }
void
_ecdb_burn_data_unmount_cb(void *data, void *reply_data __UNUSED__,
DBusError *err)
{
Ecdb_Data_Project *proj;
Ecdb_Page *page;
page = data;
if (!page)
{
EINA_ERROR_PWARN("NULL page!\n");
return;
}
proj = evas_object_data_get(page->data, "proj");
if (!proj)
{
EINA_ERROR_PWARN("NULL project!\n");
return;
}
if (dbus_error_is_set(err))
{
if (!strcmp(err->name, "org.freedesktop.Hal.Device.Volume.NotMounted"))
{
_ecdb_burn_data_do_burn(page, proj);
}
else
{
edje_object_part_text_set(page->data, "progress_text",
"Can not unmount drive!");
EINA_ERROR_PWARN("Unmount error:\n%s\n%s\n", err->name, err->message);
}
dbus_error_free(err);
}
else
{
_ecdb_burn_data_do_burn(page, proj);
}
}
static void
_ecdb_burn_data_do_burn(Ecdb_Page *page, Ecdb_Data_Project *proj)
{
char *buf;
int idx;
Ecdb_Burn_Result burn_result;
if (!proj)
{
EINA_ERROR_PWARN("NULL project!\n");
return;
}
if (!page)
{
EINA_ERROR_PWARN("NULL page!\n");
return;
}
if (!ecdb_aquire_drive(ECDB_PROJECT(proj)))
{
EINA_ERROR_PWARN("Couldn't grab drive!\n");
edje_object_part_text_set(page->data, "progress_text",
"Couldn't grab the drive!");
return;
}
edje_object_part_text_set(page->data, "progress_text", "Commencing...");
burn_result = ecdb_burn_project(ECDB_BURN(proj), page);
switch (burn_result)
{
case ECDB_ERROR_NONE:
edje_object_signal_emit(page->gui, "ecdb,filelist,hide", "ecdb");
edje_object_signal_emit(page->data, "ecdb,burn_data,start", "ecdb");
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 (idx = 0; objs[idx] != NULL; idx++)
{
edje_object_signal_emit(objs[idx], "ecdb,disable", "ecdb");
printf("disabling controls...\n");
}
return;
case ECDB_ERROR_IMAGE_CREATE:
buf = "Invalid file!";
break;
case ECDB_ERROR_SOURCE_ATTACH:
buf = "Couldn't attach source data!";
break;
case ECDB_ERROR_WRITE_MODE:
buf = "No suitable burn mode!";
break;
default:
buf = "Unknown error :-(";
}
edje_object_part_text_set(page->data, "progress_text", buf);
burn_drive_release(ECDB_PROJECT(proj)->drive->tangible[0].drive, 0);
burn_drive_info_free(ECDB_PROJECT(proj)->drive->tangible);
}

View File

@ -61,7 +61,6 @@ _button_cb_begin(void *data, Evas_Object *o __UNUSED__,
page = data; page = data;
proj = evas_object_data_get(page->erase, "proj"); proj = evas_object_data_get(page->erase, "proj");
edje_object_part_text_set(page->erase, "progress_text", "Commencing...");
idx = ecdb_combo_selected_get(ECDB_PROJECT(proj)->drive_combo); idx = ecdb_combo_selected_get(ECDB_PROJECT(proj)->drive_combo);
if (idx < 0) if (idx < 0)
@ -99,9 +98,16 @@ _button_cb_begin(void *data, Evas_Object *o __UNUSED__,
/* Apparently DBus doesn't tell you when a disc has been mounted /* Apparently DBus doesn't tell you when a disc has been mounted
* or unmounted, so do this every time regardless... * or unmounted, so do this every time regardless...
*/ */
ecdb_hal_request_unmount(ECDB_PROJECT(proj)->drive, if (!(ECDB_PROJECT(proj)->drive->status & ECDB_DISC_BLANK))
{
ecdb_hal_request_unmount(ECDB_PROJECT(proj)->drive,
_ecdb_erase_unmount_cb, _ecdb_erase_unmount_cb,
page); page);
}
else
{
_ecdb_erase_do_erase(page, proj);
}
} }
void void
@ -230,6 +236,8 @@ _ecdb_erase_do_erase(Ecdb_Page *page, Ecdb_Erase_Project *proj)
return; return;
} }
edje_object_part_text_set(page->erase, "progress_text", "Commencing...");
if (!ecdb_aquire_drive(ECDB_PROJECT(proj))) if (!ecdb_aquire_drive(ECDB_PROJECT(proj)))
{ {
EINA_ERROR_PWARN("Couldn't grab the drive!\n"); EINA_ERROR_PWARN("Couldn't grab the drive!\n");
@ -287,7 +295,7 @@ _ecdb_erase_unmount_cb(void *data, void *reply_data __UNUSED__, DBusError *err)
else else
{ {
edje_object_part_text_set(page->erase, "progress_text", edje_object_part_text_set(page->erase, "progress_text",
"Cannot unmount drive!"); "Can not unmount drive!");
EINA_ERROR_PWARN("Unmount error:\n%s\n%s\n", err->name, err->message); EINA_ERROR_PWARN("Unmount error:\n%s\n%s\n", err->name, err->message);
} }
dbus_error_free(err); dbus_error_free(err);