Some small gui work and bug fixes

This commit is contained in:
Jaime Thomas 2008-06-10 03:33:53 +00:00
parent e6aae7748d
commit 1d6bc631f7
9 changed files with 112 additions and 8 deletions

View File

@ -11,7 +11,6 @@ int ecdb_setup();
int int
main(int argc, char **argv) main(int argc, char **argv)
{ {
int i;
int ret = 0; int ret = 0;
if (!ecore_init()) if (!ecore_init())
@ -107,7 +106,6 @@ ecdb_setup(void)
em = NULL; em = NULL;
em = calloc(1, sizeof(Ecdb_Main)); em = calloc(1, sizeof(Ecdb_Main));
em->drives = NULL; em->drives = NULL;
em->projects = ecore_list_new();
if (!ecore_file_mkdir("/tmp/ecdb")) if (!ecore_file_mkdir("/tmp/ecdb"))
printf("Creation of temporary directory failed!\n"); printf("Creation of temporary directory failed!\n");

View File

@ -29,7 +29,6 @@
typedef struct _Ecdb_Main Ecdb_Main; typedef struct _Ecdb_Main Ecdb_Main;
struct _Ecdb_Main struct _Ecdb_Main
{ {
Ecore_List *projects;
Ecore_List *drives; Ecore_List *drives;
}; };

View File

@ -26,6 +26,7 @@ ecdb_audio_project_init(Ecdb_Audio_Project *proj)
if (!ecdb_project_init(ECDB_PROJECT(proj))) if (!ecdb_project_init(ECDB_PROJECT(proj)))
return FALSE; return FALSE;
ecdb_project_type_set(ECDB_PROJECT(proj), ECDB_AUDIO_PROJECT);
proj->tracks = ecdb_source_new(); proj->tracks = ecdb_source_new();
proj->num_tracks = 0; proj->num_tracks = 0;
proj->num_transcode_complete = 0; proj->num_transcode_complete = 0;
@ -59,7 +60,7 @@ ecdb_audio_project_start(Ecdb_Audio_Project *proj)
ECORE_EXE_PIPE_READ_LINE_BUFFERED, NULL); ECORE_EXE_PIPE_READ_LINE_BUFFERED, NULL);
} }
proj->num_tracks = i; proj->num_tracks = i + 1;
ecore_event_handler_add(ECORE_EXE_EVENT_DATA, transcode_data_cb, proj); ecore_event_handler_add(ECORE_EXE_EVENT_DATA, transcode_data_cb, proj);
} }

View File

@ -40,6 +40,7 @@ ecdb_burn_project_init(Ecdb_Burn_Project *proj)
return FALSE; return FALSE;
/* Create some sane defaults */ /* Create some sane defaults */
ecdb_project_type_set(ECDB_PROJECT(proj), ECDB_BURN_PROJECT);
proj->burn_mode = BURN_MODE1; proj->burn_mode = BURN_MODE1;
proj->fifo_chunksize = 2048; proj->fifo_chunksize = 2048;
proj->fifo_chunks = 2048; proj->fifo_chunks = 2048;
@ -75,6 +76,7 @@ ecdb_erase_project_init(Ecdb_Erase_Project *proj)
return FALSE; return FALSE;
/* Proper defaults */ /* Proper defaults */
ecdb_project_type_set(ECDB_PROJECT(proj), ECDB_ERASE_PROJECT);
proj->quick = TRUE; proj->quick = TRUE;
proj->format = FALSE; proj->format = FALSE;

View File

@ -11,6 +11,15 @@ typedef struct burn_progress BurnProgress;
typedef struct burn_drive_info BurnDriveInfo; typedef struct burn_drive_info BurnDriveInfo;
typedef enum burn_drive_status BurnDriveStatus; 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
};
typedef struct _Ecdb_Drive_Info Ecdb_Drive_Info; typedef struct _Ecdb_Drive_Info Ecdb_Drive_Info;
struct _Ecdb_Drive_Info struct _Ecdb_Drive_Info
{ {
@ -49,6 +58,7 @@ struct _Ecdb_Project_Info
BurnProgress progress; BurnProgress progress;
BurnDriveStatus stat; BurnDriveStatus stat;
Ecore_Event_Handler *ev_handler; Ecore_Event_Handler *ev_handler;
unsigned int type;
}; };
/* Typecast a pointer to an Ecdb_Source */ /* Typecast a pointer to an Ecdb_Source */

