Formatting changes.
This commit is contained in:
parent
48f67e3844
commit
7207b1b406
@ -11,179 +11,179 @@ int ecdb_setup();
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int ret = 0;
|
||||
int ret = 0;
|
||||
|
||||
/* Do I really need all of these? */
|
||||
if (!ecore_init())
|
||||
{
|
||||
printf("Cannot initialize Ecore!\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!ecore_string_init())
|
||||
{
|
||||
printf("Cannot initialize Ecore_String!\n");
|
||||
ret = 1;
|
||||
goto SHUTDOWN;
|
||||
}
|
||||
/* Do I really need all of these? */
|
||||
if (!ecore_init())
|
||||
{
|
||||
printf("Cannot initialize Ecore!\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!ecore_string_init())
|
||||
{
|
||||
printf("Cannot initialize Ecore_String!\n");
|
||||
ret = 1;
|
||||
goto SHUTDOWN;
|
||||
}
|
||||
|
||||
if (!ecore_file_init())
|
||||
{
|
||||
printf("Cannot initialize Ecore_File!\n");
|
||||
ret = 1;
|
||||
goto SHUTDOWN;
|
||||
}
|
||||
if (!ecore_file_init())
|
||||
{
|
||||
printf("Cannot initialize Ecore_File!\n");
|
||||
ret = 1;
|
||||
goto SHUTDOWN;
|
||||
}
|
||||
|
||||
if (!ecore_evas_init())
|
||||
{
|
||||
printf("Cannot initialize Ecore_Evas!\n");
|
||||
ret = 1;
|
||||
goto SHUTDOWN;
|
||||
}
|
||||
if (!ecore_evas_init())
|
||||
{
|
||||
printf("Cannot initialize Ecore_Evas!\n");
|
||||
ret = 1;
|
||||
goto SHUTDOWN;
|
||||
}
|
||||
|
||||
if (!edje_init())
|
||||
{
|
||||
printf("Cannot initialize Edje!\n");
|
||||
ret = 1;
|
||||
goto SHUTDOWN;
|
||||
}
|
||||
if (!edje_init())
|
||||
{
|
||||
printf("Cannot initialize Edje!\n");
|
||||
ret = 1;
|
||||
goto SHUTDOWN;
|
||||
}
|
||||
|
||||
if (!efreet_init())
|
||||
{
|
||||
printf("Cannot initialize Efreet!\n");
|
||||
ret = 1;
|
||||
goto SHUTDOWN;
|
||||
}
|
||||
if (!efreet_init())
|
||||
{
|
||||
printf("Cannot initialize Efreet!\n");
|
||||
ret = 1;
|
||||
goto SHUTDOWN;
|
||||
}
|
||||
|
||||
if (!ewl_init(&argc, argv))
|
||||
{
|
||||
printf("Connot initialize Ewl!\n");
|
||||
ret = 1;
|
||||
goto SHUTDOWN;
|
||||
}
|
||||
if (!ewl_init(&argc, argv))
|
||||
{
|
||||
printf("Connot initialize Ewl!\n");
|
||||
ret = 1;
|
||||
goto SHUTDOWN;
|
||||
}
|
||||
|
||||
if (!ecdb_image_init())
|
||||
{
|
||||
printf("Cannot initialize libisofs!\n");
|
||||
ret = 1;
|
||||
goto SHUTDOWN;
|
||||
}
|
||||
if (!ecdb_image_init())
|
||||
{
|
||||
printf("Cannot initialize libisofs!\n");
|
||||
ret = 1;
|
||||
goto SHUTDOWN;
|
||||
}
|
||||
|
||||
if (!ecdb_burn_init())
|
||||
{
|
||||
printf("Cannot initialize libburn!\n");
|
||||
ret = 1;
|
||||
goto SHUTDOWN;
|
||||
}
|
||||
if (!ecdb_burn_init())
|
||||
{
|
||||
printf("Cannot initialize libburn!\n");
|
||||
ret = 1;
|
||||
goto SHUTDOWN;
|
||||
}
|
||||
|
||||
if (!ecdb_setup())
|
||||
{
|
||||
printf("Setup failed\n");
|
||||
ret = 1;
|
||||
goto SHUTDOWN;
|
||||
}
|
||||
if (!ecdb_setup())
|
||||
{
|
||||
printf("Setup failed\n");
|
||||
ret = 1;
|
||||
goto SHUTDOWN;
|
||||
}
|
||||
|
||||
ecdb_print_drive_info();
|
||||
|
||||
if (!ecdb_create_main_gui())
|
||||
{
|
||||
printf("Cannot create main window\n");
|
||||
ret = 1;
|
||||
goto SHUTDOWN;
|
||||
}
|
||||
ecdb_print_drive_info();
|
||||
|
||||
if (!ecdb_create_main_gui())
|
||||
{
|
||||
printf("Cannot create main window\n");
|
||||
ret = 1;
|
||||
goto SHUTDOWN;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
|
||||
Ecdb_Audio_Project *proj;
|
||||
Ecdb_Source *src;
|
||||
proj = ecdb_audio_project_new();
|
||||
Ecdb_Audio_Project *proj;
|
||||
Ecdb_Source *src;
|
||||
proj = ecdb_audio_project_new();
|
||||
|
||||
i = 1;
|
||||
while ((i < argc) && (argv))
|
||||
{
|
||||
if (ecore_file_exists(argv[i]))
|
||||
{
|
||||
if (!ecore_file_is_dir(argv[i]))
|
||||
{
|
||||
src = ecdb_source_new();
|
||||
ecdb_source_data_set(src, argv[i], 0);
|
||||
ecdb_source_child_append(proj->tracks, src);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
i = 1;
|
||||
while ((i < argc) && (argv))
|
||||
{
|
||||
if (ecore_file_exists(argv[i]))
|
||||
{
|
||||
if (!ecore_file_is_dir(argv[i]))
|
||||
{
|
||||
src = ecdb_source_new();
|
||||
ecdb_source_data_set(src, argv[i], 0);
|
||||
ecdb_source_child_append(proj->tracks, src);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
ecdb_audio_project_start(proj);
|
||||
ecdb_audio_project_start(proj);
|
||||
|
||||
proj->publisher_id = proj->data_preparer_id = proj->system_id =
|
||||
proj->application_id = proj->copywrite_id =
|
||||
proj->abstract_id = proj->biblio_id = strdup("ecdb");
|
||||
|
||||
if (!ecdb_aquire_drive(ECDB_PROJECT(proj), 0))
|
||||
{
|
||||
printf("Couldn't grab drive!\n");
|
||||
ret = 1;
|
||||
goto SHUTDOWN;
|
||||
}
|
||||
proj->publisher_id = proj->data_preparer_id = proj->system_id =
|
||||
proj->application_id = proj->copywrite_id =
|
||||
proj->abstract_id = proj->biblio_id = strdup("ecdb");
|
||||
|
||||
if (!ecdb_aquire_drive(ECDB_PROJECT(proj), 0))
|
||||
{
|
||||
printf("Couldn't grab drive!\n");
|
||||
ret = 1;
|
||||
goto SHUTDOWN;
|
||||
}
|
||||
|
||||
if (!ecdb_burn_project(proj))
|
||||
{
|
||||
printf("Burn was unsuccessful\n");
|
||||
ret = 1;
|
||||
goto SHUTDOWN;
|
||||
}
|
||||
if (!ecdb_burn_project(proj))
|
||||
{
|
||||
printf("Burn was unsuccessful\n");
|
||||
ret = 1;
|
||||
goto SHUTDOWN;
|
||||
}
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
ewl_main();
|
||||
ewl_main();
|
||||
|
||||
/* End testing */
|
||||
/* End testing */
|
||||
|
||||
SHUTDOWN:
|
||||
burn_finish();
|
||||
iso_finish();
|
||||
ewl_shutdown();
|
||||
ecore_file_shutdown();
|
||||
ecore_string_shutdown();
|
||||
ecore_evas_shutdown();
|
||||
ecore_shutdown();
|
||||
edje_shutdown();
|
||||
efreet_shutdown();
|
||||
burn_finish();
|
||||
iso_finish();
|
||||
ewl_shutdown();
|
||||
ecore_file_shutdown();
|
||||
ecore_string_shutdown();
|
||||
ecore_evas_shutdown();
|
||||
ecore_shutdown();
|
||||
edje_shutdown();
|
||||
efreet_shutdown();
|
||||
|
||||
printf("Program Done\n");
|
||||
return ret;
|
||||
printf("Program Done\n");
|
||||
return ret;
|
||||
};
|
||||
|
||||
int
|
||||
ecdb_setup(void)
|
||||
{
|
||||
em = NULL;
|
||||
em = calloc(1, sizeof(Ecdb_Main));
|
||||
em->drives = NULL;
|
||||
em->drop_object = NULL;
|
||||
em->dnd_candidates = ecore_list_new();
|
||||
em = NULL;
|
||||
em = calloc(1, sizeof(Ecdb_Main));
|
||||
em->drives = NULL;
|
||||
em->drop_object = NULL;
|
||||
em->dnd_candidates = ecore_list_new();
|
||||
|
||||
if (!ecore_file_mkdir("/tmp/ecdb"))
|
||||
printf("Creation of temporary directory failed!\n");
|
||||
if (!ecore_file_mkdir("/tmp/ecdb"))
|
||||
{
|
||||
printf("Creation of temporary directory failed!\n");
|
||||
}
|
||||
|
||||
ECDB_DRIVE_ACTION_FINISHED = ecore_event_type_new();
|
||||
ECDB_DRIVE_ACTION_BEGUN = ecore_event_type_new();
|
||||
ECDB_DRIVE_ACTION_UPDATE = ecore_event_type_new();
|
||||
ECDB_DRIVE_ACTION_FINISHED = ecore_event_type_new();
|
||||
ECDB_DRIVE_ACTION_BEGUN = ecore_event_type_new();
|
||||
ECDB_DRIVE_ACTION_UPDATE = ecore_event_type_new();
|
||||
|
||||
ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, ecdb_shutdown,
|
||||
NULL);
|
||||
ecore_event_handler_add(ECORE_X_EVENT_XDND_POSITION, ecdb_dnd_position,
|
||||
em);
|
||||
ecore_event_handler_add(ECORE_X_EVENT_XDND_DROP, ecdb_dnd_drop, em);
|
||||
ecore_event_handler_add(ECORE_X_EVENT_SELECTION_NOTIFY,
|
||||
ecdb_dnd_selection, em);
|
||||
ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, ecdb_shutdown, NULL);
|
||||
ecore_event_handler_add(ECORE_X_EVENT_XDND_POSITION, ecdb_dnd_position, em);
|
||||
ecore_event_handler_add(ECORE_X_EVENT_XDND_DROP, ecdb_dnd_drop, em);
|
||||
ecore_event_handler_add(ECORE_X_EVENT_SELECTION_NOTIFY, ecdb_dnd_selection,
|
||||
em);
|
||||
|
||||
if (!ecdb_aquire_drive_info())
|
||||
{
|
||||
printf("Aquiring drives failed!\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
if (!ecdb_aquire_drive_info())
|
||||
{
|
||||
printf("Aquiring drives failed!\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
#undef FREE
|
||||
#define FREE(dat) \
|
||||
{ \
|
||||
if (dat) { free(dat); dat = NULL; } \
|
||||
if (dat) { free(dat); dat = NULL; } \
|
||||
}
|
||||
|
||||
#undef __UNUSED__
|
||||
@ -40,11 +40,11 @@
|
||||
typedef struct _Ecdb_Main Ecdb_Main;
|
||||
struct _Ecdb_Main
|
||||
{
|
||||
char theme_path[PATH_MAX];
|
||||
Ecore_Evas *main_win_ee;
|
||||
Ecore_List *drives;
|
||||
Ecore_List *dnd_candidates;
|
||||
Evas_Object *drop_object;
|
||||
char theme_path[PATH_MAX];
|
||||
Ecore_Evas *main_win_ee;
|
||||
Ecore_List *drives;
|
||||
Ecore_List *dnd_candidates;
|
||||
Evas_Object *drop_object;
|
||||
};
|
||||
|
||||
extern Ecdb_Main *em;
|
||||
|
@ -6,94 +6,98 @@ int ecdb_audio_project_init(Ecdb_Audio_Project *proj);
|
||||
Ecdb_Audio_Project *
|
||||
ecdb_audio_project_new(void)
|
||||
{
|
||||
Ecdb_Audio_Project *proj;
|
||||
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;
|
||||
}
|
||||
proj = calloc(1, sizeof(Ecdb_Audio_Project));
|
||||
if (!proj)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
if (!ecdb_audio_project_init(proj))
|
||||
{
|
||||
FREE(proj);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return proj;
|
||||
return proj;
|
||||
}
|
||||
|
||||
int
|
||||
ecdb_audio_project_init(Ecdb_Audio_Project *proj)
|
||||
{
|
||||
if (!ecdb_project_init(ECDB_PROJECT(proj)))
|
||||
return FALSE;
|
||||
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;
|
||||
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;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
ecdb_audio_project_destroy(Ecdb_Audio_Project *proj)
|
||||
{
|
||||
ecdb_source_destroy(proj->tracks);
|
||||
ecdb_project_destroy(ECDB_PROJECT(proj));
|
||||
free(proj);
|
||||
ecdb_source_destroy(proj->tracks);
|
||||
ecdb_project_destroy(ECDB_PROJECT(proj));
|
||||
free(proj);
|
||||
}
|
||||
|
||||
void
|
||||
ecdb_audio_project_start(Ecdb_Audio_Project *proj)
|
||||
{
|
||||
char cmd[PATH_MAX]; //<-- + 20ish?
|
||||
int i;
|
||||
char cmd[PATH_MAX]; //<-- + 20ish?
|
||||
int i;
|
||||
|
||||
/* Fork off the gstreamer program for every file to be added
|
||||
* Depending on the number of files, this can be pretty system intensive, so
|
||||
* is there a way to reduce/control this ?
|
||||
*/
|
||||
for (i = 0; proj->tracks->children[i]; i++)
|
||||
{
|
||||
snprintf(cmd, PATH_MAX, "ecdb_transcode_helper %s",
|
||||
proj->tracks->children[i]->dst);
|
||||
ecore_exe_pipe_run(cmd, ECORE_EXE_PIPE_READ |
|
||||
ECORE_EXE_PIPE_READ_LINE_BUFFERED, NULL);
|
||||
}
|
||||
|
||||
proj->num_tracks = i + 1;
|
||||
ecore_event_handler_add(ECORE_EXE_EVENT_DATA, transcode_data_cb, proj);
|
||||
/* Fork off the gstreamer program for every file to be added
|
||||
* Depending on the number of files, this can be pretty system intensive, so
|
||||
* is there a way to reduce/control this ?
|
||||
*/
|
||||
for (i = 0; proj->tracks->children[i]; i++)
|
||||
{
|
||||
snprintf(cmd, PATH_MAX, "ecdb_transcode_helper %s",
|
||||
proj->tracks->children[i]->dst);
|
||||
ecore_exe_pipe_run(cmd, ECORE_EXE_PIPE_READ |
|
||||
ECORE_EXE_PIPE_READ_LINE_BUFFERED, NULL);
|
||||
}
|
||||
|
||||
proj->num_tracks = i + 1;
|
||||
ecore_event_handler_add(ECORE_EXE_EVENT_DATA, transcode_data_cb, proj);
|
||||
}
|
||||
|
||||
int
|
||||
transcode_data_cb(void *data, int type, void *event)
|
||||
{
|
||||
const char *rec;
|
||||
Ecore_Exe_Event_Data *ev = event;
|
||||
Ecdb_Audio_Project *proj = data;
|
||||
const char *rec;
|
||||
Ecore_Exe_Event_Data *ev = event;
|
||||
Ecdb_Audio_Project *proj = data;
|
||||
|
||||
rec = ev->data;
|
||||
proj->num_transcode_complete++;
|
||||
rec = ev->data;
|
||||
proj->num_transcode_complete++;
|
||||
|
||||
printf("Message: %s\n", rec);
|
||||
printf("Message: %s\n", rec);
|
||||
|
||||
if (!strcmp(rec, "EOS"))
|
||||
{
|
||||
printf("Transcode complete\n");
|
||||
proj->num_transcode_complete++;
|
||||
}
|
||||
if (!strcmp(rec, "EOS"))
|
||||
{
|
||||
printf("Transcode complete\n");
|
||||
proj->num_transcode_complete++;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Error!\n"); // How to handle these?
|
||||
}
|
||||
|
||||
/* How to handle errors? */
|
||||
else
|
||||
printf("Error!\n");
|
||||
if (proj->num_tracks == proj->num_transcode_complete)
|
||||
{
|
||||
printf("Hurrah, transcoding is done!\n");
|
||||
|
||||
/* Change to another event later */
|
||||
ecore_event_add(ECORE_EVENT_SIGNAL_EXIT, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
if (proj->num_tracks == proj->num_transcode_complete)
|
||||
{
|
||||
printf("Hurrah, transcoding is done!\n");
|
||||
|
||||
/* Change to another event later */
|
||||
ecore_event_add(ECORE_EVENT_SIGNAL_EXIT, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
#ifndef 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_destroy(Ecdb_Audio_Project *proj);
|
||||
Ecdb_Audio_Project *ecdb_audio_project_new(void);
|
||||
void ecdb_audio_project_start(Ecdb_Audio_Project *proj);
|
||||
void ecdb_audio_project_destroy(Ecdb_Audio_Project *proj);
|
||||
|
||||
#endif
|
||||
|
@ -3,18 +3,18 @@
|
||||
typedef struct Burn_Data Burn_Data;
|
||||
struct Burn_Data
|
||||
{
|
||||
BurnDisc *disc;
|
||||
BurnSession *session;
|
||||
Ecore_List *sources;
|
||||
Ecore_List *tracks;
|
||||
Ecdb_Project *proj;
|
||||
BurnDisc *disc;
|
||||
BurnSession *session;
|
||||
Ecore_List *sources;
|
||||
Ecore_List *tracks;
|
||||
Ecdb_Project *proj;
|
||||
};
|
||||
|
||||
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);
|
||||
static void ecdb_burn_progress_handler(void *data, void *buffer,
|
||||
unsigned int nbyte);
|
||||
unsigned int nbyte);
|
||||
void ecdb_sources_list_free(void *data);
|
||||
void ecdb_tracks_list_free(void *data);
|
||||
|
||||
@ -22,278 +22,282 @@ void ecdb_tracks_list_free(void *data);
|
||||
Ecdb_Burn_Project *
|
||||
ecdb_burn_project_new(void)
|
||||
{
|
||||
Ecdb_Burn_Project *proj;
|
||||
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;
|
||||
}
|
||||
proj = calloc(1, sizeof(Ecdb_Burn_Project));
|
||||
if (!proj)
|
||||
return NULL;
|
||||
if (!ecdb_burn_project_init(proj))
|
||||
{
|
||||
FREE(proj);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return proj;
|
||||
return proj;
|
||||
}
|
||||
|
||||
int
|
||||
ecdb_burn_project_init(Ecdb_Burn_Project *proj)
|
||||
{
|
||||
if (!ecdb_project_init(ECDB_PROJECT(proj)))
|
||||
return FALSE;
|
||||
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->files = ecdb_source_new();
|
||||
/* 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->files = ecdb_source_new();
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
ecdb_burn_project_destroy(Ecdb_Burn_Project *proj)
|
||||
{
|
||||
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);
|
||||
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
|
||||
ecdb_burn_project(Ecdb_Burn_Project *proj)
|
||||
{
|
||||
char reasons[BURN_REASONS_LEN];
|
||||
int padding, i;
|
||||
Burn_Data *data;
|
||||
BurnTrack *track;
|
||||
BurnSource *source;
|
||||
BurnWriteOpts *opts;
|
||||
pthread_t progress_update;
|
||||
char reasons[BURN_REASONS_LEN];
|
||||
int padding, i;
|
||||
Burn_Data *data;
|
||||
BurnTrack *track;
|
||||
BurnSource *source;
|
||||
BurnWriteOpts *opts;
|
||||
pthread_t progress_update;
|
||||
|
||||
i = 0;
|
||||
data = calloc(1, sizeof(Burn_Data));
|
||||
if (!data)
|
||||
{
|
||||
printf("Error: Cannot create burn data structure!\n");
|
||||
return FALSE;
|
||||
}
|
||||
data->proj = ECDB_PROJECT(proj);
|
||||
data->sources = ecore_list_new();
|
||||
data->tracks = ecore_list_new();
|
||||
ecore_list_free_cb_set(data->sources, ecdb_sources_list_free);
|
||||
ecore_list_free_cb_set(data->tracks, ecdb_tracks_list_free);
|
||||
i = 0;
|
||||
data = calloc(1, sizeof(Burn_Data));
|
||||
if (!data)
|
||||
{
|
||||
printf("Error: Cannot create burn data structure!\n");
|
||||
return FALSE;
|
||||
}
|
||||
data->proj = ECDB_PROJECT(proj);
|
||||
data->sources = ecore_list_new();
|
||||
data->tracks = ecore_list_new();
|
||||
ecore_list_free_cb_set(data->sources, ecdb_sources_list_free);
|
||||
ecore_list_free_cb_set(data->tracks, ecdb_tracks_list_free);
|
||||
|
||||
if (proj->burn_mode != BURN_AUDIO)
|
||||
padding = 300*1024;
|
||||
if (proj->burn_mode != BURN_AUDIO)
|
||||
padding = 300*1024;
|
||||
|
||||
data->disc = burn_disc_create();
|
||||
data->session = burn_session_create();
|
||||
burn_disc_add_session(data->disc, data->session, BURN_POS_END);
|
||||
data->disc = burn_disc_create();
|
||||
data->session = burn_session_create();
|
||||
burn_disc_add_session(data->disc, data->session, BURN_POS_END);
|
||||
|
||||
track = burn_track_create();
|
||||
burn_track_define_data(track, 0, padding, 1, proj->burn_mode);
|
||||
track = burn_track_create();
|
||||
burn_track_define_data(track, 0, padding, 1, proj->burn_mode);
|
||||
|
||||
source = ecdb_image_project(proj);
|
||||
if (!source)
|
||||
{
|
||||
printf("Failed to add any files to burn disc!\n");
|
||||
burn_session_free(data->session);
|
||||
burn_disc_free(data->disc);
|
||||
ecore_list_destroy(data->sources);
|
||||
ecore_list_destroy(data->tracks);
|
||||
FREE(data);
|
||||
return ECDB_ERROR_IMAGE_CREATE;
|
||||
}
|
||||
source = ecdb_image_project(proj);
|
||||
if (!source)
|
||||
{
|
||||
printf("Failed to add any files to burn disc!\n");
|
||||
burn_session_free(data->session);
|
||||
burn_disc_free(data->disc);
|
||||
ecore_list_destroy(data->sources);
|
||||
ecore_list_destroy(data->tracks);
|
||||
FREE(data);
|
||||
return ECDB_ERROR_IMAGE_CREATE;
|
||||
}
|
||||
|
||||
if (burn_track_set_source(track, source) != BURN_SOURCE_OK)
|
||||
{
|
||||
printf("Error: Cannot attach source object to track "
|
||||
"object!\n");
|
||||
burn_session_free(data->session);
|
||||
burn_disc_free(data->disc);
|
||||
ecore_list_destroy(data->sources);
|
||||
ecore_list_destroy(data->tracks);
|
||||
FREE(data);
|
||||
return ECDB_ERROR_SOURCE_ATTACH;
|
||||
}
|
||||
if (burn_track_set_source(track, source) != BURN_SOURCE_OK)
|
||||
{
|
||||
printf("Error: Cannot attach source object to track object!\n");
|
||||
burn_session_free(data->session);
|
||||
burn_disc_free(data->disc);
|
||||
ecore_list_destroy(data->sources);
|
||||
ecore_list_destroy(data->tracks);
|
||||
FREE(data);
|
||||
return ECDB_ERROR_SOURCE_ATTACH;
|
||||
}
|
||||
|
||||
burn_session_add_track(data->session, track, BURN_POS_END);
|
||||
ecore_list_append(data->sources, source);
|
||||
ecore_list_append(data->tracks, track);
|
||||
burn_session_add_track(data->session, track, BURN_POS_END);
|
||||
ecore_list_append(data->sources, source);
|
||||
ecore_list_append(data->tracks, track);
|
||||
|
||||
opts = burn_write_opts_new(ECDB_PROJECT(proj)->drive->
|
||||
tangible[0].drive);
|
||||
burn_write_opts_set_perform_opc(opts, proj->opc);
|
||||
burn_write_opts_set_multi(opts, proj->multi);
|
||||
if (proj->simulate)
|
||||
printf("Simulating Burn!\n");
|
||||
burn_write_opts_set_simulate(opts, proj->simulate);
|
||||
burn_drive_set_speed(ECDB_PROJECT(proj)->drive->tangible->drive, 0,
|
||||
proj->speed);
|
||||
burn_write_opts_set_underrun_proof(opts, proj->underrun_proof);
|
||||
opts = burn_write_opts_new(ECDB_PROJECT(proj)->drive->tangible[0].drive);
|
||||
burn_write_opts_set_perform_opc(opts, proj->opc);
|
||||
burn_write_opts_set_multi(opts, proj->multi);
|
||||
if (proj->simulate)
|
||||
{
|
||||
printf("Simulating Burn!\n");
|
||||
}
|
||||
burn_write_opts_set_simulate(opts, proj->simulate);
|
||||
burn_drive_set_speed(ECDB_PROJECT(proj)->drive->tangible->drive, 0,
|
||||
proj->speed);
|
||||
burn_write_opts_set_underrun_proof(opts, proj->underrun_proof);
|
||||
|
||||
printf("Searching for burn mode\n");
|
||||
if (burn_write_opts_auto_write_type(opts, data->disc, reasons, 0)
|
||||
== BURN_WRITE_NONE)
|
||||
{
|
||||
printf("Error: Failed to find a suitable write mode for "
|
||||
"disc!\n");
|
||||
burn_session_free(data->session);
|
||||
burn_disc_free(data->disc);
|
||||
burn_write_opts_free(opts);
|
||||
ecore_list_destroy(data->sources);
|
||||
ecore_list_destroy(data->tracks);
|
||||
FREE(proj);
|
||||
return ECDB_ERROR_WRITE_MODE;
|
||||
}
|
||||
printf("Searching for burn mode\n");
|
||||
if (burn_write_opts_auto_write_type(opts, data->disc, reasons, 0)
|
||||
== BURN_WRITE_NONE)
|
||||
{
|
||||
printf("Error: Failed to find a suitable write mode for disc!\n");
|
||||
burn_session_free(data->session);
|
||||
burn_disc_free(data->disc);
|
||||
burn_write_opts_free(opts);
|
||||
ecore_list_destroy(data->sources);
|
||||
ecore_list_destroy(data->tracks);
|
||||
FREE(proj);
|
||||
return ECDB_ERROR_WRITE_MODE;
|
||||
}
|
||||
|
||||
burn_disc_write(opts, data->disc);
|
||||
burn_write_opts_free(opts);
|
||||
burn_disc_write(opts, data->disc);
|
||||
burn_write_opts_free(opts);
|
||||
|
||||
printf("Disc now burning\n");
|
||||
ECDB_PROJECT(proj)->pipe = ecore_pipe_add(ecdb_burn_progress_handler,
|
||||
NULL);
|
||||
pthread_create(&progress_update, NULL, ecdb_drive_progress_update,
|
||||
proj);
|
||||
pthread_detach(progress_update);
|
||||
ECDB_PROJECT(proj)->ev_handler = ecore_event_handler_add
|
||||
(ECDB_DRIVE_ACTION_FINISHED, ecdb_burn_finished,
|
||||
data);
|
||||
printf("Disc now burning\n");
|
||||
ECDB_PROJECT(proj)->pipe = ecore_pipe_add(ecdb_burn_progress_handler, NULL);
|
||||
pthread_create(&progress_update, NULL, ecdb_drive_progress_update, proj);
|
||||
pthread_detach(progress_update);
|
||||
ECDB_PROJECT(proj)->ev_handler = ecore_event_handler_add
|
||||
(ECDB_DRIVE_ACTION_FINISHED, ecdb_burn_finished, data);
|
||||
|
||||
return ECDB_ERROR_NONE;
|
||||
return ECDB_ERROR_NONE;
|
||||
}
|
||||
|
||||
/* This function is pretty naive... Should probably update it at some time */
|
||||
void *
|
||||
ecdb_drive_progress_update(void *data)
|
||||
{
|
||||
const Ecdb_Project *proj;
|
||||
BurnProgress p;
|
||||
struct burn_drive *drive;
|
||||
const Ecdb_Project *proj;
|
||||
BurnProgress p;
|
||||
struct burn_drive *drive;
|
||||
|
||||
proj = data;
|
||||
proj = data;
|
||||
|
||||
if (!proj->drive->tangible)
|
||||
{
|
||||
printf("No tangible drive!\n");
|
||||
ecore_pipe_del(proj->pipe);
|
||||
/* Call failure here */
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
drive = proj->drive->tangible[0].drive;
|
||||
if (!proj->drive->tangible)
|
||||
{
|
||||
printf("No tangible drive!\n");
|
||||
ecore_pipe_del(proj->pipe);
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
drive = proj->drive->tangible[0].drive;
|
||||
|
||||
printf("Progress update active\n");
|
||||
while (burn_drive_get_status(drive, NULL) == BURN_DRIVE_SPAWNING)
|
||||
usleep(100000);
|
||||
printf("Progress update active\n");
|
||||
while (burn_drive_get_status(drive, NULL) == BURN_DRIVE_SPAWNING)
|
||||
{
|
||||
usleep(100000);
|
||||
}
|
||||
|
||||
while (burn_drive_get_status(drive, &p) != BURN_DRIVE_IDLE)
|
||||
{
|
||||
if (p.sectors > 0)
|
||||
ecore_pipe_write(proj->pipe, &p, sizeof(p));
|
||||
usleep(100000);
|
||||
}
|
||||
while (burn_drive_get_status(drive, &p) != BURN_DRIVE_IDLE)
|
||||
{
|
||||
if (p.sectors > 0)
|
||||
{
|
||||
ecore_pipe_write(proj->pipe, &p, sizeof(p));
|
||||
}
|
||||
usleep(100000);
|
||||
}
|
||||
|
||||
ecore_pipe_write(proj->pipe, "AC", sizeof("AC"));
|
||||
ecore_pipe_del(proj->pipe);
|
||||
/* Call the finished event handler here */
|
||||
pthread_exit(NULL);
|
||||
ecore_pipe_write(proj->pipe, "AC", sizeof("AC"));
|
||||
ecore_pipe_del(proj->pipe);
|
||||
/* Call the finished event handler here */
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
ecdb_burn_progress_handler(void *data, void *buffer, unsigned int nbyte)
|
||||
{
|
||||
BurnProgress *p;
|
||||
Evas_Object *swallow;
|
||||
char buf[1024];
|
||||
static int last_sector = 0;
|
||||
BurnProgress *p;
|
||||
Evas_Object *swallow;
|
||||
char buf[1024];
|
||||
static int last_sector = 0;
|
||||
|
||||
if ((nbyte != sizeof(BurnProgress)) || (!strcmp((char *)buffer, "AC")))
|
||||
{
|
||||
ecore_event_add(ECDB_DRIVE_ACTION_FINISHED, NULL, NULL, NULL);
|
||||
last_sector = 0;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
p = buffer;
|
||||
}
|
||||
if ((nbyte != sizeof(BurnProgress)) || (!strcmp((char *)buffer, "AC")))
|
||||
{
|
||||
ecore_event_add(ECDB_DRIVE_ACTION_FINISHED, NULL, NULL, NULL);
|
||||
last_sector = 0;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
p = buffer;
|
||||
}
|
||||
|
||||
|
||||
/* Libburn reports p->sector as being 0 right at the end of the job,
|
||||
* so store the last sector and use that to determine the proper
|
||||
* percentage/sector to set
|
||||
*/
|
||||
if (last_sector <= p->sector)
|
||||
last_sector = p->sector;
|
||||
else
|
||||
last_sector = p->sectors;
|
||||
/* Libburn reports p->sector as being 0 right at the end of the job,
|
||||
* so store the last sector and use that to determine the proper
|
||||
* percentage/sector to set
|
||||
*/
|
||||
if (last_sector <= p->sector)
|
||||
{
|
||||
last_sector = p->sector;
|
||||
}
|
||||
else
|
||||
{
|
||||
last_sector = p->sectors;
|
||||
}
|
||||
|
||||
swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee),
|
||||
"burn_image_page");
|
||||
snprintf(buf, sizeof(buf), "%d/%d", last_sector, p->sectors);
|
||||
edje_object_part_text_set(swallow, "progress_text", buf);
|
||||
snprintf(buf, sizeof(buf), "%d%%", (int)((double)(last_sector + 1) /
|
||||
(double)p->sectors * 100.0));
|
||||
edje_object_part_text_set(swallow, "progress_percent", buf);
|
||||
swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee),
|
||||
"burn_image_page");
|
||||
snprintf(buf, sizeof(buf), "%d/%d", last_sector, p->sectors);
|
||||
edje_object_part_text_set(swallow, "progress_text", buf);
|
||||
snprintf(buf, sizeof(buf), "%d%%", (int)((double)(last_sector + 1) /
|
||||
(double)p->sectors * 100.0));
|
||||
edje_object_part_text_set(swallow, "progress_percent", buf);
|
||||
}
|
||||
|
||||
int
|
||||
ecdb_burn_finished(void *data, int type, void *event)
|
||||
{
|
||||
Burn_Data *proj;
|
||||
Burn_Data *proj;
|
||||
|
||||
proj = data;
|
||||
proj = data;
|
||||
|
||||
printf("Freeing source and tracks\n");
|
||||
ecore_list_destroy(proj->sources);
|
||||
ecore_list_destroy(proj->tracks);
|
||||
printf("Freeing source and tracks\n");
|
||||
ecore_list_destroy(proj->sources);
|
||||
ecore_list_destroy(proj->tracks);
|
||||
|
||||
printf("Freeing session and disc\n");
|
||||
burn_session_free(proj->session);
|
||||
burn_disc_free(proj->disc);
|
||||
printf("Freeing session and disc\n");
|
||||
burn_session_free(proj->session);
|
||||
burn_disc_free(proj->disc);
|
||||
|
||||
printf("Releasing drive\n");
|
||||
burn_drive_release(proj->proj->drive->tangible[0].drive, 1);
|
||||
burn_drive_info_free(proj->proj->drive->tangible);
|
||||
printf("Burn Complete\n");
|
||||
printf("Releasing drive\n");
|
||||
burn_drive_release(proj->proj->drive->tangible[0].drive, 1);
|
||||
burn_drive_info_free(proj->proj->drive->tangible);
|
||||
printf("Burn Complete\n");
|
||||
|
||||
ecore_event_handler_del(proj->proj->ev_handler);
|
||||
ecore_event_handler_del(proj->proj->ev_handler);
|
||||
|
||||
switch (proj->proj->type)
|
||||
{
|
||||
case ECDB_AUDIO_PROJECT:
|
||||
ecdb_audio_project_destroy(ECDB_AUDIO(proj->proj));
|
||||
break;
|
||||
default:
|
||||
ecdb_burn_project_destroy(ECDB_BURN(proj->proj));
|
||||
}
|
||||
FREE(proj);
|
||||
switch (proj->proj->type)
|
||||
{
|
||||
case ECDB_AUDIO_PROJECT:
|
||||
ecdb_audio_project_destroy(ECDB_AUDIO(proj->proj));
|
||||
break;
|
||||
|
||||
ecdb_gui_burn_image_cleanup();
|
||||
default:
|
||||
ecdb_burn_project_destroy(ECDB_BURN(proj->proj));
|
||||
}
|
||||
FREE(proj);
|
||||
|
||||
return TRUE;
|
||||
ecdb_gui_burn_image_cleanup();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
ecdb_sources_list_free(void *data)
|
||||
{
|
||||
burn_source_free(data);
|
||||
burn_source_free(data);
|
||||
}
|
||||
|
||||
void
|
||||
ecdb_tracks_list_free(void *data)
|
||||
{
|
||||
burn_track_free(data);
|
||||
burn_track_free(data);
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
#ifndef ECDB_BURN_H
|
||||
#define ECDB_BURN_H
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
#endif
|
||||
|
@ -14,60 +14,60 @@ typedef enum burn_drive_status BurnDriveStatus;
|
||||
typedef enum _Ecdb_Project_Type Ecdb_Project_Type;
|
||||
enum _Ecdb_Project_Type
|
||||
{
|
||||
ECDB_BURN_PROJECT,
|
||||
ECDB_AUDIO_PROJECT,
|
||||
ECDB_ERASE_PROJECT,
|
||||
ECDB_COPY_PROJECT,
|
||||
ECDB_IMAGE_PROJECT
|
||||
ECDB_BURN_PROJECT,
|
||||
ECDB_AUDIO_PROJECT,
|
||||
ECDB_ERASE_PROJECT,
|
||||
ECDB_COPY_PROJECT,
|
||||
ECDB_IMAGE_PROJECT
|
||||
};
|
||||
|
||||
typedef enum _Ecdb_Burn_Result Ecdb_Burn_Result;
|
||||
enum _Ecdb_Burn_Result
|
||||
{
|
||||
ECDB_ERROR_IMAGE_CREATE,
|
||||
ECDB_ERROR_SOURCE_ATTACH,
|
||||
ECDB_ERROR_WRITE_MODE,
|
||||
ECDB_ERROR_NONE
|
||||
ECDB_ERROR_IMAGE_CREATE,
|
||||
ECDB_ERROR_SOURCE_ATTACH,
|
||||
ECDB_ERROR_WRITE_MODE,
|
||||
ECDB_ERROR_NONE
|
||||
};
|
||||
|
||||
typedef struct _Ecdb_Drive_Info Ecdb_Drive_Info;
|
||||
struct _Ecdb_Drive_Info
|
||||
{
|
||||
/* Speeds */
|
||||
int *read_speeds;
|
||||
int *write_speeds;
|
||||
/* Speeds */
|
||||
int *read_speeds;
|
||||
int *write_speeds;
|
||||
|
||||
/* Profiles */
|
||||
char *profile_name;
|
||||
int profile_loaded;
|
||||
/* Profiles */
|
||||
char *profile_name;
|
||||
int profile_loaded;
|
||||
|
||||
/* Drive info */
|
||||
char *vendor;
|
||||
char *product;
|
||||
char *revision;
|
||||
char *location;
|
||||
/* Drive info */
|
||||
char *vendor;
|
||||
char *product;
|
||||
char *revision;
|
||||
char *location;
|
||||
|
||||
unsigned char read_dvdram:1;
|
||||
unsigned char read_dvdr:1;
|
||||
unsigned char read_dvdrom:1;
|
||||
unsigned char read_cdr:1;
|
||||
unsigned char read_cdrw:1;
|
||||
unsigned char write_dvdram:1;
|
||||
unsigned char write_dvdr:1;
|
||||
unsigned char write_cdr:1;
|
||||
unsigned char write_simulate:1;
|
||||
unsigned char read_dvdram:1;
|
||||
unsigned char read_dvdr:1;
|
||||
unsigned char read_dvdrom:1;
|
||||
unsigned char read_cdr:1;
|
||||
unsigned char read_cdrw:1;
|
||||
unsigned char write_dvdram:1;
|
||||
unsigned char write_dvdr:1;
|
||||
unsigned char write_cdr:1;
|
||||
unsigned char write_simulate:1;
|
||||
|
||||
BurnDriveInfo *tangible;
|
||||
BurnDriveInfo *tangible;
|
||||
};
|
||||
|
||||
typedef struct _Ecdb_Project_Info Ecdb_Project;
|
||||
struct _Ecdb_Project_Info
|
||||
{
|
||||
/* The drive reference */
|
||||
Ecdb_Drive_Info *drive;
|
||||
Ecore_Event_Handler *ev_handler;
|
||||
Ecore_Pipe *pipe;
|
||||
unsigned int type;
|
||||
/* The drive reference */
|
||||
Ecdb_Drive_Info *drive;
|
||||
Ecore_Event_Handler *ev_handler;
|
||||
Ecore_Pipe *pipe;
|
||||
unsigned int type;
|
||||
};
|
||||
|
||||
/* Typecast a pointer to an Ecdb_Source */
|
||||
@ -76,12 +76,12 @@ struct _Ecdb_Project_Info
|
||||
typedef struct _Ecdb_Source Ecdb_Source;
|
||||
struct _Ecdb_Source
|
||||
{
|
||||
const char *dst;
|
||||
unsigned char dir:1;
|
||||
unsigned int num_children;
|
||||
Ecdb_Source **children;
|
||||
Ecdb_Source *parent;
|
||||
IsoNode *node;
|
||||
const char *dst;
|
||||
unsigned char dir:1;
|
||||
unsigned int num_children;
|
||||
Ecdb_Source **children;
|
||||
Ecdb_Source *parent;
|
||||
IsoNode *node;
|
||||
};
|
||||
|
||||
/* Typecast a pointer to an Ecdb_Project */
|
||||
@ -90,42 +90,42 @@ struct _Ecdb_Source
|
||||
typedef struct _Ecdb_Burn_Project Ecdb_Burn_Project;
|
||||
struct _Ecdb_Burn_Project
|
||||
{
|
||||
/* Inherit from normal project */
|
||||
Ecdb_Project proj;
|
||||
/* Inherit from normal project */
|
||||
Ecdb_Project proj;
|
||||
|
||||
/* Files are important here */
|
||||
Ecdb_Source *files;
|
||||
/* Files are important here */
|
||||
Ecdb_Source *files;
|
||||
|
||||
/* 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;
|
||||
/* 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 */
|
||||
unsigned char iso_level:1;
|
||||
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;
|
||||
/* iso options */
|
||||
unsigned char iso_level:1;
|
||||
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 */
|
||||
unsigned char opc:1;
|
||||
unsigned char multi:1;
|
||||
unsigned char simulate:1;
|
||||
unsigned char underrun_proof:1;
|
||||
int speed;
|
||||
/* burn options */
|
||||
unsigned char opc:1;
|
||||
unsigned char multi:1;
|
||||
unsigned char simulate:1;
|
||||
unsigned char underrun_proof:1;
|
||||
int speed;
|
||||
|
||||
/* burn stuff */
|
||||
int fifo_chunksize;
|
||||
int fifo_chunks;
|
||||
int burn_mode;
|
||||
/* burn stuff */
|
||||
int fifo_chunksize;
|
||||
int fifo_chunks;
|
||||
int burn_mode;
|
||||
};
|
||||
|
||||
/* Typecast a pointer to an Ecdb_Burn_Project */
|
||||
@ -134,13 +134,13 @@ struct _Ecdb_Burn_Project
|
||||
typedef struct _Ecdb_Audio_Project Ecdb_Audio_Project;
|
||||
struct _Ecdb_Audio_Project
|
||||
{
|
||||
/* Inherit from normal project */
|
||||
Ecdb_Project proj;
|
||||
/* Inherit from normal project */
|
||||
Ecdb_Project proj;
|
||||
|
||||
/* Audio tracks */
|
||||
Ecdb_Source *tracks;
|
||||
int num_tracks;
|
||||
int num_transcode_complete;
|
||||
/* Audio tracks */
|
||||
Ecdb_Source *tracks;
|
||||
int num_tracks;
|
||||
int num_transcode_complete;
|
||||
};
|
||||
|
||||
/* Typecast a pointer to an Ecdb_Audio_Project */
|
||||
@ -149,12 +149,12 @@ struct _Ecdb_Audio_Project
|
||||
typedef struct _Ecdb_Erase_Project Ecdb_Erase_Project;
|
||||
struct _Ecdb_Erase_Project
|
||||
{
|
||||
/* Inherit from normal project */
|
||||
Ecdb_Project proj;
|
||||
/* Inherit from normal project */
|
||||
Ecdb_Project proj;
|
||||
|
||||
/* Speed */
|
||||
unsigned char quick:1;
|
||||
unsigned char format:1;
|
||||
/* Speed */
|
||||
unsigned char quick:1;
|
||||
unsigned char format:1;
|
||||
};
|
||||
|
||||
/* Typecast a pointer to an Ecdb_Erase_Project */
|
||||
|
@ -5,159 +5,169 @@ void ecdb_drive_info_free_cb(void *data);
|
||||
int
|
||||
ecdb_aquire_drive_info(void)
|
||||
{
|
||||
int ret, i;
|
||||
unsigned int drive_num;
|
||||
struct burn_drive_info *drives_current;
|
||||
struct burn_speed_descriptor *speeds;
|
||||
int ret, i;
|
||||
unsigned int drive_num;
|
||||
struct burn_drive_info *drives_current;
|
||||
struct burn_speed_descriptor *speeds;
|
||||
|
||||
ret = 0;
|
||||
if (em->drives)
|
||||
ecore_list_destroy(em->drives);
|
||||
ret = 0;
|
||||
if (em->drives)
|
||||
{
|
||||
ecore_list_destroy(em->drives);
|
||||
}
|
||||
|
||||
em->drives = ecore_list_new();
|
||||
ecore_list_free_cb_set(em->drives, ecdb_drive_info_free_cb);
|
||||
em->drives = ecore_list_new();
|
||||
ecore_list_free_cb_set(em->drives, ecdb_drive_info_free_cb);
|
||||
|
||||
while (!ret)
|
||||
ret = burn_drive_scan(&drives_current, &drive_num);
|
||||
while (!ret)
|
||||
{
|
||||
ret = burn_drive_scan(&drives_current, &drive_num);
|
||||
}
|
||||
|
||||
for (i = 0; i < drive_num; i++)
|
||||
{
|
||||
Ecdb_Drive_Info *drive;
|
||||
for (i = 0; i < drive_num; i++)
|
||||
{
|
||||
Ecdb_Drive_Info *drive;
|
||||
|
||||
drive = calloc(1, sizeof(Ecdb_Drive_Info));
|
||||
drive = calloc(1, sizeof(Ecdb_Drive_Info));
|
||||
|
||||
if (!drive)
|
||||
return FALSE;
|
||||
if (!drive)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* It would be nice if there was an easier way to do this */
|
||||
drive->product = strdup(drives_current[i].product);
|
||||
drive->vendor = strdup(drives_current[i].vendor);
|
||||
drive->revision = strdup(drives_current[i].revision);
|
||||
drive->location = strdup(drives_current[i].location);
|
||||
drive->read_dvdram = drives_current[i].read_dvdram;
|
||||
drive->read_dvdr = drives_current[i].read_dvdr;
|
||||
drive->read_dvdrom = drives_current[i].read_dvdrom;
|
||||
drive->read_cdr = drives_current[i].read_cdr;
|
||||
drive->read_cdrw = drives_current[i].read_cdrw;
|
||||
drive->write_dvdram = drives_current[i].write_dvdram;
|
||||
drive->write_dvdr = drives_current[i].write_dvdr;
|
||||
drive->write_cdr = drives_current[i].write_cdr;
|
||||
drive->write_simulate = drives_current[i].write_simulate;
|
||||
/* It would be nice if there was an easier way to do this */
|
||||
drive->product = strdup(drives_current[i].product);
|
||||
drive->vendor = strdup(drives_current[i].vendor);
|
||||
drive->revision = strdup(drives_current[i].revision);
|
||||
drive->location = strdup(drives_current[i].location);
|
||||
drive->read_dvdram = drives_current[i].read_dvdram;
|
||||
drive->read_dvdr = drives_current[i].read_dvdr;
|
||||
drive->read_dvdrom = drives_current[i].read_dvdrom;
|
||||
drive->read_cdr = drives_current[i].read_cdr;
|
||||
drive->read_cdrw = drives_current[i].read_cdrw;
|
||||
drive->write_dvdram = drives_current[i].write_dvdram;
|
||||
drive->write_dvdr = drives_current[i].write_dvdr;
|
||||
drive->write_cdr = drives_current[i].write_cdr;
|
||||
drive->write_simulate = drives_current[i].write_simulate;
|
||||
|
||||
burn_drive_get_speedlist(drives_current[i].drive, &speeds);
|
||||
burn_drive_get_speedlist(drives_current[i].drive, &speeds);
|
||||
|
||||
drive->profile_name = strdup(speeds->profile_name);
|
||||
drive->profile_loaded = speeds->profile_loaded;
|
||||
drive->profile_name = strdup(speeds->profile_name);
|
||||
drive->profile_loaded = speeds->profile_loaded;
|
||||
|
||||
while (speeds->next)
|
||||
{
|
||||
i++;
|
||||
speeds = speeds->next;
|
||||
}
|
||||
while (speeds->next)
|
||||
{
|
||||
i++;
|
||||
speeds = speeds->next;
|
||||
}
|
||||
|
||||
drive->read_speeds = calloc(i + 2, sizeof(int));
|
||||
drive->write_speeds = calloc(i + 2, sizeof(int));
|
||||
drive->read_speeds = calloc(i + 2, sizeof(int));
|
||||
drive->write_speeds = calloc(i + 2, sizeof(int));
|
||||
|
||||
drive->read_speeds[0] = i + 1;
|
||||
drive->write_speeds[0] = i + 1;
|
||||
drive->read_speeds[0] = i + 1;
|
||||
drive->write_speeds[0] = i + 1;
|
||||
|
||||
for (ret = 1; ret <= i; ret++)
|
||||
{
|
||||
drive->write_speeds[ret] = speeds->write_speed;
|
||||
drive->read_speeds[ret] = speeds->read_speed;
|
||||
speeds = speeds->prev;
|
||||
}
|
||||
for (ret = 1; ret <= i; ret++)
|
||||
{
|
||||
drive->write_speeds[ret] = speeds->write_speed;
|
||||
drive->read_speeds[ret] = speeds->read_speed;
|
||||
speeds = speeds->prev;
|
||||
}
|
||||
|
||||
burn_drive_free_speedlist(&speeds);
|
||||
ecore_list_append(em->drives, drive);
|
||||
}
|
||||
burn_drive_free_speedlist(&speeds);
|
||||
ecore_list_append(em->drives, drive);
|
||||
}
|
||||
|
||||
burn_drive_info_free(drives_current);
|
||||
burn_drive_info_free(drives_current);
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
ecdb_drive_info_free_cb(void *data)
|
||||
{
|
||||
Ecdb_Drive_Info *info;
|
||||
Ecdb_Drive_Info *info;
|
||||
|
||||
info = data;
|
||||
info = data;
|
||||
|
||||
FREE(info->read_speeds);
|
||||
FREE(info->write_speeds);
|
||||
FREE(info->vendor);
|
||||
FREE(info->product);
|
||||
FREE(info->revision);
|
||||
FREE(info->location);
|
||||
FREE(info->profile_name);
|
||||
FREE(info);
|
||||
FREE(info->read_speeds);
|
||||
FREE(info->write_speeds);
|
||||
FREE(info->vendor);
|
||||
FREE(info->product);
|
||||
FREE(info->revision);
|
||||
FREE(info->location);
|
||||
FREE(info->profile_name);
|
||||
FREE(info);
|
||||
}
|
||||
|
||||
void
|
||||
ecdb_print_drive_info(void)
|
||||
{
|
||||
Ecdb_Drive_Info *drive;
|
||||
int j, i, h;
|
||||
Ecdb_Drive_Info *drive;
|
||||
int j, i, h;
|
||||
|
||||
ecore_list_first_goto(em->drives);
|
||||
while ((drive = ecore_list_next(em->drives)))
|
||||
{
|
||||
printf("Vendor: %s, Product: %s, Revision: %s, "
|
||||
"Location: %s\n",
|
||||
drive->vendor, drive->product,
|
||||
drive->revision, drive->location);
|
||||
printf("Profile name: %s, Loaded: %d\n",
|
||||
drive->profile_name,
|
||||
drive->profile_loaded);
|
||||
printf("Read DVDRAM: %d, Read DVDR: %d, Read DVDROM: %d, "
|
||||
"Read CDR: %d, Read CDRW: %d\n",
|
||||
drive->read_dvdram,
|
||||
drive->read_dvdr,
|
||||
drive->read_dvdrom,
|
||||
drive->read_cdr,
|
||||
drive->read_cdrw);
|
||||
printf("Write DVDRAM: %d, Write DVDR: %d, Write CDR: %d, "
|
||||
"Write Simulate: %d\n",
|
||||
drive->write_dvdram,
|
||||
drive->write_dvdr,
|
||||
drive->write_cdr,
|
||||
drive->write_simulate);
|
||||
ecore_list_first_goto(em->drives);
|
||||
while ((drive = ecore_list_next(em->drives)))
|
||||
{
|
||||
printf("Vendor: %s, Product: %s, Revision: %s, "
|
||||
"Location: %s\n",
|
||||
drive->vendor, drive->product,
|
||||
drive->revision, drive->location);
|
||||
printf("Profile name: %s, Loaded: %d\n",
|
||||
drive->profile_name,
|
||||
drive->profile_loaded);
|
||||
printf("Read DVDRAM: %d, Read DVDR: %d, Read DVDROM: %d, "
|
||||
"Read CDR: %d, Read CDRW: %d\n",
|
||||
drive->read_dvdram,
|
||||
drive->read_dvdr,
|
||||
drive->read_dvdrom,
|
||||
drive->read_cdr,
|
||||
drive->read_cdrw);
|
||||
printf("Write DVDRAM: %d, Write DVDR: %d, Write CDR: %d, "
|
||||
"Write Simulate: %d\n",
|
||||
drive->write_dvdram,
|
||||
drive->write_dvdr,
|
||||
drive->write_cdr,
|
||||
drive->write_simulate);
|
||||
|
||||
j = drive->read_speeds[0];
|
||||
j = drive->read_speeds[0];
|
||||
|
||||
for (i = 1; i < j; i ++)
|
||||
{
|
||||
if ((h = drive->write_speeds[i]))
|
||||
printf("Write: %d\n", h);
|
||||
if ((h = drive->read_speeds[i]))
|
||||
printf("Read: %d\n", h);
|
||||
}
|
||||
}
|
||||
for (i = 1; i < j; i ++)
|
||||
{
|
||||
if ((h = drive->write_speeds[i]))
|
||||
{
|
||||
printf("Write: %d\n", h);
|
||||
}
|
||||
if ((h = drive->read_speeds[i]))
|
||||
{
|
||||
printf("Read: %d\n", h);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
ecdb_aquire_drive(Ecdb_Project *proj, unsigned int idx)
|
||||
{
|
||||
Ecdb_Drive_Info *info;
|
||||
char adr[BURN_DRIVE_ADR_LEN];
|
||||
Ecdb_Drive_Info *info;
|
||||
char adr[BURN_DRIVE_ADR_LEN];
|
||||
|
||||
info = ecore_list_index_goto(em->drives, idx);
|
||||
if (burn_drive_convert_fs_adr(info->location, adr) <= 0)
|
||||
{
|
||||
printf("Error: Address doesn't provide cd burner!\n");
|
||||
return FALSE;
|
||||
}
|
||||
info = ecore_list_index_goto(em->drives, idx);
|
||||
if (burn_drive_convert_fs_adr(info->location, adr) <= 0)
|
||||
{
|
||||
printf("Error: Address doesn't provide cd burner!\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (burn_drive_scan_and_grab(&info->tangible, adr, 1) > 0)
|
||||
{
|
||||
proj->drive = info;
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
info->tangible = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
if (burn_drive_scan_and_grab(&info->tangible, adr, 1) > 0)
|
||||
{
|
||||
proj->drive = info;
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
info->tangible = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
#ifndef ECDB_DRIVES_H
|
||||
#define ECDB_DRIVES_H
|
||||
|
||||
int ecdb_aquire_drive_info(void);
|
||||
void ecdb_print_drive_info(void);
|
||||
int ecdb_aquire_drive(Ecdb_Project *proj, unsigned int idx);
|
||||
int ecdb_aquire_drive_info(void);
|
||||
void ecdb_print_drive_info(void);
|
||||
int ecdb_aquire_drive(Ecdb_Project *proj, unsigned int idx);
|
||||
|
||||
#endif
|
||||
|
@ -2,146 +2,152 @@
|
||||
|
||||
int ecdb_erase_project_init(Ecdb_Erase_Project *proj);
|
||||
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);
|
||||
|
||||
|
||||
Ecdb_Erase_Project *
|
||||
ecdb_erase_project_new(void)
|
||||
{
|
||||
Ecdb_Erase_Project *proj;
|
||||
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;
|
||||
}
|
||||
proj = calloc(1, sizeof(Ecdb_Erase_Project));
|
||||
if (!proj)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!ecdb_erase_project_init(proj))
|
||||
{
|
||||
FREE(proj);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return proj;
|
||||
return proj;
|
||||
}
|
||||
|
||||
int
|
||||
ecdb_erase_project_init(Ecdb_Erase_Project *proj)
|
||||
{
|
||||
if (!ecdb_project_init(ECDB_PROJECT(proj)))
|
||||
return FALSE;
|
||||
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;
|
||||
/* Proper defaults */
|
||||
ecdb_project_type_set(ECDB_PROJECT(proj), ECDB_ERASE_PROJECT);
|
||||
proj->quick = TRUE;
|
||||
proj->format = FALSE;
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
ecdb_erase_project_destroy(Ecdb_Erase_Project *proj)
|
||||
{
|
||||
ecdb_project_destroy(ECDB_PROJECT(proj));
|
||||
FREE(proj);
|
||||
ecdb_project_destroy(ECDB_PROJECT(proj));
|
||||
FREE(proj);
|
||||
}
|
||||
|
||||
// FIXME Make this return an error code
|
||||
int
|
||||
ecdb_erase_disc(Ecdb_Erase_Project *proj)
|
||||
{
|
||||
BurnDriveStatus disc_state;
|
||||
pthread_t progress_update;
|
||||
BurnDriveStatus disc_state;
|
||||
pthread_t progress_update;
|
||||
|
||||
disc_state = burn_disc_get_status(ECDB_PROJECT(proj)->drive->
|
||||
tangible[0].drive);
|
||||
if (disc_state == BURN_DISC_BLANK)
|
||||
{
|
||||
printf("Disc is already blank!\n");
|
||||
return FALSE;
|
||||
}
|
||||
else if (disc_state == BURN_DISC_EMPTY)
|
||||
{
|
||||
printf("No disc!\n");
|
||||
return FALSE;
|
||||
}
|
||||
else if (!burn_disc_erasable(ECDB_PROJECT(proj)->drive->
|
||||
tangible[0].drive))
|
||||
{
|
||||
printf("Not able to erase!\n");
|
||||
return FALSE;
|
||||
}
|
||||
else if (disc_state == BURN_DISC_FULL || BURN_DISC_APPENDABLE)
|
||||
{
|
||||
printf("Beginning to erase disc!\n");
|
||||
ECDB_PROJECT(proj)->pipe = ecore_pipe_add
|
||||
(ecdb_erase_progress_handler,
|
||||
NULL);
|
||||
burn_disc_erase(ECDB_PROJECT(proj)->drive->
|
||||
tangible[0].drive, proj->quick);
|
||||
pthread_create(&progress_update, NULL,
|
||||
ecdb_drive_progress_update, proj);
|
||||
pthread_detach(progress_update);
|
||||
ECDB_PROJECT(proj)->ev_handler = ecore_event_handler_add
|
||||
(ECDB_DRIVE_ACTION_FINISHED,
|
||||
ecdb_erase_finished, proj);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Not of erasable type\n");
|
||||
return FALSE;
|
||||
}
|
||||
disc_state = burn_disc_get_status(ECDB_PROJECT(proj)->drive->
|
||||
tangible[0].drive);
|
||||
if (disc_state == BURN_DISC_BLANK)
|
||||
{
|
||||
printf("Disc is already blank!\n");
|
||||
return FALSE;
|
||||
}
|
||||
else if (disc_state == BURN_DISC_EMPTY)
|
||||
{
|
||||
printf("No disc!\n");
|
||||
return FALSE;
|
||||
}
|
||||
else if (!burn_disc_erasable(ECDB_PROJECT(proj)->drive->
|
||||
tangible[0].drive))
|
||||
{
|
||||
printf("Not able to erase!\n");
|
||||
return FALSE;
|
||||
}
|
||||
else if (disc_state == BURN_DISC_FULL || BURN_DISC_APPENDABLE)
|
||||
{
|
||||
printf("Beginning to erase disc!\n");
|
||||
ECDB_PROJECT(proj)->pipe = ecore_pipe_add(ecdb_erase_progress_handler,
|
||||
NULL);
|
||||
burn_disc_erase(ECDB_PROJECT(proj)->drive->tangible[0].drive,
|
||||
proj->quick);
|
||||
pthread_create(&progress_update, NULL, ecdb_drive_progress_update, proj);
|
||||
pthread_detach(progress_update);
|
||||
ECDB_PROJECT(proj)->ev_handler = ecore_event_handler_add
|
||||
(ECDB_DRIVE_ACTION_FINISHED, ecdb_erase_finished, proj);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Not of erasable type\n");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ecdb_erase_progress_handler(void *data, void *buffer, unsigned int nbyte)
|
||||
{
|
||||
BurnProgress *p;
|
||||
Evas_Object *swallow;
|
||||
char buf[1024];
|
||||
static int last_sector = 0;
|
||||
BurnProgress *p;
|
||||
Evas_Object *swallow;
|
||||
char buf[1024];
|
||||
static int last_sector = 0;
|
||||
|
||||
if ((nbyte != sizeof(BurnProgress)) || (!strcmp((char *)buffer, "AC")))
|
||||
{
|
||||
ecore_event_add(ECDB_DRIVE_ACTION_FINISHED, NULL, NULL, NULL);
|
||||
last_sector = 0;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
p = buffer;
|
||||
}
|
||||
if ((nbyte != sizeof(BurnProgress)) || (!strcmp((char *)buffer, "AC")))
|
||||
{
|
||||
ecore_event_add(ECDB_DRIVE_ACTION_FINISHED, NULL, NULL, NULL);
|
||||
last_sector = 0;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
p = buffer;
|
||||
}
|
||||
|
||||
|
||||
/* Libburn reports p->sector as being 0 right at the end of the job,
|
||||
* so store the last sector and use that to determine the proper
|
||||
* percentage/sector to set
|
||||
*/
|
||||
if (last_sector <= p->sector)
|
||||
last_sector = p->sector;
|
||||
else
|
||||
last_sector = p->sectors;
|
||||
/* Libburn reports p->sector as being 0 right at the end of the job,
|
||||
* so store the last sector and use that to determine the proper
|
||||
* percentage/sector to set
|
||||
*/
|
||||
if (last_sector <= p->sector)
|
||||
{
|
||||
last_sector = p->sector;
|
||||
}
|
||||
else
|
||||
{
|
||||
last_sector = p->sectors;
|
||||
}
|
||||
|
||||
swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee),
|
||||
"erase_page");
|
||||
snprintf(buf, sizeof(buf), "%d/%d", last_sector, p->sectors);
|
||||
edje_object_part_text_set(swallow, "progress_text", buf);
|
||||
snprintf(buf, sizeof(buf), "%d%%", (int)((double)(last_sector + 1) /
|
||||
(double)p->sectors * 100.0));
|
||||
edje_object_part_text_set(swallow, "progress_percent", buf);
|
||||
swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee),
|
||||
"erase_page");
|
||||
snprintf(buf, sizeof(buf), "%d/%d", last_sector, p->sectors);
|
||||
edje_object_part_text_set(swallow, "progress_text", buf);
|
||||
snprintf(buf, sizeof(buf), "%d%%", (int)((double)(last_sector + 1) /
|
||||
(double)p->sectors * 100.0));
|
||||
edje_object_part_text_set(swallow, "progress_percent", buf);
|
||||
}
|
||||
|
||||
int
|
||||
ecdb_erase_finished(void *data, int type, void *event)
|
||||
{
|
||||
Ecdb_Erase_Project *proj;
|
||||
Ecdb_Erase_Project *proj;
|
||||
|
||||
proj = data;
|
||||
proj = data;
|
||||
|
||||
burn_drive_release(ECDB_PROJECT(proj)->drive->tangible[0].drive, 0);
|
||||
burn_drive_info_free(ECDB_PROJECT(proj)->drive->tangible);
|
||||
ecore_event_handler_del(ECDB_PROJECT(proj)->ev_handler);
|
||||
ecdb_erase_project_destroy(proj);
|
||||
ecdb_gui_erase_cleanup();
|
||||
burn_drive_release(ECDB_PROJECT(proj)->drive->tangible[0].drive, 0);
|
||||
burn_drive_info_free(ECDB_PROJECT(proj)->drive->tangible);
|
||||
ecore_event_handler_del(ECDB_PROJECT(proj)->ev_handler);
|
||||
ecdb_erase_project_destroy(proj);
|
||||
ecdb_gui_erase_cleanup();
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
#ifndef ECDB_ERASE_H
|
||||
#define ECDB_ERASE_H
|
||||
|
||||
void ecdb_erase_project_start(Ecdb_Erase_Project *proj);
|
||||
int ecdb_erase_disc(Ecdb_Erase_Project *proj);
|
||||
void ecdb_erase_project_start(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);
|
||||
void ecdb_erase_project_destroy(Ecdb_Erase_Project *proj);
|
||||
|
||||
#endif
|
||||
|
@ -2,168 +2,165 @@
|
||||
|
||||
static void free_file(Ewl_Filelist_File *file);
|
||||
static void ecdb_custom_filelist_cb_clicked(Ewl_Widget *w, void *ev,
|
||||
void *data);
|
||||
|
||||
void *data);
|
||||
static Ewl_Widget *ecdb_custom_filelist_view_widget_fetch(void *data,
|
||||
unsigned int row, unsigned int column);
|
||||
unsigned int row, unsigned int column);
|
||||
static void *ecdb_custom_filelist_model_data_fetch(void *data, unsigned int row,
|
||||
unsigned int column);
|
||||
|
||||
unsigned int column);
|
||||
|
||||
static void ecdb_custom_filelist_model_filter(Ewl_Filelist_Directory *dir);
|
||||
static unsigned int ecdb_custom_filelist_model_data_unref(void *data);
|
||||
static Ewl_Filelist_Directory *ecdb_custom_filelist_directory_new
|
||||
(Ecdb_Source *src);
|
||||
(Ecdb_Source *src);
|
||||
static void ecdb_custom_filelist_dnd_dropped_cb(Ewl_Widget *w, void *ev,
|
||||
void *data);
|
||||
void *data);
|
||||
|
||||
Ewl_Widget *
|
||||
ecdb_custom_filelist_new(void)
|
||||
{
|
||||
const char *dnd_types[] = {"text/uri-list", NULL};
|
||||
Ewl_Widget *ret;
|
||||
const char *dnd_types[] = {"text/uri-list", NULL};
|
||||
Ewl_Widget *ret;
|
||||
|
||||
ret = ewl_filelist_new();
|
||||
ewl_model_data_unref_set(EWL_FILELIST(ret)->model,
|
||||
ecdb_custom_filelist_model_data_unref);
|
||||
ewl_model_data_fetch_set(EWL_FILELIST(ret)->model,
|
||||
ecdb_custom_filelist_model_data_fetch);
|
||||
ewl_view_widget_fetch_set(EWL_FILELIST(ret)->view,
|
||||
ecdb_custom_filelist_view_widget_fetch);
|
||||
ewl_callback_append(ret, EWL_CALLBACK_DND_DATA_RECEIVED,
|
||||
ecdb_custom_filelist_dnd_dropped_cb, NULL);
|
||||
ewl_dnd_accepted_types_set(ret, dnd_types);
|
||||
ewl_callback_del_type(EWL_FILELIST(ret)->controller,
|
||||
EWL_CALLBACK_CLICKED);
|
||||
ewl_callback_prepend(EWL_FILELIST(ret)->controller,
|
||||
EWL_CALLBACK_CLICKED, ecdb_custom_filelist_cb_clicked,
|
||||
ret);
|
||||
return ret;
|
||||
ret = ewl_filelist_new();
|
||||
ewl_model_data_unref_set(EWL_FILELIST(ret)->model,
|
||||
ecdb_custom_filelist_model_data_unref);
|
||||
ewl_model_data_fetch_set(EWL_FILELIST(ret)->model,
|
||||
ecdb_custom_filelist_model_data_fetch);
|
||||
ewl_view_widget_fetch_set(EWL_FILELIST(ret)->view,
|
||||
ecdb_custom_filelist_view_widget_fetch);
|
||||
ewl_callback_append(ret, EWL_CALLBACK_DND_DATA_RECEIVED,
|
||||
ecdb_custom_filelist_dnd_dropped_cb, NULL);
|
||||
ewl_dnd_accepted_types_set(ret, dnd_types);
|
||||
ewl_callback_del_type(EWL_FILELIST(ret)->controller, EWL_CALLBACK_CLICKED);
|
||||
ewl_callback_prepend(EWL_FILELIST(ret)->controller, EWL_CALLBACK_CLICKED,
|
||||
ecdb_custom_filelist_cb_clicked, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
ecdb_custom_filelist_dnd_dropped_cb(Ewl_Widget *w, void *ev,
|
||||
void *data__UNUSED__)
|
||||
void *data__UNUSED__)
|
||||
{
|
||||
int i;
|
||||
Ewl_Event_Dnd_Data_Received *dnd = ev;
|
||||
char **files = dnd->data;
|
||||
Ecdb_Source *parent, *child;
|
||||
Efreet_Uri *uri;
|
||||
int i;
|
||||
Ewl_Event_Dnd_Data_Received *dnd = ev;
|
||||
char **files = dnd->data;
|
||||
Ecdb_Source *parent, *child;
|
||||
Efreet_Uri *uri;
|
||||
|
||||
/* Get the parent, find the path of the file(s) dropped
|
||||
* and add them as children to parent */
|
||||
parent = ewl_widget_data_get(w, "source");
|
||||
/* Get the parent, find the path of the file(s) dropped
|
||||
* and add them as children to parent */
|
||||
parent = ewl_widget_data_get(w, "source");
|
||||
|
||||
for (i = 0; i < dnd->len; i++)
|
||||
{
|
||||
uri = efreet_uri_decode(files[i]);
|
||||
if (!ecore_file_exists(uri->path))
|
||||
{
|
||||
efreet_uri_free(uri);
|
||||
continue;
|
||||
}
|
||||
child = ecdb_source_new();
|
||||
ecdb_source_data_set(child, uri->path);
|
||||
ecdb_source_child_append(parent, child);
|
||||
efreet_uri_free(uri);
|
||||
}
|
||||
for (i = 0; i < dnd->len; i++)
|
||||
{
|
||||
uri = efreet_uri_decode(files[i]);
|
||||
if (!ecore_file_exists(uri->path))
|
||||
{
|
||||
efreet_uri_free(uri);
|
||||
continue;
|
||||
}
|
||||
child = ecdb_source_new();
|
||||
ecdb_source_data_set(child, uri->path);
|
||||
ecdb_source_child_append(parent, child);
|
||||
efreet_uri_free(uri);
|
||||
}
|
||||
|
||||
ecdb_custom_filelist_directory_set(EWL_FILELIST(w), parent);
|
||||
ecdb_custom_filelist_directory_set(EWL_FILELIST(w), parent);
|
||||
|
||||
/* And filter it here -- a bit of a hack */
|
||||
ewl_filelist_model_data_sort(ewl_mvc_data_get
|
||||
(EWL_MVC(EWL_FILELIST(w)->controller)),
|
||||
0, EWL_SORT_DIRECTION_ASCENDING);
|
||||
ewl_mvc_dirty_set(EWL_MVC(EWL_FILELIST(w)->controller), TRUE);
|
||||
/* And filter it here -- a bit of a hack */
|
||||
ewl_filelist_model_data_sort(ewl_mvc_data_get
|
||||
(EWL_MVC(EWL_FILELIST(w)->controller)),
|
||||
0, EWL_SORT_DIRECTION_ASCENDING);
|
||||
ewl_mvc_dirty_set(EWL_MVC(EWL_FILELIST(w)->controller), TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
ecdb_custom_filelist_directory_set(Ewl_Filelist *fl, Ecdb_Source *src)
|
||||
{
|
||||
if (src)
|
||||
{
|
||||
Ewl_Filelist_Directory *data;
|
||||
Ewl_Event_Action_Response ev_data;
|
||||
if (src)
|
||||
{
|
||||
Ewl_Filelist_Directory *data;
|
||||
Ewl_Event_Action_Response ev_data;
|
||||
|
||||
data = ewl_mvc_data_get(EWL_MVC(fl->controller));
|
||||
if (data) ecdb_custom_filelist_model_data_unref(data);
|
||||
data = ewl_mvc_data_get(EWL_MVC(fl->controller));
|
||||
if (data)
|
||||
{
|
||||
ecdb_custom_filelist_model_data_unref(data);
|
||||
}
|
||||
|
||||
data = ecdb_custom_filelist_directory_new(src);
|
||||
ewl_mvc_data_set(EWL_MVC(fl->controller), data);
|
||||
ev_data.response = EWL_FILELIST_EVENT_DIR_CHANGE;
|
||||
ewl_callback_call_with_event_data(EWL_WIDGET(fl),
|
||||
EWL_CALLBACK_VALUE_CHANGED, &ev_data);
|
||||
|
||||
/* Set the source as needed for file operations */
|
||||
ewl_widget_data_set(EWL_WIDGET(fl), "source", src);
|
||||
}
|
||||
data = ecdb_custom_filelist_directory_new(src);
|
||||
ewl_mvc_data_set(EWL_MVC(fl->controller), data);
|
||||
ev_data.response = EWL_FILELIST_EVENT_DIR_CHANGE;
|
||||
ewl_callback_call_with_event_data(EWL_WIDGET(fl),
|
||||
EWL_CALLBACK_VALUE_CHANGED, &ev_data);
|
||||
|
||||
/* Set the source as needed for file operations */
|
||||
ewl_widget_data_set(EWL_WIDGET(fl), "source", src);
|
||||
}
|
||||
}
|
||||
|
||||
static Ewl_Filelist_Directory *
|
||||
ecdb_custom_filelist_directory_new(Ecdb_Source *parent)
|
||||
{
|
||||
Ecdb_Source *src;
|
||||
Ewl_Filelist_Directory *dir;
|
||||
Ewl_Filelist_File *file;
|
||||
Ecdb_Source *src;
|
||||
Ewl_Filelist_Directory *dir;
|
||||
Ewl_Filelist_File *file;
|
||||
|
||||
struct stat st;
|
||||
int nf = 0, nd = 0, i = 0;
|
||||
Ecore_List *files, *dirs;
|
||||
struct stat st;
|
||||
int nf = 0, nd = 0, i = 0;
|
||||
Ecore_List *files, *dirs;
|
||||
|
||||
files = ecore_list_new();
|
||||
dirs = ecore_list_new();
|
||||
ecore_list_free_cb_set(files, ECORE_FREE_CB(free_file));
|
||||
ecore_list_free_cb_set(dirs, ECORE_FREE_CB(free_file));
|
||||
files = ecore_list_new();
|
||||
dirs = ecore_list_new();
|
||||
ecore_list_free_cb_set(files, ECORE_FREE_CB(free_file));
|
||||
ecore_list_free_cb_set(dirs, ECORE_FREE_CB(free_file));
|
||||
|
||||
if (!parent)
|
||||
return NULL;
|
||||
if (!parent)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* No up for now */
|
||||
while ((src = parent->children[i]))
|
||||
{
|
||||
file = calloc(1, sizeof(Ewl_Filelist_File));
|
||||
file->name = eina_stringshare_add(src->dst);
|
||||
|
||||
while ((src = parent->children[i]))
|
||||
{
|
||||
file = calloc(1, sizeof(Ewl_Filelist_File));
|
||||
file->name = eina_stringshare_add(src->dst);
|
||||
stat(src->dst, &st);
|
||||
file->size = st.st_size;
|
||||
file->modtime = st.st_mtime;
|
||||
file->mode = st.st_mode;
|
||||
file->groupname = st.st_gid;
|
||||
file->username = st.st_uid;
|
||||
file->is_dir = src->dir;
|
||||
file->readable = ecore_file_can_read(src->dst);
|
||||
file->writeable = ecore_file_can_write(src->dst);
|
||||
|
||||
stat(src->dst, &st);
|
||||
file->size = st.st_size;
|
||||
file->modtime = st.st_mtime;
|
||||
file->mode = st.st_mode;
|
||||
file->groupname = st.st_gid;
|
||||
file->username = st.st_uid;
|
||||
file->is_dir = src->dir;
|
||||
file->readable = ecore_file_can_read(src->dst);
|
||||
file->writeable = ecore_file_can_write(src->dst);
|
||||
if (src->dir)
|
||||
{
|
||||
ecore_list_append(dirs, file);
|
||||
nd++;
|
||||
}
|
||||
|
||||
if (src->dir)
|
||||
{
|
||||
ecore_list_append(dirs, file);
|
||||
nd++;
|
||||
}
|
||||
else
|
||||
{
|
||||
ecore_list_append(files, file);
|
||||
nf++;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
ecore_list_append(files, file);
|
||||
nf++;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
/* Oops */
|
||||
i++;
|
||||
}
|
||||
dir = calloc(1, sizeof(Ewl_Filelist_Directory));
|
||||
dir->files = ecore_list_new();
|
||||
dir->dirs = ecore_list_new();
|
||||
dir->rfiles = files;
|
||||
dir->rdirs = dirs;
|
||||
dir->num_dirs = nd;
|
||||
dir->num_files = nf;
|
||||
|
||||
dir = calloc(1, sizeof(Ewl_Filelist_Directory));
|
||||
ecdb_custom_filelist_model_filter(dir);
|
||||
|
||||
dir->files = ecore_list_new();
|
||||
dir->dirs = ecore_list_new();
|
||||
dir->rfiles = files;
|
||||
dir->rdirs = dirs;
|
||||
dir->num_dirs = nd;
|
||||
dir->num_files = nf;
|
||||
|
||||
ecdb_custom_filelist_model_filter(dir);
|
||||
|
||||
return dir;
|
||||
return dir;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -176,208 +173,216 @@ free_file(Ewl_Filelist_File *file)
|
||||
static void
|
||||
ecdb_custom_filelist_model_filter(Ewl_Filelist_Directory *dir)
|
||||
{
|
||||
Ewl_Filelist_File *file;
|
||||
int nd, nf;
|
||||
|
||||
ecore_list_clear(dir->files);
|
||||
ecore_list_clear(dir->dirs);
|
||||
nd = nf = 0;
|
||||
Ewl_Filelist_File *file;
|
||||
int nd, nf;
|
||||
|
||||
ecore_list_clear(dir->files);
|
||||
ecore_list_clear(dir->dirs);
|
||||
nd = nf = 0;
|
||||
|
||||
if (!dir->show_dot)
|
||||
{
|
||||
ecore_list_first_goto(dir->rfiles);
|
||||
while ((file = ecore_list_next(dir->rfiles)))
|
||||
{
|
||||
if (ecore_file_file_get(file->name)[0] != '.')
|
||||
{
|
||||
ecore_list_append(dir->files, file);
|
||||
nf++;
|
||||
}
|
||||
}
|
||||
ecore_list_first_goto(dir->rdirs);
|
||||
while ((file = ecore_list_next(dir->rdirs)))
|
||||
{
|
||||
if (ecore_file_file_get(file->name)[0] != '.')
|
||||
{
|
||||
ecore_list_append(dir->dirs, file);
|
||||
nd++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ecore_list_first_goto(dir->rfiles);
|
||||
while ((file = ecore_list_next(dir->rfiles)))
|
||||
{
|
||||
ecore_list_append(dir->files, file);
|
||||
nf++;
|
||||
}
|
||||
ecore_list_first_goto(dir->rdirs);
|
||||
while ((file = ecore_list_next(dir->rdirs)))
|
||||
{
|
||||
ecore_list_append(dir->dirs, file);
|
||||
nd++;
|
||||
}
|
||||
}
|
||||
if (!dir->show_dot)
|
||||
{
|
||||
ecore_list_first_goto(dir->rfiles);
|
||||
while ((file = ecore_list_next(dir->rfiles)))
|
||||
{
|
||||
if (ecore_file_file_get(file->name)[0] != '.')
|
||||
{
|
||||
ecore_list_append(dir->files, file);
|
||||
nf++;
|
||||
}
|
||||
}
|
||||
ecore_list_first_goto(dir->rdirs);
|
||||
while ((file = ecore_list_next(dir->rdirs)))
|
||||
{
|
||||
if (ecore_file_file_get(file->name)[0] != '.')
|
||||
{
|
||||
ecore_list_append(dir->dirs, file);
|
||||
nd++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ecore_list_first_goto(dir->rfiles);
|
||||
while ((file = ecore_list_next(dir->rfiles)))
|
||||
{
|
||||
ecore_list_append(dir->files, file);
|
||||
nf++;
|
||||
}
|
||||
ecore_list_first_goto(dir->rdirs);
|
||||
while ((file = ecore_list_next(dir->rdirs)))
|
||||
{
|
||||
ecore_list_append(dir->dirs, file);
|
||||
nd++;
|
||||
}
|
||||
}
|
||||
|
||||
dir->num_dirs = nd;
|
||||
dir->num_files = nf;
|
||||
dir->num_dirs = nd;
|
||||
dir->num_files = nf;
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
ecdb_custom_filelist_model_data_unref(void *data)
|
||||
{
|
||||
Ewl_Filelist_Directory *dir;
|
||||
Ewl_Filelist_Directory *dir;
|
||||
|
||||
dir = data;
|
||||
ecore_list_destroy(dir->files);
|
||||
ecore_list_destroy(dir->dirs);
|
||||
ecore_list_destroy(dir->rfiles);
|
||||
ecore_list_destroy(dir->rdirs);
|
||||
FREE(dir);
|
||||
return TRUE;
|
||||
dir = data;
|
||||
ecore_list_destroy(dir->files);
|
||||
ecore_list_destroy(dir->dirs);
|
||||
ecore_list_destroy(dir->rfiles);
|
||||
ecore_list_destroy(dir->rdirs);
|
||||
FREE(dir);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void *
|
||||
ecdb_custom_filelist_model_data_fetch(void *data, unsigned int row,
|
||||
unsigned int column)
|
||||
unsigned int column)
|
||||
{
|
||||
Ewl_Filelist_Directory *fld;
|
||||
Ewl_Filelist_File *file;
|
||||
int i;
|
||||
void *ret;
|
||||
Ewl_Filelist_Directory *fld;
|
||||
Ewl_Filelist_File *file;
|
||||
int i;
|
||||
void *ret;
|
||||
|
||||
fld = data;
|
||||
fld = data;
|
||||
|
||||
/* Check if in dirs or files list */
|
||||
if (row < fld->num_dirs)
|
||||
file = ecore_list_index_goto(fld->dirs, row);
|
||||
else
|
||||
{
|
||||
i = (row - fld->num_dirs);
|
||||
file = ecore_list_index_goto(fld->files, i);
|
||||
}
|
||||
/* Check if in dirs or files list */
|
||||
if (row < fld->num_dirs)
|
||||
{
|
||||
file = ecore_list_index_goto(fld->dirs, row);
|
||||
}
|
||||
else
|
||||
{
|
||||
i = (row - fld->num_dirs);
|
||||
file = ecore_list_index_goto(fld->files, i);
|
||||
}
|
||||
|
||||
if (column == 1) ret = ewl_filelist_size_get(file->size);
|
||||
else if (column == 2) ret = ewl_filelist_perms_get(file->mode);
|
||||
else if (column == 3) ret = ewl_filelist_username_get
|
||||
(file->username);
|
||||
else if (column == 4) ret = ewl_filelist_groupname_get
|
||||
(file->groupname);
|
||||
else if (column == 5) ret = ewl_filelist_modtime_get
|
||||
(file->modtime);
|
||||
else ret = strdup(file->name);
|
||||
if (column == 1) ret = ewl_filelist_size_get(file->size);
|
||||
else if (column == 2) ret = ewl_filelist_perms_get(file->mode);
|
||||
else if (column == 3) ret = ewl_filelist_username_get(file->username);
|
||||
else if (column == 4) ret = ewl_filelist_groupname_get(file->groupname);
|
||||
else if (column == 5) ret = ewl_filelist_modtime_get(file->modtime);
|
||||
else ret = strdup(file->name);
|
||||
|
||||
/* ret needs to be freed by the view or with model_data_free_set */
|
||||
return ret;
|
||||
/* ret needs to be freed by the view or with model_data_free_set */
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
ecdb_custom_filelist_cb_clicked(Ewl_Widget *w, void *ev, void *data)
|
||||
{
|
||||
Ewl_Event_Mouse_Down *md;
|
||||
char *file;
|
||||
int i = 0;
|
||||
Ewl_Widget *c;
|
||||
Ewl_Filelist *fl;
|
||||
Ecdb_Source *parent, *child;
|
||||
Ewl_Event_Mouse_Down *md;
|
||||
char *file;
|
||||
int i = 0;
|
||||
Ewl_Widget *c;
|
||||
Ewl_Filelist *fl;
|
||||
Ecdb_Source *parent, *child;
|
||||
|
||||
md = ev;
|
||||
fl = data;
|
||||
md = ev;
|
||||
fl = data;
|
||||
|
||||
if (!ewl_mvc_selected_count_get(EWL_MVC(fl->controller)))
|
||||
return;
|
||||
if (!ewl_mvc_selected_count_get(EWL_MVC(fl->controller)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (md->clicks != 2)
|
||||
{
|
||||
ewl_filelist_selected_files_change_notify(fl);
|
||||
return;
|
||||
}
|
||||
if (md->clicks != 2)
|
||||
{
|
||||
ewl_filelist_selected_files_change_notify(fl);
|
||||
return;
|
||||
}
|
||||
|
||||
c = ewl_container_child_at_recursive_get(EWL_CONTAINER(fl),
|
||||
md->base.x, md->base.y);
|
||||
c = ewl_container_child_at_recursive_get(EWL_CONTAINER(fl), md->base.x,
|
||||
md->base.y);
|
||||
|
||||
while (c && c->parent)
|
||||
{
|
||||
if (!ewl_widget_internal_is(c))
|
||||
{
|
||||
i = 1;
|
||||
break;
|
||||
}
|
||||
c = c->parent;
|
||||
}
|
||||
while (c && c->parent)
|
||||
{
|
||||
if (!ewl_widget_internal_is(c))
|
||||
{
|
||||
i = 1;
|
||||
break;
|
||||
}
|
||||
c = c->parent;
|
||||
}
|
||||
|
||||
if (!i)
|
||||
return;
|
||||
if (!i)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
file = ecdb_custom_filelist_selected_file_get(fl);
|
||||
file = ecdb_custom_filelist_selected_file_get(fl);
|
||||
|
||||
parent = ewl_widget_data_get(EWL_WIDGET(fl), "source");
|
||||
i = 0;
|
||||
while ((child = parent->children[i]))
|
||||
{
|
||||
if ((child->dir) && (!strcmp(child->dst, file)))
|
||||
{
|
||||
ecdb_custom_filelist_directory_set(fl, child);
|
||||
FREE(file);
|
||||
return;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
ewl_filelist_selected_files_change_notify(fl);
|
||||
FREE(file);
|
||||
parent = ewl_widget_data_get(EWL_WIDGET(fl), "source");
|
||||
i = 0;
|
||||
while ((child = parent->children[i]))
|
||||
{
|
||||
if ((child->dir) && (!strcmp(child->dst, file)))
|
||||
{
|
||||
ecdb_custom_filelist_directory_set(fl, child);
|
||||
FREE(file);
|
||||
return;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
ewl_filelist_selected_files_change_notify(fl);
|
||||
FREE(file);
|
||||
}
|
||||
|
||||
char *
|
||||
ecdb_custom_filelist_selected_file_get(Ewl_Filelist *fl)
|
||||
{
|
||||
Ewl_Filelist_Directory *data;
|
||||
Ewl_Filelist_File *file;
|
||||
Ewl_Selection_Idx *idx;
|
||||
int i;
|
||||
Ewl_Filelist_Directory *data;
|
||||
Ewl_Filelist_File *file;
|
||||
Ewl_Selection_Idx *idx;
|
||||
int i;
|
||||
|
||||
idx = ewl_mvc_selected_get(EWL_MVC(fl->controller));
|
||||
data = EWL_SELECTION(idx)->data;
|
||||
if (idx->row < data->num_dirs)
|
||||
file = ecore_list_index_goto(data->dirs, idx->row);
|
||||
else
|
||||
{
|
||||
i = (idx->row - data->num_dirs);
|
||||
file = ecore_list_index_goto(data->files, i);
|
||||
}
|
||||
FREE(idx);
|
||||
return strdup(file->name);
|
||||
idx = ewl_mvc_selected_get(EWL_MVC(fl->controller));
|
||||
data = EWL_SELECTION(idx)->data;
|
||||
if (idx->row < data->num_dirs)
|
||||
{
|
||||
file = ecore_list_index_goto(data->dirs, idx->row);
|
||||
}
|
||||
else
|
||||
{
|
||||
i = (idx->row - data->num_dirs);
|
||||
file = ecore_list_index_goto(data->files, i);
|
||||
}
|
||||
|
||||
FREE(idx);
|
||||
return strdup(file->name);
|
||||
}
|
||||
|
||||
static Ewl_Widget *
|
||||
ecdb_custom_filelist_view_widget_fetch(void *data, unsigned int row __UNUSED__,
|
||||
unsigned int column)
|
||||
unsigned int column)
|
||||
{
|
||||
Ewl_Widget *ret;
|
||||
const char *img = NULL, *stock, *filename;
|
||||
Ewl_Widget *ret;
|
||||
const char *img = NULL, *stock, *filename;
|
||||
|
||||
/* Create icon */
|
||||
ret = ewl_icon_simple_new();
|
||||
ewl_icon_constrain_set(EWL_ICON(ret), EWL_ICON_SIZE_MEDIUM);
|
||||
ewl_box_orientation_set(EWL_BOX(ret),
|
||||
EWL_ORIENTATION_HORIZONTAL);
|
||||
ewl_object_alignment_set(EWL_OBJECT(ret), EWL_FLAG_ALIGN_LEFT);
|
||||
/* Create icon */
|
||||
ret = ewl_icon_simple_new();
|
||||
ewl_icon_constrain_set(EWL_ICON(ret), EWL_ICON_SIZE_MEDIUM);
|
||||
ewl_box_orientation_set(EWL_BOX(ret), EWL_ORIENTATION_HORIZONTAL);
|
||||
ewl_object_alignment_set(EWL_OBJECT(ret), EWL_FLAG_ALIGN_LEFT);
|
||||
|
||||
/* Get and set data into icon */
|
||||
if (column == 0)
|
||||
{
|
||||
stock = ewl_filelist_stock_icon_get(data);
|
||||
img = ewl_icon_theme_icon_path_get(stock, EWL_ICON_SIZE_MEDIUM);
|
||||
if (img) ewl_icon_image_set(EWL_ICON(ret), img, NULL);
|
||||
|
||||
filename = ecore_file_file_get(data);
|
||||
ewl_icon_label_set(EWL_ICON(ret), filename);
|
||||
}
|
||||
else
|
||||
ewl_icon_label_set(EWL_ICON(ret), data);
|
||||
|
||||
FREE(data);
|
||||
|
||||
return ret;
|
||||
/* Get and set data into icon */
|
||||
if (column == 0)
|
||||
{
|
||||
stock = ewl_filelist_stock_icon_get(data);
|
||||
img = ewl_icon_theme_icon_path_get(stock, EWL_ICON_SIZE_MEDIUM);
|
||||
if (img)
|
||||
{
|
||||
ewl_icon_image_set(EWL_ICON(ret), img, NULL);
|
||||
}
|
||||
filename = ecore_file_file_get(data);
|
||||
ewl_icon_label_set(EWL_ICON(ret), filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
ewl_icon_label_set(EWL_ICON(ret), data);
|
||||
}
|
||||
|
||||
FREE(data);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
#ifndef ECDB_FILELIST_CUSTOM_H
|
||||
#define ECDB_FILELIST_CUSTOM_H
|
||||
|
||||
void ecdb_custom_filelist_directory_set(Ewl_Filelist *fl,
|
||||
Ecdb_Source *src);
|
||||
Ewl_Widget *ecdb_custom_filelist_new(void);
|
||||
char * ecdb_custom_filelist_selected_file_get(Ewl_Filelist *fl);
|
||||
void ecdb_custom_filelist_directory_set(Ewl_Filelist *fl,
|
||||
Ecdb_Source *src);
|
||||
Ewl_Widget *ecdb_custom_filelist_new(void);
|
||||
char * ecdb_custom_filelist_selected_file_get(Ewl_Filelist *fl);
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,9 +1,9 @@
|
||||
#ifndef ECDB_GUI_H
|
||||
#define ECDB_GUI_H
|
||||
|
||||
int ecdb_create_main_gui(void);
|
||||
void ecdb_set_main_theme(const char *theme_name);
|
||||
void ecdb_gui_erase_cleanup(void);
|
||||
void ecdb_gui_burn_image_cleanup(void);
|
||||
int ecdb_create_main_gui(void);
|
||||
void ecdb_set_main_theme(const char *theme_name);
|
||||
void ecdb_gui_erase_cleanup(void);
|
||||
void ecdb_gui_burn_image_cleanup(void);
|
||||
|
||||
#endif
|
||||
|
@ -6,103 +6,109 @@ void ecdb_source_add_directory_recursive(Ecdb_Source *parent);
|
||||
Ecdb_Source *
|
||||
ecdb_source_new(void)
|
||||
{
|
||||
Ecdb_Source *src;
|
||||
Ecdb_Source *src;
|
||||
|
||||
src = calloc(1, sizeof(Ecdb_Source));
|
||||
if (!src)
|
||||
return NULL;
|
||||
if (!ecdb_source_init(src))
|
||||
{
|
||||
FREE(src);
|
||||
return NULL;
|
||||
}
|
||||
src = calloc(1, sizeof(Ecdb_Source));
|
||||
if (!src)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
if (!ecdb_source_init(src))
|
||||
{
|
||||
FREE(src);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return src;
|
||||
return src;
|
||||
}
|
||||
|
||||
int
|
||||
ecdb_source_init(Ecdb_Source *src)
|
||||
{
|
||||
src->dir = FALSE;
|
||||
src->num_children = 0;
|
||||
src->children = calloc(1, sizeof(Ecdb_Source));
|
||||
if (!src->children)
|
||||
return FALSE;
|
||||
src->children[src->num_children] = NULL;
|
||||
return TRUE;
|
||||
src->dir = FALSE;
|
||||
src->num_children = 0;
|
||||
src->children = calloc(1, sizeof(Ecdb_Source));
|
||||
if (!src->children)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
src->children[src->num_children] = NULL;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
ecdb_source_destroy(Ecdb_Source *src)
|
||||
{
|
||||
int i;
|
||||
Ecdb_Source *child;
|
||||
int i;
|
||||
Ecdb_Source *child;
|
||||
|
||||
/* free the non-recursive stuff */
|
||||
if (src->dst) eina_stringshare_del(src->dst);
|
||||
if (src->node) iso_node_unref(src->node);
|
||||
/* free the non-recursive stuff */
|
||||
if (src->dst) eina_stringshare_del(src->dst);
|
||||
if (src->node) iso_node_unref(src->node);
|
||||
|
||||
for (i = 0; src->children[i]; i++)
|
||||
{
|
||||
child = src->children[i];
|
||||
ecdb_source_destroy(child);
|
||||
}
|
||||
FREE(src->children);
|
||||
FREE(src);
|
||||
for (i = 0; src->children[i]; i++)
|
||||
{
|
||||
child = src->children[i];
|
||||
ecdb_source_destroy(child);
|
||||
}
|
||||
FREE(src->children);
|
||||
FREE(src);
|
||||
}
|
||||
|
||||
void
|
||||
ecdb_source_data_set(Ecdb_Source *src, const char *dst)
|
||||
{
|
||||
if ((!src) || (!ecore_file_exists(dst)))
|
||||
return;
|
||||
if ((!src) || (!ecore_file_exists(dst)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
src->dst = eina_stringshare_add(dst);
|
||||
src->dst = eina_stringshare_add(dst);
|
||||
|
||||
/* Add the files recursively here */
|
||||
if (ecore_file_is_dir(src->dst))
|
||||
{
|
||||
src->dir = !!TRUE;
|
||||
ecdb_source_add_directory_recursive(src);
|
||||
}
|
||||
/* Add the files recursively here */
|
||||
if (ecore_file_is_dir(src->dst))
|
||||
{
|
||||
src->dir = !!TRUE;
|
||||
ecdb_source_add_directory_recursive(src);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ecdb_source_add_directory_recursive(Ecdb_Source *parent)
|
||||
{
|
||||
Ecore_List *files;
|
||||
Ecdb_Source *child;
|
||||
char path[PATH_MAX];
|
||||
char *src;
|
||||
Ecore_List *files;
|
||||
Ecdb_Source *child;
|
||||
char path[PATH_MAX];
|
||||
char *src;
|
||||
|
||||
files = ecore_file_ls(parent->dst);
|
||||
files = ecore_file_ls(parent->dst);
|
||||
|
||||
while ((src = ecore_list_first_remove(files)))
|
||||
{
|
||||
child = ecdb_source_new();
|
||||
snprintf(path, PATH_MAX, "%s/%s", parent->dst, src);
|
||||
ecdb_source_data_set(child, path);
|
||||
ecdb_source_child_append(parent, child);
|
||||
free(src);
|
||||
}
|
||||
ecore_list_destroy(files);
|
||||
while ((src = ecore_list_first_remove(files)))
|
||||
{
|
||||
child = ecdb_source_new();
|
||||
snprintf(path, PATH_MAX, "%s/%s", parent->dst, src);
|
||||
ecdb_source_data_set(child, path);
|
||||
ecdb_source_child_append(parent, child);
|
||||
FREE(src);
|
||||
}
|
||||
ecore_list_destroy(files);
|
||||
}
|
||||
|
||||
void
|
||||
ecdb_source_child_append(Ecdb_Source *src, Ecdb_Source *child)
|
||||
{
|
||||
if (src == child)
|
||||
{
|
||||
printf("Trying to make a parent of itself!\n");
|
||||
return;
|
||||
}
|
||||
if (src == child)
|
||||
{
|
||||
printf("Trying to make a parent of itself!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
src->num_children++;
|
||||
src->children = realloc(src->children, sizeof(Ecdb_Source) *
|
||||
(src->num_children + 1));
|
||||
src->children[src->num_children - 1] = child;
|
||||
src->children[src->num_children] = NULL;
|
||||
child->parent = src;
|
||||
src->num_children++;
|
||||
src->children = realloc(src->children, sizeof(Ecdb_Source) *
|
||||
(src->num_children + 1));
|
||||
src->children[src->num_children - 1] = child;
|
||||
src->children[src->num_children] = NULL;
|
||||
child->parent = src;
|
||||
}
|
||||
|
||||
/* Basically here we can remove all occurences (who knows why we'd get
|
||||
@ -112,163 +118,176 @@ ecdb_source_child_append(Ecdb_Source *src, Ecdb_Source *child)
|
||||
void
|
||||
ecdb_source_child_remove(Ecdb_Source *src, Ecdb_Source *child)
|
||||
{
|
||||
Ecdb_Source **temp;
|
||||
int i, cidx, f;
|
||||
Ecdb_Source **temp;
|
||||
int i, cidx, f;
|
||||
|
||||
if (src == child)
|
||||
{
|
||||
printf("Trying to remove oneself\n");
|
||||
return;
|
||||
}
|
||||
if (src == child)
|
||||
{
|
||||
printf("Trying to remove oneself\n");
|
||||
return;
|
||||
}
|
||||
|
||||
temp = calloc(src->num_children, sizeof(Ecdb_Source));
|
||||
temp[src->num_children - 1] = NULL;
|
||||
temp = calloc(src->num_children, sizeof(Ecdb_Source));
|
||||
temp[src->num_children - 1] = NULL;
|
||||
|
||||
cidx = f = 0;
|
||||
for (i = 0; src->children[i]; i++)
|
||||
{
|
||||
if ((src->children[i] == child) && (!f))
|
||||
{
|
||||
f++;
|
||||
continue;
|
||||
}
|
||||
temp[cidx] = src->children[i];
|
||||
cidx++;
|
||||
}
|
||||
cidx = f = 0;
|
||||
for (i = 0; src->children[i]; i++)
|
||||
{
|
||||
if ((src->children[i] == child) && (!f))
|
||||
{
|
||||
f++;
|
||||
continue;
|
||||
}
|
||||
temp[cidx] = src->children[i];
|
||||
cidx++;
|
||||
}
|
||||
|
||||
FREE(src->children);
|
||||
src->children = temp;
|
||||
src->num_children--;
|
||||
child->parent = NULL;
|
||||
FREE(src->children);
|
||||
src->children = temp;
|
||||
src->num_children--;
|
||||
child->parent = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
ecdb_source_add_children_rec(Ecdb_Source *parent, IsoImage *image)
|
||||
{
|
||||
IsoDir *cd = NULL;
|
||||
Ecdb_Source *cs;
|
||||
int i;
|
||||
IsoDir *cd = NULL;
|
||||
Ecdb_Source *cs;
|
||||
int i;
|
||||
|
||||
if ((!parent) || (!image))
|
||||
return;
|
||||
if ((!parent) || (!image))
|
||||
return;
|
||||
|
||||
i = 0;
|
||||
while ((cs = parent->children[i]))
|
||||
{
|
||||
if (cs->dir)
|
||||
{
|
||||
iso_tree_add_new_dir(ISO_DIR(parent->node),
|
||||
ecore_file_file_get(cs->dst),
|
||||
&cd);
|
||||
cs->node = ISO_NODE(cd);
|
||||
/* If the source has children, find the node from above
|
||||
* (if applicable), and recursively add to it */
|
||||
if (cs->num_children > 0)
|
||||
{
|
||||
ecdb_source_add_children_rec(cs, image);
|
||||
}
|
||||
i = 0;
|
||||
while ((cs = parent->children[i]))
|
||||
{
|
||||
if (cs->dir)
|
||||
{
|
||||
iso_tree_add_new_dir(ISO_DIR(parent->node),
|
||||
ecore_file_file_get(cs->dst), &cd);
|
||||
cs->node = ISO_NODE(cd);
|
||||
/* If the source has children, find the node from above
|
||||
* (if applicable), and recursively add to it */
|
||||
if (cs->num_children > 0)
|
||||
{
|
||||
ecdb_source_add_children_rec(cs, image);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* file */
|
||||
else
|
||||
{
|
||||
iso_tree_add_node(image, ISO_DIR(parent->node),
|
||||
cs->dst, NULL);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
/* file */
|
||||
else
|
||||
{
|
||||
iso_tree_add_node(image, ISO_DIR(parent->node),
|
||||
cs->dst, NULL);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
/* proj->files should only have children */
|
||||
BurnSource *
|
||||
ecdb_image_project(Ecdb_Burn_Project *proj)
|
||||
{
|
||||
IsoImage *image;
|
||||
Ecdb_Source *c;
|
||||
IsoWriteOpts *opts;
|
||||
BurnSource *data_src, *fifo_src;
|
||||
IsoImage *image;
|
||||
Ecdb_Source *c;
|
||||
IsoWriteOpts *opts;
|
||||
BurnSource *data_src, *fifo_src;
|
||||
|
||||
if ((!proj->files) || (!proj->files->num_children))
|
||||
return NULL;
|
||||
if ((!proj->files) || (!proj->files->num_children))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* To handle already-suplied image files */
|
||||
if (proj->files->num_children == 1)
|
||||
{
|
||||
efreet_mime_init();
|
||||
c = proj->files->children[0];
|
||||
if ((!ecore_file_is_dir(c->dst)) &&
|
||||
(!strcmp(efreet_mime_type_get(c->dst),
|
||||
"application/x-cd-image")))
|
||||
{
|
||||
data_src = burn_file_source_new(c->dst, NULL);
|
||||
goto FIFO_CREATE;
|
||||
}
|
||||
else if (ECDB_PROJECT(proj)->type == ECDB_IMAGE_PROJECT)
|
||||
{
|
||||
printf("Supplied file is not an image!\n");
|
||||
efreet_mime_shutdown();
|
||||
return NULL;
|
||||
}
|
||||
efreet_mime_shutdown();
|
||||
}
|
||||
/* To handle already-suplied image files */
|
||||
if (proj->files->num_children == 1)
|
||||
{
|
||||
efreet_mime_init();
|
||||
c = proj->files->children[0];
|
||||
if ((!ecore_file_is_dir(c->dst)) &&
|
||||
(!strcmp(efreet_mime_type_get(c->dst), "application/x-cd-image")))
|
||||
{
|
||||
data_src = burn_file_source_new(c->dst, NULL);
|
||||
goto FIFO_CREATE;
|
||||
}
|
||||
else if (ECDB_PROJECT(proj)->type == ECDB_IMAGE_PROJECT)
|
||||
{
|
||||
printf("Supplied file is not an image!\n");
|
||||
efreet_mime_shutdown();
|
||||
return NULL;
|
||||
}
|
||||
efreet_mime_shutdown();
|
||||
}
|
||||
|
||||
/* Otherwise we have a bunch of files */
|
||||
if (!iso_image_new(proj->volume_id, &image))
|
||||
{
|
||||
printf("Failed to create image!\n");
|
||||
return NULL;
|
||||
}
|
||||
/* Otherwise we have a bunch of files */
|
||||
if (!iso_image_new(proj->volume_id, &image))
|
||||
{
|
||||
printf("Failed to create image!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Set all ids */
|
||||
if (proj->publisher_id)
|
||||
iso_image_set_publisher_id(image, proj->publisher_id);
|
||||
if (proj->data_preparer_id)
|
||||
iso_image_set_data_preparer_id(image,
|
||||
proj->data_preparer_id);
|
||||
if (proj->system_id)
|
||||
iso_image_set_system_id(image, proj->system_id);
|
||||
if (proj->application_id)
|
||||
iso_image_set_application_id(image, proj->application_id);
|
||||
if (proj->copywrite_id)
|
||||
iso_image_set_copyright_file_id(image, proj->copywrite_id);
|
||||
if (proj->abstract_id)
|
||||
iso_image_set_abstract_file_id(image, proj->abstract_id);
|
||||
if (proj->biblio_id)
|
||||
iso_image_set_biblio_file_id(image, proj->biblio_id);
|
||||
/* Set all ids */
|
||||
if (proj->publisher_id)
|
||||
{
|
||||
iso_image_set_publisher_id(image, proj->publisher_id);
|
||||
}
|
||||
if (proj->data_preparer_id)
|
||||
{
|
||||
iso_image_set_data_preparer_id(image, proj->data_preparer_id);
|
||||
}
|
||||
if (proj->system_id)
|
||||
{
|
||||
iso_image_set_system_id(image, proj->system_id);
|
||||
}
|
||||
if (proj->application_id)
|
||||
{
|
||||
iso_image_set_application_id(image, proj->application_id);
|
||||
}
|
||||
if (proj->copywrite_id)
|
||||
{
|
||||
iso_image_set_copyright_file_id(image, proj->copywrite_id);
|
||||
}
|
||||
if (proj->abstract_id)
|
||||
{
|
||||
iso_image_set_abstract_file_id(image, proj->abstract_id);
|
||||
}
|
||||
if (proj->biblio_id)
|
||||
{
|
||||
iso_image_set_biblio_file_id(image, proj->biblio_id);
|
||||
}
|
||||
|
||||
if (!iso_write_opts_new(&opts, 2))
|
||||
{
|
||||
printf("Failed to create writing options!\n");
|
||||
iso_image_unref(image);
|
||||
return NULL;
|
||||
}
|
||||
if (!iso_write_opts_new(&opts, 2))
|
||||
{
|
||||
printf("Failed to create writing options!\n");
|
||||
iso_image_unref(image);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* And some write opts stuff */
|
||||
iso_write_opts_set_iso_level(opts, proj->iso_level);
|
||||
iso_write_opts_set_joliet(opts, proj->use_joliet);
|
||||
iso_write_opts_set_rockridge(opts, proj->use_rockridge);
|
||||
iso_write_opts_set_iso1999(opts, proj->iso1990);
|
||||
iso_write_opts_set_appendable(opts, proj->multi);
|
||||
|
||||
iso_tree_set_follow_symlinks(image, proj->follow_symlinks);
|
||||
iso_tree_set_ignore_hidden(image, proj->ignore_hidden);
|
||||
iso_tree_set_ignore_special(image, proj->ignore_special);
|
||||
/* And some write opts stuff */
|
||||
iso_write_opts_set_iso_level(opts, proj->iso_level);
|
||||
iso_write_opts_set_joliet(opts, proj->use_joliet);
|
||||
iso_write_opts_set_rockridge(opts, proj->use_rockridge);
|
||||
iso_write_opts_set_iso1999(opts, proj->iso1990);
|
||||
iso_write_opts_set_appendable(opts, proj->multi);
|
||||
|
||||
iso_tree_set_follow_symlinks(image, proj->follow_symlinks);
|
||||
iso_tree_set_ignore_hidden(image, proj->ignore_hidden);
|
||||
iso_tree_set_ignore_special(image, proj->ignore_special);
|
||||
|
||||
/* actually fill image with some files now */
|
||||
proj->files->node = ISO_NODE(iso_image_get_root(image));
|
||||
ecdb_source_add_children_rec(proj->files, image);
|
||||
|
||||
/* Make the burn source here */
|
||||
iso_image_create_burn_source(image, opts, &data_src);
|
||||
iso_write_opts_free(opts);
|
||||
iso_image_unref(image);
|
||||
/* actually fill image with some files now */
|
||||
proj->files->node = ISO_NODE(iso_image_get_root(image));
|
||||
ecdb_source_add_children_rec(proj->files, image);
|
||||
|
||||
/* Make the burn source here */
|
||||
iso_image_create_burn_source(image, opts, &data_src);
|
||||
iso_write_opts_free(opts);
|
||||
iso_image_unref(image);
|
||||
|
||||
/* And, convert to fifo */
|
||||
/* And, convert to fifo */
|
||||
FIFO_CREATE:
|
||||
fifo_src = burn_fifo_source_new(data_src,
|
||||
proj->fifo_chunksize, proj->fifo_chunks, 0);
|
||||
burn_source_free(data_src);
|
||||
return fifo_src;
|
||||
fifo_src = burn_fifo_source_new(data_src, proj->fifo_chunksize,
|
||||
proj->fifo_chunks, 0);
|
||||
burn_source_free(data_src);
|
||||
return fifo_src;
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
#ifndef ECDB_IMAGE_H
|
||||
#define ECDB_IMAGE_H
|
||||
|
||||
Ecdb_Source *ecdb_source_new(void);
|
||||
void ecdb_source_destroy(Ecdb_Source *src);
|
||||
void ecdb_source_data_set(Ecdb_Source *src, const char *dst);
|
||||
void ecdb_source_child_append(Ecdb_Source *src, Ecdb_Source *child);
|
||||
void ecdb_source_child_remove(Ecdb_Source *src, Ecdb_Source *child);
|
||||
Ecdb_Source *ecdb_source_new(void);
|
||||
void ecdb_source_destroy(Ecdb_Source *src);
|
||||
void ecdb_source_data_set(Ecdb_Source *src, const char *dst);
|
||||
void ecdb_source_child_append(Ecdb_Source *src, Ecdb_Source *child);
|
||||
void ecdb_source_child_remove(Ecdb_Source *src, Ecdb_Source *child);
|
||||
BurnSource *ecdb_image_project(Ecdb_Burn_Project *proj);
|
||||
|
||||
#endif
|
||||
|
@ -3,241 +3,264 @@
|
||||
Ecdb_Project *
|
||||
ecdb_project_new(void)
|
||||
{
|
||||
Ecdb_Project *proj;
|
||||
Ecdb_Project *proj;
|
||||
|
||||
proj = calloc(1, sizeof(Ecdb_Project));
|
||||
if (!proj)
|
||||
return NULL;
|
||||
if (!ecdb_project_init(proj))
|
||||
{
|
||||
FREE(proj);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return 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;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
ecdb_project_destroy(Ecdb_Project *proj)
|
||||
{
|
||||
printf("Destroying base project\n");
|
||||
printf("Destroying base project\n");
|
||||
}
|
||||
|
||||
void
|
||||
ecdb_project_type_set(Ecdb_Project *proj, unsigned int t)
|
||||
{
|
||||
proj->type = t;
|
||||
proj->type = t;
|
||||
}
|
||||
|
||||
int
|
||||
ecdb_shutdown(void *data, int type, void *event)
|
||||
{
|
||||
if (em->drives) ecore_list_destroy(em->drives);
|
||||
if (em->dnd_candidates) ecore_list_destroy(em->dnd_candidates);
|
||||
free(em);
|
||||
|
||||
if (!ecore_file_recursive_rm("/tmp/ecdb"))
|
||||
printf("Removal of temporary directory failed!\n");
|
||||
ewl_main_quit();
|
||||
return FALSE;
|
||||
if (em->drives)
|
||||
{
|
||||
ecore_list_destroy(em->drives);
|
||||
}
|
||||
if (em->dnd_candidates)
|
||||
{
|
||||
ecore_list_destroy(em->dnd_candidates);
|
||||
}
|
||||
FREE(em);
|
||||
|
||||
if (!ecore_file_recursive_rm("/tmp/ecdb"))
|
||||
{
|
||||
printf("Removal of temporary directory failed!\n");
|
||||
}
|
||||
ewl_main_quit();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int
|
||||
ecdb_burn_init(void)
|
||||
{
|
||||
if (!burn_initialize())
|
||||
return 0;
|
||||
if (!burn_initialize())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
burn_msgs_set_severities("NEVER", "SORRY", "ecdb: ");
|
||||
burn_set_signal_handling("ecdb: ", NULL, 0);
|
||||
burn_msgs_set_severities("NEVER", "SORRY", "ecdb: ");
|
||||
burn_set_signal_handling("ecdb: ", NULL, 0);
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
ecdb_image_init(void)
|
||||
{
|
||||
if (!iso_init())
|
||||
return 0;
|
||||
iso_set_msgs_severities("NEVER", "SORRY", "ecdb: ");
|
||||
if (!iso_init())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
iso_set_msgs_severities("NEVER", "SORRY", "ecdb: ");
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
ecdb_match_keyword(const char *chk, const char *key, int len)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
if (chk[i] != key[i])
|
||||
return TRUE;
|
||||
}
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
if (chk[i] != key[i])
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
char *
|
||||
ecdb_strip_string(const char *strip)
|
||||
{
|
||||
char *t1 = (char *)strip;
|
||||
char *t1 = (char *)strip;
|
||||
|
||||
do
|
||||
{
|
||||
if (*t1 == ' ')
|
||||
{
|
||||
t1++;
|
||||
return strdup(t1);
|
||||
}
|
||||
} while ((t1) && (t1++));
|
||||
do
|
||||
{
|
||||
if (*t1 == ' ')
|
||||
{
|
||||
t1++;
|
||||
return strdup(t1);
|
||||
}
|
||||
} while ((t1) && (t1++));
|
||||
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *
|
||||
ecdb_strip_next_argument(const char *strip)
|
||||
{
|
||||
char *t1 = (char *)strip, *t2;
|
||||
char *ret = NULL;
|
||||
int len = 0, space = FALSE;
|
||||
char *t1 = (char *)strip, *t2;
|
||||
char *ret = NULL;
|
||||
int len = 0, space = FALSE;
|
||||
|
||||
do
|
||||
{
|
||||
if (*t1 == ' ')
|
||||
space = TRUE;
|
||||
do
|
||||
{
|
||||
if (*t1 == ' ')
|
||||
{
|
||||
space = TRUE;
|
||||
}
|
||||
|
||||
if ((*t1 != ' ') && (space == TRUE))
|
||||
{
|
||||
t2 = t1;
|
||||
if ((*t1 != ' ') && (space == TRUE))
|
||||
{
|
||||
t2 = t1;
|
||||
|
||||
/* Find length of string to copy */
|
||||
while ((*t2) && (*t2 != ' '))
|
||||
{
|
||||
len++;
|
||||
t2++;
|
||||
}
|
||||
/* Find length of string to copy */
|
||||
while ((*t2) && (*t2 != ' '))
|
||||
{
|
||||
len++;
|
||||
t2++;
|
||||
}
|
||||
|
||||
/* Given no more args */
|
||||
if (!len)
|
||||
return NULL;
|
||||
else
|
||||
len++;
|
||||
/* Given no more args */
|
||||
if (!len)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
len++;
|
||||
}
|
||||
|
||||
/* Make a new string and copy everything over */
|
||||
ret = malloc(sizeof(char) * len);
|
||||
memcpy(ret, t1, len);
|
||||
return ret;
|
||||
}
|
||||
} while (*(t1++));
|
||||
/* Make a new string and copy everything over */
|
||||
ret = malloc(sizeof(char) * len);
|
||||
memcpy(ret, t1, len);
|
||||
return ret;
|
||||
}
|
||||
} while (*(t1++));
|
||||
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
ecdb_button_icon_swallow(Evas *e, Evas_Object *b, const char *iname)
|
||||
{
|
||||
Evas_Object *icon;
|
||||
Evas_Coord x, y, w, h;
|
||||
Evas_Object *icon;
|
||||
Evas_Coord x, y, w, h;
|
||||
|
||||
icon = edje_object_add(e);
|
||||
edje_object_file_set(icon, em->theme_path, iname);
|
||||
edje_object_part_geometry_get(b, "icon", &x, &y, &w, &h);
|
||||
evas_object_move(icon, x, y);
|
||||
evas_object_resize(icon, w, h);
|
||||
edje_object_part_swallow(b, "icon", icon);
|
||||
evas_object_show(icon);
|
||||
icon = edje_object_add(e);
|
||||
edje_object_file_set(icon, em->theme_path, iname);
|
||||
edje_object_part_geometry_get(b, "icon", &x, &y, &w, &h);
|
||||
evas_object_move(icon, x, y);
|
||||
evas_object_resize(icon, w, h);
|
||||
edje_object_part_swallow(b, "icon", icon);
|
||||
evas_object_show(icon);
|
||||
}
|
||||
|
||||
int
|
||||
ecdb_dnd_position(void *data, int type, void *event)
|
||||
{
|
||||
Ecore_X_Event_Xdnd_Position *ev;
|
||||
Evas_Object *o;
|
||||
Ecore_X_Rectangle rect;
|
||||
Evas_Coord window_x, window_y, window_w, window_h, x, y, w, h;
|
||||
Ecore_X_Event_Xdnd_Position *ev;
|
||||
Evas_Object *o;
|
||||
Ecore_X_Rectangle rect;
|
||||
Evas_Coord window_x, window_y, window_w, window_h, x, y, w, h;
|
||||
|
||||
ev = event;
|
||||
if (ev->win != ecore_evas_software_x11_window_get(em->main_win_ee))
|
||||
return 1;
|
||||
ev = event;
|
||||
if (ev->win != ecore_evas_software_x11_window_get(em->main_win_ee))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
ecore_evas_geometry_get(em->main_win_ee, &window_x,
|
||||
&window_y, &window_w, &window_h);
|
||||
ecore_list_first_goto(em->dnd_candidates);
|
||||
while ((o = ecore_list_next(em->dnd_candidates)))
|
||||
{
|
||||
if (evas_object_visible_get(o))
|
||||
{
|
||||
evas_object_geometry_get(o, &x, &y, &w, &h);
|
||||
x += window_x;
|
||||
y += window_y;
|
||||
ecore_evas_geometry_get(em->main_win_ee, &window_x, &window_y, &window_w,
|
||||
&window_h);
|
||||
ecore_list_first_goto(em->dnd_candidates);
|
||||
while ((o = ecore_list_next(em->dnd_candidates)))
|
||||
{
|
||||
if (evas_object_visible_get(o))
|
||||
{
|
||||
evas_object_geometry_get(o, &x, &y, &w, &h);
|
||||
x += window_x;
|
||||
y += window_y;
|
||||
|
||||
if ((ev->position.x >= x) && (ev->position.x <= (x+w))
|
||||
&& (ev->position.y >= y)
|
||||
&& (ev->position.y <= (y + h)))
|
||||
{
|
||||
rect.x = x;
|
||||
rect.y = y;
|
||||
rect.width = w;
|
||||
rect.height = h;
|
||||
em->drop_object = o;
|
||||
ecore_x_dnd_send_status(1, 1, rect,
|
||||
ECORE_X_DND_ACTION_PRIVATE);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((ev->position.x >= x) && (ev->position.x <= (x+w))
|
||||
&& (ev->position.y >= y) && (ev->position.y <= (y + h)))
|
||||
{
|
||||
rect.x = x;
|
||||
rect.y = y;
|
||||
rect.width = w;
|
||||
rect.height = h;
|
||||
em->drop_object = o;
|
||||
ecore_x_dnd_send_status(1, 1, rect, ECORE_X_DND_ACTION_PRIVATE);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rect.x = window_x;
|
||||
rect.y = window_y;
|
||||
rect.width = window_w;
|
||||
rect.height = window_h;
|
||||
ecore_x_dnd_send_status(0, 1, rect, ECORE_X_DND_ACTION_PRIVATE);
|
||||
rect.x = window_x;
|
||||
rect.y = window_y;
|
||||
rect.width = window_w;
|
||||
rect.height = window_h;
|
||||
ecore_x_dnd_send_status(0, 1, rect, ECORE_X_DND_ACTION_PRIVATE);
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
ecdb_dnd_drop(void *data, int type, void *event)
|
||||
{
|
||||
if (em->drop_object)
|
||||
{
|
||||
ecore_x_selection_xdnd_request
|
||||
(ecore_evas_software_x11_window_get(em->main_win_ee),
|
||||
"text/uri-list");
|
||||
}
|
||||
return 1;
|
||||
if (em->drop_object)
|
||||
{
|
||||
ecore_x_selection_xdnd_request
|
||||
(ecore_evas_software_x11_window_get(em->main_win_ee),
|
||||
"text/uri-list");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
ecdb_dnd_selection(void *data, int type, void *event)
|
||||
{
|
||||
Ecore_X_Event_Selection_Notify *ev;
|
||||
Ecore_X_Selection_Data_Files *files;
|
||||
void (*call_func)(Evas_Object *, Ecore_X_Selection_Data_Files *) =
|
||||
NULL;
|
||||
Ecore_X_Event_Selection_Notify *ev;
|
||||
Ecore_X_Selection_Data_Files *files;
|
||||
void (*call_func)(Evas_Object *, Ecore_X_Selection_Data_Files *) = NULL;
|
||||
|
||||
ev = event;
|
||||
if ((!em->drop_object) || (ev->selection != ECORE_X_SELECTION_XDND)
|
||||
|| (!(files = ev->data)) || (files->num_files <= 0))
|
||||
{
|
||||
ecore_x_dnd_send_finished();
|
||||
return 1;
|
||||
}
|
||||
ev = event;
|
||||
if ((!em->drop_object) || (ev->selection != ECORE_X_SELECTION_XDND)
|
||||
|| (!(files = ev->data)) || (files->num_files <= 0))
|
||||
{
|
||||
ecore_x_dnd_send_finished();
|
||||
return 1;
|
||||
}
|
||||
|
||||
call_func = evas_object_data_get(em->drop_object, "dnd_call_func");
|
||||
if (call_func != NULL)
|
||||
call_func(em->drop_object, files);
|
||||
call_func = evas_object_data_get(em->drop_object, "dnd_call_func");
|
||||
if (call_func != NULL)
|
||||
{
|
||||
call_func(em->drop_object, files);
|
||||
}
|
||||
|
||||
em->drop_object = NULL;
|
||||
ecore_x_dnd_send_finished();
|
||||
return 1;
|
||||
em->drop_object = NULL;
|
||||
ecore_x_dnd_send_finished();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@ -246,5 +269,9 @@ ecdb_dnd_selection(void *data, int type, void *event)
|
||||
void
|
||||
ecdb_dnd_entry_dnd_set(Evas_Object *o, Ecore_X_Selection_Data_Files *files)
|
||||
{
|
||||
edje_object_part_text_set(o, "label", files->files[0]);
|
||||
Efreet_Uri *uri;
|
||||
|
||||
uri = efreet_uri_decode(files->files[0]);
|
||||
edje_object_part_text_set(o, "label", uri->path);
|
||||
efreet_uri_free(uri);
|
||||
}
|
||||
|
@ -3,27 +3,27 @@
|
||||
|
||||
// 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_burn_init(void);
|
||||
int ecdb_image_init(void);
|
||||
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_burn_init(void);
|
||||
int ecdb_image_init(void);
|
||||
|
||||
/* This is misc after all */
|
||||
int ecdb_match_keyword(const char *chk, const char *key, int len);
|
||||
char *ecdb_strip_next_argument(const char *strip);
|
||||
char *ecdb_strip_string(const char *strip);
|
||||
void ecdb_button_icon_swallow(Evas *e, Evas_Object *b,
|
||||
const char *iname);
|
||||
int ecdb_match_keyword(const char *chk, const char *key, int len);
|
||||
char *ecdb_strip_next_argument(const char *strip);
|
||||
char *ecdb_strip_string(const char *strip);
|
||||
void ecdb_button_icon_swallow(Evas *e, Evas_Object *b,
|
||||
const char *iname);
|
||||
|
||||
// Also consider moving dnd stuff into its own file
|
||||
int ecdb_dnd_position(void *data, int type, void *event);
|
||||
int ecdb_dnd_drop(void *data, int type, void *event);
|
||||
int ecdb_dnd_selection(void *data, int type, void *event);
|
||||
void ecdb_dnd_entry_dnd_set(Evas_Object *o,
|
||||
Ecore_X_Selection_Data_Files *files);
|
||||
int ecdb_dnd_position(void *data, int type, void *event);
|
||||
int ecdb_dnd_drop(void *data, int type, void *event);
|
||||
int ecdb_dnd_selection(void *data, int type, void *event);
|
||||
void ecdb_dnd_entry_dnd_set(Evas_Object *o,
|
||||
Ecore_X_Selection_Data_Files *files);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user