jackdanielz pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=cd037452812ce63351f6f4c0b9c3c7dd3ffb0eaf

commit cd037452812ce63351f6f4c0b9c3c7dd3ffb0eaf
Author: Daniel Zaoui <daniel.za...@samsung.com>
Date:   Tue Jul 7 11:24:12 2015 +0300

    Eo Events: port more Evas Smart callbacks to Eo
    
    Some Evas Smart callbacks invocations were still inside code
    and should have been ported.
---
 src/lib/elm_cnp.c       | 23 +++++++++++++---------
 src/lib/elm_conform.c   | 52 ++++++++++++++++++++++++++++---------------------
 src/lib/elm_gengrid.c   |  3 ++-
 src/lib/elm_store.c     | 29 +++++++++++++++------------
 src/lib/elm_view_list.c | 38 +++++++++++++++++++++---------------
 5 files changed, 85 insertions(+), 60 deletions(-)

diff --git a/src/lib/elm_cnp.c b/src/lib/elm_cnp.c
index 08c02be..c585121 100644
--- a/src/lib/elm_cnp.c
+++ b/src/lib/elm_cnp.c
@@ -1685,12 +1685,15 @@ _x11_dnd_status(void *data EINA_UNUSED, int etype 
EINA_UNUSED, void *ev)
    return EINA_TRUE;
 }
 
-static void
-_x11_win_rotation_changed_cb(void *data, Evas_Object *obj, void *event_info 
EINA_UNUSED)
+static Eina_Bool
+_x11_win_rotation_changed_cb(void *data,
+      Eo *obj, const Eo_Event_Description *desc EINA_UNUSED,
+      void *event_info EINA_UNUSED)
 {
    Evas_Object *win = data;
    int rot = elm_win_rotation_get(obj);
    elm_win_rotation_set(win, rot);
+   return EINA_TRUE;
 }
 
 static Eina_Bool
@@ -1731,8 +1734,9 @@ _x11_drag_mouse_up(void *data, int etype EINA_UNUSED, 
void *event)
                     {
                        Evas_Object *win = elm_widget_top_get(dragwidget);
                        if (win && eo_isa(win, ELM_WIN_CLASS))
-                         evas_object_smart_callback_del_full(win, 
"rotation,changed",
-                                                  
_x11_win_rotation_changed_cb, dragwin);
+                         eo_do(win, eo_event_callback_del(
+                                  ELM_WIN_EVENT_ROTATION_CHANGED,
+                                  _x11_win_rotation_changed_cb, dragwin));
                     }
                }
 
@@ -2188,9 +2192,9 @@ _x11_elm_drag_start(Evas_Object *obj, Elm_Sel_Format 
format, const char *data,
         if (win && eo_isa(win, ELM_WIN_CLASS))
           {
              elm_win_rotation_set(dragwin, elm_win_rotation_get(win));
-             evas_object_smart_callback_add(win, "rotation,changed",
-                                            _x11_win_rotation_changed_cb,
-                                            dragwin);
+             eo_do(win, eo_event_callback_add(
+                      ELM_WIN_EVENT_ROTATION_CHANGED,
+                      _x11_win_rotation_changed_cb, dragwin));
           }
      }
 
@@ -4453,8 +4457,9 @@ elm_drag_cancel(Evas_Object *obj)
                {
                   Evas_Object *win = elm_widget_top_get(dragwidget);
                   if (win && eo_isa(win, ELM_WIN_CLASS))
-                     evas_object_smart_callback_del_full(win, 
"rotation,changed",
-                           _x11_win_rotation_changed_cb, dragwin);
+                     eo_do(win, eo_event_callback_del(
+                              ELM_WIN_EVENT_ROTATION_CHANGED,
+                              _x11_win_rotation_changed_cb, dragwin));
                }
           }
         goto end;
diff --git a/src/lib/elm_conform.c b/src/lib/elm_conform.c
index b18642b..543aa7d 100644
--- a/src/lib/elm_conform.c
+++ b/src/lib/elm_conform.c
@@ -506,9 +506,9 @@ _indicator_opacity_set(Evas_Object *conformant, 
Elm_Win_Indicator_Opacity_Mode i
    //TODO: opacity change
 }
 
