From f586a54ab8279026543489f5d7da76fa71e5bb59 Mon Sep 17 00:00:00 2001 From: hermet Date: Mon, 2 Jan 2012 11:46:32 +0000 Subject: [PATCH] elementary - Added 1 more API elm_object_item_del_cb_set() also deprecated below APIs elm_hoversel_item_del_cb_set() elm_diskselector_item_del_cb_set() elm_toolbar_item_del_cb_set() elm_index_item_del_cb_set() elm_menu_item_del_cb_set() git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@66748 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- doc/examples.dox | 2 +- src/examples/diskselector_example_02.c | 2 +- src/examples/hoversel_example_01.c | 2 +- src/examples/index_example_01.c | 2 +- src/examples/web_example.c | 2 +- src/lib/elc_hoversel.c | 3 +- src/lib/elc_hoversel.h | 18 ------- src/lib/elm_deprecated.h | 85 +++++++++++++++++++++++++++++++++- src/lib/elm_diskselector.c | 3 +- src/lib/elm_diskselector.h | 23 +-------- src/lib/elm_index.c | 3 +- src/lib/elm_index.h | 18 +------ src/lib/elm_main.c | 4 ++ src/lib/elm_menu.c | 3 +- src/lib/elm_menu.h | 11 ----- src/lib/elm_object_item.h | 17 +++++++ src/lib/elm_toolbar.c | 3 +- src/lib/elm_toolbar.h | 30 ++---------- 18 files changed, 122 insertions(+), 109 deletions(-) diff --git a/doc/examples.dox b/doc/examples.dox index 8bf1220..bf4598c 100644 --- a/doc/examples.dox +++ b/doc/examples.dox @@ -2208,7 +2208,7 @@ * * If you want to free this data, or handle that the way you need when the * item is deleted, set a callback function for that, with - * elm_diskselector_item_del_cb_set(). + * elm_object_item_del_cb_set(). * * As you can see we check if @c it is not @c NULL after appending it. * If an error happens, we won't try to set a function for it. diff --git a/src/examples/diskselector_example_02.c b/src/examples/diskselector_example_02.c index 8ac55be..36f0fed 100644 --- a/src/examples/diskselector_example_02.c +++ b/src/examples/diskselector_example_02.c @@ -102,7 +102,7 @@ _add_data_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED_ printf("Error adding item\n"); return; } - elm_diskselector_item_del_cb_set(ds_it, _free_data); + elm_object_item_del_cb_set(ds_it, _free_data); } static void diff --git a/src/examples/hoversel_example_01.c b/src/examples/hoversel_example_01.c index 769f878..eb3038e 100644 --- a/src/examples/hoversel_example_01.c +++ b/src/examples/hoversel_example_01.c @@ -94,7 +94,7 @@ _add_item(void *data, Evas_Object *obj, void *event_info) hoversel_it = elm_hoversel_item_add(obj, str, NULL, ELM_ICON_NONE, NULL, str); - elm_hoversel_item_del_cb_set(hoversel_it, _free); + elm_object_item_del_cb_set(hoversel_it, _free); } static void diff --git a/src/examples/index_example_01.c b/src/examples/index_example_01.c index 0dbc846..f6f5d0a 100644 --- a/src/examples/index_example_01.c +++ b/src/examples/index_example_01.c @@ -164,7 +164,7 @@ elm_main(int argc __UNUSED__, elm_index_item_append(d.index, buf, it); index_it = elm_index_item_find(d.index, it); - elm_index_item_del_cb_set(index_it, _index_item_del); + elm_object_item_del_cb_set(index_it, _index_item_del); } } diff --git a/src/examples/web_example.c b/src/examples/web_example.c index 4fedfce..91814d8 100644 --- a/src/examples/web_example.c +++ b/src/examples/web_example.c @@ -156,7 +156,7 @@ tab_add(App_Data *ad) td->app = ad; td->tab = elm_toolbar_item_append(td->app->tabs, NULL, "New tab", _tab_clicked_cb, td); - elm_toolbar_item_del_cb_set(td->tab, _tb_item_del_cb); + elm_object_item_del_cb_set(td->tab, _tb_item_del_cb); evas_object_data_set(td->web, "tab_data", td); diff --git a/src/lib/elc_hoversel.c b/src/lib/elc_hoversel.c index ea0d686..4c1c3d8 100644 --- a/src/lib/elc_hoversel.c +++ b/src/lib/elc_hoversel.c @@ -515,8 +515,7 @@ elm_hoversel_item_del(Elm_Object_Item *it) EAPI void elm_hoversel_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func) { - ELM_OBJ_ITEM_CHECK_OR_RETURN(it); - elm_widget_item_del_cb_set(it, func); + elm_object_item_del_cb_set(it, func); } EAPI void * diff --git a/src/lib/elc_hoversel.h b/src/lib/elc_hoversel.h index d0de653..63dab9f 100644 --- a/src/lib/elc_hoversel.h +++ b/src/lib/elc_hoversel.h @@ -127,7 +127,6 @@ EAPI Eina_Bool elm_hoversel_expanded_get(const Evas_Object *o * @warning Should @b not be called while the hoversel is active; use * elm_hoversel_expanded_get() to check first. * - * @see elm_hoversel_item_del_cb_set() * @see elm_hoversel_item_del() */ EAPI void elm_hoversel_clear(Evas_Object *obj); @@ -173,27 +172,10 @@ EAPI Elm_Object_Item *elm_hoversel_item_add(Evas_Object *obj, const * hoversel is active; use elm_hoversel_expanded_get() to check first). * * @see elm_hoversel_item_add() - * @see elm_hoversel_item_del_cb_set() */ EAPI void elm_hoversel_item_del(Elm_Object_Item *it); /** - * @brief Set the function to be called when an item from the hoversel is - * freed. - * - * @param it The item to set the callback on - * @param func The function called - * - * That function will receive these parameters: - * @li void * item data - * @li Evas_Object * hoversel object - * @li Elm_Object_Item * hoversel item - * - * @see elm_hoversel_item_add() - */ -EAPI void elm_hoversel_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func); - -/** * @brief This sets the icon for the given hoversel item. * * @param it The item to set the icon diff --git a/src/lib/elm_deprecated.h b/src/lib/elm_deprecated.h index 3ad2cf6..3341b93 100644 --- a/src/lib/elm_deprecated.h +++ b/src/lib/elm_deprecated.h @@ -566,6 +566,23 @@ EINA_DEPRECATED EAPI void *elm_hoversel_item_data_get(const Elm_Object_It EINA_DEPRECATED EAPI const char *elm_hoversel_item_label_get(const Elm_Object_Item *it); /** + * @brief Set the function to be called when an item from the hoversel is + * freed. + * + * @param it The item to set the callback on + * @param func The function called + * + * That function will receive these parameters: + * @li void * item data + * @li Evas_Object * hoversel object + * @li Elm_Object_Item * hoversel item + * + * @see elm_hoversel_item_add() + * @deprecated Use elm_object_item_del_cb_set() instead + */ +EINA_DEPRECATED EAPI void elm_hoversel_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func); + +/** * Set actionslider labels. * * @param obj The actionslider object @@ -1245,6 +1262,26 @@ EINA_DEPRECATED EAPI void elm_diskselector_item_label_set(Elm_ */ EINA_DEPRECATED EAPI const char *elm_diskselector_item_label_get(const Elm_Object_Item *it); +/** + * Set the function called when a diskselector item is freed. + * + * @param it The item to set the callback on + * @param func The function called + * + * If there is a @p func, then it will be called prior item's memory release. + * That will be called with the following arguments: + * @li item's data; + * @li item's Evas object; + * @li item itself; + * + * This way, a data associated to a diskselector item could be properly + * freed. + * @deprecated Use elm_object_item_del_cb_set() instead + * + * @ingroup Diskselector + */ +EINA_DEPRECATED EAPI void elm_diskselector_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func); + EINA_DEPRECATED EAPI void elm_factory_content_set(Evas_Object *obj, Evas_Object *content); EINA_DEPRECATED EAPI Evas_Object *elm_factory_content_get(const Evas_Object *obj); @@ -1402,7 +1439,22 @@ EINA_DEPRECATED EAPI void *elm_index_item_data_get(const Elm_Object_Item *item); EINA_DEPRECATED EAPI void elm_index_item_data_set(Elm_Object_Item *it, const void *data); /** - * @brief Set the label on the label object + * Set the function to be called when a given index widget item is freed. + * + * @param it The item to set the callback on + * @param func The function to call on the item's deletion + * + * When called, @p func will have both @c data and @c event_info + * arguments with the @p it item's data value and, naturally, the + * @c obj argument with a handle to the parent index widget. + * + * @deprecated Use elm_object_item_del_cb_set() instead + * @ingroup Index + */ +EINA_DEPRECATED EAPI void elm_index_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func); + +/** +* @brief Set the label on the label object * * @param obj The label object * @param label The label will be used on the label object @@ -1659,6 +1711,18 @@ EINA_DEPRECATED EAPI Eina_Bool elm_menu_item_disabled_get(const Elm_Object_It EINA_DEPRECATED EAPI void *elm_menu_item_data_get(const Elm_Object_Item *it); /** + * @brief Set the function called when a menu item is deleted. + * + * @param it The item to set the callback on + * @param func The function called + * + * @see elm_menu_item_add() + * @see elm_menu_item_del() + * @deprecated Use elm_object_item_del_cb_set() instead + */ +EINA_DEPRECATED EAPI void elm_menu_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func); + +/** * @brief Sets the data to be associated with menu item @p item. * * @param it The item @@ -2458,6 +2522,25 @@ EINA_DEPRECATED EAPI void elm_toolbar_orientation_set(Evas_Object *obj, EINA_DEPRECATED EAPI Eina_Bool elm_toolbar_orientation_get(const Evas_Object *obj); /** + * Set the function called when a toolbar item is freed. + * + * @param it The item to set the callback on. + * @param func The function called. + * + * If there is a @p func, then it will be called prior item's memory release. + * That will be called with the following arguments: + * @li item's data; + * @li item's Evas object; + * @li item itself; + * + * This way, a data associated to a toolbar item could be properly freed. + * + * @deprecated Use elm_object_item_del_cb_set() instead + * @ingroup Toolbar + */ +EINA_DEPRECATED EAPI void elm_toolbar_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func); + +/** * @brief Link a Elm_Payer with an Elm_Video object. * * @param player the Elm_Player object. diff --git a/src/lib/elm_diskselector.c b/src/lib/elm_diskselector.c index 842ca9d..1f232a1 100644 --- a/src/lib/elm_diskselector.c +++ b/src/lib/elm_diskselector.c @@ -1321,8 +1321,7 @@ elm_diskselector_item_selected_get(const Elm_Object_Item *it) EAPI void elm_diskselector_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func) { - ELM_OBJ_ITEM_CHECK_OR_RETURN(it); - elm_widget_item_del_cb_set(it, func); + elm_object_item_del_cb_set(it, func); } EAPI void * diff --git a/src/lib/elm_diskselector.h b/src/lib/elm_diskselector.h index d1f316b..47e8688 100644 --- a/src/lib/elm_diskselector.h +++ b/src/lib/elm_diskselector.h @@ -268,7 +268,7 @@ EAPI const Eina_List *elm_diskselector_items_get(const Evas_Object *obj); * elm_diskselector_item_del(). * * Associated @p data can be properly freed when item is deleted if a - * callback function is set with elm_diskselector_item_del_cb_set(). + * callback function is set with elm_object_item_del_cb_set(). * * If a function is passed as argument, it will be called everytime this item * is selected, i.e., the user stops the diskselector with this @@ -285,7 +285,6 @@ EAPI const Eina_List *elm_diskselector_items_get(const Evas_Object *obj); * @endcode * * @see elm_diskselector_item_del() - * @see elm_diskselector_item_del_cb_set() * @see elm_diskselector_clear() * @see elm_icon_add() * @@ -304,32 +303,12 @@ EAPI Elm_Object_Item *elm_diskselector_item_append(Evas_Object *obj, const char * * @see elm_diskselector_clear() * @see elm_diskselector_item_append() - * @see elm_diskselector_item_del_cb_set() * * @ingroup Diskselector */ EAPI void elm_diskselector_item_del(Elm_Object_Item *it); /** - * Set the function called when a diskselector item is freed. - * - * @param it The item to set the callback on - * @param func The function called - * - * If there is a @p func, then it will be called prior item's memory release. - * That will be called with the following arguments: - * @li item's data; - * @li item's Evas object; - * @li item itself; - * - * This way, a data associated to a diskselector item could be properly - * freed. - * - * @ingroup Diskselector - */ -EAPI void elm_diskselector_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func); - -/** * Get the selected item. * * @param obj The diskselector object. diff --git a/src/lib/elm_index.c b/src/lib/elm_index.c index 893d4f9..16927f7 100644 --- a/src/lib/elm_index.c +++ b/src/lib/elm_index.c @@ -811,8 +811,7 @@ elm_index_item_data_set(Elm_Object_Item *it, const void *data) EAPI void elm_index_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func) { - ELM_OBJ_ITEM_CHECK_OR_RETURN(it); - elm_widget_item_del_cb_set(it, func); + elm_object_item_del_cb_set(it, func); } EAPI const char * diff --git a/src/lib/elm_index.h b/src/lib/elm_index.h index 6123f61..e312027 100644 --- a/src/lib/elm_index.h +++ b/src/lib/elm_index.h @@ -246,7 +246,7 @@ EAPI void elm_index_item_sorted_insert(Evas_Object *obj, const * @param obj The index object * @param item The item to be removed from @p obj * - * If a deletion callback is set, via elm_index_item_del_cb_set(), + * If a deletion callback is set, via elm_object_item_del_cb_set(), * that callback function will be called by this one. * * @ingroup Index @@ -269,7 +269,7 @@ EAPI Elm_Object_Item *elm_index_item_find(Evas_Object *obj, const void *ite * * @param obj The index object. * - * If deletion callbacks are set, via elm_index_item_del_cb_set(), + * If deletion callbacks are set, via elm_object_item_del_cb_set(), * that callback function will be called for each item in @p obj. * * @ingroup Index @@ -287,20 +287,6 @@ EAPI void elm_index_item_clear(Evas_Object *obj); EAPI void elm_index_item_go(Evas_Object *obj, int level); /** - * Set the function to be called when a given index widget item is freed. - * - * @param it The item to set the callback on - * @param func The function to call on the item's deletion - * - * When called, @p func will have both @c data and @c event_info - * arguments with the @p it item's data value and, naturally, the - * @c obj argument with a handle to the parent index widget. - * - * @ingroup Index - */ -EAPI void elm_index_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func); - -/** * Get the letter (string) set on a given index widget item. * * @param it The index item handle diff --git a/src/lib/elm_main.c b/src/lib/elm_main.c index 1e2e787..e46e608 100644 --- a/src/lib/elm_main.c +++ b/src/lib/elm_main.c @@ -2129,3 +2129,7 @@ EAPI Eina_Bool elm_object_item_disabled_get(const Elm_Object_Item *it) return _elm_widget_item_disabled_get((Elm_Widget_Item *) it); } +EAPI void elm_object_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb del_cb) +{ + _elm_widget_item_del_cb_set((Elm_Widget_Item *) it, del_cb); +} diff --git a/src/lib/elm_menu.c b/src/lib/elm_menu.c index fc2e678..c099990 100644 --- a/src/lib/elm_menu.c +++ b/src/lib/elm_menu.c @@ -920,8 +920,7 @@ elm_menu_item_del(Elm_Object_Item *it) EAPI void elm_menu_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func) { - ELM_OBJ_ITEM_CHECK_OR_RETURN(it); - elm_widget_item_del_cb_set(it, func); + elm_object_item_del_cb_set(it, func); } EAPI void * diff --git a/src/lib/elm_menu.h b/src/lib/elm_menu.h index 398803b..5f34bdc 100644 --- a/src/lib/elm_menu.h +++ b/src/lib/elm_menu.h @@ -187,17 +187,6 @@ EAPI Eina_Bool elm_menu_item_is_separator(Elm_Object_Item *it EAPI void elm_menu_item_del(Elm_Object_Item *it); /** - * @brief Set the function called when a menu item is deleted. - * - * @param it The item to set the callback on - * @param func The function called - * - * @see elm_menu_item_add() - * @see elm_menu_item_del() - */ -EAPI void elm_menu_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func); - -/** * @brief Returns a list of @p item's subitems. * * @param it The item diff --git a/src/lib/elm_object_item.h b/src/lib/elm_object_item.h index 5d9e3b1..e004d3e 100644 --- a/src/lib/elm_object_item.h +++ b/src/lib/elm_object_item.h @@ -158,3 +158,20 @@ EAPI void elm_object_item_disabled_set(Elm_Object_Item * * @ingroup Styles */ EAPI Eina_Bool elm_object_item_disabled_get(const Elm_Object_Item *it); + +/** + * @brief Set the function to be called when an item from the widget is + * freed. + * + * @param it The item to set the callback on + * @param func The function called + * + * That function will receive these parameters: + * @li void * item data + * @li Evas_Object * widget object + * @li Elm_Object_Item * widget item + * + * @see elm_object_item_del() + * @ingroup General + */ +EAPI void elm_object_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb del_cb); diff --git a/src/lib/elm_toolbar.c b/src/lib/elm_toolbar.c index 55969a2..030bc4b 100644 --- a/src/lib/elm_toolbar.c +++ b/src/lib/elm_toolbar.c @@ -1472,8 +1472,7 @@ elm_toolbar_item_del(Elm_Object_Item *it) EAPI void elm_toolbar_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func) { - ELM_OBJ_ITEM_CHECK_OR_RETURN(it); - elm_widget_item_del_cb_set(it, func); + elm_object_item_del_cb_set(it, func); } EAPI Eina_Bool diff --git a/src/lib/elm_toolbar.h b/src/lib/elm_toolbar.h index 24e8a22..06a04d8 100644 --- a/src/lib/elm_toolbar.h +++ b/src/lib/elm_toolbar.h @@ -220,7 +220,7 @@ EAPI Eina_Bool elm_toolbar_no_select_mode_get(const Evas_Obje * elm_toolbar_item_del(). * * Associated @p data can be properly freed when item is deleted if a - * callback function is set with elm_toolbar_item_del_cb_set(). + * callback function is set with elm_object_item_del_cb_set(). * * If a function is passed as argument, it will be called everytime this item * is selected, i.e., the user clicks over an unselected item. @@ -233,7 +233,6 @@ EAPI Eina_Bool elm_toolbar_no_select_mode_get(const Evas_Obje * * @see elm_toolbar_item_icon_set() * @see elm_toolbar_item_del() - * @see elm_toolbar_item_del_cb_set() * * @ingroup Toolbar */ @@ -256,7 +255,7 @@ EAPI Elm_Object_Item *elm_toolbar_item_append(Evas_Object *obj, cons * elm_toolbar_item_del(). * * Associated @p data can be properly freed when item is deleted if a - * callback function is set with elm_toolbar_item_del_cb_set(). + * callback function is set with elm_object_item_del_cb_set(). * * If a function is passed as argument, it will be called everytime this item * is selected, i.e., the user clicks over an unselected item. @@ -269,7 +268,6 @@ EAPI Elm_Object_Item *elm_toolbar_item_append(Evas_Object *obj, cons * * @see elm_toolbar_item_icon_set() * @see elm_toolbar_item_del() - * @see elm_toolbar_item_del_cb_set() * * @ingroup Toolbar */ @@ -293,7 +291,7 @@ EAPI Elm_Object_Item *elm_toolbar_item_prepend(Evas_Object *obj, con * elm_toolbar_item_del(). * * Associated @p data can be properly freed when item is deleted if a - * callback function is set with elm_toolbar_item_del_cb_set(). + * callback function is set with elm_object_item_del_cb_set(). * * If a function is passed as argument, it will be called everytime this item * is selected, i.e., the user clicks over an unselected item. @@ -306,7 +304,6 @@ EAPI Elm_Object_Item *elm_toolbar_item_prepend(Evas_Object *obj, con * * @see elm_toolbar_item_icon_set() * @see elm_toolbar_item_del() - * @see elm_toolbar_item_del_cb_set() * * @ingroup Toolbar */ @@ -330,7 +327,7 @@ EAPI Elm_Object_Item *elm_toolbar_item_insert_before(Evas_Object *ob * elm_toolbar_item_del(). * * Associated @p data can be properly freed when item is deleted if a - * callback function is set with elm_toolbar_item_del_cb_set(). + * callback function is set with elm_object_item_del_cb_set(). * * If a function is passed as argument, it will be called everytime this item * is selected, i.e., the user clicks over an unselected item. @@ -343,7 +340,6 @@ EAPI Elm_Object_Item *elm_toolbar_item_insert_before(Evas_Object *ob * * @see elm_toolbar_item_icon_set() * @see elm_toolbar_item_del() - * @see elm_toolbar_item_del_cb_set() * * @ingroup Toolbar */ @@ -597,29 +593,11 @@ EAPI Eina_Bool elm_toolbar_item_icon_file_set(Elm_Object_Item * @param it The item of toolbar to be deleted. * * @see elm_toolbar_item_append() - * @see elm_toolbar_item_del_cb_set() * * @ingroup Toolbar */ EAPI void elm_toolbar_item_del(Elm_Object_Item *it); -/** - * Set the function called when a toolbar item is freed. - * - * @param it The item to set the callback on. - * @param func The function called. - * - * If there is a @p func, then it will be called prior item's memory release. - * That will be called with the following arguments: - * @li item's data; - * @li item's Evas object; - * @li item itself; - * - * This way, a data associated to a toolbar item could be properly freed. - * - * @ingroup Toolbar - */ -EAPI void elm_toolbar_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func); /** * Set or unset item as a separator. -- 2.7.4