aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-08-03 17:24:50 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-08-04 11:52:16 +0900
commit3e5cfb83c092652cf0306b7f4b1a0b230fdf21bf (patch)
tree59fe7b31bfa8a460ab9a04f17ea04c04aff89c74 /src/lib
parentedje: Move signal APIs to an interface (diff)
downloadefl-3e5cfb83c092652cf0306b7f4b1a0b230fdf21bf.tar.gz
elm: Remove custom layout signal APIs
This merges them with the now standard interface: Efl.Canvas.Layout_Signal Some wrapping work was required for legacy API which takes no user_data in del() but instead returns it. The new EO function, while harder to use, is more correct (you can't delete the invalid callback by accident, and this follows EO events design). Another crazy wrapping was done in entry/text in order to add the callbacks to 2 objects instead of just one, and still return the user data. As for Naviframe and Popup, those two widgets override signal_emit to forward the call to another object than the resize object, but not callback_add/del. So they are definitely broken. Ref https://phab.enlightenment.org/T5315
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/elementary/efl_ui_image.c2
-rw-r--r--src/lib/elementary/efl_ui_image.eo2
-rw-r--r--src/lib/elementary/efl_ui_text.c64
-rw-r--r--src/lib/elementary/efl_ui_text.eo6
-rw-r--r--src/lib/elementary/elc_naviframe.c4
-rw-r--r--src/lib/elementary/elc_popup.c2
-rw-r--r--src/lib/elementary/elm_entry.c76
-rw-r--r--src/lib/elementary/elm_entry.eo6
-rw-r--r--src/lib/elementary/elm_layout.c169
-rw-r--r--src/lib/elementary/elm_layout.eo69
-rw-r--r--src/lib/elementary/elm_layout_legacy.h54
-rw-r--r--src/lib/elementary/elm_naviframe.eo2
-rw-r--r--src/lib/elementary/elm_popup.eo2
-rw-r--r--src/lib/elementary/elm_priv.h7
-rw-r--r--src/lib/elementary/elm_widget_entry.h1
15 files changed, 258 insertions, 208 deletions
diff --git a/src/lib/elementary/efl_ui_image.c b/src/lib/elementary/efl_ui_image.c
index ef433b034b..c779ff17dd 100644
--- a/src/lib/elementary/efl_ui_image.c
+++ b/src/lib/elementary/efl_ui_image.c
@@ -1168,7 +1168,7 @@ _efl_ui_image_efl_file_file_set(Eo *obj, Efl_Ui_Image_Data *sd, const char *file
}
EOLIAN static void
-_efl_ui_image_edje_object_signal_emit(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, const char *emission, const char *source)
+_efl_ui_image_efl_canvas_layout_signal_signal_emit(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, const char *emission, const char *source)
{
if (sd->edje)
edje_object_signal_emit(sd->img, emission, source);
diff --git a/src/lib/elementary/efl_ui_image.eo b/src/lib/elementary/efl_ui_image.eo
index 62747bec83..973c8c932b 100644
--- a/src/lib/elementary/efl_ui_image.eo
+++ b/src/lib/elementary/efl_ui_image.eo
@@ -135,7 +135,7 @@ class Efl.Ui.Image (Elm.Widget, Efl.Ui.Clickable, Efl.Ui.Draggable,
Efl.Flipable.flip { get; set; }
Efl.Player.playable { get; }
Efl.Player.play { get; set; }
- Edje.Object.signal_emit;
+ Efl.Canvas.Layout_Signal.signal_emit;
Edje.Object.group_size_min { get; }
Edje.Object.group_size_max { get; }
Efl.Canvas.Layout_Calc.calc_size_min;
diff --git a/src/lib/elementary/efl_ui_text.c b/src/lib/elementary/efl_ui_text.c
index 64a4935c6a..311a5bebbb 100644
--- a/src/lib/elementary/efl_ui_text.c
+++ b/src/lib/elementary/efl_ui_text.c
@@ -2573,69 +2573,43 @@ _markup_filter_cb(void *data,
}
EOLIAN static void
-_efl_ui_text_elm_layout_signal_emit(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd, const char *emission, const char *source)
+_efl_ui_text_efl_canvas_layout_signal_signal_emit(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd, const char *emission, const char *source)
{
/* always pass to both edje objs */
- edje_object_signal_emit(sd->entry_edje, emission, source);
- edje_object_message_signal_process(sd->entry_edje);
+ efl_canvas_layout_signal_emit(sd->entry_edje, emission, source);
+
+ // FIXME: This should not be here!
+ efl_canvas_layout_signal_process(sd->entry_edje, EINA_TRUE);
if (sd->scr_edje)
{
- edje_object_signal_emit(sd->scr_edje, emission, source);
- edje_object_message_signal_process(sd->scr_edje);
+ efl_canvas_layout_signal_emit(sd->scr_edje, emission, source);
+ efl_canvas_layout_signal_process(sd->scr_edje, EINA_TRUE); // FIXME
}
}
-EOLIAN static void
-_efl_ui_text_elm_layout_signal_callback_add (Eo *obj, Efl_Ui_Text_Data *sd, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
+EOLIAN static Eina_Bool
+_efl_ui_text_efl_canvas_layout_signal_signal_callback_add(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
{
- Evas_Object *ro;
-
- ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
-
- ro = wd->resize_obj;
-
- wd->resize_obj = sd->entry_edje;
-
- elm_obj_layout_signal_callback_add
- (efl_super(obj, MY_CLASS), emission, source, func_cb, data);
+ Eina_Bool ok;
+ ok = efl_canvas_layout_signal_callback_add(sd->entry_edje, emission, source, func_cb, data);
if (sd->scr_edje)
- {
- wd->resize_obj = sd->scr_edje;
+ ok = efl_canvas_layout_signal_callback_add(sd->scr_edje, emission, source, func_cb, data);
- elm_obj_layout_signal_callback_add
- (efl_super(obj, MY_CLASS), emission, source, func_cb, data);
- }
-
- wd->resize_obj = ro;
+ return ok;
}
-EOLIAN static void *
-_efl_ui_text_elm_layout_signal_callback_del(Eo *obj, Efl_Ui_Text_Data *sd, const char *emission, const char *source, Edje_Signal_Cb func_cb)
+EOLIAN static Eina_Bool
+_efl_ui_text_efl_canvas_layout_signal_signal_callback_del(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
{
- Evas_Object *ro;
- void *data = NULL;
-
- ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
-
- ro = wd->resize_obj;
-
- wd->resize_obj = sd->entry_edje;
-
- data = elm_obj_layout_signal_callback_del
- (efl_super(obj, MY_CLASS), emission, source, func_cb);
+ Eina_Bool ok;
+ ok = efl_canvas_layout_signal_callback_del(sd->entry_edje, emission, source, func_cb, data);
if (sd->scr_edje)
- {
- wd->resize_obj = sd->scr_edje;
-
- data = elm_obj_layout_signal_callback_del
- (efl_super(obj, MY_CLASS), emission, source, func_cb);
- }
+ ok = efl_canvas_layout_signal_callback_del(sd->scr_edje, emission, source, func_cb, data);
- wd->resize_obj = ro;
- return data;
+ return ok;
}
#if 0
diff --git a/src/lib/elementary/efl_ui_text.eo b/src/lib/elementary/efl_ui_text.eo
index d06700e922..94abc9d31b 100644
--- a/src/lib/elementary/efl_ui_text.eo
+++ b/src/lib/elementary/efl_ui_text.eo
@@ -404,6 +404,9 @@ class Efl.Ui.Text (Elm.Layout, Elm.Interface_Scrollable, Efl.Ui.Clickable,
Efl.Gfx.position { set; }
Efl.Gfx.size { set; }
Efl.Canvas.Group.group_member_add;
+ Efl.Canvas.Layout_Signal.signal_callback_add;
+ Efl.Canvas.Layout_Signal.signal_callback_del;
+ Efl.Canvas.Layout_Signal.signal_emit;
Elm.Widget.activate;
Elm.Widget.focus_direction_manager_is;
Elm.Widget.theme_apply;
@@ -413,9 +416,6 @@ class Efl.Ui.Text (Elm.Layout, Elm.Interface_Scrollable, Efl.Ui.Clickable,
Elm.Widget.sub_object_del;
Elm.Widget.focus_next_manager_is;
Elm.Layout.sizing_eval;
- Elm.Layout.signal_callback_add;
- Elm.Layout.signal_callback_del;
- Elm.Layout.signal_emit;
Elm.Interface_Scrollable.policy { set; }
Elm.Interface_Scrollable.bounce_allow { set; }
Elm.Interface.Atspi_Accessible.state_set { get; }
diff --git a/src/lib/elementary/elc_naviframe.c b/src/lib/elementary/elc_naviframe.c
index e8316f18a3..20213e324a 100644
--- a/src/lib/elementary/elc_naviframe.c
+++ b/src/lib/elementary/elc_naviframe.c
@@ -1014,7 +1014,7 @@ _back_btn_new(Evas_Object *obj, const char *title_label)
}
EOLIAN static void
-_elm_naviframe_elm_layout_signal_emit(Eo *obj, Elm_Naviframe_Data *sd EINA_UNUSED, const char *emission, const char *source)
+_elm_naviframe_efl_canvas_layout_signal_signal_emit(Eo *obj, Elm_Naviframe_Data *sd EINA_UNUSED, const char *emission, const char *source)
{
Elm_Object_Item *eo_top_it;
@@ -1022,7 +1022,7 @@ _elm_naviframe_elm_layout_signal_emit(Eo *obj, Elm_Naviframe_Data *sd EINA_UNUSE
if (!eo_top_it) return;
ELM_NAVIFRAME_ITEM_DATA_GET(eo_top_it, top_it);
- elm_obj_layout_signal_emit(VIEW(top_it), emission, source);
+ efl_canvas_layout_signal_emit(VIEW(top_it), emission, source);
}
/* content/text smart functions proxying things to the top item, which
diff --git a/src/lib/elementary/elc_popup.c b/src/lib/elementary/elc_popup.c
index dc51f9749d..e936a4e0bc 100644
--- a/src/lib/elementary/elc_popup.c
+++ b/src/lib/elementary/elc_popup.c
@@ -503,7 +503,7 @@ _elm_popup_elm_layout_sizing_eval(Eo *obj, Elm_Popup_Data *sd)
}
EOLIAN static void
-_elm_popup_elm_layout_signal_emit(Eo *obj EINA_UNUSED, Elm_Popup_Data *sd, const char *emission, const char *source)
+_elm_popup_efl_canvas_layout_signal_signal_emit(Eo *obj EINA_UNUSED, Elm_Popup_Data *sd, const char *emission, const char *source)
{
elm_layout_signal_emit(sd->main_layout, emission, source);
}
diff --git a/src/lib/elementary/elm_entry.c b/src/lib/elementary/elm_entry.c
index 677cd8e0a7..292680ca15 100644
--- a/src/lib/elementary/elm_entry.c
+++ b/src/lib/elementary/elm_entry.c
@@ -987,9 +987,9 @@ _elm_entry_elm_widget_theme_apply(Eo *obj, Elm_Entry_Data *sd)
elm_entry_end_visible_set(obj, EINA_TRUE);
if (sd->scroll)
- edje_obj_signal_emit(sd->entry_edje, "elm,scroll,enable", "elm");
+ efl_canvas_layout_signal_emit(sd->entry_edje, "elm,scroll,enable", "elm");
else
- edje_obj_signal_emit(sd->entry_edje, "elm,scroll,disable", "elm");
+ efl_canvas_layout_signal_emit(sd->entry_edje, "elm,scroll,disable", "elm");
sd->changed = EINA_TRUE;
elm_layout_sizing_eval(obj);
@@ -3070,7 +3070,7 @@ _chars_add_till_limit(Evas_Object *obj,
}
EOLIAN static void
-_elm_entry_elm_layout_signal_emit(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, const char *emission, const char *source)
+_elm_entry_efl_canvas_layout_signal_signal_emit(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, const char *emission, const char *source)
{
/* always pass to both edje objs */
edje_object_signal_emit(sd->entry_edje, emission, source);
@@ -3083,55 +3083,61 @@ _elm_entry_elm_layout_signal_emit(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, const
}
}
-EOLIAN static void
-_elm_entry_elm_layout_signal_callback_add (Eo *obj, Elm_Entry_Data *sd, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
+EOLIAN static Eina_Bool
+_elm_entry_efl_canvas_layout_signal_signal_callback_add(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
{
- Evas_Object *ro;
-
- ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
+ Eina_Bool ok;
- ro = wd->resize_obj;
+ ok = efl_canvas_layout_signal_callback_add(sd->entry_edje, emission, source, func_cb, data);
+ if (sd->scr_edje)
+ ok = efl_canvas_layout_signal_callback_add(sd->scr_edje, emission, source, func_cb, data);
- wd->resize_obj = sd->entry_edje;
+ return ok;
+}
- elm_obj_layout_signal_callback_add
- (efl_super(obj, MY_CLASS), emission, source, func_cb, data);
+EOLIAN static Eina_Bool
+_elm_entry_efl_canvas_layout_signal_signal_callback_del(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
+{
+ Eina_Bool ok;
+ ok = efl_canvas_layout_signal_callback_del(sd->entry_edje, emission, source, func_cb, data);
if (sd->scr_edje)
- {
- wd->resize_obj = sd->scr_edje;
-
- elm_obj_layout_signal_callback_add
- (efl_super(obj, MY_CLASS), emission, source, func_cb, data);
- }
+ ok = efl_canvas_layout_signal_callback_del(sd->scr_edje, emission, source, func_cb, data);
- wd->resize_obj = ro;
+ return ok;
}
-EOLIAN static void *
-_elm_entry_elm_layout_signal_callback_del(Eo *obj, Elm_Entry_Data *sd, const char *emission, const char *source, Edje_Signal_Cb func_cb)
+// Legacy support... del() returns the user data.
+void
+_elm_entry_signal_callback_add_legacy(Eo *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
{
- Evas_Object *ro;
- void *data = NULL;
+ Elm_Entry_Data *sd;
- ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
+ sd = efl_data_scope_safe_get(obj, MY_CLASS);
+ if (!sd) return;
- ro = wd->resize_obj;
+ _elm_layout_signal_callback_add_legacy(obj, sd->entry_edje, &sd->edje_signals,
+ emission, source, func_cb, data);
- wd->resize_obj = sd->entry_edje;
+ if (sd->scr_edje)
+ efl_canvas_layout_signal_callback_add(sd->scr_edje, emission, source, func_cb, data);
+}
- data = elm_obj_layout_signal_callback_del
- (efl_super(obj, MY_CLASS), emission, source, func_cb);
+void *
+_elm_entry_signal_callback_del_legacy(Eo *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb)
+{
+ Elm_Entry_Data *sd;
+ void *data;
- if (sd->scr_edje)
- {
- wd->resize_obj = sd->scr_edje;
+ sd = efl_data_scope_safe_get(obj, MY_CLASS);
+ if (!sd) return NULL;
- data = elm_obj_layout_signal_callback_del
- (efl_super(obj, MY_CLASS), emission, source, func_cb);
- }
+ data = _elm_layout_signal_callback_del_legacy(obj, sd->entry_edje, &sd->edje_signals,
+ emission, source, func_cb);
+
+ if (sd->scr_edje)
+ efl_canvas_layout_signal_callback_del(sd->scr_edje, emission, source, func_cb, data);
- wd->resize_obj = ro;
return data;
}
diff --git a/src/lib/elementary/elm_entry.eo b/src/lib/elementary/elm_entry.eo
index 92978ad681..72f2d5a8db 100644
--- a/src/lib/elementary/elm_entry.eo
+++ b/src/lib/elementary/elm_entry.eo
@@ -954,6 +954,9 @@ class Elm.Entry (Elm.Layout, Elm.Interface_Scrollable, Efl.Ui.Clickable,
Efl.Gfx.position { set; }
Efl.Gfx.size { set; }
Efl.Canvas.Group.group_member_add;
+ Efl.Canvas.Layout_Signal.signal_callback_add;
+ Efl.Canvas.Layout_Signal.signal_callback_del;
+ Efl.Canvas.Layout_Signal.signal_emit;
Elm.Widget.activate;
Elm.Widget.focus_direction_manager_is;
Elm.Widget.theme_apply;
@@ -963,9 +966,6 @@ class Elm.Entry (Elm.Layout, Elm.Interface_Scrollable, Efl.Ui.Clickable,
Elm.Widget.sub_object_del;
Elm.Widget.focus_next_manager_is;
Elm.Layout.sizing_eval;
- Elm.Layout.signal_callback_add;
- Elm.Layout.signal_callback_del;
- Elm.Layout.signal_emit;
Elm.Interface_Scrollable.policy { set; }
Elm.Interface_Scrollable.bounce_allow { set; }
Elm.Interface.Atspi_Accessible.state_set { get; }
diff --git a/src/lib/elementary/elm_layout.c b/src/lib/elementary/elm_layout.c
index a3b843eb75..500dabd8ad 100644
--- a/src/lib/elementary/elm_layout.c
+++ b/src/lib/elementary/elm_layout.c
@@ -912,68 +912,34 @@ _elm_layout_theme_set(Eo *obj, Elm_Layout_Smart_Data *sd, const char *klass, con
}
EOLIAN static void
-_elm_layout_signal_emit(Eo *obj, Elm_Layout_Smart_Data *_pd EINA_UNUSED, const char *emission, const char *source)
+_elm_layout_efl_canvas_layout_signal_signal_emit(Eo *obj, Elm_Layout_Smart_Data *_pd EINA_UNUSED, const char *emission, const char *source)
{
+ // Don't do anything else than call forward here
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
-
- edje_object_signal_emit(wd->resize_obj, emission, source);
+ efl_canvas_layout_signal_emit(wd->resize_obj, emission, source);
}
-EOLIAN static void
-_elm_layout_signal_callback_add(Eo *obj, Elm_Layout_Smart_Data *sd, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
+EOLIAN static Eina_Bool
+_elm_layout_efl_canvas_layout_signal_signal_callback_add(Eo *obj, Elm_Layout_Smart_Data *_pd EINA_UNUSED, const char *emission, const char *source, Efl_Signal_Cb func, void *data)
{
- Edje_Signal_Data *esd;
-
- ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
-
- esd = ELM_NEW(Edje_Signal_Data);
- if (!esd) return;
-
- esd->obj = obj;
- esd->func = func_cb;
- esd->emission = eina_stringshare_add(emission);
- esd->source = eina_stringshare_add(source);
- esd->data = data;
- sd->edje_signals = eina_list_append(sd->edje_signals, esd);
-
- edje_object_signal_callback_add
- (wd->resize_obj, emission, source,
- _edje_signal_callback, esd);
+ // Don't do anything else than call forward here
+ ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
+ return efl_canvas_layout_signal_callback_add(wd->resize_obj, emission, source, func, data);
}
-EOLIAN static void*
-_elm_layout_signal_callback_del(Eo *obj, Elm_Layout_Smart_Data *sd, const char *emission, const char *source, Edje_Signal_Cb func_cb)
+EOLIAN static Eina_Bool
+_elm_layout_efl_canvas_layout_signal_signal_callback_del(Eo *obj, Elm_Layout_Smart_Data *_pd EINA_UNUSED, const char *emission, const char *source, Edje_Signal_Cb func, void *data)
{
- Edje_Signal_Data *esd = NULL;
- void *data = NULL;
- Eina_List *l;
-
- ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
-
- EINA_LIST_FOREACH(sd->edje_signals, l, esd)
- {
- if ((esd->func == func_cb) && (!strcmp(esd->emission, emission)) &&
- (!strcmp(esd->source, source)))
- {
- sd->edje_signals = eina_list_remove_list(sd->edje_signals, l);
- eina_stringshare_del(esd->emission);
- eina_stringshare_del(esd->source);
- data = esd->data;
-
- edje_object_signal_callback_del_full
- (wd->resize_obj, emission, source,
- _edje_signal_callback, esd);
-
- free(esd);
-
- return data; /* stop at 1st match */
-
- }
- }
-
- return NULL;
+ // Don't do anything else than call forward here
+ ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
+ return efl_canvas_layout_signal_callback_add(wd->resize_obj, emission, source, func, data);
}
+// TODO:
+// - message_send
+// - message_signal_process
+// and also message handler (not implemented yet as an EO interface!)
+
EAPI Eina_Bool
elm_layout_content_set(Evas_Object *obj,
const char *swallow,
@@ -2379,6 +2345,105 @@ elm_layout_thaw(Evas_Object *obj)
return efl_canvas_layout_calc_thaw(obj);
}
+void
+_elm_layout_signal_callback_add_legacy(Eo *obj, Eo *edje, Eina_List **p_edje_signals,
+ const char *emission, const char *source,
+ Edje_Signal_Cb func, void *data)
+{
+ Edje_Signal_Data *esd;
+
+ esd = ELM_NEW(Edje_Signal_Data);
+ if (!esd) return;
+
+ esd->obj = obj;
+ esd->func = func;
+ esd->emission = eina_stringshare_add(emission);
+ esd->source = eina_stringshare_add(source);
+ esd->data = data;
+ *p_edje_signals = eina_list_append(*p_edje_signals, esd);
+
+ efl_canvas_layout_signal_callback_add(edje, emission, source,
+ _edje_signal_callback, esd);
+}
+
+EAPI void
+elm_layout_signal_callback_add(Elm_Layout *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data)
+{
+ Elm_Layout_Smart_Data *sd;
+
+ if (!emission || !source) return;
+
+ if (efl_isa(obj, ELM_ENTRY_CLASS))
+ {
+ _elm_entry_signal_callback_add_legacy(obj, emission, source, func, data);
+ return;
+ }
+
+ sd = efl_data_scope_safe_get(obj, MY_CLASS);
+ if (!sd) return;
+ ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
+
+ _elm_layout_signal_callback_add_legacy(obj, wd->resize_obj, &sd->edje_signals,
+ emission, source, func, data);
+}
+
+void *
+_elm_layout_signal_callback_del_legacy(Eo *obj EINA_UNUSED, Eo *edje, Eina_List **p_edje_signals,
+ const char *emission, const char *source,
+ Edje_Signal_Cb func)
+{
+ Edje_Signal_Data *esd = NULL;
+ void *data = NULL;
+ Eina_List *l;
+
+ if (!emission || !source) return NULL;
+
+ EINA_LIST_FOREACH(*p_edje_signals, l, esd)
+ {
+ if ((esd->func == func) && (!strcmp(esd->emission, emission)) &&
+ (!strcmp(esd->source, source)))
+ {
+ *p_edje_signals = eina_list_remove_list(*p_edje_signals, l);
+
+ efl_canvas_layout_signal_callback_del(edje, emission, source,
+ _edje_signal_callback, esd);
+
+ eina_stringshare_del(esd->emission);
+ eina_stringshare_del(esd->source);
+ data = esd->data;
+ free(esd);
+
+ return data; /* stop at 1st match */
+ }
+ }
+
+ return NULL;
+}
+
+EAPI void *
+elm_layout_signal_callback_del(Elm_Layout *obj, const char *emission, const char *source, Edje_Signal_Cb func)
+{
+ Elm_Layout_Smart_Data *sd;
+
+ if (!emission || !source) return NULL;
+
+ if (efl_isa(obj, ELM_ENTRY_CLASS))
+ return _elm_entry_signal_callback_del_legacy(obj, emission, source, func);
+
+ sd = efl_data_scope_safe_get(obj, MY_CLASS);
+ if (!sd) return NULL;
+ ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
+
+ return _elm_layout_signal_callback_del_legacy(obj, wd->resize_obj, &sd->edje_signals,
+ emission, source, func);
+}
+
+EAPI void
+elm_layout_signal_emit(Elm_Layout *obj, const char *emission, const char *source)
+{
+ efl_canvas_layout_signal_emit(obj, emission, source);
+}
+
/* End of legacy only */
diff --git a/src/lib/elementary/elm_layout.eo b/src/lib/elementary/elm_layout.eo
index d5049814ab..99920ee7be 100644
--- a/src/lib/elementary/elm_layout.eo
+++ b/src/lib/elementary/elm_layout.eo
@@ -2,7 +2,7 @@ import edje_types;
class Elm.Layout (Elm.Widget, Efl.Part, Efl.Container, Efl.File,
Efl.Ui.View, Efl.Ui.Model.Connect, Efl.Ui.Model.Factory.Connect,
- Efl.Canvas.Layout_Calc)
+ Efl.Canvas.Layout_Calc, Efl.Canvas.Layout_Signal)
{
[[Elementary layout class]]
legacy_prefix: elm_layout;
@@ -70,23 +70,6 @@ class Elm.Layout (Elm.Widget, Efl.Part, Efl.Container, Efl.File,
@in height: bool; [[Restrict minimum size ot the current height.]]
}
}
- signal_callback_add {
- [[Add a callback for a (Edje) signal emitted by a layout widget's
- underlying Edje object.
-
- This function connects a callback function to a signal emitted by
- the underlying Edje object of $obj. Globs are accepted in either
- the emission or source strings.
- ]]
- params {
- @in emission: string; [[The signal's name string.]]
- @in source: string; [[The signal's source string.]]
- @in func: Edje.Signal_Cb; [[The callback function to be executed
- when the signal is emitted.]]
- @in data: void_ptr @optional; [[A pointer to data to pass in to the
- callback function.]]
- }
- }
data_get @const {
[[Get the edje data from the given layout.
@@ -96,56 +79,11 @@ class Elm.Layout (Elm.Widget, Efl.Part, Efl.Container, Efl.File,
In EDC this comes from a data block within the group block that
$obj was loaded from.
]]
- /* FIXME-doc
- @code
- collections {
- group {
- name: "a_group";
- data {
- item: "key1" "value1";
- item: "key2" "value2";
- }
- }
- }
- @endcode
- */
return: string; [[The edje data string.]]
params {
@in key: string; [[The data key.]]
}
}
- signal_callback_del {
- [[Remove a signal-triggered callback from a given layout widget.
-
- This function removes the last callback attached to a signal
- emitted by the undelying Edje object of $obj, with parameters
- $emission, $source and $func matching exactly those passed to a
- previous call to @.signal_callback_add. The data pointer that
- was passed to this call will be returned.
- ]]
- return: void_ptr; [[The data pointer of the signal callback (passed on
- @.signal_callback_add) or $null on errors.]]
- params {
- @in emission: string; [[The signal's name string.]]
- @in source: string; [[The signal's source string.]]
- @in func: Edje.Signal_Cb; [[The callback function being executed
- when the signal was emitted.]]
- }
- }
- signal_emit {
- [[Send a (Edje) signal to a given layout widget's underlying Edje
- object.
-
- This function sends a signal to the underlying Edje object of
- $obj. An Edje program on that Edje object's definition can
- respond to a signal by specifying matching 'signal' and
- 'source' fields.
- ]]
- params {
- @in emission: string; [[The signal's name string.]]
- @in source: string; [[The signal's source string.]]
- }
- }
}
implements {
class.constructor;
@@ -155,6 +93,11 @@ class Elm.Layout (Elm.Widget, Efl.Part, Efl.Container, Efl.File,
Efl.Canvas.Group.group_calculate;
Efl.Canvas.Layout_Calc.calc_freeze;
Efl.Canvas.Layout_Calc.calc_thaw;
+ Efl.Canvas.Layout_Signal.signal_callback_add;
+ Efl.Canvas.Layout_Signal.signal_callback_del;
+ Efl.Canvas.Layout_Signal.signal_emit;
+ //Efl.Canvas.Layout_Signal.message_send;
+ //Efl.Canvas.Layout_Signal.signal_process;
Elm.Widget.focus_direction;
Elm.Widget.sub_object_add;
Elm.Widget.theme_apply;
diff --git a/src/lib/elementary/elm_layout_legacy.h b/src/lib/elementary/elm_layout_legacy.h
index a7b61d038d..e26a6be06b 100644
--- a/src/lib/elementary/elm_layout_legacy.h
+++ b/src/lib/elementary/elm_layout_legacy.h
@@ -41,6 +41,60 @@ typedef struct _Elm_Layout_Part_Alias_Description Elm_Layout_Part_Alias_Descript
EAPI Evas_Object *elm_layout_add(Evas_Object *parent);
/**
+ * @brief Add a callback for a (Edje) signal emitted by a layout widget's
+ * underlying Edje object.
+ *
+ * This function connects a callback function to a signal emitted by the
+ * underlying Edje object of @c obj. Globs are accepted in either the emission
+ * or source strings.
+ *
+ * @param[in] emission The signal's name string.
+ * @param[in] source The signal's source string.
+ * @param[in] func The callback function to be executed when the signal is
+ * emitted.
+ * @param[in] data A pointer to data to pass in to the callback function.
+ *
+ * @ingroup Elm_Layout
+ */
+EAPI void elm_layout_signal_callback_add(Elm_Layout *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data);
+
+/**
+ * @brief Remove a signal-triggered callback from a given layout widget.
+ *
+ * This function removes the last callback attached to a signal emitted by the
+ * undelying Edje object of @c obj, with parameters @c emission, @c source and
+ * @c func matching exactly those passed to a previous call to
+ * @ref elm_layout_signal_callback_add. The data pointer that was passed to
+ * this call will be returned.
+ *
+ * @param[in] emission The signal's name string.
+ * @param[in] source The signal's source string.
+ * @param[in] func The callback function being executed when the signal was
+ * emitted.
+ *
+ * @return The data pointer of the signal callback (passed on
+ * @ref elm_layout_signal_callback_add) or @c null on errors.
+ *
+ * @ingroup Elm_Layout
+ */
+EAPI void *elm_layout_signal_callback_del(Elm_Layout *obj, const char *emission, const char *source, Edje_Signal_Cb func);
+
+/**
+ * @brief Send a (Edje) signal to a given layout widget's underlying Edje
+ * object.
+ *
+ * This function sends a signal to the underlying Edje object of @c obj. An
+ * Edje program on that Edje object's definition can respond to a signal by
+ * specifying matching 'signal' and 'source' fields.
+ *
+ * @param[in] emission The signal's name string.
+ * @param[in] source The signal's source string.
+ *
+ * @ingroup Elm_Layout
+ */
+EAPI void elm_layout_signal_emit(Elm_Layout *obj, const char *emission, const char *source);
+
+/**
* @brief Get the edje layout
*
* This returns the edje object. It is not expected to be used to then swallow
diff --git a/src/lib/elementary/elm_naviframe.eo b/src/lib/elementary/elm_naviframe.eo
index 4619bd792c..1e914801bf 100644
--- a/src/lib/elementary/elm_naviframe.eo
+++ b/src/lib/elementary/elm_naviframe.eo
@@ -152,7 +152,7 @@ class Elm.Naviframe (Elm.Layout, Elm.Interface.Atspi_Widget_Action)
Elm.Widget.translate;
Elm.Widget.theme_apply;
Elm.Widget.widget_event;
- Elm.Layout.signal_emit;
+ Efl.Canvas.Layout_Signal.signal_emit;
Elm.Layout.sizing_eval;
Elm.Interface.Atspi_Widget_Action.elm_actions { get; }
Efl.Part.part;
diff --git a/src/lib/elementary/elm_popup.eo b/src/lib/elementary/elm_popup.eo
index 83011a08f7..b043b71d17 100644
--- a/src/lib/elementary/elm_popup.eo
+++ b/src/lib/elementary/elm_popup.eo
@@ -179,7 +179,7 @@ class Elm.Popup (Elm.Layout, Elm.Interface.Atspi_Widget_Action)
Elm.Widget.sub_object_del;
Elm.Widget.widget_event;
Elm.Layout.sizing_eval;
- Elm.Layout.signal_emit;
+ Efl.Canvas.Layout_Signal.signal_emit;
Elm.Interface.Atspi_Widget_Action.elm_actions { get; }
Elm.Interface.Atspi_Accessible.state_set { get; }
Efl.Part.part;
diff --git a/src/lib/elementary/elm_priv.h b/src/lib/elementary/elm_priv.h
index b2bebed4a3..8f53bb12d0 100644
--- a/src/lib/elementary/elm_priv.h
+++ b/src/lib/elementary/elm_priv.h
@@ -610,6 +610,13 @@ void _elm_entry_entry_paste(Evas_Object *obj, const char *entry);
double _elm_atof(const char *s);
+// elm_layout and elm_entry LEGACY signal API (returned the user data pointer)
+void _elm_layout_signal_callback_add_legacy(Eo *obj, Eo *edje, Eina_List **p_edje_signals, const char *emission, const char *source, Edje_Signal_Cb func, void *data);
+void *_elm_layout_signal_callback_del_legacy(Eo *obj, Eo *edje, Eina_List **p_edje_signals, const char *emission, const char *source, Edje_Signal_Cb func);
+void _elm_entry_signal_callback_add_legacy(Eo *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data);
+void *_elm_entry_signal_callback_del_legacy(Eo *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb);
+
+
/* Internal EO APIs */
const Elm_Layout_Part_Alias_Description *elm_layout_content_aliases_get(const Eo *obj);
const Elm_Layout_Part_Alias_Description *elm_layout_text_aliases_get(const Eo *obj);
diff --git a/src/lib/elementary/elm_widget_entry.h b/src/lib/elementary/elm_widget_entry.h
index 10aa893ef8..2ef453928f 100644
--- a/src/lib/elementary/elm_widget_entry.h
+++ b/src/lib/elementary/elm_widget_entry.h
@@ -69,6 +69,7 @@ struct _Elm_Entry_Data
Elm_Input_Hints input_hints;
Edje_Cursor sel_handler_cursor;
void *input_panel_imdata;
+ Eina_List *edje_signals;
int input_panel_imdata_len;
int input_panel_layout_variation;
int validators;