-static void
+static Eina_Bool
 _on_indicator_mode_changed(void *data,
-                           Evas_Object *obj,
+                           Eo *obj, const Eo_Event_Description *desc 
EINA_UNUSED,
                            void *event_info EINA_UNUSED)
 {
    Evas_Object *conformant = data;
@@ -525,11 +525,12 @@ _on_indicator_mode_changed(void *data,
      _indicator_mode_set(conformant, indmode);
    if (ind_o_mode != sd->ind_o_mode)
      _indicator_opacity_set(conformant, ind_o_mode);
+   return EINA_TRUE;
 }
 
-static void
+static Eina_Bool
 _on_rotation_changed(void *data,
-                     Evas_Object *obj,
+                     Eo *obj, const Eo_Event_Description *desc EINA_UNUSED,
                      void *event_info EINA_UNUSED)
 {
    int rot = 0;
@@ -541,12 +542,12 @@ _on_rotation_changed(void *data,
 
    rot = elm_win_rotation_get(win);
 
-   if (rot == sd->rot) return;
+   if (rot == sd->rot) return EINA_TRUE;
 
    sd->rot = rot;
    old_indi = elm_layout_content_unset(conformant, INDICATOR_PART);
    /* this means ELM_WIN_INDICATOR_SHOW never be set.we don't need to change 
indicator type*/
-   if (!old_indi) return;
+   if (!old_indi) return EINA_TRUE;
    evas_object_hide(old_indi);
 
    if ((rot == 90) || (rot == 270))
@@ -554,7 +555,7 @@ _on_rotation_changed(void *data,
         if (!sd->landscape_indicator)
           sd->landscape_indicator = _create_landscape_indicator(conformant);
 
-        if (!sd->landscape_indicator) return;
+        if (!sd->landscape_indicator) return EINA_TRUE;
 
         evas_object_show(sd->landscape_indicator);
         evas_object_data_set(sd->landscape_indicator, CONFORMANT_KEY, (void *) 
(intptr_t) rot);
@@ -565,12 +566,13 @@ _on_rotation_changed(void *data,
         if (!sd->portrait_indicator)
           sd->portrait_indicator = _create_portrait_indicator(conformant);
 
-        if (!sd->portrait_indicator) return;
+        if (!sd->portrait_indicator) return EINA_TRUE;
 
         evas_object_show(sd->portrait_indicator);
         evas_object_data_set(sd->portrait_indicator, CONFORMANT_KEY, (void *) 
(intptr_t) rot);
         elm_layout_content_set(conformant, INDICATOR_PART, 
sd->portrait_indicator);
      }
+   return EINA_TRUE;
 }
 
 EOLIAN static Eina_Bool
@@ -761,7 +763,8 @@ _virtualkeypad_state_change(Evas_Object *obj, 
Ecore_X_Event_Window_Property *ev)
         evas_object_size_hint_max_set(sd->virtualkeypad, -1, 0);
         _conformant_part_sizing_eval(obj, ELM_CONFORMANT_VIRTUAL_KEYPAD_PART);
         elm_widget_display_mode_set(obj, EVAS_DISPLAY_MODE_NONE);
-        evas_object_smart_callback_call(obj, SIG_VIRTUALKEYPAD_STATE_OFF, 
NULL);
+        eo_do(obj, eo_event_callback_call(
+                 ELM_CONFORMANT_EVENT_VIRTUALKEYPAD_STATE_OFF, NULL));
      }
    else if (state == ECORE_X_VIRTUAL_KEYBOARD_STATE_ON)
      {
@@ -769,7 +772,8 @@ _virtualkeypad_state_change(Evas_Object *obj, 
Ecore_X_Event_Window_Property *ev)
         _conformant_part_sizing_eval(obj, ELM_CONFORMANT_VIRTUAL_KEYPAD_PART);
         elm_widget_display_mode_set(obj, EVAS_DISPLAY_MODE_COMPRESS);
         _autoscroll_objects_update(obj);
-        evas_object_smart_callback_call(obj, SIG_VIRTUALKEYPAD_STATE_ON, NULL);
+        eo_do(obj, eo_event_callback_call(
+                 ELM_CONFORMANT_EVENT_VIRTUALKEYPAD_STATE_ON, NULL));
      }
 }
 
@@ -798,13 +802,15 @@ _clipboard_state_change(Evas_Object *obj, 
Ecore_X_Event_Window_Property *ev)
         evas_object_size_hint_min_set(sd->clipboard, -1, 0);
         evas_object_size_hint_max_set(sd->clipboard, -1, 0);
         elm_widget_display_mode_set(obj, EVAS_DISPLAY_MODE_NONE);
-        evas_object_smart_callback_call(obj, SIG_CLIPBOARD_STATE_OFF, NULL);
+        eo_do(obj, eo_event_callback_call(
+                 ELM_CONFORMANT_EVENT_CLIPBOARD_STATE_OFF, NULL));
      }
    else if (state == ECORE_X_ILLUME_CLIPBOARD_STATE_ON)
      {
         elm_widget_display_mode_set(obj, EVAS_DISPLAY_MODE_COMPRESS);
         _autoscroll_objects_update(obj);
-        evas_object_smart_callback_call(obj, SIG_CLIPBOARD_STATE_ON, NULL);
+        eo_do(obj, eo_event_callback_call(
+                 ELM_CONFORMANT_EVENT_CLIPBOARD_STATE_ON, NULL));
      }
 }
 
