Knock another item off the TODO. Theme now emits ecdb,clicked for taking action, and ecdb,activate for focusing.

This commit is contained in:
Jaime Thomas 2009-04-19 18:31:20 +00:00
parent 88677ca45a
commit 62867a7d49
13 changed files with 203 additions and 96 deletions

View File

@ -17,10 +17,10 @@ TODO
-> integrate exchange
-> instead of always swallowing widgets, allow theme to specify on a widget-by-widget basis if it wants to emit signals from internal parts (so, for example, the settings could be triggered by a small + in the corner, and expand from there)
->able to allow entire gui to be handled by theme... so we only interact with signals (no widgets at all)
-> make theme and code use a custom signal, rather than mouse,clicked,1
DONE
//////////////////////////////////////////////////////////////////////////////
-> better way to detect pipe deletion (done? - needs more testing)
-> get rid of evas_object_name_find/name_set
-> Detect if the media in a drive has changed and update the drive info using dbus.
-> make theme and code use a custom signal, rather than mouse,clicked,1

View File

@ -454,6 +454,27 @@ group {
}
programs {
program {
name: "emit_clicked_return";
signal: "mouse,clicked,1";
action: SIGNAL_EMIT "ecdb,clicked" "ecdb/burn_data/return";
source: "ecdb/burn_data/return";
}
program {
name: "emit_clicked_begin";
signal: "mouse,clicked,1";
action: SIGNAL_EMIT "ecdb,clicked" "ecdb/burn_data/begin";
source: "ecdb/burn_data/begin";
}
program {
name: "emit_clicked_settings";
signal: "mouse,clicked,1";
action: SIGNAL_EMIT "ecdb,clicked" "ecdb/burn_data/settings";
source: "ecdb/burn_data/settings";
}
program {
name: "burn_data_page,visible1";
signal: "ecdb,burn_data_page,visible";

View File

@ -350,6 +350,20 @@ group {
}
programs {
program {
name: "emit_clicked_return";
signal: "mouse,clicked,1";
action: SIGNAL_EMIT "ecdb,clicked" "ecdb/burn_image/return";
source: "ecdb/burn_image/return";
}
program {
name: "emit_clicked_begin";
signal: "mouse,clicked,1";
action: SIGNAL_EMIT "ecdb,clicked" "ecdb/burn_image/begin";
source: "ecdb/burn_image/begin";
}
program {
name: "burn_image_page,visible1";
signal: "ecdb,burn_image_page,visible";

View File

@ -364,7 +364,7 @@ group {
name: "click_emit";
signal: "mouse,clicked,1";
source: "*";
action: SIGNAL_EMIT "clicked" "ecdb";
action: SIGNAL_EMIT "ecdb,clicked" "ecdb";
}
program {
@ -391,6 +391,13 @@ group {
source: "ecdb";
target: "button";
}
program {
name: "activate";
signal: "mouse,down,1";
action: SIGNAL_EMIT "ecdb,activate" "ecdb";
source: "*";
}
}
}

View File

@ -186,6 +186,20 @@ group {
}
programs {
program {
name: "emit_clicked";
signal: "mouse,clicked,1";
action: SIGNAL_EMIT "ecdb,clicked" "ecdb";
source: "*";
}
program {
name: "emit_activate";
signal: "mouse,down,1";
action: SIGNAL_EMIT "ecdb,activate" "ecdb";
source: "*";
}
program {
name: "focus_in";
signal: "ecdb,focus,in";

View File

@ -307,10 +307,17 @@ group {
}
program {
name: "clicked_send";
name: "emit_clicked";
signal: "mouse,clicked,1";
source: "*";
action: SIGNAL_EMIT "ecdb,combo,clicked" "ecdb";
action: SIGNAL_EMIT "ecdb,clicked" "ecdb";
}
program {
name: "emit_activate";
signal: "mouse,down,1";
source: "*";
action: SIGNAL_EMIT "ecdb,activate" "ecdb";
}
program {

View File

@ -112,7 +112,14 @@ group {
program {
name: "signal_emit";
signal: "mouse,clicked,1";
action: SIGNAL_EMIT "clicked" "ecdb";
action: SIGNAL_EMIT "ecdb,clicked" "ecdb";
source: "*";
}
program {
name: "ecdb,activate";
signal: "mouse,down,1";
action: SIGNAL_EMIT "ecdb,activate" "ecdb";
source: "*";
}

View File

@ -315,6 +315,20 @@ group {
}
programs {
program {
name: "emit_clicked_return";
signal: "mouse,clicked,1";
action: SIGNAL_EMIT "ecdb,clicked" "ecdb/erase/return";
source: "ecdb/erase/return";
}
program {
name: "emit_clicked_begin";
signal: "mouse,clicked,1";
action: SIGNAL_EMIT "ecdb,clicked" "ecdb/erase/begin";
source: "ecdb/erase/begin";
}
program {
name: "erase_page,visible1";
signal: "ecdb,erase_page,visible";

View File

@ -8,7 +8,9 @@ static void _button_cb_begin(void *data, Evas_Object *obj,
const char *emission,
const char *source);
static void _page_del(void *data, Evas *e, Evas_Object *obj, void *ev);
static void _combo_cb_clicked(void *data, Evas_Object *obj, void *event_info);
static void _combo_cb_clicked(void *data, Evas_Object *obj,
const char *emission,
const char *source);
static void _update_capacity(Ewl_Widget *w, void *ev_info, void *data);
// Config inwin updates
@ -211,7 +213,8 @@ _button_cb_begin(void *data, Evas_Object *obj __UNUSED__,
static void
_combo_cb_clicked(void *data, Evas_Object *obj __UNUSED__,
void *event_info __UNUSED__)
const char *emission __UNUSED__,
const char *source __UNUSED__)
{
Evas_Object *b;
Ecdb_Data_Project *proj;
@ -512,14 +515,14 @@ ecdb_burn_data_page_show(Ecdb_Page *page)
bp->ret = ecdb_button_add(page->data, "ecdb/burn_data/return");
ecdb_button_label_set(bp->ret, "Return to Main Page");
edje_object_signal_callback_add(page->data, "mouse,clicked,1",
edje_object_signal_callback_add(page->data, "ecdb,clicked",
"ecdb/burn_data/return", _button_cb_return, page);
evas_object_show(bp->ret);
ecdb_button_icon_set(bp->ret, "ecdb/burn_data/return");
bp->begin = ecdb_button_add(page->data, "ecdb/burn_data/begin");
ecdb_button_label_set(bp->begin, "Start Burn");
edje_object_signal_callback_add(page->data, "mouse,clicked,1",
edje_object_signal_callback_add(page->data, "ecdb,clicked",
"ecdb/burn_data/begin", _button_cb_begin, page);
evas_object_show(bp->begin);
ecdb_button_icon_set(bp->begin, "ecdb/burn_data/begin");
@ -540,7 +543,8 @@ ecdb_burn_data_page_show(Ecdb_Page *page)
{
b = ecdb_combo_item_add(bp->drive_combo, NULL);
ecdb_combo_item_label_set(b, drive->product);
evas_object_smart_callback_add(b, "clicked", _combo_cb_clicked, proj);
edje_object_signal_callback_add(b, "ecdb,clicked", "ecdb",
_combo_cb_clicked, proj);
ecdb_combo_append(bp->drive_combo, b);
evas_object_show(b);
}
@ -649,7 +653,7 @@ ecdb_burn_data_page_show(Ecdb_Page *page)
b = ecdb_button_add(t, NULL);
ecdb_button_label_set(b, "Apply");
edje_object_signal_callback_add(b, "mouse,down,1", "*", _apply_clicked,
edje_object_signal_callback_add(b, "ecdb,clicked", "*", _apply_clicked,
t);
ecdb_config_inwin_child_add(t, b, 0, 4, 2, 1);
evas_object_show(b);
@ -657,7 +661,7 @@ ecdb_burn_data_page_show(Ecdb_Page *page)
// At the end so t is a valid pointer
b = ecdb_button_add(page->data, "ecdb/burn_data/settings");
ecdb_button_label_set(b, "Settings");
edje_object_signal_callback_add(page->data, "mouse,clicked,1",
edje_object_signal_callback_add(page->data, "ecdb,clicked",
"ecdb/burn_data/settings", _settings_clicked, t);
evas_object_show(b);
}

View File

@ -7,7 +7,9 @@ static void _button_cb_return(void *data, Evas_Object *obj,
static void _button_cb_begin(void *data, Evas_Object *obj,
const char *emission,
const char *source);
static void _combo_cb_clicked(void *data, Evas_Object *obj, void *event_info);
static void _combo_cb_clicked(void *data, Evas_Object *obj,
const char *emission,
const char *source);
static void _page_hide_finished(void *data, Evas_Object *o,
const char *emission,
const char *source);
@ -144,7 +146,8 @@ _button_cb_begin(void *data, Evas_Object *obj __UNUSED__,
static void
_combo_cb_clicked(void *data, Evas_Object *obj __UNUSED__,
void *event_info __UNUSED__)
const char *emission __UNUSED__,
const char *source __UNUSED__)
{
Evas_Object *b;
Ecdb_Burn_Project *bp;
@ -214,14 +217,14 @@ ecdb_burn_image_page_show(Ecdb_Page *page)
/* Make the interface all nice and proper */
bp->ret = ecdb_button_add(page->image, "ecdb/burn_image/return");
ecdb_button_label_set(bp->ret, "Return to Main Page");
edje_object_signal_callback_add(page->image, "mouse,clicked,1",
edje_object_signal_callback_add(page->image, "ecdb,clicked",
"ecdb/burn_image/return", _button_cb_return, page);
evas_object_show(bp->ret);
ecdb_button_icon_set(bp->ret, "ecdb/burn_image/return");
bp->begin = ecdb_button_add(page->image, "ecdb/burn_image/begin");
ecdb_button_label_set(bp->begin, "Start Burn");
edje_object_signal_callback_add(page->image, "mouse,clicked,1",
edje_object_signal_callback_add(page->image, "ecdb,clicked",
"ecdb/burn_image/begin", _button_cb_begin, page);
evas_object_show(bp->begin);
ecdb_button_icon_set(bp->begin, "ecdb/burn_image/begin");
@ -246,7 +249,8 @@ ecdb_burn_image_page_show(Ecdb_Page *page)
{
b = ecdb_combo_item_add(bp->drive_combo, NULL);
ecdb_combo_item_label_set(b, drive->product);
evas_object_smart_callback_add(b, "clicked", _combo_cb_clicked, proj);
edje_object_signal_callback_add(b, "ecdb,clicked", "ecdb",
_combo_cb_clicked, proj);
ecdb_combo_append(bp->drive_combo, b);
evas_object_show(b);
}

View File

@ -133,14 +133,14 @@ ecdb_erase_page_show(Ecdb_Page *page)
bp->ret = ecdb_button_add(page->erase, "ecdb/erase/return");
ecdb_button_label_set(bp->ret, "Return to Main Page");
edje_object_signal_callback_add(page->erase, "mouse,clicked,1",
edje_object_signal_callback_add(page->erase, "ecdb,clicked",
"ecdb/erase/return", _button_cb_return, page);
evas_object_show(bp->ret);
ecdb_button_icon_set(bp->ret, "ecdb/erase/return");
bp->begin = ecdb_button_add(page->erase, "ecdb/erase/begin");
ecdb_button_label_set(bp->begin, "Start Erase");
edje_object_signal_callback_add(page->erase, "mouse,clicked,1",
edje_object_signal_callback_add(page->erase, "ecdb,clicked",
"ecdb/erase/begin", _button_cb_begin, page);
evas_object_show(bp->begin);
ecdb_button_icon_set(bp->begin, "ecdb/erase/begin");

View File

@ -1,13 +1,21 @@
/* vim: set sw=3 ts=3 sts=3 expandtab: */
#include "ecdb.h"
static void ecdb_handle_typebuf(Evas_Object *gui, Ewl_Widget *fl);
static void ecdb_cb_welcome_page_buttons_clicked(void *data, Evas_Object *o,
typedef void (*edje_cb_type)(void *, Evas_Object *, const char *, const char *);
static void ecdb_cb_burn_data_clicked(void *data, Evas_Object *o,
const char *emission, const char *source);
static void ecdb_cb_burn_audio_clicked(void *data, Evas_Object *o,
const char *emission, const char *source);
static void ecdb_cb_burn_image_clicked(void *data, Evas_Object *o,
const char *emission, const char *source);
static void ecdb_cb_erase_disc_clicked(void *data, Evas_Object *o,
const char *emission, const char *source);
static void ecdb_handle_typebuf(Evas_Object *gui, Ewl_Widget *fl);
static void ecdb_filelist_show(Ecdb_Page *page);
static void ecdb_welcome_page_hide_finished(void *data, Evas_Object *o,
const char *emission,
const char *source);
const char *emission, const char *source);
static void _page_del(void *data, Evas *e, Evas_Object *obj, void *ev);
static void _filelist_del(Ewl_Widget *w, void *ev_data, void *data);
@ -357,39 +365,6 @@ ecdb_handle_typebuf(Evas_Object *gui, Ewl_Widget *fl)
edje_object_part_text_set(gui, "filelist_overlay_text", NULL);
}
static void
ecdb_cb_welcome_page_buttons_clicked(void *data, Evas_Object *o,
const char *emission __UNUSED__,
const char *source)
{
Ecdb_Page *page = data;
if (!strcmp(source, "ecdb/burn_data"))
{
edje_object_signal_emit(o, "ecdb,welcome_page,hide", "ecdb");
ecdb_burn_data_page_show(page);
ecdb_filelist_show(page);
}
else if (!strcmp(source, "ecdb/erase"))
{
edje_object_signal_emit(o, "ecdb,welcome_page,hide", "ecdb");
ecdb_erase_page_show(page);
}
else if (!strcmp(source, "ecdb/burn_image"))
{
ecdb_filelist_show(page);
edje_object_signal_emit(o, "ecdb,welcome_page,hide", "ecdb");
ecdb_burn_image_page_show(page);
}
else if (o)
{
edje_object_signal_emit(page->gui, "ecdb,filelist,hide", "ecdb");
}
EINA_ERROR_PDBG("Action: %s\n", source);
}
void
ecdb_welcome_page_show(Ecdb_Page *page)
{
@ -404,23 +379,40 @@ ecdb_welcome_page_show(Ecdb_Page *page)
evas_object_move(page->welcome, x, y);
evas_object_resize(page->welcome, w, h);
edje_object_part_swallow(page->gui, "action_area", page->welcome);
edje_object_signal_callback_add(page->welcome, "mouse,clicked,1",
"ecdb/*", ecdb_cb_welcome_page_buttons_clicked, page);
edje_object_signal_callback_add(page->welcome, "hide,finished",
"welcome_page", ecdb_welcome_page_hide_finished,
page->gui);
evas_object_show(page->welcome);
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"};
edje_cb_type cbs[] =
{
ecdb_cb_burn_data_clicked,
ecdb_cb_burn_audio_clicked,
ecdb_cb_burn_image_clicked,
ecdb_cb_erase_disc_clicked
};
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 = ecdb_button_add(page->welcome, ids[i]);
ecdb_button_label_set(b, labels[i]);
evas_object_show(b);
edje_object_signal_callback_add(b, "ecdb,clicked", "ecdb",
cbs[i], page);
ecdb_button_icon_set(b, ids[i]);
}
}
@ -533,3 +525,47 @@ ecdb_gui_combo_header_from_speeds(Evas_Object *c, const char *name, void *data,
evas_object_show(ret);
}
static void
ecdb_cb_burn_data_clicked(void *data, Evas_Object *o,
const char *emission __UNUSED__,
const char *source __UNUSED__)
{
Ecdb_Page *page = data;
edje_object_signal_emit(page->welcome, "ecdb,welcome_page,hide", "ecdb");
ecdb_burn_data_page_show(page);
ecdb_filelist_show(page);
}
static void
ecdb_cb_burn_audio_clicked(void *data, Evas_Object *o,
const char *emission __UNUSED__,
const char *source __UNUSED__)
{
Ecdb_Page *page = data;
edje_object_signal_emit(page->welcome, "ecdb,filelist,hide", "ecdb");
EINA_ERROR_PDBG("Burn Audio Disc\n");
}
static void
ecdb_cb_burn_image_clicked(void *data, Evas_Object *o,
const char *emission __UNUSED__,
const char *source __UNUSED__)
{
Ecdb_Page *page = data;
ecdb_filelist_show(page);
edje_object_signal_emit(page->welcome, "ecdb,welcome_page,hide", "ecdb");
ecdb_burn_image_page_show(page);
}
static void
ecdb_cb_erase_disc_clicked(void *data, Evas_Object *o,
const char *emission __UNUSED__,
const char *source __UNUSED__)
{
Ecdb_Page *page = data;
edje_object_signal_emit(page->welcome, "ecdb,welcome_page,hide", "ecdb");
ecdb_erase_page_show(page);
}

View File

@ -52,7 +52,7 @@ ecdb_widget_add(Evas_Object *parent, const char *name)
return NULL;
}
edje_object_signal_callback_add(o, "mouse,down,*", "*",
edje_object_signal_callback_add(o, "ecdb,activate", "*",
_mouse_down_edje, NULL);
if (name)
@ -68,13 +68,6 @@ ecdb_widget_add(Evas_Object *parent, const char *name)
/************************** BUTTON ******************************************/
void
_button_click_cb_call(void *data, Evas_Object *obj, const char *emission,
const char *source)
{
evas_object_smart_callback_call(obj, "clicked", NULL);
}
Evas_Object *
ecdb_button_add(Evas_Object *parent, const char *name)
{
@ -88,8 +81,6 @@ ecdb_button_add(Evas_Object *parent, const char *name)
}
edje_object_file_set(b, em->theme_path, "ecdb/button");
edje_object_signal_callback_add(b, "clicked", "ecdb", _button_click_cb_call,
b);
return b;
}
@ -139,13 +130,6 @@ ecdb_button_label_get(Evas_Object *b)
}
/************************* COMBO ITEM ****************************************/
void
_combo_item_click_cb_call(void *data, Evas_Object *obj, const char *emission,
const char *source)
{
evas_object_smart_callback_call(obj, "clicked", NULL);
}
Evas_Object *
ecdb_combo_item_add(Evas_Object *parent, const char *name)
{
@ -158,8 +142,6 @@ ecdb_combo_item_add(Evas_Object *parent, const char *name)
return NULL;
}
edje_object_file_set(ci, em->theme_path, "ecdb/combo_item");
edje_object_signal_callback_add(ci, "clicked", "ecdb",
_combo_item_click_cb_call, ci);
return ci;
}
@ -510,7 +492,6 @@ _entry_click_cb_call(void *data, Evas_Object *obj, const char *emission,
const char *source)
{
evas_object_focus_set(obj, 1);
evas_object_smart_callback_call(obj, "clicked", NULL);
}
Evas_Object *
@ -641,7 +622,8 @@ _combo_hide(void *data, Evas *e, Evas_Object *obj, void *event_info)
}
static void
_combo_clicked(void *data, Evas_Object *obj, void *event_info)
_combo_clicked(void *data, Evas_Object *obj, const char *emission __UNUSED__,
const char *source __UNUSED__)
{
Combo_Data *cd;
Evas_Object *swallow, *header;
@ -685,12 +667,6 @@ _combo_clicked(void *data, Evas_Object *obj, void *event_info)
ecdb_combo_collapse(data);
}
static void
_combo_item_hide(void *data, Evas_Object *obj, void *event_info)
{
edje_object_signal_emit(obj, "ecdb,focus,out", "ecdb");
}
static void
_combo_moveable_click_cb(void *data, Evas_Object *obj, const char *emission,
const char *source)
@ -715,7 +691,6 @@ _combo_click_cb(void *data, Evas_Object *obj, const char *emission,
ecdb_combo_expand(c);
else
ecdb_combo_collapse(c);
evas_object_smart_callback_call(c, "clicked", NULL);
}
Evas_Object *
@ -736,7 +711,7 @@ ecdb_combo_add(Evas_Object *parent, const char *name)
c);
evas_object_event_callback_add(parent, EVAS_CALLBACK_HIDE, _combo_hide, c);
evas_object_event_callback_add(c, EVAS_CALLBACK_DEL, _combo_del, c);
edje_object_signal_callback_add(c, "ecdb,combo,clicked", "ecdb",
edje_object_signal_callback_add(c, "ecdb,clicked", "ecdb",
_combo_click_cb, c);
cd = calloc(1, sizeof(Combo_Data));
@ -811,8 +786,8 @@ ecdb_combo_append(Evas_Object *c, Evas_Object *o)
}
cd->count++;
edje_object_part_box_append(cd->popup, "ecdb.box", o);
evas_object_smart_callback_add(o, "clicked", _combo_clicked, c);
evas_object_smart_callback_add(o, "hidden", _combo_item_hide, c);
edje_object_signal_callback_add(o, "ecdb,clicked", "ecdb",
_combo_clicked, c);
}
void
@ -943,7 +918,7 @@ ecdb_combo_collapse(Evas_Object *c)
}
while ((eina_iterator_next(it, (void **)&o)))
evas_object_smart_callback_call(o, "hidden", c);
edje_object_signal_emit(o, "ecdb,focus,out", "ecdb");
eina_iterator_free(it);
cd->expanded = 0;
@ -1133,10 +1108,14 @@ _config_inwin_del(void *data, Evas *e, Evas_Object *obj, void *event_info)
iwd = data;
if (!evas_object_event_callback_del(iwd->parent, EVAS_CALLBACK_HIDE,
_config_inwin_hide))
{
EINA_ERROR_PWARN("EVAS_CALLBACK_HIDE callback removal failure!\n");
}
if (!evas_object_event_callback_del(iwd->parent, EVAS_CALLBACK_RESIZE,
_config_inwin_resize))
{
EINA_ERROR_PWARN("EVAS_CALLBACK_RESIZE callback removal failure!\n");
}
FREE(iwd);
}