And horribly break everything. Need to rewrite a bunch of stuff dealing with inheritance.

This commit is contained in:
Jaime Thomas 2009-01-30 03:59:48 +00:00
parent 787957d78d
commit 2d5000f5a9
18 changed files with 450 additions and 307 deletions

View File

@ -18,6 +18,7 @@ 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
DONE DONE
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////

View File

@ -4,6 +4,7 @@ bin_PROGRAMS = ecdb
ecdb_SOURCES = \ ecdb_SOURCES = \
ecdb.c ecdb.h \ ecdb.c ecdb.h \
ecdb_projects.c ecdb_projects.h \
ecdb_drives.c ecdb_drives.h \ ecdb_drives.c ecdb_drives.h \
ecdb_image.c ecdb_image.h \ ecdb_image.c ecdb_image.h \
ecdb_burn.c ecdb_burn.h \ ecdb_burn.c ecdb_burn.h \

View File

@ -52,6 +52,7 @@ extern int ECDB_DRIVE_ACTION_UPDATE;
extern int ECDB_FILELIST_SIZE_CHANGED; extern int ECDB_FILELIST_SIZE_CHANGED;
#include "ecdb_common.h" #include "ecdb_common.h"
#include "ecdb_projects.h"
#include "ecdb_drives.h" #include "ecdb_drives.h"
#include "ecdb_image.h" #include "ecdb_image.h"
#include "ecdb_burn.h" #include "ecdb_burn.h"

View File

@ -2,50 +2,6 @@
#include "ecdb.h" #include "ecdb.h"
int transcode_data_cb(void *data, int type, void *event); int transcode_data_cb(void *data, int type, void *event);
int ecdb_audio_project_init(Ecdb_Audio_Project *proj);
Ecdb_Audio_Project *
ecdb_audio_project_new(void)
{
Ecdb_Audio_Project *proj;
proj = calloc(1, sizeof(Ecdb_Audio_Project));
if (!proj)
{
return NULL;
}
if (!ecdb_audio_project_init(proj))
{
FREE(proj);
return NULL;
}
return proj;
}
int
ecdb_audio_project_init(Ecdb_Audio_Project *proj)
{
if (!ecdb_project_init(ECDB_PROJECT(proj)))
{
return FALSE;
}
ecdb_project_type_set(ECDB_PROJECT(proj), ECDB_AUDIO_PROJECT);
proj->tracks = ecdb_source_new();
proj->num_tracks = 0;
proj->num_transcode_complete = 0;
return TRUE;
}
void
ecdb_audio_project_destroy(Ecdb_Audio_Project *proj)
{
ecdb_source_destroy(proj->tracks);
ecdb_project_destroy(ECDB_PROJECT(proj));
free(proj);
}
void void
ecdb_audio_project_start(Ecdb_Audio_Project *proj) ecdb_audio_project_start(Ecdb_Audio_Project *proj)

View File

@ -2,8 +2,6 @@
#ifndef ECDB_AUDIO_H #ifndef ECDB_AUDIO_H
#define ECDB_AUDIO_H #define ECDB_AUDIO_H
Ecdb_Audio_Project *ecdb_audio_project_new(void);
void ecdb_audio_project_start(Ecdb_Audio_Project *proj); void ecdb_audio_project_start(Ecdb_Audio_Project *proj);
void ecdb_audio_project_destroy(Ecdb_Audio_Project *proj);
#endif #endif

View File

