General cleanups, able to enter multi-word directories, and start on the erase disc interface.
This commit is contained in:
parent
f8c2aa95fb
commit
6cffccc0ef
@ -10,4 +10,5 @@ collections {
|
||||
#include "groups/welcome_page.edc"
|
||||
#include "groups/button.edc"
|
||||
#include "groups/icons.edc"
|
||||
#include "groups/erase_disc.edc"
|
||||
}
|
||||
|
@ -0,0 +1,51 @@
|
||||
group {
|
||||
name: "ecdb/erase_page";
|
||||
min: 640 170;
|
||||
|
||||
parts {
|
||||
part {
|
||||
name: "bg";
|
||||
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
color: 0 0 0 0;
|
||||
|
||||
rel1 {
|
||||
relative: 0.0 0.0;
|
||||
offset: 0 0;
|
||||
}
|
||||
|
||||
rel2 {
|
||||
relative: 1.0 1.0;
|
||||
offset: -1 -1;
|
||||
}
|
||||
}
|
||||
|
||||
description {
|
||||
state: "visible" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
color: 255 0 0 120;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
programs {
|
||||
program {
|
||||
name: "erase_page,visible";
|
||||
signal: "ecdb,erase_page,visible";
|
||||
source: "ecdb";
|
||||
action: STATE_SET "visible" 0.0;
|
||||
target: "bg";
|
||||
transition: LINEAR 0.5;
|
||||
}
|
||||
|
||||
program {
|
||||
name: "erase_page,hide";
|
||||
signal: "ecdb,erase_page,hide";
|
||||
source: "ecdb";
|
||||
action: STATE_SET "default" 0.0;
|
||||
target: "bg";
|
||||
transition: LINEAR 0.5;
|
||||
}
|
||||
}
|
||||
}
|
@ -5,6 +5,8 @@ static void ecdb_cb_welcome_page_buttons_focused(void *data, Evas_Object *o,
|
||||
const char *emission, const char *source);
|
||||
static void ecdb_cb_welcome_page_buttons_clicked(void *data, Evas_Object *o,
|
||||
const char *emission, const char *source);
|
||||
static void ecdb_filelist_show(void);
|
||||
static void ecdb_welcome_page_show(void);
|
||||
|
||||
static void
|
||||
ecdb_cb_enter(Ecore_Evas *ee)
|
||||
@ -154,9 +156,7 @@ int
|
||||
ecdb_create_main_gui(void)
|
||||
{
|
||||
Evas_Object *gui;
|
||||
Evas_Coord x, y, w, h;
|
||||
Ewl_Widget *embed, *filelist;
|
||||
Evas_Object *swallow;
|
||||
Evas_Coord mw, mh;
|
||||
|
||||
em->main_win_ee = ecore_evas_software_x11_new(0, 0, 0, 0, 255, 255);
|
||||
|
||||
@ -179,140 +179,35 @@ ecdb_create_main_gui(void)
|
||||
edje_frametime_set(1.0 / 60.0);
|
||||
ecore_evas_show(em->main_win_ee);
|
||||
|
||||
/* Make this configurable at some point */
|
||||
ecdb_set_main_theme(NULL);
|
||||
|
||||
gui = edje_object_add(ecore_evas_get(em->main_win_ee));
|
||||
edje_object_file_set(gui, em->theme_path, "ecdb/window");
|
||||
edje_object_size_min_get(gui, &mw, &mh);
|
||||
if (mw <= 0) mw = 400;
|
||||
if (mh <= 0) mh = 300;
|
||||
evas_object_resize(gui, mw, mh);
|
||||
ecore_evas_resize(em->main_win_ee, mw, mh);
|
||||
ecore_evas_size_min_set(em->main_win_ee, mw, mh);
|
||||
evas_object_name_set(gui, "gui");
|
||||
evas_object_move(gui, 0, 0);
|
||||
evas_object_show(gui);
|
||||
|
||||
ecdb_set_main_theme(NULL, "ecdb/window");
|
||||
|
||||
/* Filelist swallow next */
|
||||
embed = ewl_embed_new();
|
||||
ewl_object_fill_policy_set(EWL_OBJECT(embed), EWL_FLAG_FILL_ALL);
|
||||
swallow = ewl_embed_canvas_set(EWL_EMBED(embed),
|
||||
ecore_evas_get(em->main_win_ee),
|
||||
(void *)(long) ecore_evas_software_x11_window_get
|
||||
(em->main_win_ee));
|
||||
ewl_embed_focus_set(EWL_EMBED(embed), TRUE);
|
||||
ewl_widget_show(embed);
|
||||
|
||||
filelist = ewl_filelist_new();
|
||||
ewl_widget_name_set(EWL_WIDGET(filelist), "main_filelist");
|
||||
ewl_container_child_append(EWL_CONTAINER(embed), filelist);
|
||||
ewl_filelist_directory_set(EWL_FILELIST(filelist), getenv("HOME"));
|
||||
ewl_callback_append(filelist, EWL_CALLBACK_MOUSE_IN,
|
||||
_cb_filelist_mouse_in, gui);
|
||||
ewl_callback_append(filelist, EWL_CALLBACK_MOUSE_OUT,
|
||||
_cb_filelist_mouse_out, gui);
|
||||
ewl_widget_show(filelist);
|
||||
|
||||
edje_object_part_geometry_get(gui, "filelist", &x, &y, &w, &h);
|
||||
evas_object_name_set(swallow, "main_filelist");
|
||||
evas_object_move(swallow, x, y);
|
||||
evas_object_resize(swallow, w, h);
|
||||
edje_object_part_swallow(gui, "filelist", swallow);
|
||||
evas_object_event_callback_add(swallow, EVAS_CALLBACK_MOUSE_DOWN,
|
||||
_cb_filelist_mouse_down, gui);
|
||||
evas_object_event_callback_add(swallow, EVAS_CALLBACK_KEY_DOWN,
|
||||
_cb_filelist_key_down, gui);
|
||||
evas_object_show(swallow);
|
||||
|
||||
/* Set up the welcome page */
|
||||
Evas_Object *welcome_page;
|
||||
|
||||
welcome_page = edje_object_add(ecore_evas_get(em->main_win_ee));
|
||||
evas_object_name_set(welcome_page, "welcome_page");
|
||||
edje_object_file_set(welcome_page, em->theme_path, "ecdb/welcome_page");
|
||||
edje_object_part_geometry_get(gui, "active_area", &x, &y, &w, &h);
|
||||
evas_object_move(welcome_page, x, y);
|
||||
evas_object_resize(welcome_page, w, h);
|
||||
edje_object_part_swallow(gui, "action_area", welcome_page);
|
||||
edje_object_signal_callback_add(welcome_page, "mouse,down,1", "ecdb/*",
|
||||
ecdb_cb_welcome_page_buttons_focused, NULL);
|
||||
edje_object_signal_callback_add(welcome_page, "mouse,clicked,1",
|
||||
"ecdb/*", ecdb_cb_welcome_page_buttons_clicked, NULL);
|
||||
evas_object_show(welcome_page);
|
||||
|
||||
/* Buttons next, do properly next */
|
||||
Evas_Object *b;
|
||||
int i;
|
||||
char *labels[] = {"Burn Data CD", "Burn Audio CD", "Burn Image",
|
||||
"Erase Re-writable Disc"};
|
||||
char *ids[] = {"ecdb/burn_data", "ecdb/burn_audio", "ecdb/burn_image",
|
||||
"ecdb/erase"};
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
b = edje_object_add(ecore_evas_get(em->main_win_ee));
|
||||
evas_object_name_set(b, ids[i]);
|
||||
edje_object_file_set(b, em->theme_path, "ecdb/button");
|
||||
edje_object_part_geometry_get(welcome_page, ids[i], &x,
|
||||
&y, &w, &h);
|
||||
edje_object_part_text_set(b, "label", labels[i]);
|
||||
evas_object_move(b, x, y);
|
||||
evas_object_resize(b, w, h);
|
||||
edje_object_part_swallow(welcome_page, ids[i], b);
|
||||
evas_object_show(b);
|
||||
|
||||
/* Place this after */
|
||||
ecdb_button_icon_swallow(ecore_evas_get(em->main_win_ee), b,
|
||||
ids[i]);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int
|
||||
ecdb_create_data_tab(void)
|
||||
{
|
||||
printf("Creating data tab\n");
|
||||
|
||||
ecdb_welcome_page_show();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
ecdb_set_main_theme(const char *theme_name, const char *group)
|
||||
ecdb_set_main_theme(const char *theme_name)
|
||||
{
|
||||
Evas_Coord mw, mh;
|
||||
Evas_Object *gui;
|
||||
|
||||
gui = evas_object_name_find(ecore_evas_get(em->main_win_ee), "gui");
|
||||
|
||||
if ((!group) || (!gui))
|
||||
{
|
||||
printf("Fail on group or object!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!theme_name)
|
||||
{
|
||||
snprintf(em->theme_path, PATH_MAX, "%s/%s", PACKAGE_DATA_DIR,
|
||||
"themes/default.edj");
|
||||
if (!edje_object_file_set(gui, em->theme_path, group))
|
||||
{
|
||||
printf("Error setting default theme: %s\n",
|
||||
em->theme_path);
|
||||
return;
|
||||
}
|
||||
evas_font_path_append(ecore_evas_get(em->main_win_ee),
|
||||
PACKAGE_DATA_DIR"/font");
|
||||
}
|
||||
|
||||
else if (!edje_object_file_set(gui, theme_name, group))
|
||||
{
|
||||
printf("Error setting theme to: %s\n", theme_name);
|
||||
return;
|
||||
}
|
||||
|
||||
edje_object_size_min_get(gui, &mw, &mh);
|
||||
if ((mw <= 0) && (mh <= 0))
|
||||
{
|
||||
mw = 255;
|
||||
mh = 255;
|
||||
}
|
||||
|
||||
evas_object_resize(gui, mw, mh);
|
||||
ecore_evas_resize(em->main_win_ee, mw, mh);
|
||||
ecore_evas_size_min_set(em->main_win_ee, mw, mh);
|
||||
}
|
||||
|
||||
void
|
||||
@ -334,7 +229,7 @@ ecdb_handle_typebuf(Evas_Object *gui)
|
||||
char *dir;
|
||||
|
||||
/* What to do about multi-word directories? */
|
||||
dir = ecdb_strip_next_argument(ext);
|
||||
dir = ecdb_strip_string(ext);
|
||||
|
||||
if ((dir) && (dir[0] == '/'))
|
||||
{
|
||||
@ -439,10 +334,135 @@ ecdb_cb_welcome_page_buttons_clicked(void *data, Evas_Object *o,
|
||||
* now
|
||||
*/
|
||||
if (!strcmp(source, "ecdb/burn_data"))
|
||||
edje_object_signal_emit(gui, "ecdb,filelist,visible", "ecdb");
|
||||
ecdb_filelist_show();
|
||||
else if (swallow)
|
||||
edje_object_signal_emit(gui, "ecdb,filelist,hide", "ecdb");
|
||||
|
||||
printf("Action: %s\n", source);
|
||||
}
|
||||
|
||||
static void
|
||||
ecdb_welcome_page_show(void)
|
||||
{
|
||||
Evas_Object *gui, *swallow;
|
||||
|
||||
gui = evas_object_name_find(ecore_evas_get(em->main_win_ee), "gui");
|
||||
swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee),
|
||||
"welcome_page");
|
||||
|
||||
if (!swallow)
|
||||
{
|
||||
Evas_Coord x, y, w, h;
|
||||
|
||||
swallow = edje_object_add(ecore_evas_get(em->main_win_ee));
|
||||
evas_object_name_set(swallow, "welcome_page");
|
||||
edje_object_file_set(swallow, em->theme_path,
|
||||
"ecdb/welcome_page");
|
||||
edje_object_part_geometry_get(gui, "active_area",
|
||||
&x, &y, &w, &h);
|
||||
evas_object_move(swallow, x, y);
|
||||
evas_object_resize(swallow, w, h);
|
||||
edje_object_part_swallow(gui, "action_area", swallow);
|
||||
edje_object_signal_callback_add(swallow, "mouse,down,1",
|
||||
"ecdb/*", ecdb_cb_welcome_page_buttons_focused,
|
||||
NULL);
|
||||
edje_object_signal_callback_add(swallow, "mouse,clicked,1",
|
||||
"ecdb/*", ecdb_cb_welcome_page_buttons_clicked,
|
||||
NULL);
|
||||
evas_object_show(swallow);
|
||||
|
||||
Evas_Object *b;
|
||||
int i;
|
||||
char *labels[] = {"Burn Data CD", "Burn Audio CD",
|
||||
"Burn Image", "Erase Re-writable Disc"};
|
||||
char *ids[] = {"ecdb/burn_data", "ecdb/burn_audio",
|
||||
"ecdb/burn_image", "ecdb/erase"};
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
b = edje_object_add(ecore_evas_get(em->main_win_ee));
|
||||
evas_object_name_set(b, ids[i]);
|
||||
edje_object_file_set(b, em->theme_path, "ecdb/button");
|
||||
edje_object_part_geometry_get(swallow, ids[i], &x,
|
||||
&y, &w, &h);
|
||||
edje_object_part_text_set(b, "label", labels[i]);
|
||||
evas_object_move(b, x, y);
|
||||
evas_object_resize(b, w, h);
|
||||
edje_object_part_swallow(swallow, ids[i], b);
|
||||
evas_object_show(b);
|
||||
|
||||
/* Place this after */
|
||||
ecdb_button_icon_swallow(ecore_evas_get
|
||||
(em->main_win_ee), b, ids[i]);
|
||||
}
|
||||
}
|
||||
|
||||
else if (edje_object_part_swallow_get(gui, "action_area") != swallow)
|
||||
{
|
||||
/* All that is needed here? */
|
||||
edje_object_part_swallow(gui, "action_area", swallow);
|
||||
evas_object_show(swallow);
|
||||
}
|
||||
|
||||
edje_object_signal_emit(gui, "ecdb,welcome_page,show", "ecdb");
|
||||
}
|
||||
|
||||
static void
|
||||
ecdb_filelist_show(void)
|
||||
{
|
||||
Evas_Object *gui, *swallow;
|
||||
|
||||
gui = evas_object_name_find(ecore_evas_get(em->main_win_ee), "gui");
|
||||
swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee),
|
||||
"main_filelist");
|
||||
|
||||
if (!swallow)
|
||||
{
|
||||
Evas_Coord x, y, w, h;
|
||||
Ewl_Widget *embed, *filelist;
|
||||
|
||||
embed = ewl_embed_new();
|
||||
ewl_object_fill_policy_set(EWL_OBJECT(embed),
|
||||
EWL_FLAG_FILL_ALL);
|
||||
swallow = ewl_embed_canvas_set(EWL_EMBED(embed),
|
||||
ecore_evas_get(em->main_win_ee),
|
||||
(void *)(long)ecore_evas_software_x11_window_get
|
||||
(em->main_win_ee));
|
||||
ewl_embed_focus_set(EWL_EMBED(embed), TRUE);
|
||||
ewl_widget_show(embed);
|
||||
|
||||
filelist = ewl_filelist_new();
|
||||
ewl_widget_name_set(EWL_WIDGET(filelist), "main_filelist");
|
||||
ewl_container_child_append(EWL_CONTAINER(embed), filelist);
|
||||
ewl_filelist_directory_set(EWL_FILELIST(filelist),
|
||||
getenv("HOME"));
|
||||
ewl_callback_append(filelist, EWL_CALLBACK_MOUSE_IN,
|
||||
_cb_filelist_mouse_in, gui);
|
||||
ewl_callback_append(filelist, EWL_CALLBACK_MOUSE_OUT,
|
||||
_cb_filelist_mouse_out, gui);
|
||||
ewl_widget_show(filelist);
|
||||
|
||||
edje_object_part_geometry_get(gui, "filelist", &x, &y, &w, &h);
|
||||
evas_object_name_set(swallow, "main_filelist");
|
||||
evas_object_move(swallow, x, y);
|
||||
evas_object_resize(swallow, w, h);
|
||||
edje_object_part_swallow(gui, "filelist", swallow);
|
||||
evas_object_event_callback_add(swallow,
|
||||
EVAS_CALLBACK_MOUSE_DOWN,
|
||||
_cb_filelist_mouse_down, gui);
|
||||
evas_object_event_callback_add(swallow, EVAS_CALLBACK_KEY_DOWN,
|
||||
_cb_filelist_key_down, gui);
|
||||
evas_object_show(swallow);
|
||||
}
|
||||
|
||||
/* Assume here that it is the active projects job to hide itself and
|
||||
* call this show function
|
||||
*/
|
||||
else if (edje_object_part_swallow_get(gui, "filelist") != swallow)
|
||||
{
|
||||
/* Is this all that is neccessary? */
|
||||
edje_object_part_swallow(gui, "filelist", swallow);
|
||||
evas_object_show(swallow);
|
||||
}
|
||||
|
||||
edje_object_signal_emit(gui, "ecdb,filelist,visible", "ecdb");
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
#define ECDB_GUI_H
|
||||
|
||||
int ecdb_create_main_gui(void);
|
||||
int ecdb_create_data_tab(void);
|
||||
void ecdb_set_main_theme(const char *theme_name, const char *group);
|
||||
void ecdb_set_main_theme(const char *theme_name);
|
||||
|
||||
#endif
|
||||
|
@ -84,6 +84,23 @@ ecdb_match_keyword(const char *chk, const char *key, int len)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
char *
|
||||
ecdb_strip_string(const char *strip)
|
||||
{
|
||||
char *t1 = (char *)strip;
|
||||
|
||||
do
|
||||
{
|
||||
if (*t1 == ' ')
|
||||
{
|
||||
t1++;
|
||||
return strdup(t1);
|
||||
}
|
||||
} while ((t1) && (t1++));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *
|
||||
ecdb_strip_next_argument(const char *strip)
|
||||
{
|
||||
|
@ -13,6 +13,7 @@ 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);
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user