Some random fixes here and there. There is no more name_find or name_set use.

This commit is contained in:
Jaime Thomas 2009-02-17 19:16:38 +00:00
parent 8f4dc5a95e
commit 937e001022
9 changed files with 219 additions and 125 deletions

View File

@ -18,9 +18,9 @@ TODO
-> integrate exchange -> integrate exchange
-> instead of always swallowing widgets, allow theme to specify on a widget-by-widget basis if it wants to emit signals from internal parts (so, for example, the settings could be triggered by a small + in the corner, and expand from there) -> instead of always swallowing widgets, allow theme to specify on a widget-by-widget basis if it wants to emit signals from internal parts (so, for example, the settings could be triggered by a small + in the corner, and expand from there)
->able to allow entire gui to be handled by theme... so we only interact with signals (no widgets at all) ->able to allow entire gui to be handled by theme... so we only interact with signals (no widgets at all)
->get rid of evas_object_name_find/name_set
-> make theme and code use a custom signal, rather than mouse,clicked,1 -> make theme and code use a custom signal, rather than mouse,clicked,1
DONE DONE
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
-> better way to detect pipe deletion (done? - needs more testing) -> better way to detect pipe deletion (done? - needs more testing)
->get rid of evas_object_name_find/name_set

View File

@ -11,10 +11,6 @@ group {
set_text(PART:"progress_percent", percent); set_text(PART:"progress_percent", percent);
snprintf(sectors, 100, "%d/%d", getarg(3), getarg(4)); snprintf(sectors, 100, "%d/%d", getarg(3), getarg(4));
set_text(PART:"progress_text", sectors); set_text(PART:"progress_text", sectors);
/* Also sent is the buffer available [getarg(5)] and
* the buffer capacity [getarg(6)]
*/
} }
} }
} }
@ -42,7 +38,7 @@ group {
description { description {
state: "before_show" 0.0; state: "before_show" 0.0;
color: 0 0 0 0; color: 0 0 0 0;
rel1 { rel1 {
relative: 0.0 0.0; relative: 0.0 0.0;
offset: -33 0; offset: -33 0;
@ -75,7 +71,7 @@ group {
type: SWALLOW; type: SWALLOW;
repeat_events: 1; repeat_events: 1;
scale: 1; scale: 1;
description { description {
state: "default" 0.0; state: "default" 0.0;
min: 100 26; min: 100 26;

View File

@ -8,7 +8,8 @@ struct Burn_Data
BurnSession *session; BurnSession *session;
Eina_List *sources; Eina_List *sources;
Eina_List *tracks; Eina_List *tracks;
Ecdb_Project *proj; Ecdb_Project *proj;
Ecdb_Page *page;
}; };
int ecdb_burn_finished(void *data, int type, void *event); int ecdb_burn_finished(void *data, int type, void *event);
@ -19,7 +20,7 @@ void ecdb_sources_list_free(Eina_List *list);
void ecdb_tracks_list_free(Eina_List *list); void ecdb_tracks_list_free(Eina_List *list);
int int
ecdb_burn_project(Ecdb_Burn_Project *proj) ecdb_burn_project(Ecdb_Burn_Project *proj, Ecdb_Page *page)
{ {
char reasons[BURN_REASONS_LEN]; char reasons[BURN_REASONS_LEN];
int padding, i; int padding, i;
@ -36,7 +37,8 @@ ecdb_burn_project(Ecdb_Burn_Project *proj)
printf("Error: Cannot create burn data structure!\n"); printf("Error: Cannot create burn data structure!\n");
return FALSE; return FALSE;
} }
data->proj = ECDB_PROJECT(proj); data->proj = ECDB_PROJECT(proj);
data->page = page;
if (proj->burn_mode != BURN_AUDIO) if (proj->burn_mode != BURN_AUDIO)
padding = 300*1024; padding = 300*1024;
@ -105,7 +107,7 @@ ecdb_burn_project(Ecdb_Burn_Project *proj)
burn_write_opts_free(opts); burn_write_opts_free(opts);
printf("Disc now burning\n"); printf("Disc now burning\n");
ECDB_PROJECT(proj)->pipe = ecore_pipe_add(ecdb_burn_progress_handler, proj); ECDB_PROJECT(proj)->pipe = ecore_pipe_add(ecdb_burn_progress_handler, data);
pthread_create(&progress_update, NULL, ecdb_drive_progress_update, proj); pthread_create(&progress_update, NULL, ecdb_drive_progress_update, proj);
pthread_detach(progress_update); pthread_detach(progress_update);
ECDB_PROJECT(proj)->ev_handler = ecore_event_handler_add ECDB_PROJECT(proj)->ev_handler = ecore_event_handler_add
@ -156,7 +158,8 @@ static void
ecdb_burn_progress_handler(void *data, void *buffer, unsigned int nbyte) ecdb_burn_progress_handler(void *data, void *buffer, unsigned int nbyte)
{ {
BurnProgress *p; BurnProgress *p;
Evas_Object *swallow; Evas_Object *swallow;
Burn_Data *bdata;
static int last_sector = 0; static int last_sector = 0;
int percent; int percent;
Edje_Message_Int_Set *progress_msg; Edje_Message_Int_Set *progress_msg;
@ -186,11 +189,40 @@ ecdb_burn_progress_handler(void *data, void *buffer, unsigned int nbyte)
else else
{ {
last_sector = p->sectors; 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;
} }
swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee),
"burn_image_page");
percent = (int)((double)(last_sector + 1) / (double)p->sectors * 100.0); percent = (int)((double)(last_sector + 1) / (double)p->sectors * 100.0);
if (percent >= 100) if (percent >= 100)
{ {
@ -230,23 +262,28 @@ ecdb_burn_finished(void *data, int type, void *event)
burn_drive_info_free(proj->proj->drive->tangible); burn_drive_info_free(proj->proj->drive->tangible);
printf("Burn Complete\n"); printf("Burn Complete\n");
ecore_event_handler_del(proj->proj->ev_handler); ecore_event_handler_del(proj->proj->ev_handler);
ecore_pipe_del(proj->proj->pipe); proj->proj->ev_handler = NULL;
ecore_pipe_del(proj->proj->pipe);
proj->proj->pipe = NULL;
switch (proj->proj->type) switch (proj->proj->type)
{ {
case ECDB_AUDIO_PROJECT: case ECDB_AUDIO_PROJECT:
ecdb_audio_project_destroy(ECDB_AUDIO(proj->proj)); print("How in the world did you get here?\n");
//ecdb_burn_audio_cleanup(proj->page);
break; break;
case ECDB_BURN_PROJECT: case ECDB_BURN_PROJECT:
ecdb_burn_data_cleanup(ECDB_BURN(proj->proj)); ecdb_burn_data_cleanup(proj->page);
ecdb_burn_project_destroy(ECDB_BURN(proj->proj));
break; break;
case ECDB_IMAGE_PROJECT: case ECDB_IMAGE_PROJECT:
ecdb_burn_image_cleanup(); ecdb_burn_image_cleanup(proj->page);
ecdb_burn_project_destroy(ECDB_BURN(proj->proj)); break;
default:
printf("ecdb_burn_finished: unknown project type!\n");
} }
FREE(proj); FREE(proj);

View File

@ -2,7 +2,8 @@
#ifndef ECDB_BURN_H #ifndef ECDB_BURN_H
#define ECDB_BURN_H #define ECDB_BURN_H
int ecdb_burn_project(Ecdb_Burn_Project *proj); int ecdb_burn_project(Ecdb_Burn_Project *proj,
Ecdb_Page *page);
void *ecdb_drive_progress_update(void *data); void *ecdb_drive_progress_update(void *data);
#endif #endif

View File

@ -169,7 +169,7 @@ _button_cb_begin(void *data, Evas_Object *obj __UNUSED__,
return; return;
} }
burn_result = ecdb_burn_project(ECDB_BURN(proj)); burn_result = ecdb_burn_project(ECDB_BURN(proj), page);
switch (burn_result) switch (burn_result)
{ {
case ECDB_ERROR_NONE: case ECDB_ERROR_NONE:
@ -179,7 +179,7 @@ _button_cb_begin(void *data, Evas_Object *obj __UNUSED__,
proj->filelist_swallow, ECDB_BURN(proj)->speed_combo, proj->filelist_swallow, ECDB_BURN(proj)->speed_combo,
ECDB_PROJECT(proj)->ret, ECDB_PROJECT(proj)->begin, ECDB_PROJECT(proj)->ret, ECDB_PROJECT(proj)->begin,
NULL}; NULL};
for (idx = 0; objs[idx] != NULL; idx++) for (idx = 0; objs[idx]; idx++)
edje_object_signal_emit(objs[idx], "ecdb,disable", "ecdb"); edje_object_signal_emit(objs[idx], "ecdb,disable", "ecdb");
return; return;
@ -197,8 +197,8 @@ _button_cb_begin(void *data, Evas_Object *obj __UNUSED__,
default: default:
snprintf(buf, sizeof(buf), "Unknown error :-("); snprintf(buf, sizeof(buf), "Unknown error :-(");
} }
edje_object_part_text_set(page->data, "progress_text", buf); edje_object_part_text_set(page->data, "progress_text", buf);
burn_drive_release(ECDB_PROJECT(proj)->drive->tangible[0].drive, 1); burn_drive_release(ECDB_PROJECT(proj)->drive->tangible[0].drive, 1);
burn_drive_info_free(ECDB_PROJECT(proj)->drive->tangible); burn_drive_info_free(ECDB_PROJECT(proj)->drive->tangible);
@ -271,14 +271,14 @@ _joliet_clicked(void *data, Evas_Object *obj, const char *emission __UNUSED__,
proj = data; proj = data;
proj->use_joliet = !proj->use_joliet; proj->use_joliet = !proj->use_joliet;
state = ecdb_check_checked_get(obj); state = ecdb_check_checked_get(obj);
if (state != proj->use_joliet) if (state != proj->use_joliet)
ecdb_check_checked_set(obj, proj->use_joliet); ecdb_check_checked_set(obj, proj->use_joliet);
} }
static void static void
_joliet_config(void *data, Evas_Object *obj, void *event_info __UNUSED__) _joliet_config(void *data, Evas_Object *obj, void *event_info __UNUSED__)
{ {
Ecdb_Data_Project *proj; Ecdb_Data_Project *proj;
@ -296,7 +296,7 @@ _rockridge_clicked(void *data, Evas_Object *obj,
proj = data; proj = data;
proj->use_rockridge = !proj->use_rockridge; proj->use_rockridge = !proj->use_rockridge;
state = ecdb_check_checked_get(obj); state = ecdb_check_checked_get(obj);
if (state != proj->use_rockridge) if (state != proj->use_rockridge)
ecdb_check_checked_set(obj, proj->use_rockridge); ecdb_check_checked_set(obj, proj->use_rockridge);
@ -320,7 +320,7 @@ _symlinks_clicked(void *data, Evas_Object *obj, const char *emission __UNUSED__,
proj = data; proj = data;
proj->follow_symlinks = !proj->follow_symlinks; proj->follow_symlinks = !proj->follow_symlinks;
state = ecdb_check_checked_get(obj); state = ecdb_check_checked_get(obj);
if (state != proj->follow_symlinks) if (state != proj->follow_symlinks)
ecdb_check_checked_set(obj, proj->follow_symlinks); ecdb_check_checked_set(obj, proj->follow_symlinks);
@ -344,7 +344,7 @@ _hidden_clicked(void *data, Evas_Object *obj, const char *emission __UNUSED__,
proj = data; proj = data;
proj->ignore_hidden = !proj->ignore_hidden; proj->ignore_hidden = !proj->ignore_hidden;
state = ecdb_check_checked_get(obj); state = ecdb_check_checked_get(obj);
if (state != proj->ignore_hidden) if (state != proj->ignore_hidden)
ecdb_check_checked_set(obj, proj->ignore_hidden); ecdb_check_checked_set(obj, proj->ignore_hidden);
@ -368,7 +368,7 @@ _multi_clicked(void *data, Evas_Object *obj, const char *emission __UNUSED__,
proj = data; proj = data;
proj->multi = !proj->multi; proj->multi = !proj->multi;
state = ecdb_check_checked_get(obj); state = ecdb_check_checked_get(obj);
if (state != proj->multi) if (state != proj->multi)
ecdb_check_checked_set(obj, proj->multi); ecdb_check_checked_set(obj, proj->multi);
@ -392,7 +392,7 @@ _sim_clicked(void *data, Evas_Object *obj, const char *emission __UNUSED__,
proj = data; proj = data;
proj->simulate = !proj->simulate; proj->simulate = !proj->simulate;
state = ecdb_check_checked_get(obj); state = ecdb_check_checked_get(obj);
if (state != proj->simulate) if (state != proj->simulate)
ecdb_check_checked_set(obj, proj->simulate); ecdb_check_checked_set(obj, proj->simulate);
@ -416,7 +416,7 @@ _underrun_clicked(void *data, Evas_Object *obj, const char *emission __UNUSED__,
proj = data; proj = data;
proj->underrun_proof = !proj->underrun_proof; proj->underrun_proof = !proj->underrun_proof;
state = ecdb_check_checked_get(obj); state = ecdb_check_checked_get(obj);
if (state != proj->underrun_proof) if (state != proj->underrun_proof)
ecdb_check_checked_set(obj, proj->underrun_proof); ecdb_check_checked_set(obj, proj->underrun_proof);
@ -476,7 +476,7 @@ _settings_clicked(void *data, Evas_Object *obj __UNUSED__,
table = edje_object_part_object_get(data, "ecdb.table"); table = edje_object_part_object_get(data, "ecdb.table");
it = evas_object_table_iterator_new(table); it = evas_object_table_iterator_new(table);
if (!it) if (!it)
{ {
printf("_settings_clicked: NULL iterator!\n"); printf("_settings_clicked: NULL iterator!\n");
@ -515,7 +515,7 @@ ecdb_burn_data_page_show(Ecdb_Page *page)
"burn_data_page", "burn_data_page",
_page_hide_finished, page->gui); _page_hide_finished, page->gui);
evas_object_show(page->data); evas_object_show(page->data);
proj = ecdb_data_project_new(); proj = ecdb_data_project_new();
bp = ECDB_PROJECT(proj); bp = ECDB_PROJECT(proj);
bup = ECDB_BURN(proj); bup = ECDB_BURN(proj);
@ -580,7 +580,7 @@ ecdb_burn_data_page_show(Ecdb_Page *page)
&x, &y, &w, &h); &x, &y, &w, &h);
evas_object_move(proj->filelist_swallow, x, y); evas_object_move(proj->filelist_swallow, x, y);
evas_object_resize(proj->filelist_swallow, w, h); evas_object_resize(proj->filelist_swallow, w, h);
edje_object_part_swallow(page->data, "ecdb/burn_data/filelist", edje_object_part_swallow(page->data, "ecdb/burn_data/filelist",
proj->filelist_swallow); proj->filelist_swallow);
ecdb_widget_focus_callback_add(proj->filelist_swallow, ecdb_widget_focus_callback_add(proj->filelist_swallow,
"ecdb/burn_data/filelist"); "ecdb/burn_data/filelist");
@ -594,14 +594,13 @@ ecdb_burn_data_page_show(Ecdb_Page *page)
t = ecdb_config_inwin_add(bp->ret, NULL); t = ecdb_config_inwin_add(bp->ret, NULL);
ecdb_config_inwin_follow_set(t, page->data); ecdb_config_inwin_follow_set(t, page->data);
b = ecdb_check_add(t, NULL); b = ecdb_check_add(t, NULL);
ecdb_check_label_set(b, "Use Joliet"); ecdb_check_label_set(b, "Use Joliet");
edje_object_signal_callback_add(b, "ecdb,check,*checked", "ecdb", edje_object_signal_callback_add(b, "ecdb,check,*checked", "ecdb",
_joliet_clicked, proj); _joliet_clicked, proj);
evas_object_smart_callback_add(b, "proj_config", _joliet_config, proj); evas_object_smart_callback_add(b, "proj_config", _joliet_config, proj);
ecdb_config_inwin_child_add(t, b, 0, 0, 1, 1); ecdb_config_inwin_child_add(t, b, 0, 0, 1, 1);
evas_object_name_set(b, "ecdb/burn_data/joliet");
evas_object_show(b); evas_object_show(b);
b = ecdb_check_add(t, NULL); b = ecdb_check_add(t, NULL);
@ -610,7 +609,6 @@ ecdb_burn_data_page_show(Ecdb_Page *page)
_rockridge_clicked, proj); _rockridge_clicked, proj);
evas_object_smart_callback_add(b, "proj_config", _rockridge_config, proj); evas_object_smart_callback_add(b, "proj_config", _rockridge_config, proj);
ecdb_config_inwin_child_add(t, b, 0, 1, 1, 1); ecdb_config_inwin_child_add(t, b, 0, 1, 1, 1);
evas_object_name_set(b, "ecdb/burn_data/rockridge");
evas_object_show(b); evas_object_show(b);
b = ecdb_check_add(t, NULL); b = ecdb_check_add(t, NULL);
@ -619,7 +617,6 @@ ecdb_burn_data_page_show(Ecdb_Page *page)
_symlinks_clicked, proj); _symlinks_clicked, proj);
evas_object_smart_callback_add(b, "proj_config", _symlinks_config, proj); evas_object_smart_callback_add(b, "proj_config", _symlinks_config, proj);
ecdb_config_inwin_child_add(t, b, 0, 2, 1, 1); ecdb_config_inwin_child_add(t, b, 0, 2, 1, 1);
evas_object_name_set(b, "ecdb/burn_data/symlinks");
evas_object_show(b); evas_object_show(b);
b = ecdb_check_add(t, NULL); b = ecdb_check_add(t, NULL);
@ -628,7 +625,6 @@ ecdb_burn_data_page_show(Ecdb_Page *page)
_hidden_clicked, proj); _hidden_clicked, proj);
evas_object_smart_callback_add(b, "proj_config", _hidden_config, proj); evas_object_smart_callback_add(b, "proj_config", _hidden_config, proj);
ecdb_config_inwin_child_add(t, b, 0, 3, 1, 1); ecdb_config_inwin_child_add(t, b, 0, 3, 1, 1);
evas_object_name_set(b, "ecdb/burn_data/hidden");
evas_object_show(b); evas_object_show(b);
b = ecdb_check_add(t, NULL); b = ecdb_check_add(t, NULL);
@ -637,7 +633,6 @@ ecdb_burn_data_page_show(Ecdb_Page *page)
_multi_clicked, proj); _multi_clicked, proj);
evas_object_smart_callback_add(b, "proj_config", _multi_config, proj); evas_object_smart_callback_add(b, "proj_config", _multi_config, proj);
ecdb_config_inwin_child_add(t, b, 1, 0, 1, 1); ecdb_config_inwin_child_add(t, b, 1, 0, 1, 1);
evas_object_name_set(b, "ecdb/burn_data/multi");
evas_object_show(b); evas_object_show(b);
b = ecdb_check_add(t, NULL); b = ecdb_check_add(t, NULL);
@ -646,7 +641,6 @@ ecdb_burn_data_page_show(Ecdb_Page *page)
_sim_clicked, proj); _sim_clicked, proj);
evas_object_smart_callback_add(b, "proj_config", _sim_config, proj); evas_object_smart_callback_add(b, "proj_config", _sim_config, proj);
ecdb_config_inwin_child_add(t, b, 1, 1, 1, 1); ecdb_config_inwin_child_add(t, b, 1, 1, 1, 1);
evas_object_name_set(b, "ecdb/burn_data/sim");
evas_object_show(b); evas_object_show(b);
b = ecdb_check_add(t, NULL); b = ecdb_check_add(t, NULL);
@ -655,7 +649,6 @@ ecdb_burn_data_page_show(Ecdb_Page *page)
_underrun_clicked, proj); _underrun_clicked, proj);
evas_object_smart_callback_add(b, "proj_config", _underrun_config, proj); evas_object_smart_callback_add(b, "proj_config", _underrun_config, proj);
ecdb_config_inwin_child_add(t, b, 1, 2, 1, 1); ecdb_config_inwin_child_add(t, b, 1, 2, 1, 1);
evas_object_name_set(b, "ecdb/burn_data/underrun");
evas_object_show(b); evas_object_show(b);
b = ecdb_entry_add(t, NULL); b = ecdb_entry_add(t, NULL);
@ -664,7 +657,6 @@ ecdb_burn_data_page_show(Ecdb_Page *page)
_proj_name, proj); _proj_name, proj);
evas_object_smart_callback_add(b, "proj_config", _proj_config, proj); evas_object_smart_callback_add(b, "proj_config", _proj_config, proj);
ecdb_config_inwin_child_add(t, b, 1, 3, 1, 1); ecdb_config_inwin_child_add(t, b, 1, 3, 1, 1);
evas_object_name_set(b, "ecdb/burn_data/name");
evas_object_show(b); evas_object_show(b);
b = ecdb_button_add(t, NULL); b = ecdb_button_add(t, NULL);
@ -672,9 +664,8 @@ ecdb_burn_data_page_show(Ecdb_Page *page)
edje_object_signal_callback_add(b, "mouse,down,1", "*", _apply_clicked, edje_object_signal_callback_add(b, "mouse,down,1", "*", _apply_clicked,
t); t);
ecdb_config_inwin_child_add(t, b, 0, 4, 2, 1); ecdb_config_inwin_child_add(t, b, 0, 4, 2, 1);
evas_object_name_set(b, "ecdb/burn_data/apply");
evas_object_show(b); evas_object_show(b);
// At the end so t is a valid pointer // At the end so t is a valid pointer
b = ecdb_button_add(page->data, "ecdb/burn_data/settings"); b = ecdb_button_add(page->data, "ecdb/burn_data/settings");
ecdb_button_label_set(b, "Settings"); ecdb_button_label_set(b, "Settings");
@ -694,27 +685,38 @@ ecdb_burn_data_page_show(Ecdb_Page *page)
} }
void void
ecdb_burn_data_cleanup(Ecdb_Burn_Project *proj) ecdb_burn_data_cleanup(Ecdb_Page *page)
{ {
/*
Ewl_Widget *filelist; Ewl_Widget *filelist;
Ecdb_Source *src; Ecdb_Source *src;
int i; Ecdb_Burn_Data_Project *proj;
const char *ids[] = {"ecdb/burn_data/return", "ecdb/burn_data/begin", int i;
"ecdb/burn_data/file", "ecdb/burn_data/drive"
"ecdb/burn_data/speed"}; 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");
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");
if (!proj) filelist = proj->filelist;
{
printf("ecdb_burn_data_cleanup: NULL project!\n");
return;
}
edje_object_part_text_set(proj->parent, "progress_text", "Burn Complete!");
ecdb_gui_controls_enable(ids, 5);
edje_object_signal_emit(proj->parent, "ecdb,burn_data,done", "ecdb");
filelist = ewl_widget_name_find("ecdb/burn_data/filelist");
src = ewl_widget_data_get(filelist, "source"); src = ewl_widget_data_get(filelist, "source");
while (src->parent) while (src->parent)
src = src->parent; src = src->parent;
@ -724,8 +726,5 @@ ecdb_burn_data_cleanup(Ecdb_Burn_Project *proj)
ecdb_source_child_remove(src, src->children[i]); ecdb_source_child_remove(src, src->children[i]);
ecdb_source_destroy(src->children[i]); ecdb_source_destroy(src->children[i]);
} }
evas_object_data_set(proj->parent, "proj", NULL);
*/
} }

