Get rid of Burn_Data_Data.

This commit is contained in:
Jaime Thomas 2009-01-11 22:13:44 +00:00
parent ce8eef1b7d
commit 860a1c025e
6 changed files with 163 additions and 148 deletions

View File

@ -297,8 +297,8 @@ ecdb_burn_finished(void *data, int type, void *event)
break; break;
case ECDB_BURN_PROJECT: case ECDB_BURN_PROJECT:
ecdb_burn_data_cleanup(ECDB_BURN(proj->proj));
ecdb_burn_project_destroy(ECDB_BURN(proj->proj)); ecdb_burn_project_destroy(ECDB_BURN(proj->proj));
ecdb_burn_data_cleanup();
break; break;
case ECDB_IMAGE_PROJECT: case ECDB_IMAGE_PROJECT:

View File

@ -1,16 +1,6 @@
/* 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 _Burn_Data_Data Burn_Data_Data;
struct _Burn_Data_Data
{
Ecdb_Burn_Project *proj;
Evas_Object *capacity;
Evas_Object *swallow;
Evas_Object *sc;
Evas_Object *dc;
};
static void _button_cb_return(void *data, Evas_Object *obj, void *event_info); static void _button_cb_return(void *data, Evas_Object *obj, void *event_info);
static void _button_cb_begin(void *data, Evas_Object *obj, void *event_info); static void _button_cb_begin(void *data, Evas_Object *obj, void *event_info);
static void _combo_cb_clicked(void *data, Evas_Object *obj, void *event_info); static void _combo_cb_clicked(void *data, Evas_Object *obj, void *event_info);
@ -42,33 +32,34 @@ static int
_update_capacity(void *data, int type, void *ev_data) _update_capacity(void *data, int type, void *ev_data)
{ {
Ecdb_Source *src; Ecdb_Source *src;
Edje_Message_Float msg; Ecdb_Burn_Project *proj;
Burn_Data_Data *bdd; Ecdb_Project *base_proj;
Ecdb_Project *proj; float val;
bdd = data; proj = data;
if ((!bdd) || (!bdd->proj)) if (!proj)
return ECORE_CALLBACK_RENEW; return ECORE_CALLBACK_RENEW;
proj = ECDB_PROJECT(bdd->proj); base_proj = ECDB_PROJECT(proj);
src = evas_object_data_get(bdd->capacity, "source"); src = evas_object_data_get(proj->capacity, "source");
if ((proj->drive) && (proj->drive->capacity > 0)) if ((base_proj->drive) && (base_proj->drive->capacity > 0))
{ {
printf("drive capacity: %lld, src->size: %lld\n", proj->drive->capacity, src->size); printf("drive capacity: %lld, src->size: %lld\n",
msg.val = (float)src->size / (float)proj->drive->capacity; base_proj->drive->capacity, src->size);
val = (float)src->size / (float)base_proj->drive->capacity;
} }
else else
{ {
// Default to a nice, small size // Default to a nice, small size
msg.val = (float)src->size / 1048576.0 / 700.0; val = (float)src->size / 1048576.0 / 700.0;
} }
if (msg.val > 1.0) if (val > 1.0)
{ {
printf("OVER SIZE LIMIT!\n"); printf("OVER SIZE LIMIT!\n");
edje_object_signal_emit(bdd->capacity, "ecdb,capacity,exceeded", "ecdb"); edje_object_signal_emit(proj->capacity, "ecdb,capacity,exceeded", "ecdb");
edje_object_signal_emit(bdd->swallow, "ecdb,capacity, exceeded", "ecdb"); edje_object_signal_emit(proj->parent, "ecdb,capacity, exceeded", "ecdb");
} }
edje_object_message_send(bdd->capacity, EDJE_MESSAGE_FLOAT, 1, &msg); ecdb_capacity_float_set(proj->capacity, val);
return ECORE_CALLBACK_RENEW; return ECORE_CALLBACK_RENEW;
} }
@ -77,17 +68,17 @@ static void
_button_cb_return(void *data, Evas_Object *obj, void *event_info) _button_cb_return(void *data, Evas_Object *obj, void *event_info)
{ {
Evas_Object *gui; Evas_Object *gui;
Burn_Data_Data *bdd; Ecdb_Burn_Project *proj;
char *signal; char *signal;
bdd = data; proj = data;
if (!bdd) if (!proj)
return; return;
gui = evas_object_name_find(ecore_evas_get(em->main_win_ee), "gui"); gui = evas_object_name_find(ecore_evas_get(em->main_win_ee), "gui");
signal = evas_object_data_get(bdd->swallow, "hide_signal"); signal = evas_object_data_get(proj->parent, "hide_signal");
edje_object_signal_emit(bdd->swallow, signal, "ecdb"); edje_object_signal_emit(proj->parent, signal, "ecdb");
ecdb_welcome_page_show(); ecdb_welcome_page_show();
/* Hide the filelist to be nice */ /* Hide the filelist to be nice */
@ -98,56 +89,54 @@ static void
_button_cb_begin(void *data, Evas_Object *obj, void *event_info) _button_cb_begin(void *data, Evas_Object *obj, void *event_info)
{ {
Evas_Object *gui; Evas_Object *gui;
Ecdb_Project *base_proj; Ecdb_Burn_Project *proj;
Burn_Data_Data *bdd;
Ewl_Widget *filelist; Ewl_Widget *filelist;
char buf[1024]; char buf[1024];
Ecdb_Burn_Result burn_result; Ecdb_Burn_Result burn_result;
int drive, speed; int drive, speed;
bdd = data; proj = data;
if ((!bdd) || (!bdd->proj)) if (!proj)
return; return;
gui = evas_object_name_find(ecore_evas_get(em->main_win_ee), "gui"); gui = evas_object_name_find(ecore_evas_get(em->main_win_ee), "gui");
filelist = ewl_widget_name_find("ecdb/burn_data/filelist"); filelist = ewl_widget_name_find("ecdb/burn_data/filelist");
base_proj = ECDB_PROJECT(bdd->proj); if (!ECDB_PROJECT(proj)->drive)
if (!base_proj->drive)
{ {
printf("Choose a drive!\n"); printf("Choose a drive!\n");
edje_object_part_text_set(bdd->swallow, "progress_text", edje_object_part_text_set(proj->parent, "progress_text",
"Choose a Drive!"); "Choose a Drive!");
return; return;
} }
drive = ecdb_combo_selected_get(bdd->dc); drive = ecdb_combo_selected_get(proj->drive_combo);
speed = ecdb_speed_convert(eina_list_nth(em->drives, drive), speed = ecdb_speed_convert(eina_list_nth(em->drives, drive),
ecdb_combo_selected_get(bdd->sc)); ecdb_combo_selected_get(proj->speed_combo));
if (speed < 0) if (speed < 0)
bdd->proj->speed = 0; proj->speed = 0;
else else
bdd->proj->speed = speed; proj->speed = speed;
bdd->proj->files = ewl_widget_data_get(filelist, "source"); proj->files = ewl_widget_data_get(filelist, "source");
while (bdd->proj->files->parent) while (proj->files->parent)
bdd->proj->files = bdd->proj->files->parent; proj->files = proj->files->parent;
snprintf(buf, sizeof(buf), "Commencing..."); snprintf(buf, sizeof(buf), "Commencing...");
edje_object_part_text_set(bdd->swallow, "progress_text", buf); edje_object_part_text_set(proj->parent, "progress_text", buf);
if (!ecdb_aquire_drive(ECDB_PROJECT(bdd->proj), drive)) if (!ecdb_aquire_drive(ECDB_PROJECT(proj), drive))
{ {
printf("Couldn't grab drive!\n"); printf("Couldn't grab drive!\n");
edje_object_part_text_set(bdd->swallow, "progress_text", edje_object_part_text_set(proj->parent, "progress_text",
"Couldn't grab the drive!"); "Couldn't grab the drive!");
return; return;
} }
burn_result = ecdb_burn_project(bdd->proj); burn_result = ecdb_burn_project(proj);
switch (burn_result) switch (burn_result)
{ {
case ECDB_ERROR_NONE: case ECDB_ERROR_NONE:
edje_object_signal_emit(gui, "ecdb,filelist,hide", "ecdb"); edje_object_signal_emit(gui, "ecdb,filelist,hide", "ecdb");
edje_object_signal_emit(bdd->swallow, "ecdb,burn_data,start", "ecdb"); edje_object_signal_emit(proj->parent, "ecdb,burn_data,start", "ecdb");
const char *ids[] = {"ecdb/burn_data/return", "ecdb/burn_data/begin", const char *ids[] = {"ecdb/burn_data/return", "ecdb/burn_data/begin",
"ecdb/burn_data/file", "ecdb/burn_data/drive", "ecdb/burn_data/file", "ecdb/burn_data/drive",
"ecdb/burn_data/speed"}; "ecdb/burn_data/speed"};
@ -170,52 +159,52 @@ _button_cb_begin(void *data, Evas_Object *obj, void *event_info)
snprintf(buf, sizeof(buf), "Unknown error :-("); snprintf(buf, sizeof(buf), "Unknown error :-(");
} }
edje_object_part_text_set(bdd->swallow, "progress_text", buf); edje_object_part_text_set(proj->parent, "progress_text", buf);
burn_drive_release(base_proj->drive->tangible[0].drive, 1); burn_drive_release(ECDB_PROJECT(proj)->drive->tangible[0].drive, 1);
burn_drive_info_free(base_proj->drive->tangible); burn_drive_info_free(ECDB_PROJECT(proj)->drive->tangible);
ecdb_burn_project_destroy(bdd->proj); ecdb_burn_project_destroy(proj);
bdd->proj = NULL; evas_object_data_set(proj->parent, "proj", NULL);
} }
static void static void
_combo_cb_clicked(void *data, Evas_Object *obj, void *event_info) _combo_cb_clicked(void *data, Evas_Object *obj, void *event_info)
{ {
Evas_Object *b; Evas_Object *b;
Burn_Data_Data *bdd; Ecdb_Burn_Project *proj;
Ecdb_Project *proj; Ecdb_Project *base_proj;
int sel, i, num_speeds, speed; int sel, i, num_speeds, speed;
char buf[1024]; char buf[1024];
bdd = data; proj = data;
if ((!bdd) || (!bdd->proj)) if (!proj)
return; return;
proj = ECDB_PROJECT(bdd->proj); base_proj = ECDB_PROJECT(proj);
sel = ecdb_combo_selected_get(bdd->dc); sel = ecdb_combo_selected_get(proj->drive_combo);
if (sel < 0) if (sel < 0)
return; return;
proj->drive = eina_list_nth(em->drives, sel); base_proj->drive = eina_list_nth(em->drives, sel);
// Update the capacity here, as our capacity could change with the drive // Update the capacity here, as our capacity could change with the drive
ecore_event_add(ECDB_FILELIST_SIZE_CHANGED, NULL, NULL, NULL); ecore_event_add(ECDB_FILELIST_SIZE_CHANGED, NULL, NULL, NULL);
num_speeds = proj->drive->write_speeds[0]; num_speeds = base_proj->drive->write_speeds[0];
ecdb_combo_data_set(bdd->sc, proj->drive); ecdb_combo_data_set(proj->speed_combo, base_proj->drive);
for (i = 1; i < num_speeds; i++) for (i = 1; i < num_speeds; i++)
{ {
if ((proj->drive->write_speeds[i]) <= 0) if (base_proj->drive->write_speeds[i] <= 0)
continue; continue;
b = ecdb_combo_item_add(bdd->sc, NULL); b = ecdb_combo_item_add(proj->speed_combo, NULL);
if ((proj->drive->profile_name) && if ((base_proj->drive->profile_name) &&
(proj->drive->profile_name[0] != '\0')) (base_proj->drive->profile_name[0] != '\0'))
{ {
if (proj->drive->profile_name[0] == 'C') if (base_proj->drive->profile_name[0] == 'C')
speed = proj->drive->write_speeds[i] / 150; speed = base_proj->drive->write_speeds[i] / 150;
else if (proj->drive->profile_name[0] == 'D') else if (base_proj->drive->profile_name[0] == 'D')
speed = proj->drive->write_speeds[i] / 1352; speed = base_proj->drive->write_speeds[i] / 1352;
else else
speed = proj->drive->write_speeds[i] / 4500; speed = base_proj->drive->write_speeds[i] / 4500;
} }
else else
{ {
@ -223,9 +212,9 @@ _combo_cb_clicked(void *data, Evas_Object *obj, void *event_info)
} }
snprintf(buf, sizeof(buf), "%dX (%dkb/s)", speed, snprintf(buf, sizeof(buf), "%dX (%dkb/s)", speed,
proj->drive->write_speeds[i]); base_proj->drive->write_speeds[i]);
ecdb_combo_item_label_set(b, buf); ecdb_combo_item_label_set(b, buf);
ecdb_combo_append(bdd->sc, b); ecdb_combo_append(proj->speed_combo, b);
evas_object_show(b); evas_object_show(b);
} }
} }
@ -430,7 +419,7 @@ void
ecdb_burn_data_page_show(void) ecdb_burn_data_page_show(void)
{ {
Evas_Object *swallow, *gui; Evas_Object *swallow, *gui;
Burn_Data_Data *bdd; Ecdb_Burn_Project *proj;
gui = evas_object_name_find(ecore_evas_get(em->main_win_ee), "gui"); gui = evas_object_name_find(ecore_evas_get(em->main_win_ee), "gui");
swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee), swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee),
@ -438,15 +427,14 @@ ecdb_burn_data_page_show(void)
if (!swallow) if (!swallow)
{ {
Evas_Object *b, *c1, *c2, *t; Evas_Object *b, *t;
Eina_List *l; Eina_List *l;
Ecdb_Drive_Info *drive; Ecdb_Drive_Info *drive;
Evas_Coord x, y, w, h; Evas_Coord x, y, w, h;
Ewl_Widget *embed, *filelist; Ewl_Widget *embed, *filelist;
Ecdb_Source *src; Ecdb_Source *src;
bdd = calloc(1, sizeof(Burn_Data_Data)); proj = ecdb_burn_project_new();
bdd->proj = ecdb_burn_project_new();
swallow = edje_object_add(ecore_evas_get(em->main_win_ee)); swallow = edje_object_add(ecore_evas_get(em->main_win_ee));
edje_object_file_set(swallow, em->theme_path, "ecdb/burn_data_page"); edje_object_file_set(swallow, em->theme_path, "ecdb/burn_data_page");
@ -460,46 +448,47 @@ ecdb_burn_data_page_show(void)
edje_object_signal_callback_add(swallow, "hide,finished", edje_object_signal_callback_add(swallow, "hide,finished",
"burn_data_page", "burn_data_page",
ecdb_page_hide_finished, NULL); ecdb_page_hide_finished, NULL);
evas_object_data_set(swallow, "bdd", bdd); evas_object_data_set(swallow, "proj", proj);
evas_object_show(swallow); evas_object_show(swallow);
bdd->swallow = swallow; proj->parent = swallow;
b = ecdb_button_add(swallow, "ecdb/burn_data/return"); b = ecdb_button_add(swallow, "ecdb/burn_data/return");
ecdb_button_label_set(b, "Return to Main Page"); ecdb_button_label_set(b, "Return to Main Page");
evas_object_smart_callback_add(b, "clicked", _button_cb_return, bdd); evas_object_smart_callback_add(b, "clicked", _button_cb_return, proj);
evas_object_show(b); evas_object_show(b);
ecdb_button_icon_set(b, "ecdb/burn_data/return"); ecdb_button_icon_set(b, "ecdb/burn_data/return");
b = ecdb_button_add(swallow, "ecdb/burn_data/begin"); b = ecdb_button_add(swallow, "ecdb/burn_data/begin");
ecdb_button_label_set(b, "Start Burn"); ecdb_button_label_set(b, "Start Burn");
evas_object_smart_callback_add(b, "clicked", _button_cb_begin, bdd); evas_object_smart_callback_add(b, "clicked", _button_cb_begin, proj);
evas_object_show(b); evas_object_show(b);
ecdb_button_icon_set(b, "ecdb/burn_data/begin"); ecdb_button_icon_set(b, "ecdb/burn_data/begin");
c1 = ecdb_combo_add(swallow, "ecdb/burn_data/drive"); proj->drive_combo = ecdb_combo_add(swallow, "ecdb/burn_data/drive");
ecdb_combo_header_set(c1, "Drive"); ecdb_combo_header_set(proj->drive_combo, "Drive");
ecdb_combo_header_create_set(c1, ecdb_gui_combo_header_from_drive); ecdb_combo_header_create_set(proj->drive_combo,
evas_object_show(c1); ecdb_gui_combo_header_from_drive);
bdd->dc = c1; evas_object_show(proj->drive_combo);
c2 = ecdb_combo_add(swallow, "ecdb/burn_data/speed"); proj->speed_combo = ecdb_combo_add(swallow, "ecdb/burn_data/speed");
ecdb_combo_header_create_set(c2, ecdb_gui_combo_header_from_speeds); ecdb_combo_header_create_set(proj->speed_combo,
ecdb_combo_header_set(c2, "Max Speed"); ecdb_gui_combo_header_from_speeds);
evas_object_show(c2); ecdb_combo_header_set(proj->speed_combo, "Max Speed");
bdd->sc = c2; evas_object_show(proj->speed_combo);
EINA_LIST_FOREACH(em->drives, l, drive) EINA_LIST_FOREACH(em->drives, l, drive)
{ {
b = ecdb_combo_item_add(c1, NULL); b = ecdb_combo_item_add(proj->drive_combo, NULL);
ecdb_combo_item_label_set(b, drive->product); ecdb_combo_item_label_set(b, drive->product);
evas_object_smart_callback_add(b, "clicked", _combo_cb_clicked, bdd); evas_object_smart_callback_add(b, "clicked", _combo_cb_clicked, proj);
ecdb_combo_append(c1, b); ecdb_combo_append(proj->drive_combo, b);
evas_object_show(b); evas_object_show(b);
} }
embed = ewl_embed_new(); embed = ewl_embed_new();
ewl_object_fill_policy_set(EWL_OBJECT(embed), EWL_FLAG_FILL_ALL); ewl_object_fill_policy_set(EWL_OBJECT(embed), EWL_FLAG_FILL_ALL);
b = ewl_embed_canvas_set(EWL_EMBED(embed), evas_object_evas_get(c2), b = ewl_embed_canvas_set(EWL_EMBED(embed),
evas_object_evas_get(proj->drive_combo),
(void *)(long)ecore_evas_software_x11_window_get(em->main_win_ee)); (void *)(long)ecore_evas_software_x11_window_get(em->main_win_ee));
ewl_embed_focus_set(EWL_EMBED(embed), TRUE); ewl_embed_focus_set(EWL_EMBED(embed), TRUE);
ewl_widget_show(embed); ewl_widget_show(embed);
@ -523,77 +512,66 @@ ecdb_burn_data_page_show(void)
ecdb_widget_focus_callback_add(b, "ecdb/burn_data/filelist"); ecdb_widget_focus_callback_add(b, "ecdb/burn_data/filelist");
// FIXME Turn this into a normal widget // FIXME Turn this into a normal widget
b = ecdb_widget_add(swallow, "ecdb/burn_data/capacity"); proj->capacity = ecdb_capacity_add(swallow, "ecdb/burn_data/capacity");
edje_object_file_set(b, em->theme_path, "ecdb/capacity"); evas_object_data_set(proj->capacity, "source", src);
evas_object_data_set(b, "source", src);
ecore_event_handler_add(ECDB_FILELIST_SIZE_CHANGED, _update_capacity, ecore_event_handler_add(ECDB_FILELIST_SIZE_CHANGED, _update_capacity,
bdd); proj);
evas_object_show(b); evas_object_show(proj->capacity);
bdd->capacity = b;
t = ecdb_config_inwin_add(swallow, NULL); t = ecdb_config_inwin_add(swallow, NULL);
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");
evas_object_smart_callback_add(b, "clicked", _joliet_clicked, bdd->proj); evas_object_smart_callback_add(b, "clicked", _joliet_clicked, proj);
evas_object_smart_callback_add(b, "proj_config", _joliet_config, evas_object_smart_callback_add(b, "proj_config", _joliet_config, proj);
bdd->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_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);
ecdb_check_label_set(b, "Use Rockridge"); ecdb_check_label_set(b, "Use Rockridge");
evas_object_smart_callback_add(b, "clicked", _rockridge_clicked, evas_object_smart_callback_add(b, "clicked", _rockridge_clicked, proj);
bdd->proj); evas_object_smart_callback_add(b, "proj_config", _rockridge_config, proj);
evas_object_smart_callback_add(b, "proj_config", _rockridge_config,
bdd->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_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);
ecdb_check_label_set(b, "Follow Symlinks"); ecdb_check_label_set(b, "Follow Symlinks");
evas_object_smart_callback_add(b, "clicked", _symlinks_clicked, evas_object_smart_callback_add(b, "clicked", _symlinks_clicked, proj);
bdd->proj); evas_object_smart_callback_add(b, "proj_config", _symlinks_config, proj);
evas_object_smart_callback_add(b, "proj_config", _symlinks_config,
bdd->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_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);
ecdb_check_label_set(b, "Ignore Hidden Files"); ecdb_check_label_set(b, "Ignore Hidden Files");
evas_object_smart_callback_add(b, "clicked", _hidden_clicked, bdd->proj); evas_object_smart_callback_add(b, "clicked", _hidden_clicked, proj);
evas_object_smart_callback_add(b, "proj_config", _hidden_config, evas_object_smart_callback_add(b, "proj_config", _hidden_config, proj);
bdd->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_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);
ecdb_check_label_set(b, "Multi-session"); ecdb_check_label_set(b, "Multi-session");
evas_object_smart_callback_add(b, "clicked", _multi_clicked, bdd->proj); evas_object_smart_callback_add(b, "clicked", _multi_clicked, proj);
evas_object_smart_callback_add(b, "proj_config", _multi_config, evas_object_smart_callback_add(b, "proj_config", _multi_config, proj);
bdd->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_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);
ecdb_check_label_set(b, "Simulate"); ecdb_check_label_set(b, "Simulate");
evas_object_smart_callback_add(b, "clicked", _sim_clicked, bdd->proj); evas_object_smart_callback_add(b, "clicked", _sim_clicked, proj);
evas_object_smart_callback_add(b, "proj_config", _sim_config, bdd->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_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);
ecdb_check_label_set(b, "Use Underrun Proof"); ecdb_check_label_set(b, "Use Underrun Proof");
evas_object_smart_callback_add(b, "clicked", _underrun_clicked, evas_object_smart_callback_add(b, "clicked", _underrun_clicked, proj);
bdd->proj); evas_object_smart_callback_add(b, "proj_config", _underrun_config, proj);
evas_object_smart_callback_add(b, "proj_config", _underrun_config,
bdd->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_name_set(b, "ecdb/burn_data/underrun");
evas_object_show(b); evas_object_show(b);
@ -601,9 +579,8 @@ ecdb_burn_data_page_show(void)
b = ecdb_entry_add(t, NULL); b = ecdb_entry_add(t, NULL);
ecdb_entry_text_set(b, "Volume Name"); ecdb_entry_text_set(b, "Volume Name");
evas_object_event_callback_add(b, EVAS_CALLBACK_FOCUS_OUT, evas_object_event_callback_add(b, EVAS_CALLBACK_FOCUS_OUT,
_proj_name, bdd->proj); _proj_name, proj);
evas_object_smart_callback_add(b, "proj_config", _proj_config, evas_object_smart_callback_add(b, "proj_config", _proj_config, proj);
bdd->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_name_set(b, "ecdb/burn_data/name");
evas_object_show(b); evas_object_show(b);
@ -627,15 +604,11 @@ ecdb_burn_data_page_show(void)
evas_object_show(swallow); evas_object_show(swallow);
} }
bdd = evas_object_data_get(swallow, "bdd"); proj = evas_object_data_get(swallow, "proj");
if (!bdd) if (!proj)
{ {
printf("No data for burn data page! This should never happen!\n"); proj = ecdb_burn_project_new();
} evas_object_data_set(swallow, "proj", proj);
else
{
if (!bdd->proj)
bdd->proj = ecdb_burn_project_new();
} }
edje_object_signal_emit(gui, "ecdb,burn_data_page,visible", "ecdb"); edje_object_signal_emit(gui, "ecdb,burn_data_page,visible", "ecdb");
@ -643,23 +616,24 @@ ecdb_burn_data_page_show(void)
} }
void void
ecdb_burn_data_cleanup(void) ecdb_burn_data_cleanup(Ecdb_Burn_Project *proj)
{ {
Evas_Object *swallow;
Ewl_Widget *filelist; Ewl_Widget *filelist;
Ecdb_Source *src; Ecdb_Source *src;
Burn_Data_Data *bdd;
int i; int i;
const char *ids[] = {"ecdb/burn_data/return", "ecdb/burn_data/begin", const char *ids[] = {"ecdb/burn_data/return", "ecdb/burn_data/begin",
"ecdb/burn_data/file", "ecdb/burn_data/drive" "ecdb/burn_data/file", "ecdb/burn_data/drive"
"ecdb/burn_data/speed"}; "ecdb/burn_data/speed"};
swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee),
"burn_data_page"); if (!proj)
bdd = evas_object_data_get(swallow, "bdd"); {
edje_object_part_text_set(swallow, "progress_text", "Burn Complete!"); 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); ecdb_gui_controls_enable(ids, 5);
edje_object_signal_emit(swallow, "ecdb,burn_data,done", "ecdb"); edje_object_signal_emit(proj->parent, "ecdb,burn_data,done", "ecdb");
filelist = ewl_widget_name_find("ecdb/burn_data/filelist"); filelist = ewl_widget_name_find("ecdb/burn_data/filelist");
src = ewl_widget_data_get(filelist, "source"); src = ewl_widget_data_get(filelist, "source");
@ -671,6 +645,7 @@ ecdb_burn_data_cleanup(void)
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]);
} }
bdd->proj = NULL;
evas_object_data_set(proj->parent, "proj", NULL);
} }

