From fdabb16ad466aa67486d393dd7ad5dcd7ba4d296 Mon Sep 17 00:00:00 2001 From: Jaime Thomas Date: Mon, 9 Feb 2009 02:51:35 +0000 Subject: [PATCH] Get burn data options working again, stop crashing when deleting the config_inwin object before showing it. Also get rid of the sloppy focus to the filelist, as it doesn't work correctly in certain cases. --- experimental/ecdb/trunk/src/ecdb.c | 2 +- .../ecdb/trunk/src/ecdb_burn_data_gui.c | 136 ++++++++++++------ experimental/ecdb/trunk/src/ecdb_gui.c | 49 +------ experimental/ecdb/trunk/src/ecdb_widgets.c | 58 +++++--- experimental/ecdb/trunk/src/ecdb_widgets.h | 2 + 5 files changed, 139 insertions(+), 108 deletions(-) diff --git a/experimental/ecdb/trunk/src/ecdb.c b/experimental/ecdb/trunk/src/ecdb.c index a5451734..da80baef 100644 --- a/experimental/ecdb/trunk/src/ecdb.c +++ b/experimental/ecdb/trunk/src/ecdb.c @@ -154,8 +154,8 @@ SHUTDOWN: ecore_file_shutdown(); ecore_string_shutdown(); ecore_evas_shutdown(); - ecore_shutdown(); edje_shutdown(); + ecore_shutdown(); efreet_shutdown(); ewl_shutdown(); eina_shutdown(); diff --git a/experimental/ecdb/trunk/src/ecdb_burn_data_gui.c b/experimental/ecdb/trunk/src/ecdb_burn_data_gui.c index 279bbf04..42dbfe95 100644 --- a/experimental/ecdb/trunk/src/ecdb_burn_data_gui.c +++ b/experimental/ecdb/trunk/src/ecdb_burn_data_gui.c @@ -12,14 +12,25 @@ static void _combo_cb_clicked(void *data, Evas_Object *obj, void *event_info); static int _update_capacity(void *data, int type, void *ev_data); // Config inwin updates -static void _joliet_clicked(void *data, Evas_Object *obj, void *event_info); -static void _rockridge_clicked(void *data, Evas_Object *obj, void *event_info); -static void _symlinks_clicked(void *data, Evas_Object *obj, void *event_info); -static void _hidden_clicked(void *data, Evas_Object *obj, void *event_info); -static void _multi_clicked(void *data, Evas_Object *obj, void *event_info); -static void _sim_clicked(void *data, Evas_Object *obj, void *event_info); -static void _underrun_clicked(void *data, Evas_Object *obj, void *event_info); -static void _apply_clicked(void *data, Evas_Object *obj, void *event_info); +static void _joliet_clicked(void *data, Evas_Object *obj, const char *emission, + const char *source); +static void _rockridge_clicked(void *data, Evas_Object *obj, + const char *emission, + const char *source); +static void _symlinks_clicked(void *data, Evas_Object *obj, + const char *emission, + const char *source); +static void _hidden_clicked(void *data, Evas_Object *obj, const char *emission, + const char *source); +static void _multi_clicked(void *data, Evas_Object *obj, const char *emission, + const char *source); +static void _sim_clicked(void *data, Evas_Object *obj, const char *emission, + const char *source); +static void _underrun_clicked(void *data, Evas_Object *obj, + const char *emission, + const char *source); +static void _apply_clicked(void *data, Evas_Object *obj, const char *emission, + const char *source); static void _proj_name(void *data, Evas *e, Evas_Object *obj, void *event_info); static void _settings_clicked(void *data, Evas_Object *obj, const char *emission, @@ -252,18 +263,22 @@ _combo_cb_clicked(void *data, Evas_Object *obj __UNUSED__, } static void -_joliet_clicked(void *data, Evas_Object *obj, void *event_info) +_joliet_clicked(void *data, Evas_Object *obj, const char *emission __UNUSED__, + const char *source __UNUSED__) { int state; Ecdb_Data_Project *proj; proj = data; + proj->use_joliet = !proj->use_joliet; + state = ecdb_check_checked_get(obj); - proj->use_joliet = state; + if (state != proj->use_joliet) + ecdb_check_checked_set(obj, proj->use_joliet); } static void -_joliet_config(void *data, Evas_Object *obj, void *event_info) +_joliet_config(void *data, Evas_Object *obj, void *event_info __UNUSED__) { Ecdb_Data_Project *proj; @@ -272,18 +287,23 @@ _joliet_config(void *data, Evas_Object *obj, void *event_info) } static void -_rockridge_clicked(void *data, Evas_Object *obj, void *event_info) +_rockridge_clicked(void *data, Evas_Object *obj, + const char *emission __UNUSED__, + const char *source __UNUSED__) { int state; Ecdb_Data_Project *proj; proj = data; + proj->use_rockridge = !proj->use_rockridge; + state = ecdb_check_checked_get(obj); - proj->use_rockridge = state; + if (state != proj->use_rockridge) + ecdb_check_checked_set(obj, proj->use_rockridge); } static void -_rockridge_config(void *data, Evas_Object *obj, void *event_info) +_rockridge_config(void *data, Evas_Object *obj, void *event_info __UNUSED__) { Ecdb_Data_Project *proj; @@ -292,18 +312,22 @@ _rockridge_config(void *data, Evas_Object *obj, void *event_info) } static void -_symlinks_clicked(void *data, Evas_Object *obj, void *event_info) +_symlinks_clicked(void *data, Evas_Object *obj, const char *emission __UNUSED__, + const char *source __UNUSED__) { int state; Ecdb_Data_Project *proj; proj = data; + proj->follow_symlinks = !proj->follow_symlinks; + state = ecdb_check_checked_get(obj); - proj->follow_symlinks = state; + if (state != proj->follow_symlinks) + ecdb_check_checked_set(obj, proj->follow_symlinks); } static void -_symlinks_config(void *data, Evas_Object *obj, void *event_info) +_symlinks_config(void *data, Evas_Object *obj, void *event_info __UNUSED__) { Ecdb_Data_Project *proj; @@ -312,18 +336,22 @@ _symlinks_config(void *data, Evas_Object *obj, void *event_info) } static void -_hidden_clicked(void *data, Evas_Object *obj, void *event_info) +_hidden_clicked(void *data, Evas_Object *obj, const char *emission __UNUSED__, + const char *source __UNUSED__) { int state; Ecdb_Data_Project *proj; proj = data; + proj->ignore_hidden = !proj->ignore_hidden; + state = ecdb_check_checked_get(obj); - proj->ignore_hidden = state; + if (state != proj->ignore_hidden) + ecdb_check_checked_set(obj, proj->ignore_hidden); } static void -_hidden_config(void *data, Evas_Object *obj, void *event_info) +_hidden_config(void *data, Evas_Object *obj, void *event_info __UNUSED__) { Ecdb_Data_Project *proj; @@ -332,18 +360,22 @@ _hidden_config(void *data, Evas_Object *obj, void *event_info) } static void -_multi_clicked(void *data, Evas_Object *obj, void *event_info) +_multi_clicked(void *data, Evas_Object *obj, const char *emission __UNUSED__, + const char *source __UNUSED__) { int state; Ecdb_Burn_Project *proj; proj = data; + proj->multi = !proj->multi; + state = ecdb_check_checked_get(obj); - proj->multi = state; + if (state != proj->multi) + ecdb_check_checked_set(obj, proj->multi); } static void -_multi_config(void *data, Evas_Object *obj, void *event_info) +_multi_config(void *data, Evas_Object *obj, void *event_info __UNUSED__) { Ecdb_Burn_Project *proj; @@ -352,18 +384,22 @@ _multi_config(void *data, Evas_Object *obj, void *event_info) } static void -_sim_clicked(void *data, Evas_Object *obj, void *event_info) +_sim_clicked(void *data, Evas_Object *obj, const char *emission __UNUSED__, + const char *source __UNUSED__) { int state; Ecdb_Burn_Project *proj; proj = data; + proj->simulate = !proj->simulate; + state = ecdb_check_checked_get(obj); - proj->simulate = state; + if (state != proj->simulate) + ecdb_check_checked_set(obj, proj->simulate); } static void -_sim_config(void *data, Evas_Object *obj, void *event_info) +_sim_config(void *data, Evas_Object *obj, void *event_info __UNUSED__) { Ecdb_Burn_Project *proj; @@ -372,18 +408,22 @@ _sim_config(void *data, Evas_Object *obj, void *event_info) } static void -_underrun_clicked(void *data, Evas_Object *obj, void *event_info) +_underrun_clicked(void *data, Evas_Object *obj, const char *emission __UNUSED__, + const char *source __UNUSED__) { int state; Ecdb_Burn_Project *proj; proj = data; + proj->underrun_proof = !proj->underrun_proof; + state = ecdb_check_checked_get(obj); - proj->underrun_proof = state; + if (state != proj->underrun_proof) + ecdb_check_checked_set(obj, proj->underrun_proof); } static void -_underrun_config(void *data, Evas_Object *obj, void *event_info) +_underrun_config(void *data, Evas_Object *obj, void *event_info __UNUSED__) { Ecdb_Burn_Project *proj; @@ -392,13 +432,14 @@ _underrun_config(void *data, Evas_Object *obj, void *event_info) } static void -_apply_clicked(void *data, Evas_Object *obj, void *event_info) +_apply_clicked(void *data, Evas_Object *obj, const char *emission __UNUSED__, + const char *source __UNUSED__) { ecdb_config_inwin_hide(data); } static void -_proj_name(void *data, Evas *e, Evas_Object *obj, void *event_info) +_proj_name(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__) { char *name; Ecdb_Data_Project *proj; @@ -412,7 +453,7 @@ _proj_name(void *data, Evas *e, Evas_Object *obj, void *event_info) } static void -_proj_config(void *data, Evas_Object *obj, void *event_info) +_proj_config(void *data, Evas_Object *obj, void *event_info __UNUSED__) { Ecdb_Data_Project *proj; @@ -552,10 +593,12 @@ ecdb_burn_data_page_show(Ecdb_Page *page) evas_object_show(proj->capacity); t = ecdb_config_inwin_add(bp->ret, NULL); + ecdb_config_inwin_follow_set(t, page->data); b = ecdb_check_add(t, NULL); ecdb_check_label_set(b, "Use Joliet"); - evas_object_smart_callback_add(b, "clicked", _joliet_clicked, proj); + edje_object_signal_callback_add(b, "ecdb,check,*checked", "ecdb", + _joliet_clicked, proj); evas_object_smart_callback_add(b, "proj_config", _joliet_config, proj); ecdb_config_inwin_child_add(t, b, 0, 0, 1, 1); evas_object_name_set(b, "ecdb/burn_data/joliet"); @@ -563,7 +606,8 @@ ecdb_burn_data_page_show(Ecdb_Page *page) b = ecdb_check_add(t, NULL); ecdb_check_label_set(b, "Use Rockridge"); - evas_object_smart_callback_add(b, "clicked", _rockridge_clicked, proj); + edje_object_signal_callback_add(b, "ecdb,check,*checked", "ecdb", + _rockridge_clicked, proj); evas_object_smart_callback_add(b, "proj_config", _rockridge_config, proj); ecdb_config_inwin_child_add(t, b, 0, 1, 1, 1); evas_object_name_set(b, "ecdb/burn_data/rockridge"); @@ -571,7 +615,8 @@ ecdb_burn_data_page_show(Ecdb_Page *page) b = ecdb_check_add(t, NULL); ecdb_check_label_set(b, "Follow Symlinks"); - evas_object_smart_callback_add(b, "clicked", _symlinks_clicked, proj); + edje_object_signal_callback_add(b, "ecdb,check,*checked", "ecdb", + _symlinks_clicked, proj); evas_object_smart_callback_add(b, "proj_config", _symlinks_config, proj); ecdb_config_inwin_child_add(t, b, 0, 2, 1, 1); evas_object_name_set(b, "ecdb/burn_data/symlinks"); @@ -579,7 +624,8 @@ ecdb_burn_data_page_show(Ecdb_Page *page) b = ecdb_check_add(t, NULL); ecdb_check_label_set(b, "Ignore Hidden Files"); - evas_object_smart_callback_add(b, "clicked", _hidden_clicked, proj); + edje_object_signal_callback_add(b, "ecdb,check,*checked", "ecdb", + _hidden_clicked, proj); evas_object_smart_callback_add(b, "proj_config", _hidden_config, proj); ecdb_config_inwin_child_add(t, b, 0, 3, 1, 1); evas_object_name_set(b, "ecdb/burn_data/hidden"); @@ -587,24 +633,27 @@ ecdb_burn_data_page_show(Ecdb_Page *page) b = ecdb_check_add(t, NULL); ecdb_check_label_set(b, "Multi-session"); - evas_object_smart_callback_add(b, "clicked", _multi_clicked, bup); - evas_object_smart_callback_add(b, "proj_config", _multi_config, bup); + edje_object_signal_callback_add(b, "ecdb,check,*checked", "ecdb", + _multi_clicked, proj); + evas_object_smart_callback_add(b, "proj_config", _multi_config, proj); ecdb_config_inwin_child_add(t, b, 1, 0, 1, 1); evas_object_name_set(b, "ecdb/burn_data/multi"); evas_object_show(b); b = ecdb_check_add(t, NULL); ecdb_check_label_set(b, "Simulate"); - evas_object_smart_callback_add(b, "clicked", _sim_clicked, bup); - evas_object_smart_callback_add(b, "proj_config", _sim_config, bup); + edje_object_signal_callback_add(b, "ecdb,check,*checked", "ecdb", + _sim_clicked, proj); + evas_object_smart_callback_add(b, "proj_config", _sim_config, proj); ecdb_config_inwin_child_add(t, b, 1, 1, 1, 1); evas_object_name_set(b, "ecdb/burn_data/sim"); evas_object_show(b); b = ecdb_check_add(t, NULL); ecdb_check_label_set(b, "Use Underrun Proof"); - evas_object_smart_callback_add(b, "clicked", _underrun_clicked, bup); - evas_object_smart_callback_add(b, "proj_config", _underrun_config, bup); + edje_object_signal_callback_add(b, "ecdb,check,*checked", "ecdb", + _underrun_clicked, proj); + evas_object_smart_callback_add(b, "proj_config", _underrun_config, proj); ecdb_config_inwin_child_add(t, b, 1, 2, 1, 1); evas_object_name_set(b, "ecdb/burn_data/underrun"); evas_object_show(b); @@ -620,7 +669,8 @@ ecdb_burn_data_page_show(Ecdb_Page *page) b = ecdb_button_add(t, NULL); ecdb_button_label_set(b, "Apply"); - evas_object_smart_callback_add(b, "clicked", _apply_clicked, t); + edje_object_signal_callback_add(b, "mouse,down,1", "*", _apply_clicked, + t); ecdb_config_inwin_child_add(t, b, 0, 4, 2, 1); evas_object_name_set(b, "ecdb/burn_data/apply"); evas_object_show(b); diff --git a/experimental/ecdb/trunk/src/ecdb_gui.c b/experimental/ecdb/trunk/src/ecdb_gui.c index 0d0684d1..7800c0ef 100644 --- a/experimental/ecdb/trunk/src/ecdb_gui.c +++ b/experimental/ecdb/trunk/src/ecdb_gui.c @@ -5,8 +5,6 @@ static void ecdb_handle_typebuf(Evas_Object *gui, Ewl_Widget *fl); static void ecdb_cb_welcome_page_buttons_clicked(void *data, Evas_Object *o, const char *emission, const char *source); static void ecdb_filelist_show(Ecdb_Page *page); -static void ecdb_filelist_focus_handle(int action, Evas_Object *fl, - Evas_Object *gui); static void ecdb_welcome_page_hide_finished(void *data, Evas_Object *o, const char *emission, const char *source); @@ -63,53 +61,12 @@ ecdb_cb_resize(Ecore_Evas *ee) evas_object_resize(em->page->gui, w, h); } -static void ecdb_filelist_focus_handle(int action, Evas_Object *fl, - Evas_Object *gui) -{ - static Evas_Object *old_focus; - - if (action == IN) - { - old_focus = evas_focus_get(ecore_evas_get(em->main_win_ee)); - edje_object_signal_emit(old_focus, "ecdb,focus,out", "ecdb"); - evas_object_focus_set(fl, 1); - } - else if (old_focus) - { - edje_object_signal_emit(old_focus, "ecdb,focus,in", "ecdb"); - evas_object_focus_set(old_focus, 1); - old_focus = NULL; - - edje_object_signal_emit(gui, "ecdb,filelist_overlay,deactivate", "ecdb"); - edje_object_part_text_set(gui, "filelist_overlay_text", NULL); - } -} - -static void -_cb_filelist_mouse_in(void *data, Evas *e __UNUSED__, Evas_Object *eo, - void *ev_data) -{ - Ecdb_Page *page; - page = data; - ecdb_filelist_focus_handle(IN, eo, page->gui); -} - -static void -_cb_filelist_mouse_out(void *data, Evas *e __UNUSED__, Evas_Object *eo, - void *ev_data) -{ - Ecdb_Page *page; - page = data; - ecdb_filelist_focus_handle(OUT, eo, page->gui); -} - static void _cb_filelist_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *eo, void *ev_data __UNUSED__) { Ecdb_Page *page = data; - evas_object_focus_set(eo, TRUE); - + evas_object_focus_set(eo, 1); edje_object_signal_emit(page->gui, "ecdb,filelist_overlay,deactivate", "ecdb"); edje_object_part_text_set(page->gui, "filelist_overlay_text", NULL); @@ -501,10 +458,6 @@ ecdb_filelist_show(Ecdb_Page *page) _cb_filelist_mouse_down, page); evas_object_event_callback_add(page->filelist, EVAS_CALLBACK_KEY_DOWN, _cb_filelist_key_down, page); - evas_object_event_callback_add(page->filelist, EVAS_CALLBACK_MOUSE_IN, - _cb_filelist_mouse_in, page); - evas_object_event_callback_add(page->filelist, EVAS_CALLBACK_MOUSE_OUT, - _cb_filelist_mouse_out, page); evas_object_data_set(page->filelist, "filelist", filelist); evas_object_show(page->filelist); } diff --git a/experimental/ecdb/trunk/src/ecdb_widgets.c b/experimental/ecdb/trunk/src/ecdb_widgets.c index f8bfa502..a0cdab39 100644 --- a/experimental/ecdb/trunk/src/ecdb_widgets.c +++ b/experimental/ecdb/trunk/src/ecdb_widgets.c @@ -615,7 +615,6 @@ _combo_del(void *data, Evas *e, Evas_Object *obj, void *event_info) Combo_Data *cd; cd = evas_object_data_get(data, "cd"); - eina_stringshare_del(cd->name); eina_stringshare_del(cd->header); FREE(cd); } @@ -764,7 +763,6 @@ ecdb_combo_add(Evas_Object *parent, const char *name) evas_object_show(cd->popup); cd->parent = parent; - cd->name = eina_stringshare_add(name); cd->selected = -1; evas_object_data_set(c, "cd", cd); @@ -1082,14 +1080,11 @@ ecdb_label_text_set(Evas_Object *l, const char *text) typedef struct _Config_Inwin_Data Config_Inwin_Data; struct _Config_Inwin_Data { - Evas_Object *parent; + Evas_Object *follow; // For hide/resize functions + Evas_Object *parent; // Used to calculate the popup layers Evas_Object *back; Evas_Object *popup; unsigned int visible; - const char *name; - void *data; - void (*create_header)(Evas_Object *, const char *name, void *data, - Evas_Object *, int); }; static void @@ -1133,9 +1128,48 @@ _config_inwin_del(void *data, Evas *e, Evas_Object *obj, void *event_info) Config_Inwin_Data *iwd; iwd = data; + if (!evas_object_event_callback_del(iwd->follow, EVAS_CALLBACK_HIDE, + _config_inwin_hide)) + printf("_config_inwin_del: EVAS_CALLBACK_HIDE callback removal " + "failure!\n"); + if (!evas_object_event_callback_del(iwd->follow, EVAS_CALLBACK_RESIZE, + _config_inwin_resize)) + printf("_config_inwin_del: EVAS_CALLBACK_RESIZE callback removal " + "failure!\n"); + FREE(iwd); } +/* We ideally would just follow the object supplied as the parent, + * but there were some problems with this and setting the popup and background + * layers. It would work intermittantly. + */ +void +ecdb_config_inwin_follow_set(Evas_Object *inwin, Evas_Object *follow) +{ + Config_Inwin_Data *iwd; + + if (!inwin ) + { + printf("ecdb_config_inwin_resize_follow: NULL inwin!\n"); + return; + } + + if (!follow) + { + printf("ecdb_config_inwin_resize_follow: NULL follow!\n"); + return; + } + + iwd = evas_object_data_get(inwin, "iwd"); + iwd->follow = follow; + + evas_object_event_callback_add(follow, EVAS_CALLBACK_RESIZE, + _config_inwin_resize, iwd); + evas_object_event_callback_add(follow, EVAS_CALLBACK_HIDE, + _config_inwin_hide, iwd); +} + Evas_Object * ecdb_config_inwin_add(Evas_Object *parent, const char *name) { @@ -1158,12 +1192,6 @@ ecdb_config_inwin_add(Evas_Object *parent, const char *name) evas_object_pass_events_set(iwd->popup, 1); evas_object_show(iwd->popup); - evas_object_event_callback_add(parent, EVAS_CALLBACK_RESIZE, - _config_inwin_resize, - iwd); - evas_object_event_callback_add(parent, EVAS_CALLBACK_HIDE, - _config_inwin_hide, - iwd); evas_object_event_callback_add(iwd->popup, EVAS_CALLBACK_DEL, _config_inwin_del, iwd); @@ -1171,11 +1199,9 @@ ecdb_config_inwin_add(Evas_Object *parent, const char *name) iwd->back = edje_object_add(evas_object_evas_get(parent)); edje_object_file_set(iwd->back, em->theme_path, "ecdb/config_inwin/background"); + iwd->parent = parent; evas_object_pass_events_set(iwd->back, 1); evas_object_show(iwd->back); - - iwd->name = eina_stringshare_add(name); - iwd->parent = parent; evas_object_data_set(iwd->popup, "iwd", iwd); iwd->visible = 0; diff --git a/experimental/ecdb/trunk/src/ecdb_widgets.h b/experimental/ecdb/trunk/src/ecdb_widgets.h index 948f4391..a8209985 100644 --- a/experimental/ecdb/trunk/src/ecdb_widgets.h +++ b/experimental/ecdb/trunk/src/ecdb_widgets.h @@ -51,6 +51,8 @@ Evas_Object *ecdb_label_add(Evas_Object *parent, const char *name); void ecdb_label_text_set(Evas_Object *l, const char *text); Evas_Object *ecdb_config_inwin_add(Evas_Object *parent, const char *name); +void ecdb_config_inwin_follow_set(Evas_Object *inwin, + Evas_Object *follow); void ecdb_config_inwin_show(Evas_Object *inwin); void ecdb_config_inwin_hide(Evas_Object *inwin); void ecdb_config_inwin_child_add(Evas_Object *inwin, Evas_Object *child,