From: seoz Date: Mon, 31 Oct 2011 00:13:32 +0000 (+0000) Subject: elm: Use appropriate add/del_full for evas event callbacks. X-Git-Tag: REL_F_I9500_20120323_1~17^2~1458 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0abc9a0518c150b2fffe97fc388b532429aa4b10;p=framework%2Fuifw%2Felementary.git elm: Use appropriate add/del_full for evas event callbacks. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@64536 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/TODO b/TODO index 37adb5f..11d1c99 100644 --- a/TODO +++ b/TODO @@ -9,3 +9,6 @@ Things That Just Need To Be Rewritten (tm): "Features" elm_object_icon_s/get() should be implemented for most widgets to reduce api + +callbacks add/del + pager, panes diff --git a/src/lib/elc_fileselector_button.c b/src/lib/elc_fileselector_button.c index c5197f6..d104736 100644 --- a/src/lib/elc_fileselector_button.c +++ b/src/lib/elc_fileselector_button.c @@ -22,6 +22,7 @@ struct _Widget_Data static const char *widtype = NULL; +static void _del_pre_hook(Evas_Object *obj); static void _del_hook(Evas_Object *obj); static void _theme_hook(Evas_Object *obj); static void _disable_hook(Evas_Object *obj); @@ -30,6 +31,9 @@ static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _button_clicked(void *data, + Evas_Object *obj, + void *event_info); static void _on_focus_hook(void *data, Evas_Object *obj); static void _selection_done(void *data, @@ -44,6 +48,16 @@ static const Evas_Smart_Cb_Description _signals[] = { }; static void +_del_pre_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + evas_object_event_callback_del_full(wd->btn, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + evas_object_smart_callback_del(wd->btn, "clicked", _button_clicked); +} + +static void _del_hook(Evas_Object *obj) { Evas_Object *win; @@ -274,6 +288,7 @@ elm_fileselector_button_add(Evas_Object *parent) elm_widget_sub_object_add(parent, obj); elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); elm_widget_data_set(obj, wd); + elm_widget_del_pre_hook_set(obj, _del_pre_hook); elm_widget_del_hook_set(obj, _del_hook); elm_widget_theme_hook_set(obj, _theme_hook); elm_widget_disable_hook_set(obj, _disable_hook); diff --git a/src/lib/elc_fileselector_entry.c b/src/lib/elc_fileselector_entry.c index 653ee49..bad2caf 100644 --- a/src/lib/elc_fileselector_entry.c +++ b/src/lib/elc_fileselector_entry.c @@ -62,6 +62,8 @@ SIG_FWD(SELECTION_CUT) SIG_FWD(UNPRESSED) #undef SIG_FWD +static void _del_pre_hook(Evas_Object *obj); +static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info); static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); static void @@ -83,6 +85,17 @@ _ACTIVATED_fwd(void *data, Evas_Object *obj __UNUSED__, void *event_info) } static void +_del_pre_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + evas_object_event_callback_del_full + (wd->button, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj); + evas_object_event_callback_del_full + (wd->entry, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj); +} + +static void _del_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); @@ -233,6 +246,7 @@ elm_fileselector_entry_add(Evas_Object *parent) elm_widget_type_set(obj, "fileselector_entry"); elm_widget_sub_object_add(parent, obj); elm_widget_data_set(obj, wd); + elm_widget_del_pre_hook_set(obj, _del_pre_hook); elm_widget_del_hook_set(obj, _del_hook); elm_widget_disable_hook_set(obj, _disable_hook); elm_widget_focus_next_hook_set(obj, _elm_fileselector_entry_focus_next_hook); diff --git a/src/lib/elc_hoversel.c b/src/lib/elc_hoversel.c index e0b983c..6cb93e2 100644 --- a/src/lib/elc_hoversel.c +++ b/src/lib/elc_hoversel.c @@ -49,6 +49,8 @@ _del_pre_hook(Evas_Object *obj) Elm_Hoversel_Item *item; Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; + evas_object_event_callback_del_full(wd->btn, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); elm_hoversel_hover_end(obj); elm_hoversel_hover_parent_set(obj, NULL); EINA_LIST_FREE(wd->items, item) diff --git a/src/lib/elm_bubble.c b/src/lib/elm_bubble.c index 5c8c5d9..1dfdceb 100644 --- a/src/lib/elm_bubble.c +++ b/src/lib/elm_bubble.c @@ -281,6 +281,8 @@ elm_bubble_content_unset(Evas_Object *obj) if (!wd->content) return NULL; content = wd->content; elm_widget_sub_object_del(obj, content); + evas_object_event_callback_del_full(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); edje_object_part_unswallow(wd->bbl, content); wd->content = NULL; return content; @@ -326,6 +328,8 @@ elm_bubble_icon_unset(Evas_Object *obj) if (!wd->icon) return NULL; icon = wd->icon; elm_widget_sub_object_del(obj, icon); + evas_object_event_callback_del_full(icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); edje_object_part_unswallow(wd->bbl, icon); wd->icon = NULL; return icon; diff --git a/src/lib/elm_button.c b/src/lib/elm_button.c index cafc17e..7e2ff28 100644 --- a/src/lib/elm_button.c +++ b/src/lib/elm_button.c @@ -215,6 +215,8 @@ _content_unset_hook(Evas_Object *obj, const char *part __UNUSED__) if (!wd->icon) return NULL; Evas_Object *icon = wd->icon; elm_widget_sub_object_del(obj, wd->icon); + evas_object_event_callback_del_full(wd->icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); edje_object_part_unswallow(wd->btn, wd->icon); wd->icon = NULL; return icon; diff --git a/src/lib/elm_check.c b/src/lib/elm_check.c index 7038c71..c4e57c8 100644 --- a/src/lib/elm_check.c +++ b/src/lib/elm_check.c @@ -246,6 +246,9 @@ _content_unset_hook(Evas_Object *obj, const char *part __UNUSED__) if (!wd->icon) return NULL; Evas_Object *icon = wd->icon; elm_widget_sub_object_del(obj, wd->icon); + evas_object_event_callback_del_full(wd->icon, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); edje_object_part_unswallow(wd->chk, wd->icon); wd->icon = NULL; return icon; diff --git a/src/lib/elm_conform.c b/src/lib/elm_conform.c index 620b79e..1ccacac 100644 --- a/src/lib/elm_conform.c +++ b/src/lib/elm_conform.c @@ -160,6 +160,9 @@ _content_unset_hook(Evas_Object *obj, const char *part __UNUSED__) if ((!wd) || (!wd->content)) return NULL; content = wd->content; elm_widget_sub_object_del(obj, wd->content); + evas_object_event_callback_del_full(wd->content, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); edje_object_part_unswallow(wd->base, wd->content); wd->content = NULL; return content; diff --git a/src/lib/elm_flip.c b/src/lib/elm_flip.c index e311b7d..2f3d5cb 100644 --- a/src/lib/elm_flip.c +++ b/src/lib/elm_flip.c @@ -1721,6 +1721,9 @@ elm_flip_content_front_unset(Evas_Object *obj) Evas_Object *content = wd->front.content; evas_object_clip_unset(content); elm_widget_sub_object_del(obj, content); + evas_object_event_callback_del_full(content, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); evas_object_smart_member_del(content); wd->front.content = NULL; return content; @@ -1736,6 +1739,9 @@ elm_flip_content_back_unset(Evas_Object *obj) Evas_Object *content = wd->back.content; evas_object_clip_unset(content); elm_widget_sub_object_del(obj, content); + evas_object_event_callback_del_full(content, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); evas_object_smart_member_del(content); wd->back.content = NULL; return content; diff --git a/src/lib/elm_frame.c b/src/lib/elm_frame.c index fb1019c..7dae02b 100644 --- a/src/lib/elm_frame.c +++ b/src/lib/elm_frame.c @@ -162,6 +162,9 @@ _content_unset_hook(Evas_Object *obj, const char *part __UNUSED__) if (!wd->content) return NULL; content = wd->content; elm_widget_sub_object_del(obj, wd->content); + evas_object_event_callback_del_full(wd->content, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); edje_object_part_unswallow(wd->frm, wd->content); wd->content = NULL; return content; diff --git a/src/lib/elm_layout.c b/src/lib/elm_layout.c index 461f976..3338270 100644 --- a/src/lib/elm_layout.c +++ b/src/lib/elm_layout.c @@ -424,6 +424,9 @@ _content_unset_hook(Evas_Object *obj, const char *part) if (!si->obj) return NULL; content = si->obj; /* si will die in _sub_del due elm_widget_sub_object_del() */ elm_widget_sub_object_del(obj, content); + evas_object_event_callback_del_full(content, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, wd); edje_object_part_unswallow(wd->lay, content); return content; } diff --git a/src/lib/elm_map.c b/src/lib/elm_map.c index 0d2d40c..7142d51 100644 --- a/src/lib/elm_map.c +++ b/src/lib/elm_map.c @@ -2556,7 +2556,7 @@ _group_bubble_content_update(Marker_Group *group) elm_scroller_content_set(group->sc, group->bx); - evas_object_event_callback_add(group->sc, EVAS_CALLBACK_RESIZE, + evas_object_event_callback_add(group->sc, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _bubble_sc_hits_changed_cb, group); } diff --git a/src/lib/elm_mapbuf.c b/src/lib/elm_mapbuf.c index ab6f152..9e01249 100644 --- a/src/lib/elm_mapbuf.c +++ b/src/lib/elm_mapbuf.c @@ -191,6 +191,9 @@ _content_unset_hook(Evas_Object *obj, const char *part __UNUSED__) if (!wd->content) return NULL; content = wd->content; elm_widget_sub_object_del(obj, content); + evas_object_event_callback_add(content, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); evas_object_smart_member_del(content); evas_object_color_set(wd->clip, 0, 0, 0, 0); evas_object_clip_unset(content); diff --git a/src/lib/elm_notify.c b/src/lib/elm_notify.c index 116d475..3b2de35 100644 --- a/src/lib/elm_notify.c +++ b/src/lib/elm_notify.c @@ -456,6 +456,11 @@ _content_unset_hook(Evas_Object *obj, const char *part __UNUSED__) if (!wd->content) return NULL; content = wd->content; elm_widget_sub_object_del(obj, wd->content); + evas_object_event_callback_del_full(wd->content, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + evas_object_event_callback_del_full(wd->content, EVAS_CALLBACK_RESIZE, + _content_resize, obj); edje_object_part_unswallow(wd->notify, wd->content); wd->content = NULL; return content; diff --git a/src/lib/elm_progressbar.c b/src/lib/elm_progressbar.c index 3ee3b0c..e601662 100644 --- a/src/lib/elm_progressbar.c +++ b/src/lib/elm_progressbar.c @@ -351,6 +351,8 @@ elm_progressbar_icon_unset(Evas_Object *obj) if (!wd->icon) return NULL; Evas_Object *icon = wd->icon; elm_widget_sub_object_del(obj, wd->icon); + evas_object_event_callback_del_full(wd->icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); edje_object_part_unswallow(wd->progressbar, wd->icon); wd->icon = NULL; return icon; diff --git a/src/lib/elm_radio.c b/src/lib/elm_radio.c index 99f1ab3..83e2e74 100644 --- a/src/lib/elm_radio.c +++ b/src/lib/elm_radio.c @@ -402,6 +402,8 @@ elm_radio_icon_unset(Evas_Object *obj) if (!wd->icon) return NULL; Evas_Object *icon = wd->icon; elm_widget_sub_object_del(obj, wd->icon); + evas_object_event_callback_del_full(wd->icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); edje_object_part_unswallow(wd->radio, wd->icon); wd->icon = NULL; return icon; diff --git a/src/lib/elm_scroller.c b/src/lib/elm_scroller.c index d4487c4..8392e96 100644 --- a/src/lib/elm_scroller.c +++ b/src/lib/elm_scroller.c @@ -526,6 +526,9 @@ elm_scroller_content_unset(Evas_Object *obj) if (!wd->content) return NULL; content = wd->content; elm_widget_sub_object_del(obj, wd->content); + evas_object_event_callback_del_full(wd->content, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); edje_object_part_unswallow(elm_smart_scroller_edje_object_get(wd->scr), wd->content); wd->content = NULL; return content; diff --git a/src/lib/elm_slider.c b/src/lib/elm_slider.c index 044ce93..cc634ca 100644 --- a/src/lib/elm_slider.c +++ b/src/lib/elm_slider.c @@ -593,6 +593,9 @@ elm_slider_icon_unset(Evas_Object *obj) if (wd->icon) { elm_widget_sub_object_del(obj, wd->icon); + evas_object_event_callback_del_full(wd->icon, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); ret = wd->icon; edje_object_part_unswallow(wd->slider, wd->icon); edje_object_signal_emit(wd->slider, "elm,state,icon,hidden", "elm"); @@ -843,6 +846,9 @@ elm_slider_end_unset(Evas_Object *obj) if (wd->end) { elm_widget_sub_object_del(obj, wd->end); + evas_object_event_callback_del_full(wd->end, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); ret = wd->end; edje_object_part_unswallow(wd->slider, wd->end); edje_object_signal_emit(wd->slider, "elm,state,end,hidden", "elm"); diff --git a/src/lib/elm_slideshow.c b/src/lib/elm_slideshow.c index 69690c2..71876d6 100644 --- a/src/lib/elm_slideshow.c +++ b/src/lib/elm_slideshow.c @@ -39,6 +39,7 @@ struct _Widget_Data }; static const char *widtype = NULL; +static void _del_pre_hook(Evas_Object *obj); static void _del_hook(Evas_Object *obj); static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); static void _theme_hook(Evas_Object *obj); @@ -98,6 +99,15 @@ _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type ty } static void +_del_pre_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + evas_object_event_callback_del_full(obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); +} + +static void _del_hook(Evas_Object *obj) { const char *layout; @@ -346,6 +356,7 @@ elm_slideshow_add(Evas_Object *parent) elm_widget_sub_object_add(parent, obj); elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); elm_widget_data_set(obj, wd); + elm_widget_del_pre_hook_set(obj, _del_pre_hook); elm_widget_del_hook_set(obj, _del_hook); elm_widget_theme_hook_set(obj, _theme_hook); elm_widget_can_focus_set(obj, EINA_TRUE); diff --git a/src/lib/elm_win.c b/src/lib/elm_win.c index 2d3237b..62f9392 100644 --- a/src/lib/elm_win.c +++ b/src/lib/elm_win.c @@ -2612,6 +2612,9 @@ elm_win_inwin_content_unset(Evas_Object *obj) if (!wd->content) return NULL; Evas_Object *content = wd->content; elm_widget_sub_object_del(obj, wd->content); + evas_object_event_callback_del_full(wd->content, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); edje_object_part_unswallow(wd->frm, wd->content); wd->content = NULL; return content;