View File

@ -3,6 +3,6 @@
#define ECDB_BURN_DATA_GUI_H #define ECDB_BURN_DATA_GUI_H
void ecdb_burn_data_page_show(void); void ecdb_burn_data_page_show(void);
void ecdb_burn_data_cleanup(void); void ecdb_burn_data_cleanup(Ecdb_Burn_Project *proj);
#endif #endif

View File

@ -112,6 +112,10 @@ struct _Ecdb_Burn_Project
/* Files are important here */ /* Files are important here */
Ecdb_Source *files; Ecdb_Source *files;
Evas_Object *capacity;
Evas_Object *speed_combo;
Evas_Object *drive_combo;
Evas_Object *parent;
/* Ids */ /* Ids */
char *volume_id; char *volume_id;

View File

@ -1247,3 +1247,36 @@ ecdb_config_inwin_child_add(Evas_Object *inwin, Evas_Object *child,
} }
} }
/***************************** Capacity **************************************/
Evas_Object *
ecdb_capacity_add(Evas_Object *parent, const char *name)
{
Evas_Object *ret;
ret = ecdb_widget_add(parent, "ecdb/burn_data/capacity");
if (!ret)
{
printf("ecdb_capacity_add: NULL return!\n");
return NULL;
}
edje_object_file_set(ret, em->theme_path, "ecdb/capacity");
return ret;
}
void
ecdb_capacity_float_set(Evas_Object *cap, float val)
{
Edje_Message_Float msg;
if (!cap)
{
printf("ecdb_capacity_float_set: NULL object!\n");
return;
}
msg.val = val;
edje_object_message_send(cap, EDJE_MESSAGE_FLOAT, 1, &msg);
}

View File

@ -56,4 +56,7 @@ void ecdb_config_inwin_child_add(Evas_Object *inwin, Evas_Object *child,
int c, int r, int c, int r,
int cs, int rs); int cs, int rs);
Evas_Object *ecdb_capacity_add(Evas_Object *parent, const char *name);
void ecdb_capacity_float_set(Evas_Object *cap, float val);
#endif #endif