rimmed pushed a commit to branch master. http://git.enlightenment.org/tools/eflete.git/commit/?id=6d0f3c7db5a726836915f244b04aff9352d0a7ab
commit 6d0f3c7db5a726836915f244b04aff9352d0a7ab Author: Vitalii Vorobiov <vi.vorob...@samsung.com> Date: Tue Apr 19 19:06:26 2016 +0300 popup: add button "OK" to apply changes --- src/bin/ui/main_window.h | 2 +- src/bin/ui/popup.c | 28 +++++++++++++++++++++++----- src/bin/ui/property_macros.h | 3 +-- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/bin/ui/main_window.h b/src/bin/ui/main_window.h index b88b2eb..c17a828 100644 --- a/src/bin/ui/main_window.h +++ b/src/bin/ui/main_window.h @@ -371,7 +371,7 @@ void popup_gengrid_helper_item_select(const char *item_title); void -popup_colorselector_helper(const char *title, Evas_Object *follow_up, +popup_colorselector_helper(Evas_Object *follow_up, Helper_Done_Cb func, Evas_Smart_Cb func_change, void *data, int r, int g, int b, int a); diff --git a/src/bin/ui/popup.c b/src/bin/ui/popup.c index 737f42d..c0771fe 100644 --- a/src/bin/ui/popup.c +++ b/src/bin/ui/popup.c @@ -163,7 +163,7 @@ popup_buttons_disabled_set(Popup_Button popup_btns, Eina_Bool disabled) #define GENGRID_H 388 #define COLOR_W 261 -#define COLOR_H 280 +#define COLOR_H 300 static void _helper_obj_follow(void *data __UNUSED__, @@ -222,7 +222,7 @@ _helper_property_color_follow(void *data __UNUSED__, } static void -_helper_colorclass_dismiss(void *data __UNUSED__, +_helper_colorclass_dismiss(void *data, Evas_Object *obj __UNUSED__, const char *signal __UNUSED__, const char *source __UNUSED__) @@ -242,6 +242,12 @@ _helper_colorclass_dismiss(void *data __UNUSED__, ((Helper_Done_Cb)dismiss_func)(func_data, fs, NULL); dismiss_func = NULL; func_data = NULL; + /* using eflete_main_loop_quit/begin doesn't work here since it blocks + thumbs inside of a gengrid. + though to avoid SIGSEV deleting button first and then popup works + perfectly good */ + if (helper_data->button) + evas_object_del(helper_data->button); if (helper_data) free(helper_data); @@ -249,6 +255,14 @@ _helper_colorclass_dismiss(void *data __UNUSED__, } static void +_colorclass_done(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + _helper_colorclass_dismiss(data, NULL, NULL, NULL); +} + +static void _helper_dismiss(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *signal __UNUSED__, @@ -766,7 +780,7 @@ popup_gengrid_helper_item_select(const char *item_title) } void -popup_colorselector_helper(const char *title, Evas_Object *follow_up, +popup_colorselector_helper(Evas_Object *follow_up, Helper_Done_Cb func, Evas_Smart_Cb func_change, void *data, int r, int g, int b, int a) { @@ -779,7 +793,7 @@ popup_colorselector_helper(const char *title, Evas_Object *follow_up, evas_object_del(helper); helper = elm_layout_add(ap.win); - elm_layout_theme_set(helper, "layout", "popup", title ? "hint_title" : "hint"); + elm_layout_theme_set(helper, "layout", "popup", "hint"); evas_object_data_set(helper, "STRUCT", helper_data); elm_layout_signal_callback_add(helper, "hint,dismiss", "eflete", _helper_colorclass_dismiss, helper_data); @@ -799,7 +813,11 @@ popup_colorselector_helper(const char *title, Evas_Object *follow_up, evas_object_size_hint_min_set(helper, COLOR_W, COLOR_H); evas_object_resize(helper, COLOR_W, COLOR_H); - if (title) elm_object_text_set(helper, title); + BUTTON_ADD(fs, helper_data->button, _("Ok")) + elm_object_part_content_set(helper, "elm.swallow.ok", helper_data->button); + evas_object_smart_callback_add(helper_data->button, "clicked", _colorclass_done, helper_data); + evas_object_show(helper_data->button); + elm_layout_content_set(helper, "elm.swallow.content", fs); evas_object_size_hint_weight_set(fs, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(fs, EVAS_HINT_FILL, EVAS_HINT_FILL); diff --git a/src/bin/ui/property_macros.h b/src/bin/ui/property_macros.h index a6ba8f2..a409faa 100644 --- a/src/bin/ui/property_macros.h +++ b/src/bin/ui/property_macros.h @@ -2216,8 +2216,7 @@ _on_##MEMBER##_##VALUE##_clicked(void *data, \ assert(pd->change == NULL); \ pd->change = change_add(NULL); \ evas_object_color_get(pd->attributes.MEMBER.VALUE##_obj, &r, &g, &b, &a); \ - popup_colorselector_helper("Select some colors", \ - pd->attributes.MEMBER.VALUE##_obj, \ + popup_colorselector_helper(pd->attributes.MEMBER.VALUE##_obj, \ _on_##MEMBER##_##VALUE##_dismissed, \ _on_##MEMBER##_##VALUE##_change, \ pd, r, g, b, a); \ --