Add in beginnings of gui

This commit is contained in:
Jaime Thomas 2008-06-06 03:02:27 +00:00
parent aa1fcc472c
commit 8fd557fa07
5 changed files with 119 additions and 4 deletions

View File

@ -9,6 +9,7 @@ ecdb_SOURCES = \
ecdb_burn.c ecdb_burn.h \ ecdb_burn.c ecdb_burn.h \
ecdb_misc.c ecdb_misc.h \ ecdb_misc.c ecdb_misc.h \
ecdb_audio.c ecdb_audio.h \ ecdb_audio.c ecdb_audio.h \
ecdb_gui.c ecdb_gui.h \
ecdb_common.h ecdb_common.h
ecdb_CFLAGS = @ECDB_CFLAGS@ ecdb_CFLAGS = @ECDB_CFLAGS@

View File

@ -17,6 +17,7 @@ main(int argc, char **argv)
if (!ecore_init()) if (!ecore_init())
{ {
printf("Cannot initialize Ecore!\n"); printf("Cannot initialize Ecore!\n");
ret = 1;
return 1; return 1;
} }
@ -27,6 +28,13 @@ main(int argc, char **argv)
goto SHUTDOWN; goto SHUTDOWN;
} }
if (!ewl_init(&argc, argv))
{
printf("Cannot initialize EWL!\n");
ret = 1;
goto SHUTDOWN;
}
if (!ecdb_setup()) if (!ecdb_setup())
{ {
printf("Setup failed\n"); printf("Setup failed\n");
@ -35,9 +43,10 @@ main(int argc, char **argv)
} }
ecdb_print_drive_info(); ecdb_print_drive_info();
ecdb_burn_init(); ecdb_create_main_gui();
/*
/* Start testing */
Ecdb_Audio_Project *proj; Ecdb_Audio_Project *proj;
Ecdb_Source *src; Ecdb_Source *src;
proj = ecdb_audio_project_new(); proj = ecdb_audio_project_new();
@ -45,7 +54,6 @@ main(int argc, char **argv)
i = 1; i = 1;
while ((i < argc) && (argv)) while ((i < argc) && (argv))
{ {
/* No trailing slashes */
if (ecore_file_exists(argv[i])) if (ecore_file_exists(argv[i]))
{ {
if (!ecore_file_is_dir(argv[i])) if (!ecore_file_is_dir(argv[i]))
@ -60,7 +68,6 @@ main(int argc, char **argv)
ecdb_audio_project_start(proj); ecdb_audio_project_start(proj);
/*
proj->publisher_id = proj->data_preparer_id = proj->system_id = proj->publisher_id = proj->data_preparer_id = proj->system_id =
proj->application_id = proj->copywrite_id = proj->application_id = proj->copywrite_id =
proj->abstract_id = proj->biblio_id = strdup("ecdb"); proj->abstract_id = proj->biblio_id = strdup("ecdb");
@ -109,6 +116,7 @@ ecdb_setup(void)
ECDB_DRIVE_ACTION_BEGUN = ecore_event_type_new(); ECDB_DRIVE_ACTION_BEGUN = ecore_event_type_new();
ECDB_DRIVE_ACTION_UPDATE = ecore_event_type_new(); ECDB_DRIVE_ACTION_UPDATE = ecore_event_type_new();
ecdb_image_init(); ecdb_image_init();
ecdb_burn_init();
ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, ecdb_shutdown, ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, ecdb_shutdown,
NULL); NULL);

View File

@ -6,6 +6,7 @@
#include <Ecore_Data.h> #include <Ecore_Data.h>
#include <Ecore_File.h> #include <Ecore_File.h>
#include <Efreet_Mime.h> #include <Efreet_Mime.h>
#include <Ewl.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -45,6 +46,7 @@ extern int ECDB_DRIVE_ACTION_UPDATE;
#include "ecdb_burn.h" #include "ecdb_burn.h"
#include "ecdb_misc.h" #include "ecdb_misc.h"
#include "ecdb_audio.h" #include "ecdb_audio.h"
#include "ecdb_gui.h"
#endif #endif

98
ecdb/trunk/src/ecdb_gui.c Normal file
View File

@ -0,0 +1,98 @@
#include "ecdb.h"
static void _destroy_cb(Ewl_Widget *w, void *ev, void *data);
static Ewl_Widget *_page_start(void);
static void
_destroy_cb(Ewl_Widget *w, void *ev, void *data)
{
ewl_widget_destroy(w);
ecore_event_add(ECORE_EVENT_SIGNAL_EXIT, NULL, NULL, NULL);
}
void
ecdb_create_main_gui(void)
{
Ewl_Widget *main_win, *vbox, *filelist, *note, *fn;
main_win = ewl_window_new();
ewl_window_name_set(EWL_WINDOW(main_win), "ECDB");
ewl_window_title_set(EWL_WINDOW(main_win), "ECDB");
ewl_callback_append(main_win, EWL_CALLBACK_DELETE_WINDOW,
_destroy_cb, NULL);
ewl_widget_show(main_win);
vbox = ewl_vbox_new();
ewl_container_child_append(EWL_CONTAINER(main_win), vbox);
ewl_widget_show(vbox);
filelist = ewl_filelist_new();
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_directory_set(EWL_FILELIST(filelist), getenv("HOME"));
ewl_object_fill_policy_set(EWL_OBJECT(filelist), EWL_FLAG_FILL_ALL);
ewl_object_maximum_h_set(EWL_OBJECT(filelist), 300);
ewl_widget_show(filelist);
note = ewl_notebook_new();
ewl_object_fill_policy_set(EWL_OBJECT(note), EWL_FLAG_FILL_ALL);
ewl_container_child_append(EWL_CONTAINER(vbox), note);
ewl_notebook_tabbar_alignment_set(EWL_NOTEBOOK(note),
EWL_FLAG_ALIGN_LEFT);
ewl_widget_name_set(note, "main_notebook");
ewl_widget_show(note);
fn = _page_start();
ewl_container_child_append(EWL_CONTAINER(note), fn);
ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(note), fn, "Start");
ewl_widget_show(fn);
}
static Ewl_Widget
*_page_start(void)
{
int i;
Ewl_Widget *box, *border[3], *buttons[3];
char *bdr_titles[] = {"Create Data Disc",
"Burn Image",
"Copy Disc",
"Create Audio Disc",
NULL};
char *but_titles[] = {"Data Disc",
"Image",
"Copy",
"Audio Disc",
NULL};
char *images[] = {EWL_ICON_DRIVE_CDROM,
EWL_ICON_MEDIA_CDROM,
EWL_ICON_DRIVE_HARDDISK,
EWL_ICON_AUDIO_X_GENERIC,
NULL};
box = ewl_hbox_new();
ewl_object_fill_policy_set(EWL_OBJECT(box), EWL_FLAG_FILL_NONE);
ewl_widget_show(box);
for (i = 0; i < 4; i++)
{
border[i] = ewl_border_new();
ewl_border_label_set(EWL_BORDER(border[i]), bdr_titles[i]);
ewl_container_child_append(EWL_CONTAINER(box), border[i]);
ewl_widget_show(border[i]);
buttons[i] = ewl_button_new();
ewl_container_child_append(EWL_CONTAINER(border[i]),
buttons[i]);
ewl_button_label_set(EWL_BUTTON(buttons[i]), but_titles[i]);
ewl_button_image_set(EWL_BUTTON(buttons[i]),
ewl_icon_theme_icon_path_get(images[i], 0),
NULL);
ewl_widget_show(buttons[i]);
}
return box;
}

View File

@ -0,0 +1,6 @@
#ifndef ECDB_GUI_H
#define ECDB_GUI_H
void ecdb_create_main_gui(void);
#endif