View File

@ -1,7 +1,14 @@
#include "ecdb.h" #include "ecdb.h"
static void _destroy_cb(Ewl_Widget *w, void *ev, void *data); static void _destroy_cb(Ewl_Widget *w, void *ev, void *data);
static void _destroy_data_page_cb(Ewl_Widget *w, void *ev, void *data);
static void _data_disc_cb(Ewl_Widget *w, void *ev, void *data);
static void _burn_image_cb(Ewl_Widget *w, void *ev, void *data);
static void _copy_disc_cb(Ewl_Widget *w, void *ev, void *data);
static void _audio_disc_cb(Ewl_Widget *w, void *ev, void *data);
static Ewl_Widget *_page_start(void); static Ewl_Widget *_page_start(void);
static Ewl_Widget *_page_data(void);
static void static void
_destroy_cb(Ewl_Widget *w, void *ev, void *data) _destroy_cb(Ewl_Widget *w, void *ev, void *data)
@ -10,6 +17,29 @@ _destroy_cb(Ewl_Widget *w, void *ev, void *data)
ecore_event_add(ECORE_EVENT_SIGNAL_EXIT, NULL, NULL, NULL); ecore_event_add(ECORE_EVENT_SIGNAL_EXIT, NULL, NULL, NULL);
} }
static void
_destroy_data_page_cb(Ewl_Widget *w, void *ev, void *data)
{
Ecdb_Burn_Project *proj = data;
printf("Destroy burn project data\n");
ecdb_burn_project_destroy(proj);
}
void
ecdb_create_data_tab(void)
{
Ewl_Widget *note_page, *notebook;
notebook = ewl_widget_name_find("main_notebook");
note_page = _page_data();
ewl_container_child_append(EWL_CONTAINER(notebook), note_page);
ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(notebook), note_page,
"Data Disc");
ewl_notebook_visible_page_set(EWL_NOTEBOOK(notebook), note_page);
ewl_widget_show(note_page);
}
void void
ecdb_create_main_gui(void) ecdb_create_main_gui(void)
{ {
@ -20,6 +50,9 @@ ecdb_create_main_gui(void)
ewl_window_title_set(EWL_WINDOW(main_win), "ECDB"); ewl_window_title_set(EWL_WINDOW(main_win), "ECDB");
ewl_callback_append(main_win, EWL_CALLBACK_DELETE_WINDOW, ewl_callback_append(main_win, EWL_CALLBACK_DELETE_WINDOW,
_destroy_cb, NULL); _destroy_cb, NULL);
ewl_object_w_request(EWL_OBJECT(main_win), 640);
ewl_object_h_request(EWL_OBJECT(main_win), 480);
ewl_widget_name_set(main_win, "main_win");
ewl_widget_show(main_win); ewl_widget_show(main_win);
vbox = ewl_vbox_new(); vbox = ewl_vbox_new();
@ -28,7 +61,6 @@ ecdb_create_main_gui(void)
filelist = ewl_filelist_new(); filelist = ewl_filelist_new();
ewl_container_child_append(EWL_CONTAINER(vbox), filelist); ewl_container_child_append(EWL_CONTAINER(vbox), filelist);
ewl_filelist_view_set(EWL_FILELIST(filelist), EWL_FILELIST_VIEW_LIST);
ewl_filelist_multiselect_set(EWL_FILELIST(filelist), TRUE); ewl_filelist_multiselect_set(EWL_FILELIST(filelist), TRUE);
ewl_filelist_directory_set(EWL_FILELIST(filelist), getenv("HOME")); ewl_filelist_directory_set(EWL_FILELIST(filelist), getenv("HOME"));
ewl_object_fill_policy_set(EWL_OBJECT(filelist), EWL_FLAG_FILL_ALL); ewl_object_fill_policy_set(EWL_OBJECT(filelist), EWL_FLAG_FILL_ALL);
@ -72,6 +104,13 @@ static Ewl_Widget
EWL_ICON_AUDIO_X_GENERIC, EWL_ICON_AUDIO_X_GENERIC,
NULL}; NULL};
static void (*funs[]) (Ewl_Widget *w, void *ev, void *data) =
{_data_disc_cb,
_burn_image_cb,
_copy_disc_cb,
_audio_disc_cb,
NULL};
box = ewl_hbox_new(); box = ewl_hbox_new();
ewl_object_fill_policy_set(EWL_OBJECT(box), EWL_FLAG_FILL_NONE); ewl_object_fill_policy_set(EWL_OBJECT(box), EWL_FLAG_FILL_NONE);
ewl_widget_show(box); ewl_widget_show(box);
@ -90,9 +129,58 @@ static Ewl_Widget
ewl_button_image_set(EWL_BUTTON(buttons[i]), ewl_button_image_set(EWL_BUTTON(buttons[i]),
ewl_icon_theme_icon_path_get(images[i], 0), ewl_icon_theme_icon_path_get(images[i], 0),
NULL); NULL);
ewl_callback_append(buttons[i], EWL_CALLBACK_CLICKED,
funs[i], NULL);
ewl_widget_show(buttons[i]); ewl_widget_show(buttons[i]);
} }
return box; return box;
} }
static Ewl_Widget
*_page_data(void)
{
Ewl_Widget *box, *filelist;
Ecdb_Burn_Project *proj;
proj = ecdb_burn_project_new();
box = ewl_vbox_new();
ewl_widget_data_set(box, "proj_data", proj);
ewl_callback_append(box, EWL_CALLBACK_DESTROY,
_destroy_data_page_cb, proj);
ewl_widget_show(box);
filelist = ewl_filelist_new();
ewl_filelist_multiselect_set(EWL_FILELIST(filelist), TRUE);
ewl_container_child_append(EWL_CONTAINER(box), filelist);
ewl_widget_show(filelist);
return box;
}
static void
_data_disc_cb(Ewl_Widget *w, void *ev, void *data)
{
printf("Create Data Disc\n");
ecdb_create_data_tab();
}
static void
_burn_image_cb(Ewl_Widget *w, void *ev, void *data)
{
printf("Burn Image to Disc\n");
}
static void
_copy_disc_cb(Ewl_Widget *w, void *ev, void *data)
{
printf("Copy Disc\n");
}
static void
_audio_disc_cb(Ewl_Widget *w, void *ev, void *data)
{
printf("Create Audio Disc\n");
}

