Browse Source

Update unmount and TODO.

master
Jaime Thomas 11 years ago
parent
commit
938b9f6111
3 changed files with 133 additions and 48 deletions
  1. +2
    -0
      ecdb/trunk/TODO
  2. +120
    -45
      ecdb/trunk/src/ecdb_burn_data_gui.c
  3. +11
    -3
      ecdb/trunk/src/ecdb_erase_gui.c

+ 2
- 0
ecdb/trunk/TODO View File

@@ -6,6 +6,8 @@ Enflame

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


+ 120
- 45
ecdb/trunk/src/ecdb_burn_data_gui.c View File

@@ -51,6 +51,10 @@ static void _page_hide_finished(void *data, Evas_Object *o,
const char *emission,
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
_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_Page *page;
char *buf;
Ecdb_Burn_Result burn_result;
int drive, speed, idx;
int drive, speed;

page = data;
proj = evas_object_data_get(page->data, "proj");
@@ -188,52 +190,16 @@ _button_cb_begin(void *data, Evas_Object *obj __UNUSED__,
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");
edje_object_part_text_set(page->data, "progress_text",
"Couldn't grab the drive!");
return;
ecdb_hal_request_unmount(ECDB_PROJECT(proj)->drive,
_ecdb_burn_data_unmount_cb,
page);
}

edje_object_part_text_set(page->data, "progress_text", "Commencing...");

burn_result = ecdb_burn_project(ECDB_BURN(proj), page);
switch (burn_result)
else
{
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 :-(";
_ecdb_burn_data_do_burn(page, proj);
}

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
@@ -755,3 +721,112 @@ ecdb_burn_data_cleanup(Ecdb_Page *page)
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);
}


+ 11
- 3
ecdb/trunk/src/ecdb_erase_gui.c View File

@@ -61,7 +61,6 @@ _button_cb_begin(void *data, Evas_Object *o __UNUSED__,

page = data;
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);
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
* 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,
page);
}
else
{
_ecdb_erase_do_erase(page, proj);
}
}

void
@@ -230,6 +236,8 @@ _ecdb_erase_do_erase(Ecdb_Page *page, Ecdb_Erase_Project *proj)
return;
}

edje_object_part_text_set(page->erase, "progress_text", "Commencing...");

if (!ecdb_aquire_drive(ECDB_PROJECT(proj)))
{
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
{
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);
}
dbus_error_free(err);


Loading…
Cancel
Save