Data burning works somewhat nicely now... Also some misc memory leaks and small fixes.

This commit is contained in:
Jaime Thomas 2009-02-27 01:05:10 +00:00
parent a3ecf782c5
commit d03a494200
3 changed files with 112 additions and 28 deletions

View File

@ -1,7 +1,29 @@
/* vim: set sw=3 ts=3 sts=3 expandtab: */
group {
name: "ecdb/burn_data_page";
min: 640 170;
script {
public message(Msg_Type:type, id, ...) {
if ((type == MSG_INT_SET) && (id == 0)) {
new percent[10], sectors[100];
snprintf(percent, 10, "%d%%", getarg(2));
set_text(PART:"progress_percent", percent);
snprintf(sectors, 100, "%d/%d", getarg(3), getarg(4));
set_text(PART:"progress_text", sectors);
/* See the erase_disc.edc for other info sent */
}
else if ((type == MSG_STRING) && (id == 1))
{
new text[100];
snprintf(text, 100, "%s", getarg(2));
set_text(PART:"progress_text", text);
set_text(PART:"progress_percent", "100%");
}
}
}
parts {
part {
name: "bg";
@ -202,6 +224,7 @@ group {
description {
state: "default" 0.0;
color: 255 255 255 255;
align: 0.5 0.5;
rel1 {
to: "bg";
@ -217,10 +240,34 @@ group {
}
}
description {
state: "before_show" 0.0;
align: 0.0 0.0;
rel1 {
relative: 0.0 0.0;
offset: -33 0;
}
rel2 {
relative: 0.0 0.0;
offset: -1 0;
}
}
description {
state: "hidden" 0.0;
inherit: "default" 0.0;
color: 255 255 255 0;
align: 1.0 1.0;
rel1 {
relative: 1.0 1.0;
offset: -1 -1;
}
rel2 {
relative: 1.0 1.0;
offset: 33 33;
}
}
}
@ -254,10 +301,11 @@ group {
name: "progress_outline";
type: IMAGE;
mouse_events: 0;
clip_to: "progress_outline_clip";
description {
state: "default" 0.0;
color: 255 255 255 0;
color: 255 255 255 255;
rel1 {
to: "bg";
@ -266,9 +314,9 @@ group {
}
rel2 {
to_y: "bg";
to_x: "ecdb/burn_data/return";
relative: 0.0 1.0;
to_y: "ecdb/burn_data/capacity";
relative: 0.0 0.0;
offset: -5 -10;
}
@ -277,6 +325,20 @@ group {
border: 9 9 9 9;
}
}
}
part {
name: "progress_outline_clip";
type: RECT;
mouse_events: 0;
description {
state: "default" 0.0;
color: 255 255 255 0;
rel1.to: "progress_outline";
rel2.to: "progress_outline";
}
description {
state: "visible" 0.0;
@ -289,7 +351,7 @@ group {
name: "progress_text";
type: TEXT;
effect: SOFT_SHADOW;
clip_to: "progress_outline";
clip_to: "progress_outline_clip";
description {
state: "default" 0.0;
@ -329,7 +391,7 @@ group {
name: "progress_percent";
type: TEXT;
effect: SOFT_SHADOW;
clip_to: "progress_outline";
clip_to: "progress_outline_clip";
description {
state: "default" 0.0;
@ -439,9 +501,16 @@ group {
signal: "ecdb,burn_data,start";
source: "ecdb";
action: STATE_SET "hidden" 0.0;
target: "ecdb/burn_data/filelist";
target: "ecdb/burn_data/capacity";
target: "ecdb/burn_data/filelist";
transition: DECELERATE 0.5;
after: "burn_data_page,useless,reset";
}
program {
name: "burn_data_page,useless,reset";
action: STATE_SET "before_show" 0.0;
target: "ecdb/burn_data/filelist";
}
program {
@ -449,22 +518,22 @@ group {
signal: "ecdb,burn_data,start";
source: "ecdb";
action: STATE_SET "visible" 0.0;
target: "progress_outline";
target: "progress_outline_clip";
transition: DECELERATE 0.5;
}
program {
name: "burn_data_page,useful,hide";
signal: "ecdb,burn_data,reset";
signal: "ecdb,burn_data,hide";
source: "ecdb";
action: STATE_SET "default" 0.0;
target: "progress_outline";
target: "progress_outline_clip";
transition: DECELERATE 0.5;
}
program {
name: "burn_data_page,useless,show";
signal: "ecdb,burn_data,reset";
signal: "ecdb,burn_data,hide";
source: "ecdb";
action: STATE_SET "default" 0.0;
target: "ecdb/burn_data/filelist";

View File

@ -23,6 +23,7 @@ group {
description {
state: "default" 0.0;
color: 0 0 0 0;
align: 0.5 0.5;
rel1 {
relative: 0.0 0.0;
@ -38,6 +39,7 @@ group {
description {
state: "before_show" 0.0;
color: 0 0 0 0;
align: 0.0 0.0;
rel1 {
relative: 0.0 0.0;
@ -53,6 +55,7 @@ group {
description {
state: "hide" 0.0;
color: 0 0 0 0;
align: 1.0 1.0;
rel1 {
relative: 1.0 1.0;

View File

@ -66,11 +66,13 @@ _page_hide_finished(void *data, Evas_Object *o,
const char *emission __UNUSED__,
const char *source __UNUSED__)
{
Evas_Object *gui;
Ecdb_Page *page = data;
Ecdb_Data_Project *proj;
gui = data;
edje_object_part_unswallow(gui, o);
evas_object_hide(o);
proj = evas_object_data_get(page->data, "proj");
edje_object_part_unswallow(page->gui, page->data);
evas_object_hide(page->data);
ewl_widget_hide(proj->filelist);
}
static void
@ -180,8 +182,11 @@ _button_cb_begin(void *data, Evas_Object *obj __UNUSED__,
proj->filelist_swallow, ECDB_BURN(proj)->speed_combo,
ECDB_PROJECT(proj)->ret, ECDB_PROJECT(proj)->begin,
NULL};
for (idx = 0; objs[idx]; idx++)
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:
@ -503,7 +508,6 @@ ecdb_burn_data_page_show(Ecdb_Page *page)
Ecdb_Drive_Info *drive;
Evas_Coord x, y, w, h;
Ewl_Widget *embed;
Ecdb_Source *src;
Ecdb_Data_Project *proj;
Ecdb_Burn_Project *bup;
Ecdb_Project *bp;
@ -516,7 +520,7 @@ ecdb_burn_data_page_show(Ecdb_Page *page)
edje_object_part_swallow(page->gui, "action_area", page->data);
edje_object_signal_callback_add(page->data, "hide,finished",
"burn_data_page",
_page_hide_finished, page->gui);
_page_hide_finished, page);
evas_object_show(page->data);
proj = ecdb_data_project_new();
@ -573,13 +577,11 @@ ecdb_burn_data_page_show(Ecdb_Page *page)
_update_capacity, page);
ewl_widget_show(proj->filelist);
src = ecdb_source_new();
ewl_widget_data_set(proj->filelist, "source", src);
/* Add a delete callback so we can correctly free data that won't get
* handled automatically
*/
evas_object_event_callback_add(page->data, EVAS_CALLBACK_DEL, _page_del,
src);
bup->files);
edje_object_part_geometry_get(page->data, "ecdb/burn_data/filelist",
&x, &y, &w, &h);
@ -592,7 +594,7 @@ ecdb_burn_data_page_show(Ecdb_Page *page)
evas_object_show(proj->filelist_swallow);
proj->capacity = ecdb_capacity_add(page->data, "ecdb/burn_data/capacity");
evas_object_data_set(proj->capacity, "src", src);
evas_object_data_set(proj->capacity, "src", bup->files);
evas_object_show(proj->capacity);
t = ecdb_config_inwin_add(page->data, NULL);
@ -680,6 +682,8 @@ ecdb_burn_data_page_show(Ecdb_Page *page)
{
edje_object_part_swallow(page->gui, "action_area", page->data);
evas_object_show(page->data);
ewl_widget_show(ECDB_DATA(evas_object_data_get(page->data, "proj"))
->filelist);
}
edje_object_signal_emit(page->gui, "ecdb,burn_data_page,visible", "ecdb");
@ -690,7 +694,7 @@ void
ecdb_burn_data_cleanup(Ecdb_Page *page)
{
Ewl_Widget *filelist;
Ecdb_Source *src;
Ecdb_Source *src, *t;
Ecdb_Data_Project *proj;
int i;
@ -711,8 +715,8 @@ ecdb_burn_data_cleanup(Ecdb_Page *page)
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");
for (i = 0; objs[i] != NULL; i++)
edje_object_signal_emit(objs[i], "ecdb,enable", "ecdb");
edje_object_signal_emit(page->data, "ecdb,burn_data,start", "ecdb");
edje_object_part_text_set(page->data, "progress_text", "Burn Complete!");
@ -725,8 +729,16 @@ ecdb_burn_data_cleanup(Ecdb_Page *page)
for (i = 0; i < src->num_children; i++)
{
ecdb_source_child_remove(src, src->children[i]);
ecdb_source_destroy(src->children[i]);
t = src->children[i];
ecdb_source_child_remove(src, t);
ecdb_source_destroy(t);
}
/* Make sure, of course, to refresh the capacity and the filelist
* after finishing the burn
*/
ewl_mvc_dirty_set(EWL_MVC(EWL_FILELIST(proj->filelist)->controller), TRUE);
ewl_callback_call_with_event_data(proj->filelist, ECDB_FILELIST_SIZE_CHANGED,
src);
}