@ -12,69 +12,12 @@ struct Burn_Data
}; };
int ecdb_burn_finished(void *data, int type, void *event); int ecdb_burn_finished(void *data, int type, void *event);
int ecdb_burn_project_init(Ecdb_Burn_Project *proj);
int ecdb_erase_project_init(Ecdb_Erase_Project *proj); int ecdb_erase_project_init(Ecdb_Erase_Project *proj);
static void ecdb_burn_progress_handler(void *data, void *buffer, static void ecdb_burn_progress_handler(void *data, void *buffer,
unsigned int nbyte); unsigned int nbyte);
void ecdb_sources_list_free(Eina_List *list); void ecdb_sources_list_free(Eina_List *list);
void ecdb_tracks_list_free(Eina_List *list); void ecdb_tracks_list_free(Eina_List *list);
Ecdb_Burn_Project *
ecdb_burn_project_new(void)
{
Ecdb_Burn_Project *proj;
proj = calloc(1, sizeof(Ecdb_Burn_Project));
if (!proj)
return NULL;
if (!ecdb_burn_project_init(proj))
{
FREE(proj);
return NULL;
}
return proj;
}
int
ecdb_burn_project_init(Ecdb_Burn_Project *proj)
{
if (!ecdb_project_init(ECDB_PROJECT(proj)))
return FALSE;
/* Create some sane defaults */
ecdb_project_type_set(ECDB_PROJECT(proj), ECDB_BURN_PROJECT);
proj->burn_mode = BURN_MODE1;
proj->fifo_chunksize = 2048;
proj->fifo_chunks = 2048;
proj->underrun_proof = TRUE;
proj->opc = TRUE;
proj->multi = TRUE;
proj->use_joliet = TRUE;
proj->use_rockridge = TRUE;
proj->iso_level = 3;
return TRUE;
}
void
ecdb_burn_project_destroy(Ecdb_Burn_Project *proj)
{
if (proj->files)
ecdb_source_destroy(proj->files);
FREE(proj->volume_id);
FREE(proj->publisher_id);
FREE(proj->data_preparer_id);
FREE(proj->system_id);
FREE(proj->application_id);
FREE(proj->copywrite_id);
FREE(proj->abstract_id);
FREE(proj->biblio_id);
ecdb_project_destroy(ECDB_PROJECT(proj));
FREE(proj);
}
int int
ecdb_burn_project(Ecdb_Burn_Project *proj) ecdb_burn_project(Ecdb_Burn_Project *proj)
{ {

View File

@ -3,8 +3,6 @@
#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_Burn_Project *ecdb_burn_project_new(void);
void ecdb_burn_project_destroy(Ecdb_Burn_Project *proj);
void *ecdb_drive_progress_update(void *data); void *ecdb_drive_progress_update(void *data);
#endif #endif

View File

@ -1,8 +1,12 @@
/* 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, void *event_info); static void _button_cb_return(void *data, Evas_Object *obj,
static void _button_cb_begin(void *data, Evas_Object *obj, void *event_info); const char *emission,
const char *source);
static void _button_cb_begin(void *data, Evas_Object *obj,
const char *emission,
const char *source);
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);
static int _update_capacity(void *data, int type, void *ev_data); static int _update_capacity(void *data, int type, void *ev_data);
@ -16,7 +20,9 @@ static void _sim_clicked(void *data, Evas_Object *obj, void *event_info);
static void _underrun_clicked(void *data, Evas_Object *obj, void *event_info); static void _underrun_clicked(void *data, Evas_Object *obj, void *event_info);
static void _apply_clicked(void *data, Evas_Object *obj, void *event_info); static void _apply_clicked(void *data, Evas_Object *obj, void *event_info);
static void _proj_name(void *data, Evas *e, Evas_Object *obj, void *event_info); static void _proj_name(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _settings_clicked(void *data, Evas_Object *obj, void *event_into); static void _settings_clicked(void *data, Evas_Object *obj,
const char *emission,
const char *source);
// Update on showing to proper values // Update on showing to proper values
static void _joliet_config(void *data, Evas_Object *obj, void *event_info); static void _joliet_config(void *data, Evas_Object *obj, void *event_info);
@ -65,20 +71,17 @@ _update_capacity(void *data, int type, void *ev_data)
} }
static void static void
_button_cb_return(void *data, Evas_Object *obj, void *event_info) _button_cb_return(void *data, Evas_Object *obj,
const char *emission __UNUSED__,
const char *source __UNUSED__)
{ {
Evas_Object *gui; Evas_Object *gui;
Ecdb_Burn_Project *proj;
char *signal; char *signal;
proj = data; gui = data;
if (!proj)
return;
gui = evas_object_name_find(ecore_evas_get(em->main_win_ee), "gui"); signal = evas_object_data_get(obj, "hide_signal");
edje_object_signal_emit(obj, signal, "ecdb");
signal = evas_object_data_get(proj->parent, "hide_signal");
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 */
@ -86,7 +89,9 @@ _button_cb_return(void *data, Evas_Object *obj, void *event_info)
} }
static void static void
_button_cb_begin(void *data, Evas_Object *obj, void *event_info) _button_cb_begin(void *data, Evas_Object *obj,
const char *emission __UNUSED__,
const char *source __UNUSED__)
{ {
Evas_Object *gui; Evas_Object *gui;
Ecdb_Burn_Project *proj; Ecdb_Burn_Project *proj;
@ -122,11 +127,11 @@ _button_cb_begin(void *data, Evas_Object *obj, void *event_info)
proj->files = proj->files->parent; proj->files = proj->files->parent;
snprintf(buf, sizeof(buf), "Commencing..."); snprintf(buf, sizeof(buf), "Commencing...");
edje_object_part_text_set(proj->parent, "progress_text", buf); edje_object_part_text_set(obj, "progress_text", buf);
if (!ecdb_aquire_drive(ECDB_PROJECT(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(proj->parent, "progress_text", edje_object_part_text_set(obj, "progress_text",
"Couldn't grab the drive!"); "Couldn't grab the drive!");
return; return;
} }
@ -136,7 +141,7 @@ _button_cb_begin(void *data, Evas_Object *obj, void *event_info)
{ {
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(proj->parent, "ecdb,burn_data,start", "ecdb"); edje_object_signal_emit(obj, "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"};
@ -159,11 +164,11 @@ _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(proj->parent, "progress_text", buf); edje_object_part_text_set(obj, "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);
ecdb_burn_project_destroy(proj); ecdb_burn_project_destroy(proj);
evas_object_data_set(proj->parent, "proj", NULL); evas_object_data_set(obj, "proj", NULL);
} }
static void static void
@ -393,7 +398,9 @@ _proj_config(void *data, Evas_Object *obj, void *event_info)
} }
static void static void
_settings_clicked(void *data, Evas_Object *obj, void *event_into) _settings_clicked(void *data, Evas_Object *obj __UNUSED__,
const char *emission __UNUSED__,
const char *source __UNUSED__)
{ {
Eina_Iterator *it; Eina_Iterator *it;
const Evas_Object *table; const Evas_Object *table;
@ -454,13 +461,15 @@ ecdb_burn_data_page_show(void)
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, proj); edje_object_signal_callback_add(swallow, "mouse,clicked,1",
"ecdb/burn_data/return", _button_cb_return, gui);
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, proj); edje_object_signal_callback_add(swallow, "mouse,clicked,1",
"ecdb/burn_data/begin", _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");
@ -595,7 +604,8 @@ ecdb_burn_data_page_show(void)
// At the end so t is a valid pointer // At the end so t is a valid pointer
b = ecdb_button_add(swallow, "ecdb/burn_data/settings"); b = ecdb_button_add(swallow, "ecdb/burn_data/settings");
ecdb_button_label_set(b, "Settings"); ecdb_button_label_set(b, "Settings");
evas_object_smart_callback_add(b, "clicked", _settings_clicked, t); edje_object_signal_callback_add(swallow, "mouse,clicked,1",
"ecdb/burn_data/settings", _settings_clicked, t);
evas_object_show(b); evas_object_show(b);
} }
else if (edje_object_part_swallow_get(gui, "action_area") != swallow) else if (edje_object_part_swallow_get(gui, "action_area") != swallow)

View File

@ -7,17 +7,19 @@ static void _button_cb_return(void *data, Evas_Object *obj,
static void _button_cb_begin(void *data, Evas_Object *obj, static void _button_cb_begin(void *data, Evas_Object *obj,
const char *emission, const char *emission,
const char *source); const char *source);
static void _combo_cb_clicked(void *data, Evas_Object *obj, void *event_info); static void _combo_cb_clicked(void *data, Evas_Object *obj,
const char *emission,
const char *source);
static void static void
_button_cb_return(void *data __UNUSED__, Evas_Object *obj, _button_cb_return(void *data, Evas_Object *obj,
const char *emission __UNUSED__, const char *emission __UNUSED__,
const char *source __UNUSED__) const char *source __UNUSED__)
{ {
Evas_Object *gui; Evas_Object *gui;
char *signal; char *signal;
gui = evas_object_name_find(ecore_evas_get(em->main_win_ee), "gui"); gui = data;
edje_object_part_text_set(obj, "progress_text", "Begin Burn"); edje_object_part_text_set(obj, "progress_text", "Begin Burn");
edje_object_part_text_set(obj, "progress_percent", "0%"); edje_object_part_text_set(obj, "progress_percent", "0%");
@ -30,7 +32,7 @@ _button_cb_return(void *data __UNUSED__, Evas_Object *obj,
} }
static void static void
_button_cb_begin(void *data __UNUSED__, Evas_Object *obj, _button_cb_begin(void *data, Evas_Object *obj,
const char *emission __UNUSED__, const char *emission __UNUSED__,
const char *source __UNUSED__) const char *source __UNUSED__)
{ {
@ -41,7 +43,7 @@ _button_cb_begin(void *data __UNUSED__, Evas_Object *obj,
Ecdb_Burn_Result burn_result; Ecdb_Burn_Result burn_result;
int drive, speed; int drive, speed;
gui = evas_object_name_find(ecore_evas_get(em->main_win_ee), "gui"); gui = data;
o = evas_object_name_find(ecore_evas_get(em->main_win_ee), o = evas_object_name_find(ecore_evas_get(em->main_win_ee),
"ecdb/burn_image/file"); "ecdb/burn_image/file");
file = ecdb_entry_text_get(o); file = ecdb_entry_text_get(o);
@ -101,12 +103,9 @@ _button_cb_begin(void *data __UNUSED__, Evas_Object *obj,
edje_object_signal_emit(gui, "ecdb,filelist,hide", "ecdb"); edje_object_signal_emit(gui, "ecdb,filelist,hide", "ecdb");
edje_object_signal_emit(obj, "ecdb,burn_image,start", "ecdb"); edje_object_signal_emit(obj, "ecdb,burn_image,start", "ecdb");
const char *ids[] = {"ecdb/burn_image/file", "ecdb/burn_image/drive", const char *ids[] = {"ecdb/burn_image/file", "ecdb/burn_image/drive",
"ecdb/burn_image/speed"}; "ecdb/burn_image/speed", "ecdb/burn_image/begin",
ecdb_gui_controls_disable(ids, 3); "ecdb/burn_image/return"};
edje_object_signal_emit(obj, "ecdb,disable,ecdb/burn_image/begin", ecdb_gui_controls_disable(ids, 5);
"ecdb");
edje_object_signal_emit(obj, "ecdb,disable,ecdb/burn_image/return",
"ecdb");
return; return;
case ECDB_ERROR_IMAGE_CREATE: case ECDB_ERROR_IMAGE_CREATE:
@ -133,7 +132,9 @@ _button_cb_begin(void *data __UNUSED__, Evas_Object *obj,
} }
static void static void
_combo_cb_clicked(void *data, Evas_Object *obj, void *event_info) _combo_cb_clicked(void *data, Evas_Object *obj __UNUSED__,
const char *emission __UNUSED__,
const char *source __UNUSED__)
{ {
Evas_Object *c1, *c2, *b; Evas_Object *c1, *c2, *b;
Ecdb_Drive_Info *drive; Ecdb_Drive_Info *drive;
@ -209,15 +210,19 @@ ecdb_burn_image_page_show(void)
ecdb_page_hide_finished, NULL); ecdb_page_hide_finished, NULL);
evas_object_show(swallow); evas_object_show(swallow);
edje_object_part_text_set(swallow, "ecdb/burn_image/return/text", b = ecdb_button_add(swallow, "ecdb/burn_image/return");
"Return to Main Page"); ecdb_button_label_set(b, "Return to Main Page");
edje_object_signal_callback_add(swallow, "ecdb/burn_image/return,clicked", edje_object_signal_callback_add(swallow, "mouse,clicked,1",
"*", _button_cb_return, NULL); "ecdb/burn_image/return", _button_cb_return, gui);
evas_object_show(b);
ecdb_button_icon_set(b, "ecdb/burn_image/return");
edje_object_part_text_set(swallow, "ecdb/burn_image/begin/text", b = ecdb_button_add(swallow, "ecdb/burn_image/begin");
"Start Burn"); ecdb_button_label_set(b, "Start Burn");
edje_object_signal_callback_add(swallow, "ecdb/burn_image/begin,clicked", edje_object_signal_callback_add(swallow, "mouse,clicked,1",
"*", _button_cb_begin, NULL); "ecdb/burn_image/begin", _button_cb_begin, gui);
evas_object_show(b);
ecdb_button_icon_set(b, "ecdb/burn_image/begin");
b = ecdb_entry_add(swallow, "ecdb/burn_image/file"); b = ecdb_entry_add(swallow, "ecdb/burn_image/file");
ecdb_entry_text_set(b, "Burn File"); ecdb_entry_text_set(b, "Burn File");
@ -237,7 +242,8 @@ ecdb_burn_image_page_show(void)
{ {
b = ecdb_combo_item_add(c1, NULL); b = ecdb_combo_item_add(c1, 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, c2); edje_object_signal_callback_add(b, "mouse,clicked,1", "*",
_combo_cb_clicked, c2);
ecdb_combo_append(c1, b); ecdb_combo_append(c1, b);
evas_object_show(b); evas_object_show(b);
} }
@ -263,7 +269,7 @@ ecdb_burn_image_cleanup(void)
swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee), swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee),
"burn_image_page"); "burn_image_page");
edje_object_part_text_set(swallow, "progress_text", "Burn Complete!"); edje_object_part_text_set(swallow, "progress_text", "Burn Complete!");
ecdb_gui_controls_enable(ids, 3); ecdb_gui_controls_enable(ids, 5);
edje_object_signal_emit(swallow, "ecdb,burn_image,done", "ecdb"); edje_object_signal_emit(swallow, "ecdb,burn_image,done", "ecdb");
} }