@@ -905,10 +911,11 @@ _elm_conformant_evas_object_smart_del(Eo *obj, 
Elm_Conformant_Data *sd)
 
    evas_object_data_set(sd->win, "\377 elm,conformant", NULL);
 
-   evas_object_smart_callback_del_full
-     (sd->win, "indicator,prop,changed", _on_indicator_mode_changed, obj);
-   evas_object_smart_callback_del_full
-     (sd->win, "rotation,changed", _on_rotation_changed, obj);
+   eo_do(sd->win,
+         eo_event_callback_del(ELM_WIN_EVENT_INDICATOR_PROP_CHANGED,
+            _on_indicator_mode_changed, obj),
+         eo_event_callback_del(ELM_WIN_EVENT_ROTATION_CHANGED,
+            _on_rotation_changed, obj));
 
    eo_do_super(obj, MY_CLASS, evas_obj_smart_del());
 }
@@ -956,18 +963,19 @@ _elm_conformant_eo_base_constructor(Eo *obj, 
Elm_Conformant_Data *sd)
          elm_interface_atspi_accessible_role_set(ELM_ATSPI_ROLE_FILLER));
 
    sd->win = elm_widget_top_get(obj);
-   _on_indicator_mode_changed(obj, sd->win, NULL);
-   _on_rotation_changed(obj, sd->win, NULL);
+   _on_indicator_mode_changed(obj, sd->win, NULL, NULL);
+   _on_rotation_changed(obj, sd->win, NULL, NULL);
 
    sd->indmode = elm_win_indicator_mode_get(sd->win);
    sd->ind_o_mode = elm_win_indicator_opacity_get(sd->win);
    sd->rot = elm_win_rotation_get(sd->win);
    evas_object_data_set(sd->win, "\377 elm,conformant", obj);
 
-   evas_object_smart_callback_add
-     (sd->win, "indicator,prop,changed", _on_indicator_mode_changed, obj);
-   evas_object_smart_callback_add
-     (sd->win, "rotation,changed", _on_rotation_changed, obj);
+   eo_do(sd->win,
+         eo_event_callback_add(ELM_WIN_EVENT_INDICATOR_PROP_CHANGED,
+            _on_indicator_mode_changed, obj),
+         eo_event_callback_add(ELM_WIN_EVENT_ROTATION_CHANGED,
+            _on_rotation_changed, obj));
 
    return obj;
 }
diff --git a/src/lib/elm_gengrid.c b/src/lib/elm_gengrid.c
index e15fed4..8d1d9a3 100644
--- a/src/lib/elm_gengrid.c
+++ b/src/lib/elm_gengrid.c
@@ -749,7 +749,8 @@ _item_unhighlight(Elm_Gen_Item *it)
      return;
 
    edje_object_signal_emit(VIEW(it), "elm,state,unselected", "elm");
-   evas_object_smart_callback_call(WIDGET(it), SIG_UNHIGHLIGHTED, eo_it);
+   eo_do(WIDGET(it), eo_event_callback_call(
+            ELM_GENGRID_EVENT_UNHIGHLIGHTED, eo_it));
 
    evas_object_stack_below(VIEW(it), sd->stack);
 
diff --git a/src/lib/elm_store.c b/src/lib/elm_store.c
index cd7bb22..affc198 100644
--- a/src/lib/elm_store.c
+++ b/src/lib/elm_store.c
@@ -223,30 +223,32 @@ _store_item_eval(void *data)
      }
 }
 
-static void
-_store_genlist_item_realized(void *data, Evas_Object *obj EINA_UNUSED, void 
*event_info)
+static Eina_Bool
+_store_genlist_item_realized(void *data, Eo *obj EINA_UNUSED, const 
Eo_Event_Description *desc EINA_UNUSED, void *event_info)
 {
    Elm_Store *st = data;
    Elm_Object_Item *gli = event_info;
    Elm_Store_Item *sti = elm_object_item_data_get(gli);
-   if (!sti) return;
+   if (!sti) return EINA_TRUE;
    st->realized_count++;
    sti->live = EINA_TRUE;
    ecore_job_del(sti->eval_job);
    sti->eval_job = ecore_job_add(_store_item_eval, sti);
+   return EINA_TRUE;
 }
 
