legacy/experimental/ecdb/trunk/src/ecdb_gui.c

99 lines
2.7 KiB
C
Raw Normal View History

2008-06-06 03:02:27 +00:00
#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;
}