View File

@ -31,7 +31,8 @@ enum _Ecdb_Project_Type
ECDB_AUDIO_PROJECT, ECDB_AUDIO_PROJECT,
ECDB_ERASE_PROJECT, ECDB_ERASE_PROJECT,
ECDB_COPY_PROJECT, ECDB_COPY_PROJECT,
ECDB_IMAGE_PROJECT ECDB_IMAGE_PROJECT,
ECDB_DATA_PROJECT
}; };
typedef enum _Ecdb_Burn_Result Ecdb_Burn_Result; typedef enum _Ecdb_Burn_Result Ecdb_Burn_Result;
@ -84,6 +85,11 @@ struct _Ecdb_Project_Info
Ecore_Event_Handler *ev_handler; Ecore_Event_Handler *ev_handler;
Ecore_Pipe *pipe; Ecore_Pipe *pipe;
unsigned int type; unsigned int type;
/* Every project has these */
Evas_Object *ret;
Evas_Object *begin;
Evas_Object *drive;
}; };
/* Typecast a pointer to an Ecdb_Source */ /* Typecast a pointer to an Ecdb_Source */
@ -110,31 +116,9 @@ struct _Ecdb_Burn_Project
/* Inherit from normal project */ /* Inherit from normal project */
Ecdb_Project proj; Ecdb_Project proj;
/* Files are important here */ /* The file source */
Ecdb_Source *files; Ecdb_Source *files;
Evas_Object *capacity;
Evas_Object *speed_combo; Evas_Object *speed_combo;
Evas_Object *drive_combo;
Evas_Object *parent;
/* Ids */
char *volume_id;
char *publisher_id;
char *data_preparer_id;
char *system_id;
char *application_id;
char *copywrite_id;
char *abstract_id;
char *biblio_id;
/* iso options */
int iso_level;
unsigned char use_joliet:1;
unsigned char use_rockridge:1;
unsigned char follow_symlinks:1;
unsigned char ignore_hidden:1;
unsigned char ignore_special:1;
unsigned char iso1990:1;
/* burn options */ /* burn options */
unsigned char opc:1; unsigned char opc:1;
@ -152,14 +136,56 @@ struct _Ecdb_Burn_Project
/* Typecast a pointer to an Ecdb_Burn_Project */ /* Typecast a pointer to an Ecdb_Burn_Project */
#define ECDB_BURN(proj) ((Ecdb_Burn_Project *) proj) #define ECDB_BURN(proj) ((Ecdb_Burn_Project *) proj)
typedef struct _Ecdb_Image_Project Ecdb_Image_Project;
struct _Ecdb_Image_Project
{
/* Inherit from a burn project */
Ecdb_Burn_Project proj;
Evas_Object *entry;
}
/* Typecast a pointer to an Ecdb_Image_Project */
#define ECDB_IMAGE(proj) ((Ecdb_Image_Project *) proj)
typedef struct _Ecdb_Data_Project Ecdb_Data_Project;
struct _Ecdb_Data_Project
{
/* Inherit from a burn project */
Ecdb_Burn_Project proj;
/* Files are important here */
Evas_Object *capacity;
Evas_Object *settings;
Evas_Object *filelist_swallow;
Ewl_Widget *filelist;
/* iso options */
int iso_level;
unsigned char use_joliet:1;
unsigned char use_rockridge:1;
unsigned char follow_symlinks:1;
unsigned char ignore_hidden:1;
unsigned char ignore_special:1;
unsigned char iso1990:1;
/* Ids */
char *volume_id;
char *publisher_id;
char *data_preparer_id;
char *system_id;
char *application_id;
char *copywrite_id;
char *abstract_id;
char *biblio_id;
}
typedef struct _Ecdb_Audio_Project Ecdb_Audio_Project; typedef struct _Ecdb_Audio_Project Ecdb_Audio_Project;
struct _Ecdb_Audio_Project struct _Ecdb_Audio_Project
{ {
/* Inherit from normal project */ /* Inherit from normal project */
Ecdb_Project proj; Ecdb_Burn_Project proj;
/* Audio tracks */
Ecdb_Source *tracks;
int num_tracks; int num_tracks;
int num_transcode_complete; int num_transcode_complete;
}; };
@ -173,6 +199,9 @@ struct _Ecdb_Erase_Project
/* Inherit from normal project */ /* Inherit from normal project */
Ecdb_Project proj; Ecdb_Project proj;
/* Add a check widget */
Evas_Object *speed;
/* Speed */ /* Speed */
unsigned char quick:1; unsigned char quick:1;
unsigned char format:1; unsigned char format:1;