View File

@ -2,5 +2,6 @@
#define ECDB_GUI_H #define ECDB_GUI_H
void ecdb_create_main_gui(void); void ecdb_create_main_gui(void);
void ecdb_create_data_tab(void);
#endif #endif

View File

@ -20,7 +20,6 @@ ecdb_project_new(void)
int int
ecdb_project_init(Ecdb_Project *proj) ecdb_project_init(Ecdb_Project *proj)
{ {
ecore_list_append(em->projects, proj);
return TRUE; return TRUE;
} }
@ -30,11 +29,15 @@ ecdb_project_destroy(Ecdb_Project *proj)
free(proj); free(proj);
} }
void
ecdb_project_type_set(Ecdb_Project *proj, unsigned int t)
{
proj->type = t;
}
int int
ecdb_shutdown(void *data, int type, void *event) ecdb_shutdown(void *data, int type, void *event)
{ {
if (em->projects)
ecore_list_destroy(em->projects);
if (em->drives) if (em->drives)
ecore_list_destroy(em->drives); ecore_list_destroy(em->drives);
free(em); free(em);

View File

@ -4,6 +4,8 @@
Ecdb_Project *ecdb_project_new(void); Ecdb_Project *ecdb_project_new(void);
int ecdb_project_init(Ecdb_Project *proj); int ecdb_project_init(Ecdb_Project *proj);
void ecdb_project_destroy(Ecdb_Project *proj); void ecdb_project_destroy(Ecdb_Project *proj);
void ecdb_project_type_set(Ecdb_Project *proj, unsigned int t);
void ecdb_projects_free(void *data);
int ecdb_shutdown(void *data, int type, void *event); int ecdb_shutdown(void *data, int type, void *event);
void ecdb_burn_init(void); void ecdb_burn_init(void);
void ecdb_image_init(void); void ecdb_image_init(void);