elementary/pager - modified to content use EVAS_CALLBACK_DEL callback.
authorhermet <hermet@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 8 Jun 2011 00:10:19 +0000 (00:10 +0000)
committerhermet <hermet@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 8 Jun 2011 00:10:19 +0000 (00:10 +0000)
Because sub,del callback will be called for both base and content,
the item finding root will be called twice unnecessary.
This changes provide somewhat optimized sequence.

git-svn-id: https://svn.enlightenment.org/svn/e/trunk/elementary@60059 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/elm_pager.c

index 3808528..e2c8668 100644 (file)
@@ -48,7 +48,7 @@ static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
 static void _theme_hook(Evas_Object *obj);
 static void _sizing_eval(Evas_Object *obj);
 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
-static void _sub_del(void *data, Evas_Object *obj, void *event_info);
+static void _content_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
 static Eina_List *_item_get(Evas_Object *obj, Evas_Object *content);
 
 static const char SIG_HIDE_FINISHED[] = "hide,finished";
@@ -227,23 +227,18 @@ _move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSE
 }
 
 static void
-_sub_del(void *data, Evas_Object *obj __UNUSED__, void *event_info)
+_content_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
 {
    Widget_Data *wd = elm_widget_data_get(data);
-   Evas_Object *sub = event_info;
    Eina_List *l;
    Item *it;
    if (!wd) return;
-   l = _item_get(obj, sub);
+   l = _item_get(obj, obj);
    if (!l) return;
    it = l->data;
-
    wd->stack = eina_list_remove_list(wd->stack, l);
    evas_object_event_callback_del_full
-      (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, it);
-   //TODO: Since the base and content is sub object of pager,
-   //this function (and _item_get) will be called unnecessary.
-   //consider use EVAS_CALLBACK_DEL instead of sub_del callback
+      (obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, it);
    evas_object_del(it->base);
    _eval_top(data);
    free(it);
@@ -273,6 +268,9 @@ _signal_hide_finished(void *data, Evas_Object *obj __UNUSED__, const char *emiss
         evas_object_del(it->base);
         evas_object_event_callback_del_full
            (content, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, it);
+        evas_object_event_callback_del(content,
+                                       EVAS_CALLBACK_DEL,
+                                       _content_del);
         evas_object_del(content);
         free(it);
      }
@@ -325,8 +323,6 @@ elm_pager_add(Evas_Object *parent)
    evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _move, obj);
    evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, obj);
 
-   evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
-
    evas_object_smart_callbacks_descriptions_set(obj, _signals);
 
    _mirrored_set(obj, elm_widget_mirrored_get(obj));
@@ -375,6 +371,10 @@ elm_pager_content_push(Evas_Object *obj, Evas_Object *content)
    evas_object_event_callback_add(it->content,
                                   EVAS_CALLBACK_CHANGED_SIZE_HINTS,
                                   _changed_size_hints, it);
+   evas_object_event_callback_add(it->content,
+                                  EVAS_CALLBACK_DEL,
+                                  _content_del,
+                                  it);
    edje_object_part_swallow(it->base, "elm.swallow.content", it->content);
    edje_object_size_min_calc(it->base, &it->minw, &it->minh);
    evas_object_data_set(it->base, "_elm_leaveme", obj);