View File

@ -1,54 +1,10 @@
/* vim: set sw=3 ts=3 sts=3 expandtab: */ /* vim: set sw=3 ts=3 sts=3 expandtab: */
#include "ecdb.h" #include "ecdb.h"
int ecdb_erase_project_init(Ecdb_Erase_Project *proj);
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);
Ecdb_Erase_Project *
ecdb_erase_project_new(void)
{
Ecdb_Erase_Project *proj;
proj = calloc(1, sizeof(Ecdb_Erase_Project));
if (!proj)
{
return NULL;
}
if (!ecdb_erase_project_init(proj))
{
FREE(proj);
return NULL;
}
return proj;
}
int
ecdb_erase_project_init(Ecdb_Erase_Project *proj)
{
if (!ecdb_project_init(ECDB_PROJECT(proj)))
{
return FALSE;
}
/* Proper defaults */
ecdb_project_type_set(ECDB_PROJECT(proj), ECDB_ERASE_PROJECT);
proj->quick = TRUE;
proj->format = FALSE;
return TRUE;
}
void
ecdb_erase_project_destroy(Ecdb_Erase_Project *proj)
{
ecdb_project_destroy(ECDB_PROJECT(proj));
FREE(proj);
}
// 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)

View File

@ -4,7 +4,5 @@
void ecdb_erase_project_start(Ecdb_Erase_Project *proj); void ecdb_erase_project_start(Ecdb_Erase_Project *proj);
int ecdb_erase_disc(Ecdb_Erase_Project *proj); int ecdb_erase_disc(Ecdb_Erase_Project *proj);
Ecdb_Erase_Project *ecdb_erase_project_new();
void ecdb_erase_project_destroy(Ecdb_Erase_Project *proj);
#endif #endif