-static void
-_store_genlist_item_unrealized(void *data, Evas_Object *obj EINA_UNUSED, void 
*event_info)
+static Eina_Bool
+_store_genlist_item_unrealized(void *data, Eo *obj EINA_UNUSED, const 
Eo_Event_Description *desc EINA_UNUSED, void *event_info)
 {
    Elm_Store *st = data;
    Elm_Object_Item *gli = event_info;
    Elm_Store_Item *sti = elm_object_item_data_get(gli);
-   if (!sti) return;
+   if (!sti) return EINA_TRUE;
    st->realized_count--;
    sti->live = EINA_FALSE;
    ecore_job_del(sti->eval_job);
    sti->eval_job = ecore_job_add(_store_item_eval, sti);
+   return EINA_TRUE;
 }
 
 static const Elm_Store_Item_Mapping *
@@ -555,8 +557,9 @@ elm_store_free(Elm_Store *st)
    if (st->genlist)
      {
         evas_object_event_callback_del_full(st->genlist, EVAS_CALLBACK_DEL, 
_store_genlist_del, st);
-        evas_object_smart_callback_del(st->genlist, "realized", 
_store_genlist_item_realized);
-        evas_object_smart_callback_del(st->genlist, "unrealized", 
_store_genlist_item_unrealized);
+        eo_do(st->genlist,
+              eo_event_callback_del(ELM_GENLIST_EVENT_REALIZED, 
_store_genlist_item_realized, st),
+              eo_event_callback_del(ELM_GENLIST_EVENT_UNREALIZED, 
_store_genlist_item_unrealized, st));
         elm_genlist_clear(st->genlist);
         st->genlist = NULL;
      }
@@ -572,14 +575,16 @@ elm_store_target_genlist_set(Elm_Store *st, Evas_Object 
*obj)
    if (st->genlist)
      {
         evas_object_event_callback_del_full(st->genlist, EVAS_CALLBACK_DEL, 
_store_genlist_del, st);
-        evas_object_smart_callback_del(st->genlist, "realized", 
_store_genlist_item_realized);
-        evas_object_smart_callback_del(st->genlist, "unrealized", 
_store_genlist_item_unrealized);
+        eo_do(st->genlist,
+              eo_event_callback_del(ELM_GENLIST_EVENT_REALIZED, 
_store_genlist_item_realized, st),
+              eo_event_callback_del(ELM_GENLIST_EVENT_UNREALIZED, 
_store_genlist_item_unrealized, st));
         elm_genlist_clear(st->genlist);
      }
    st->genlist = obj;
    if (!st->genlist) return;
-   evas_object_smart_callback_add(st->genlist, "realized", 
_store_genlist_item_realized, st);
-   evas_object_smart_callback_add(st->genlist, "unrealized", 
_store_genlist_item_unrealized, st);
+   eo_do(st->genlist,
+         eo_event_callback_add(ELM_GENLIST_EVENT_REALIZED, 
_store_genlist_item_realized, st),
+         eo_event_callback_add(ELM_GENLIST_EVENT_UNREALIZED, 
_store_genlist_item_unrealized, st));
    evas_object_event_callback_add(st->genlist, EVAS_CALLBACK_DEL, 
_store_genlist_del, st);
    elm_genlist_clear(st->genlist);
 }
diff --git a/src/lib/elm_view_list.c b/src/lib/elm_view_list.c
index 5773b2a..93bd7c4 100644
--- a/src/lib/elm_view_list.c
+++ b/src/lib/elm_view_list.c
@@ -149,14 +149,14 @@ _item_text_get(void *data, Evas_Object *obj EINA_UNUSED, 
const char *part)
    return text;
 }
 