View File

@ -1,7 +1,7 @@
/* vim: set sw=3 ts=3 sts=3 expandtab: */ /* vim: set sw=3 ts=3 sts=3 expandtab: */
#include "ecdb.h" #include "ecdb.h"
static void _button_cb_return(void *data, Evas_Object *obj, static void _button_cb_return(void *data, Evas_Object *obj,
const char *emission, const char *emission,
const char *source); const char *source);
static void _button_cb_begin(void *data, Evas_Object *obj, static void _button_cb_begin(void *data, Evas_Object *obj,
@ -117,7 +117,7 @@ _button_cb_begin(void *data, Evas_Object *obj __UNUSED__,
Evas_Object *objs[] = {proj->entry, ECDB_PROJECT(proj)->ret, Evas_Object *objs[] = {proj->entry, ECDB_PROJECT(proj)->ret,
ECDB_PROJECT(proj)->begin, ECDB_PROJECT(proj)->drive_combo, ECDB_PROJECT(proj)->begin, ECDB_PROJECT(proj)->drive_combo,
ECDB_BURN(proj)->speed_combo, NULL}; ECDB_BURN(proj)->speed_combo, NULL};
for (idx = 0; objs[idx] != NULL; idx++) for (idx = 0; objs[idx]; idx++)
edje_object_signal_emit(objs[idx], "ecdb,disable", "ecdb"); edje_object_signal_emit(objs[idx], "ecdb,disable", "ecdb");
return; return;
@ -135,8 +135,8 @@ _button_cb_begin(void *data, Evas_Object *obj __UNUSED__,
default: default:
snprintf(buf, sizeof(buf), "Unknown error :-("); snprintf(buf, sizeof(buf), "Unknown error :-(");
} }
edje_object_part_text_set(page->image, "progress_text", buf); edje_object_part_text_set(page->image, "progress_text", buf);
burn_drive_release(ECDB_PROJECT(proj)->drive->tangible[0].drive, 1); burn_drive_release(ECDB_PROJECT(proj)->drive->tangible[0].drive, 1);
burn_drive_info_free(ECDB_PROJECT(proj)->drive->tangible); burn_drive_info_free(ECDB_PROJECT(proj)->drive->tangible);
@ -279,18 +279,34 @@ ecdb_burn_image_page_show(Ecdb_Page *page)
} }
void void
ecdb_burn_image_cleanup(void) ecdb_burn_image_cleanup(Ecdb_Page *page)
{ {
/* Ecdb_Burn_Image_Project *proj;
Evas_Object *swallow; int idx;
const char *ids[] = {"ecdb/burn_image/return", "ecdb/burn_image/begin",
"ecdb/burn_image/file", "ecdb/burn_image/drive" if (!page)
"ecdb/burn_image/speed"}; {
swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee), printf("ecdb_burn_image_cleanup: NULL page!\n");
"burn_image_page"); return;
edje_object_part_text_set(swallow, "progress_text", "Burn Complete!"); }
ecdb_gui_controls_enable(ids, 5);
edje_object_signal_emit(swallow, "ecdb,burn_image,done", "ecdb"); 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");
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
ecdb_entry_text_set(proj->entry, NULL);
} }

View File

@ -3,6 +3,6 @@
#define ECDB_BURN_IMAGE_GUI_H #define ECDB_BURN_IMAGE_GUI_H
void ecdb_burn_image_page_show(Ecdb_Page *page); void ecdb_burn_image_page_show(Ecdb_Page *page);
void ecdb_burn_image_cleanup(void); void ecdb_burn_image_cleanup(Ecdb_Page *page);
#endif #endif

View File

@ -1,16 +1,33 @@
/* vim: set sw=3 ts=3 sts=3 expandtab: */ /* vim: set sw=3 ts=3 sts=3 expandtab: */
#include "ecdb.h" #include "ecdb.h"
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, static void ecdb_erase_progress_handler(void *data, void *buffer,
unsigned int nbyte); unsigned int nbyte);
int ecdb_erase_finished(void *data, int type, void *event); int ecdb_erase_finished(void *data, int type, void *event);
// FIXME Make this return an error code // FIXME Make this return an error code
int int
ecdb_erase_disc(Ecdb_Erase_Project *proj) ecdb_erase_disc(Ecdb_Erase_Project *proj, Ecdb_Page *page)
{ {
BurnDriveStatus disc_state; BurnDriveStatus disc_state;
pthread_t progress_update; 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;
data->page = page;
disc_state = burn_disc_get_status(ECDB_PROJECT(proj)->drive-> disc_state = burn_disc_get_status(ECDB_PROJECT(proj)->drive->
tangible[0].drive); tangible[0].drive);
@ -34,13 +51,13 @@ ecdb_erase_disc(Ecdb_Erase_Project *proj)
{ {
printf("Beginning to erase disc!\n"); printf("Beginning to erase disc!\n");
ECDB_PROJECT(proj)->pipe = ecore_pipe_add(ecdb_erase_progress_handler, ECDB_PROJECT(proj)->pipe = ecore_pipe_add(ecdb_erase_progress_handler,
proj); data);
burn_disc_erase(ECDB_PROJECT(proj)->drive->tangible[0].drive, burn_disc_erase(ECDB_PROJECT(proj)->drive->tangible[0].drive,
proj->quick); proj->quick);
pthread_create(&progress_update, NULL, ecdb_drive_progress_update, proj); pthread_create(&progress_update, NULL, ecdb_drive_progress_update, proj);
pthread_detach(progress_update); pthread_detach(progress_update);
ECDB_PROJECT(proj)->ev_handler = ecore_event_handler_add ECDB_PROJECT(proj)->ev_handler = ecore_event_handler_add
(ECDB_DRIVE_ACTION_FINISHED, ecdb_erase_finished, proj); (ECDB_DRIVE_ACTION_FINISHED, ecdb_erase_finished, data);
return TRUE; return TRUE;
} }
else else
@ -54,7 +71,8 @@ static void
ecdb_erase_progress_handler(void *data, void *buffer, unsigned int nbyte) ecdb_erase_progress_handler(void *data, void *buffer, unsigned int nbyte)
{ {
BurnProgress *p; BurnProgress *p;
Evas_Object *swallow; Evas_Object *swallow;
Erase_Data *edata;
static int last_sector = 0; static int last_sector = 0;
Edje_Message_Int_Set *progress_msg; Edje_Message_Int_Set *progress_msg;
@ -83,35 +101,55 @@ ecdb_erase_progress_handler(void *data, void *buffer, unsigned int nbyte)
else else
{ {
last_sector = p->sectors; 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;
} }
swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee), progress_msg = alloca(sizeof(Edje_Message_Int_Set) + (2 * sizeof(int)));
"erase_page"); progress_msg->count = 3;
progress_msg = alloca(sizeof(Edje_Message_Int_Set) + (4 * sizeof(int)));
progress_msg->count = 5;
progress_msg->val[0] = (int)((double)(last_sector + 1) / progress_msg->val[0] = (int)((double)(last_sector + 1) /
(double)p->sectors * 100.0); (double)p->sectors * 100.0);
progress_msg->val[1] = last_sector; progress_msg->val[1] = last_sector;
progress_msg->val[2] = p->sectors; progress_msg->val[2] = p->sectors;
progress_msg->val[3] = (int)p->buffer_available;
progress_msg->val[4] = (int)p->buffer_capacity;
edje_object_message_send(swallow, EDJE_MESSAGE_INT_SET, 0, progress_msg); edje_object_message_send(swallow, EDJE_MESSAGE_INT_SET, 0, progress_msg);
} }
int int
ecdb_erase_finished(void *data, int type, void *event) ecdb_erase_finished(void *data, int type, void *event)
{ {
Erase_Data *ed;
Ecdb_Erase_Project *proj; Ecdb_Erase_Project *proj;
proj = data; ed = data;
proj = ed->proj;
burn_drive_release(ECDB_PROJECT(proj)->drive->tangible[0].drive, 0); burn_drive_release(ECDB_PROJECT(proj)->drive->tangible[0].drive, 0);
burn_drive_info_free(ECDB_PROJECT(proj)->drive->tangible); burn_drive_info_free(ECDB_PROJECT(proj)->drive->tangible);
ecore_event_handler_del(ECDB_PROJECT(proj)->ev_handler); ecore_event_handler_del(ECDB_PROJECT(proj)->ev_handler);
ecore_pipe_del(ECDB_PROJECT(proj)->pipe); ecore_pipe_del(ECDB_PROJECT(proj)->pipe);
ecdb_erase_project_destroy(proj); ecdb_erase_cleanup(ed->page);
ecdb_erase_cleanup();
return TRUE; return TRUE;
} }

View File

@ -56,7 +56,7 @@ _button_cb_begin(void *data, Evas_Object *o __UNUSED__,
Ecdb_Page *page; Ecdb_Page *page;
char buf[1024]; char buf[1024];
int idx; int idx;
page = data; page = data;
proj = evas_object_data_get(page->erase, "proj"); proj = evas_object_data_get(page->erase, "proj");
snprintf(buf, sizeof(buf), "Commencing..."); snprintf(buf, sizeof(buf), "Commencing...");
@ -79,7 +79,8 @@ _button_cb_begin(void *data, Evas_Object *o __UNUSED__,
return; 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))
{ {
printf("Disc not erasable!\n"); printf("Disc not erasable!\n");
@ -174,22 +175,28 @@ ecdb_erase_page_show(Ecdb_Page *page)
} }
void void
ecdb_erase_cleanup(void) ecdb_erase_cleanup(Ecdb_Page *page)
{ {
/* XXX Ecdb_Erase_Project *proj;
Evas_Object *swallow;
const char *ids[] = {"ecdb/erase/return", "ecdb/erase/begin", if (!page)
"ecdb/erase/speed", "ecdb/erase/drive"}; {
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;
}
swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee), edje_object_part_text_set(page->erase, "progress_text", "Erase Complete!");
"erase_page"); edje_object_signal_emit(page->erase, "ecdb,erase,done", "ecdb");
edje_object_part_text_set(swallow, "progress_text", "Erase Complete!");
ecdb_gui_controls_enable(ids, 4); // Set attributes back to normal
edje_object_signal_emit(swallow, "ecdb,erase,done", "ecdb"); ecdb_check_checked_set(proj->speed, 0);
proj->speed = 0;
swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee),
"ecdb/erase/drive");
ecdb_check_checked_set(swallow, 0);
*/
} }