View File

@ -1,17 +1,20 @@
/* 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, void *event_info); static void _button_cb_return(void *data, Evas_Object *o, const char *emission,
static void _button_cb_begin(void *data, Evas_Object *obj, void *event_info); const char *source);
static void _button_cb_begin(void *data, Evas_Object *o, const char *emission,
const char *source);
static void static void
_button_cb_return(void *data, Evas_Object *obj, void *event_info) _button_cb_return(void *data, Evas_Object *o __UNUSED__,
const char *emission __UNUSED__,
const char *source __UNUSED__)
{ {
Evas_Object *swallow; Evas_Object *swallow;
char *signal; char *signal;
swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee), swallow = data;
"erase_page");
edje_object_part_text_set(swallow, "progress_text", "Begin Erase"); edje_object_part_text_set(swallow, "progress_text", "Begin Erase");
edje_object_part_text_set(swallow, "progress_percent", "0%"); edje_object_part_text_set(swallow, "progress_percent", "0%");
@ -21,22 +24,24 @@ _button_cb_return(void *data, Evas_Object *obj, void *event_info)
} }
static void static void
_button_cb_begin(void *data, Evas_Object *obj, void *event_info) _button_cb_begin(void *data, Evas_Object *o __UNUSED__,
const char *emission __UNUSED__,
const char *source __UNUSED__)
{ {
Evas_Object *swallow, *o; Evas_Object *swallow, *obj;
Ecdb_Erase_Project *proj; Ecdb_Erase_Project *proj;
char buf[1024]; char buf[1024];
int drive; int drive;
swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee), swallow = data;
"erase_page");
proj = ecdb_erase_project_new(); proj = ecdb_erase_project_new();
snprintf(buf, sizeof(buf), "Commencing..."); snprintf(buf, sizeof(buf), "Commencing...");
edje_object_part_text_set(swallow, "progress_text", buf); edje_object_part_text_set(swallow, "progress_text", buf);
o = evas_object_name_find(evas_object_evas_get(obj), "ecdb/erase/drive"); obj = evas_object_name_find(evas_object_evas_get(swallow),
drive = ecdb_combo_selected_get(o); "ecdb/erase/drive");
drive = ecdb_combo_selected_get(obj);
if (drive < 0) if (drive < 0)
{ {
printf("Choose a drive!\n"); printf("Choose a drive!\n");
@ -54,8 +59,9 @@ _button_cb_begin(void *data, Evas_Object *obj, void *event_info)
return; return;
} }
o = evas_object_name_find(evas_object_evas_get(obj), "ecdb/erase/speed"); obj = evas_object_name_find(evas_object_evas_get(swallow),
proj->quick = ecdb_check_checked_get(o); "ecdb/erase/speed");
proj->quick = ecdb_check_checked_get(obj);
if (!ecdb_erase_disc(proj)) if (!ecdb_erase_disc(proj))
{ {
Ecdb_Project *p = ECDB_PROJECT(proj); Ecdb_Project *p = ECDB_PROJECT(proj);
@ -109,13 +115,15 @@ ecdb_erase_page_show(void)
b = ecdb_button_add(swallow, "ecdb/erase/return"); b = ecdb_button_add(swallow, "ecdb/erase/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, NULL); edje_object_signal_callback_add(swallow, "mouse,clicked,1",
"ecdb/erase/return", _button_cb_return, swallow);
evas_object_show(b); evas_object_show(b);
ecdb_button_icon_set(b, "ecdb/erase/return"); ecdb_button_icon_set(b, "ecdb/erase/return");
b = ecdb_button_add(swallow, "ecdb/erase/begin"); b = ecdb_button_add(swallow, "ecdb/erase/begin");
ecdb_button_label_set(b, "Start Erase"); ecdb_button_label_set(b, "Start Erase");
evas_object_smart_callback_add(b, "clicked", _button_cb_begin, NULL); edje_object_signal_callback_add(swallow, "mouse,clicked,1",
"ecdb/erase/begin", _button_cb_begin, swallow);
evas_object_show(b); evas_object_show(b);
ecdb_button_icon_set(b, "ecdb/erase/begin"); ecdb_button_icon_set(b, "ecdb/erase/begin");

View File

@ -1,43 +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"
Ecdb_Project *
ecdb_project_new(void)
{
Ecdb_Project *proj;
proj = calloc(1, sizeof(Ecdb_Project));
if (!proj)
{
return NULL;
}
if (!ecdb_project_init(proj))
{
FREE(proj);
return NULL;
}
return proj;
}
int
ecdb_project_init(Ecdb_Project *proj)
{
return TRUE;
}
void
ecdb_project_destroy(Ecdb_Project *proj)
{
printf("Destroying base project\n");
}
void
ecdb_project_type_set(Ecdb_Project *proj, unsigned int t)
{
proj->type = t;
}
int int
ecdb_shutdown(void *data, int type, void *event) ecdb_shutdown(void *data, int type, void *event)
{ {

View File

@ -2,13 +2,6 @@
#ifndef ECDB_MISC_H #ifndef ECDB_MISC_H
#define ECDB_MISC_H #define ECDB_MISC_H
// At some point I should move the ecdb_project_* stuff into its own file,
// and the init and shutdown stuff into ecdb.c
Ecdb_Project *ecdb_project_new(void);
int ecdb_project_init(Ecdb_Project *proj);
void ecdb_project_destroy(Ecdb_Project *proj);
void ecdb_project_type_set(Ecdb_Project *proj, unsigned int t);
void ecdb_projects_free(void *data);
int ecdb_shutdown(void *data, int type, void *event); int ecdb_shutdown(void *data, int type, void *event);
int ecdb_burn_init(void); int ecdb_burn_init(void);
int ecdb_image_init(void); int ecdb_image_init(void);

View File

@ -0,0 +1,272 @@
/* vim: set sw=3 ts=3 sts=3 expandtab: */
#include "ecdb.h"
int ecdb_project_init(Ecdb_Project *proj);
int ecdb_burn_project_init(Ecdb_Burn_Project *proj);
int ecdb_erase_project_init(Ecdb_Erase_Project *proj);
int ecdb_audio_project_init(Ecdb_Audio_Project *proj);
int ecdb_data_project_init(Ecdb_Data_Project *proj);
int ecdb_image_project_init(Ecdb_Image_Project *proj);
Ecdb_Project *
ecdb_project_new(void)
{
Ecdb_Project *proj;
proj = calloc(1, sizeof(Ecdb_Project));
if (!proj)
{
return NULL;
}
if (!ecdb_project_init(proj))
{
FREE(proj);
return NULL;
}
return proj;
}
int
ecdb_project_init(Ecdb_Project *proj)
{
return TRUE;
}
void
ecdb_project_destroy(Ecdb_Project *proj)
{
FREE(proj->drive);
if (proj->ev_handler) ecore_event_handler_del(proj->ev_handler);
if (proj->pipe) ecore_pipe_del(proj->pipe);
if (proj->ret) evas_object_destroy(proj->ret);
if (proj->begin) evas_object_destroy(proj->begin);
if (proj->begin) evas_object_destroy(proj->drive);
printf("Destroying base project\n");
}
void
ecdb_project_type_set(Ecdb_Project *proj, unsigned int t)
{
proj->type = t;
}
Ecdb_Burn_Project *
ecdb_burn_project_new(void)
{
Ecdb_Burn_Project *proj;
proj = calloc(1, sizeof(Ecdb_Burn_Project));
if (!proj)
return NULL;
if (!ecdb_burn_project_init(proj))
{
FREE(proj);
return NULL;
}
return proj;
}
int
ecdb_burn_project_init(Ecdb_Burn_Project *proj)
{
if (!ecdb_project_init(ECDB_PROJECT(proj)))
return FALSE;
/* Create some sane defaults */
ecdb_project_type_set(ECDB_PROJECT(proj), ECDB_BURN_PROJECT);
proj->burn_mode = BURN_MODE1;
proj->fifo_chunksize = 2048;
proj->fifo_chunks = 2048;
proj->underrun_proof = TRUE;
proj->opc = TRUE;
proj->multi = TRUE;
return TRUE;
}
void
ecdb_burn_project_destroy(Ecdb_Burn_Project *proj)
{
if (proj->files) ecdb_source_destroy(proj->files);
if (proj->speed_combo) evas_object_destroy(proj->speed_combo);
ecdb_project_destroy(ECDB_PROJECT(proj));
printf("Destroying burn project\n");
}
Ecdb_Erase_Project *
ecdb_erase_project_new(void)
{
Ecdb_Erase_Project *proj;
proj = calloc(1, sizeof(Ecdb_Erase_Project));
if (!proj)
{
return NULL;
}
if (!ecdb_erase_project_init(proj))
{
FREE(proj);
return NULL;
}
return proj;
}
int
ecdb_erase_project_init(Ecdb_Erase_Project *proj)
{
if (!ecdb_project_init(ECDB_PROJECT(proj)))
{
return FALSE;
}
/* Proper defaults */
ecdb_project_type_set(ECDB_PROJECT(proj), ECDB_ERASE_PROJECT);
proj->quick = TRUE;
proj->format = FALSE;
return TRUE;
}
void
ecdb_erase_project_destroy(Ecdb_Erase_Project *proj)
{
if (proj->speed) evas_object_destroy(proj->speed);
ecdb_project_destroy(ECDB_PROJECT(proj));
FREE(proj);
}
Ecdb_Audio_Project *
ecdb_audio_project_new(void)
{
Ecdb_Audio_Project *proj;
proj = calloc(1, sizeof(Ecdb_Audio_Project));
if (!proj)
{
return NULL;
}
if (!ecdb_audio_project_init(proj))
{
FREE(proj);
return NULL;
}
return proj;
}
int
ecdb_audio_project_init(Ecdb_Audio_Project *proj)
{
if (!ecdb_burn_project_init(ECDB_BURN(proj)))
{
return FALSE;
}
ecdb_project_type_set(ECDB_PROJECT(proj), ECDB_AUDIO_PROJECT);
return TRUE;
}
void
ecdb_audio_project_destroy(Ecdb_Audio_Project *proj)
{
ecdb_burn_project_destroy(ECDB_PROJECT(proj));
FREE(proj);
}
Ecdb_Data_Project *
ecdb_data_project_new(void)
{
Ecdb_Data_Project *proj;
proj = calloc(1, sizeof(Ecdb_Data_Project));
if (!proj)
{
return NULL;
}
if (!ecdb_data_project_init(proj))
{
FREE(proj);
return NULL;
}
return proj;
}
int
ecdb_data_project_init(Ecdb_Data_Project *proj)
{
if (!ecdb_burn_project_init(ECDB_BURN(proj)))
{
return FALSE;
}
ecdb_project_type_set(ECDB_PROJECT(proj), ECDB_DATA_PROJECT);
proj->use_joliet = TRUE;
proj->use_rockridge = TRUE;
proj->iso_level = 3;
return TRUE;
}
void
ecdb_data_project_destroy(Ecdb_Data_Project *proj)
{
if (proj->capacity) evas_object_destroy(proj->capacity);
if (proj->settings) evas_object_destroy(proj->settings);
if (proj->filelist_swallow) evas_object_destroy(proj->filelist_swallow);
if (proj->filelist) ewl_widget_destroy(filelist);
FREE(volume_id);
FREE(publisher_id);
FREE(data_preparer_id);
FREE(system_id);
FREE(application_id);
FREE(copywrite_id);
FREE(abstract_id);
FREE(biblio_id);
ecdb_burn_project_destroy(ECDB_BURN(proj));
FREE(proj);
}
Ecdb_Image_Project *
ecdb_image_project_new(void)
{
Ecdb_Image_Project *proj;
proj = calloc(1, sizeof(Ecdb_Image_Project));
if (!proj)
{
return NULL;
}
if (!ecdb_image_project_init(proj))
{
FREE(proj);
return NULL;
}
return proj;
}
int
ecdb_image_project_init(Ecdb_Image_Project *proj)
{
if (!ecdb_burn_project_init(ECDB_BURN(proj)))
return FALSE;
ecdb_project_type_set(ECDB_PROJECT(proj), ECDB_IMAGE_PROJECT);
return TRUE;
}
void
ecdb_image_project_destroy(Ecdb_Image_Project *proj)
{
if (proj->entry) evas_object_destroy(proj->entry);
ecdb_burn_project_destroy(ECDB_BURN(proj));
FREE(proj);
}