-static void
-_expand_request_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void 
*event_info)
+static Eina_Bool
+_expand_request_cb(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const 
Eo_Event_Description *desc EINA_UNUSED, void *event_info)
 {
    Elm_Object_Item *item = event_info;
    View_List_ItemData *idata = elm_object_item_data_get(item);
    Efl_Model_Load_Status st = EFL_MODEL_LOAD_STATUS_ERROR;
 
-   EINA_SAFETY_ON_NULL_RETURN(idata);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(idata, EINA_TRUE);
 
    eo_do(idata->model, st = efl_model_load_status_get());
    eo_do(idata->model, eo_event_callback_add(EFL_MODEL_BASE_EVENT_LOAD_STATUS,
@@ -172,10 +172,11 @@ _expand_request_cb(void *data EINA_UNUSED, Evas_Object 
*obj EINA_UNUSED, void *e
      {
         eo_do(idata->model, efl_model_children_load());
      }
+   return EINA_TRUE;
 }
 
-static void
-_contract_request_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, 
void *event_info)
+static Eina_Bool
+_contract_request_cb(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const 
Eo_Event_Description *desc EINA_UNUSED, void *event_info)
 {
    Elm_Object_Item *item = event_info;
    View_List_ItemData *idata = elm_object_item_data_get(item);
@@ -185,13 +186,15 @@ _contract_request_cb(void *data EINA_UNUSED, Evas_Object 
*obj EINA_UNUSED, void
    eo_do(idata->model, 
eo_event_callback_del(EFL_MODEL_BASE_EVENT_CHILDREN_COUNT_CHANGED,
                            _efl_model_children_count_change_cb, idata));
    elm_genlist_item_expanded_set(item, EINA_FALSE);
+   return EINA_TRUE;
 }
 
-static void
-_contracted_cb(void *data EINA_UNUSED, Evas_Object *o EINA_UNUSED, void 
*event_info)
+static Eina_Bool
+_contracted_cb(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const 
Eo_Event_Description *desc EINA_UNUSED, void *event_info)
 {
    Elm_Object_Item *glit = event_info;
    elm_genlist_item_subitems_clear(glit);
+   return EINA_TRUE;
 }
 
 static void
@@ -201,9 +204,10 @@ _genlist_deleted(void *data, Evas *e EINA_UNUSED, 
Evas_Object *obj, void *event_
 
    if (priv && priv->genlist && priv->genlist == obj)
      {
-        evas_object_smart_callback_del(priv->genlist, "expand,request", 
_expand_request_cb);
-        evas_object_smart_callback_del(priv->genlist, "contract,request", 
_contract_request_cb);
-        evas_object_smart_callback_del(priv->genlist, "contracted", 
_contracted_cb);
+        eo_do(priv->genlist,
+              eo_event_callback_del(ELM_GENLIST_EVENT_EXPAND_REQUEST, 
_expand_request_cb, priv),
+              eo_event_callback_del(ELM_GENLIST_EVENT_CONTRACT_REQUEST, 
_contract_request_cb, priv),
+              eo_event_callback_del(ELM_GENLIST_EVENT_CONTRACTED, 
_contracted_cb, priv));
         eo_unref(priv->genlist);
         priv->genlist = NULL;
      }
@@ -357,9 +361,10 @@ _elm_view_list_genlist_set(Eo *obj, Elm_View_List_Data 
*priv, Evas_Object *genli
    priv->itc->func.del = _item_del;
    priv->prop_con = eina_hash_string_superfast_new(free);
 
-   evas_object_smart_callback_add(priv->genlist, "expand,request", 
_expand_request_cb, priv);
-   evas_object_smart_callback_add(priv->genlist, "contract,request", 
_contract_request_cb, priv);
-   evas_object_smart_callback_add(priv->genlist, "contracted", _contracted_cb, 
priv);
+   eo_do(priv->genlist,
+         eo_event_callback_add(ELM_GENLIST_EVENT_EXPAND_REQUEST, 
_expand_request_cb, priv),
+         eo_event_callback_add(ELM_GENLIST_EVENT_CONTRACT_REQUEST, 
_contract_request_cb, priv),
+         eo_event_callback_add(ELM_GENLIST_EVENT_CONTRACTED, _contracted_cb, 
priv));
    evas_object_event_callback_add(priv->genlist, EVAS_CALLBACK_DEL, 
_genlist_deleted, priv);
 }
 
@@ -383,9 +388,10 @@ _elm_view_list_eo_base_destructor(Eo *obj, 
Elm_View_List_Data *priv)
    priv->rootdata = NULL;
    if (priv->genlist) {
      evas_object_event_callback_del(priv->genlist, EVAS_CALLBACK_DEL, 
_genlist_deleted);
-     evas_object_smart_callback_del(priv->genlist, "expand,request", 
_expand_request_cb);
-     evas_object_smart_callback_del(priv->genlist, "contract,request", 
_contract_request_cb);
-     evas_object_smart_callback_del(priv->genlist, "contracted", 
_contracted_cb);
+     eo_do(priv->genlist,
+           eo_event_callback_del(ELM_GENLIST_EVENT_EXPAND_REQUEST, 
_expand_request_cb, priv),
+           eo_event_callback_del(ELM_GENLIST_EVENT_CONTRACT_REQUEST, 
_contract_request_cb, priv),
+           eo_event_callback_del(ELM_GENLIST_EVENT_CONTRACTED, _contracted_cb, 
priv));
      eo_unref(priv->genlist);
    }
 

-- 


Reply via email to