From 65accd34fa4d973398700388fa7121cd5a8241f6 Mon Sep 17 00:00:00 2001 From: Jaime Thomas Date: Sun, 19 Apr 2009 19:20:04 +0000 Subject: [PATCH] Erasing now utilizes info already aquired from ecdb_hal. --- ecdb/trunk/TODO | 2 +- ecdb/trunk/src/ecdb_erase.c | 22 ++++------------------ ecdb/trunk/src/ecdb_erase_gui.c | 22 +++++++++++++++++++++- ecdb/trunk/src/ecdb_hal.c | 1 + 4 files changed, 27 insertions(+), 20 deletions(-) diff --git a/ecdb/trunk/TODO b/ecdb/trunk/TODO index 1bcd162..91fca10 100644 --- a/ecdb/trunk/TODO +++ b/ecdb/trunk/TODO @@ -11,7 +11,6 @@ TODO -> finish interface -> more flexible typebuf -> more configuration options (speed and drive choice done) --> fix combo theme -> figure out what to do about dnd, should it be consolidated into one system, how to handle internel, etc. -> don't load the sources all at one time (lots of memory consumed -- for my entire development tree containing 154256 files, ecdb uses 46mb) -> integrate exchange @@ -24,3 +23,4 @@ DONE -> get rid of evas_object_name_find/name_set -> Detect if the media in a drive has changed and update the drive info using dbus. -> make theme and code use a custom signal, rather than mouse,clicked,1 +-> fix combo theme (good enough, and hopefully someone will make a nicer default theme anyways) diff --git a/ecdb/trunk/src/ecdb_erase.c b/ecdb/trunk/src/ecdb_erase.c index ec31b02..051bcad 100644 --- a/ecdb/trunk/src/ecdb_erase.c +++ b/ecdb/trunk/src/ecdb_erase.c @@ -31,23 +31,9 @@ ecdb_erase_disc(Ecdb_Erase_Project *proj, Ecdb_Page *page) disc_state = burn_disc_get_status(ECDB_PROJECT(proj)->drive-> tangible[0].drive); - if (disc_state == BURN_DISC_BLANK) - { - EINA_ERROR_PINFO("Disc is already blank!\n"); - return FALSE; - } - else if (disc_state == BURN_DISC_EMPTY) - { - EINA_ERROR_PINFO("No disc!\n"); - return FALSE; - } - else if (!burn_disc_erasable(ECDB_PROJECT(proj)->drive-> - tangible[0].drive)) - { - EINA_ERROR_PINFO("Not able to erase!\n"); - return FALSE; - } - else if (disc_state == BURN_DISC_FULL || BURN_DISC_APPENDABLE) + if (((disc_state == BURN_DISC_FULL) + || (disc_state == BURN_DISC_APPENDABLE)) + && (burn_disc_erasable(ECDB_PROJECT(proj)->drive->tangible[0].drive))) { EINA_ERROR_PINFO("Beginning to erase disc!\n"); ECDB_PROJECT(proj)->pipe = ecore_pipe_add(ecdb_erase_progress_handler, @@ -62,7 +48,7 @@ ecdb_erase_disc(Ecdb_Erase_Project *proj, Ecdb_Page *page) } else { - EINA_ERROR_PINFO("Not of erasable type\n"); + EINA_ERROR_PINFO("Disc not suitable for erasing\n"); return FALSE; } } diff --git a/ecdb/trunk/src/ecdb_erase_gui.c b/ecdb/trunk/src/ecdb_erase_gui.c index 909b1fc..f24305f 100644 --- a/ecdb/trunk/src/ecdb_erase_gui.c +++ b/ecdb/trunk/src/ecdb_erase_gui.c @@ -67,7 +67,7 @@ _button_cb_begin(void *data, Evas_Object *o __UNUSED__, { EINA_ERROR_PDBG("Choose a drive!\n"); edje_object_part_text_set(page->erase, "progress_text", - "Choose a Drive!"); + "Choose a Drive!"); return; } @@ -79,6 +79,26 @@ _button_cb_begin(void *data, Evas_Object *o __UNUSED__, return; } + if (!ECDB_PROJECT(proj)->drive->fresh_info) + { + EINA_ERROR_PDBG("Insert a disc into the drive!\n"); + edje_object_part_text_set(page->erase, "progress_text", + "Insert a disc into the drive!"); + burn_drive_release(ECDB_PROJECT(proj)->drive->tangible[0].drive, 0); + burn_drive_info_free(ECDB_PROJECT(proj)->drive->tangible); + return; + } + + if (ECDB_PROJECT(proj)->drive->status & ECDB_DISC_BLANK) + { + EINA_ERROR_PDBG("Disc is already blank!\n"); + edje_object_part_text_set(page->erase, "progress_text", + "Disc is already blank!"); + burn_drive_release(ECDB_PROJECT(proj)->drive->tangible[0].drive, 0); + burn_drive_info_free(ECDB_PROJECT(proj)->drive->tangible); + return; + } + proj->quick = ecdb_check_checked_get(proj->speed); // TODO: Error Messages here if (!ecdb_erase_disc(proj, page)) diff --git a/ecdb/trunk/src/ecdb_hal.c b/ecdb/trunk/src/ecdb_hal.c index 297b43e..373f028 100644 --- a/ecdb/trunk/src/ecdb_hal.c +++ b/ecdb/trunk/src/ecdb_hal.c @@ -310,6 +310,7 @@ _ecdb_hal_volume_handle(void *data, void *reply_data, DBusError *error) { if (!strcmp(udi, drive->udi)) { + drive->fresh_info = TRUE; drive->disc_udi = disc_udi; drive->capacity = e_hal_property_uint64_get(ret, "volume.disc.capacity", NULL);