View File

@ -0,0 +1,25 @@
/* vim: set sw=3 ts=3 sts=3 expandtab: */
#ifndef ECDB_PROJECTS_H
#define ECDB_PROJECTS_H
Ecdb_Project *ecdb_project_new(void);
void ecdb_project_destroy(Ecdb_Project *proj);
void ecdb_project_type_set(Ecdb_Project *proj, unsigned int t);
Ecdb_Burn_Project *ecdb_burn_project_new(void);
void ecdb_burn_project_destroy(Ecdb_Burn_Project *proj);
Ecdb_Erase_Project *ecdb_erase_project_new(void);
void ecdb_erase_project_destroy(Ecdb_Erase_Project *proj);
Ecdb_Audio_Project *ecdb_audio_project_new(void);
void ecdb_audio_project_destroy(Ecdb_Audio_Project *proj);
Ecdb_Data_Project *ecdb_data_project_new(void);
void ecdb_data_project_destroy(Ecdb_Data_Project *proj);
Ecdb_Image_Project *ecdb_image_project_new(void);
void ecdb_image_project_destroy(Ecdb_Image_Project *proj);
#endif

View File

@ -2,26 +2,17 @@
#include "ecdb.h" #include "ecdb.h"
static void static void
_widget_focus_handle(const char *name, Evas_Object *o) _widget_focus_handle(Evas_Object *o)
{ {
static char *old_source; static Evas_Object *old_object;
Evas_Object *eo;
// Some widgets aren't named (such as when in combo), so check if (old_object)
if (!name) {
return; if (old_object != o)
edje_object_signal_emit(old_object, "ecdb,focus,out", "ecdb");
}
if ((old_source) && (strcmp(old_source, name))) old_object = o;
{
eo = evas_object_name_find(ecore_evas_get(em->main_win_ee), old_source);
edje_object_signal_emit(eo, "ecdb,focus,out", "ecdb");
FREE(old_source);
old_source = strdup(name);
}
else if (!old_source)
{
old_source = strdup(name);
}
// Send focus to the freshly clicked widget // Send focus to the freshly clicked widget
evas_object_focus_set(o, 1); evas_object_focus_set(o, 1);
@ -31,20 +22,14 @@ static void
_mouse_down_edje(void *data, Evas_Object *o, const char *emission, _mouse_down_edje(void *data, Evas_Object *o, const char *emission,
const char *source) const char *source)
{ {
const char *name; _widget_focus_handle(o);
name = evas_object_name_get(o);
_widget_focus_handle(name, o);
} }
static void static void
_mouse_down_evas(void *data, Evas *e __UNUSED__, Evas_Object *eo, _mouse_down_evas(void *data, Evas *e __UNUSED__, Evas_Object *eo,
void *ev_data __UNUSED__) void *ev_data __UNUSED__)
{ {
const char *name; _widget_focus_handle(eo);
name = evas_object_name_get(eo);
_widget_focus_handle(name, eo);
} }
void void
@ -1138,7 +1123,7 @@ ecdb_config_inwin_add(Evas_Object *parent, const char *name)
return NULL; return NULL;
} }
iwd->popup = ecdb_widget_add(parent, NULL); iwd->popup = edje_object_add(evas_object_evas_get(parent));
if (!iwd->popup) if (!iwd->popup)
{ {
printf("ecdb_config_inwin_add: NULL return!\n"); printf("ecdb_config_inwin_add: NULL return!\n");