From 5ceddd5e3050ec6efd95d3f1bfe0101725417ee3 Mon Sep 17 00:00:00 2001 From: hermet Date: Thu, 26 Jan 2012 07:31:30 +0000 Subject: [PATCH] elementary/genlist - deprecated elm_genlist_item_data_set/get but please use elm_object_item_data_set/get instead. and what was purpose of this double casting? (int)(long) elm_genlist_item_data_get(gli); these calls are used in some places. I removed the (long) casting because it looks useless. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@67546 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/bin/test_cursor.c | 2 +- src/bin/test_genlist.c | 14 +++++++------- src/bin/test_tooltip.c | 2 +- src/examples/genlist_example_05.c | 12 ++++++------ src/lib/elc_fileselector.c | 8 ++++---- src/lib/elm_deprecated.h | 35 +++++++++++++++++++++++++++++++++++ src/lib/elm_genlist.h | 38 ++------------------------------------ src/lib/elm_store.c | 4 ++-- 8 files changed, 58 insertions(+), 57 deletions(-) diff --git a/src/bin/test_cursor.c b/src/bin/test_cursor.c index cec7a09..4a95400 100644 --- a/src/bin/test_cursor.c +++ b/src/bin/test_cursor.c @@ -47,7 +47,7 @@ glt_exp(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) { Elm_Object_Item *glit = event_info; Evas_Object *gl = elm_genlist_item_genlist_get(glit); - int val = (int)(long)elm_genlist_item_data_get(glit); + int val = (int) elm_object_item_data_get(glit); Elm_Object_Item *glit1, *glit2, *glit3; val *= 10; diff --git a/src/bin/test_genlist.c b/src/bin/test_genlist.c index 38b8c25..0e0364c 100644 --- a/src/bin/test_genlist.c +++ b/src/bin/test_genlist.c @@ -63,7 +63,7 @@ _move(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *even Elm_Object_Item *gli; gli = elm_genlist_at_xy_item_get(gl, ev->cur.canvas.x, ev->cur.canvas.y, &where); if (gli) - printf("over %p, where %i\n", elm_genlist_item_data_get(gli), where); + printf("over %p, where %i\n", elm_object_item_data_get(gli), where); else printf("over none, where %i\n", where); } @@ -1051,7 +1051,7 @@ gl4_exp(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) { Elm_Object_Item *glit = event_info; Evas_Object *gl = elm_genlist_item_genlist_get(glit); - int val = (int)(long)elm_genlist_item_data_get(glit); + int val = (int) elm_object_item_data_get(glit); val *= 10; elm_genlist_item_append(gl, &itc4, (void *)(long)(val + 1)/* item data */, @@ -1536,7 +1536,7 @@ gl9_exp(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) { Elm_Object_Item *glit = event_info; Evas_Object *gl = elm_genlist_item_genlist_get(glit); - int val = (int)(long)elm_genlist_item_data_get(glit); + int val = (int) elm_object_item_data_get(glit); val *= 10; elm_genlist_item_append(gl, &itc1, (void *)(long)(val + 1)/* item data */, @@ -1953,8 +1953,8 @@ static int gl13_cmp(const void *pa, const void *pb) { const Elm_Object_Item *ia = pa, *ib = pb; - int a = (int)(long)elm_genlist_item_data_get(ia); - int b = (int)(long)elm_genlist_item_data_get(ib); + int a = (int) elm_object_item_data_get(ia); + int b = (int) elm_object_item_data_get(ib); return a - b; } @@ -2172,7 +2172,7 @@ test_genlist14(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_i Elm_Object_Item *sub_glit[6]; int j; - base = 1000 * (long)elm_genlist_item_data_get(pi[i]); + base = 1000 * (long) elm_object_item_data_get(pi[i]); sub_glit[0] = elm_genlist_item_append (gl, &itc4, (void *)(idx[0] + base)/* item data */, pi[i]/* parent */, @@ -2211,7 +2211,7 @@ test_genlist14(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_i Elm_Object_Item *sub_glit[6]; int j; - base = 1000 * (long)elm_genlist_item_data_get(pi[i]); + base = 1000 * (long) elm_object_item_data_get(pi[i]); sub_glit[0] = elm_genlist_item_append (gl, &itc4, (void *)(idx[0] + base)/* item data */, pi[i]/* parent */, diff --git a/src/bin/test_tooltip.c b/src/bin/test_tooltip.c index fa0151c..7fafdd4 100644 --- a/src/bin/test_tooltip.c +++ b/src/bin/test_tooltip.c @@ -53,7 +53,7 @@ gltt_exp(void *data __UNUSED__, { Elm_Object_Item *glit = event_info; Evas_Object *gl = elm_genlist_item_genlist_get(glit); - int val = (int)(long)elm_genlist_item_data_get(glit); + int val = (int) elm_object_item_data_get(glit); Elm_Object_Item *glit1, *glit2, *glit3; val *= 10; diff --git a/src/examples/genlist_example_05.c b/src/examples/genlist_example_05.c index f5163b9..7cea992 100644 --- a/src/examples/genlist_example_05.c +++ b/src/examples/genlist_example_05.c @@ -119,7 +119,7 @@ _append_cb(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__) if (parent) { d->level = elm_genlist_item_expanded_depth_get(parent) + 1; - pdata = elm_genlist_item_data_get(parent); + pdata = elm_object_item_data_get(parent); pdata->children = eina_list_append(pdata->children, d); } else @@ -139,7 +139,7 @@ _favorite_cb(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__) if (!glit) return; - Node_Data *d = elm_genlist_item_data_get(glit); + Node_Data *d = elm_object_item_data_get(glit); d->favorite = !d->favorite; if (d->favorite) elm_genlist_item_item_class_update(glit, &_itfav); @@ -163,7 +163,7 @@ _add_child_cb(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__ if (!glit) return; - Node_Data *d = elm_genlist_item_data_get(glit); + Node_Data *d = elm_object_item_data_get(glit); glit_prev = elm_genlist_item_prev_get(glit); glit_parent = elm_genlist_item_parent_get(glit); @@ -223,7 +223,7 @@ _del_item_cb(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__) if (!glit) return; - Node_Data *pdata, *d = elm_genlist_item_data_get(glit); + Node_Data *pdata, *d = elm_object_item_data_get(glit); glit_parent = elm_genlist_item_parent_get(glit); elm_genlist_item_subitems_clear(glit); elm_genlist_item_del(glit); @@ -232,7 +232,7 @@ _del_item_cb(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__) if (!glit_parent) return; - pdata = elm_genlist_item_data_get(glit_parent); + pdata = elm_object_item_data_get(glit_parent); pdata->children = eina_list_remove(pdata->children, d); elm_genlist_item_update(glit_parent); } @@ -258,7 +258,7 @@ _expanded_cb(void *data __UNUSED__, Evas_Object *o __UNUSED__, void *event_info) { Eina_List *l; Elm_Object_Item *glit = event_info; - Node_Data *it_data, *d = elm_genlist_item_data_get(glit); + Node_Data *it_data, *d = elm_object_item_data_get(glit); Evas_Object *list = elm_genlist_item_genlist_get(glit); Elm_Genlist_Item_Class *ic; diff --git a/src/lib/elc_fileselector.c b/src/lib/elc_fileselector.c index bccc763..fc64fad 100644 --- a/src/lib/elc_fileselector.c +++ b/src/lib/elc_fileselector.c @@ -327,7 +327,7 @@ _expand_done(void *data, void *event_info) { Elm_Object_Item *it = event_info; - const char *path = elm_genlist_item_data_get(it); + const char *path = elm_object_item_data_get(it); _populate(data, path, it); } @@ -426,7 +426,7 @@ _sel(void *data, sd = malloc(sizeof(*sd)); sd->fs = data; sd->path = wd->mode == ELM_FILESELECTOR_LIST ? - elm_genlist_item_data_get(event_info) : + elm_object_item_data_get(event_info) : elm_gengrid_item_data_get(event_info); if (!sd->path) @@ -620,7 +620,7 @@ _file_list_cmp(const void *a, const void *b) return 1; } - return strcoll(elm_genlist_item_data_get(la), elm_genlist_item_data_get(lb)); + return strcoll(elm_object_item_data_get(la), elm_object_item_data_get(lb)); } static void @@ -1156,7 +1156,7 @@ elm_fileselector_selected_get(const Evas_Object *obj) { Elm_Object_Item *it; it = elm_genlist_selected_item_get(wd->files_list); - if (it) return elm_genlist_item_data_get(it); + if (it) return elm_object_item_data_get(it); } else { diff --git a/src/lib/elm_deprecated.h b/src/lib/elm_deprecated.h index 643d0bf..07e9682 100644 --- a/src/lib/elm_deprecated.h +++ b/src/lib/elm_deprecated.h @@ -1740,6 +1740,41 @@ EINA_DEPRECATED EAPI void elm_genlist_horizontal_set(Ev */ EAPI Elm_List_Mode elm_genlist_horizontal_get(const Evas_Object *obj); +/** + * Return the data associated to a given genlist item + * + * @param it The genlist item. + * @return the data associated to this item. + * + * This returns the @c data value passed on the + * elm_genlist_item_append() and related item addition calls. + * + * @see elm_genlist_item_append() + * @see elm_genlist_item_data_set() + * + * @deprecated Use elm_object_item_data_get() instead + * @ingroup Genlist + */ +EINA_DEPRECATED EAPI void *elm_genlist_item_data_get(const Elm_Object_Item *it); + +/** + * Set the data associated to a given genlist item + * + * @param it The genlist item + * @param data The new data pointer to set on it + * + * This @b overrides the @c data value passed on the + * elm_genlist_item_append() and related item addition calls. This + * function @b won't call elm_genlist_item_update() automatically, + * so you'd issue it afterwards if you want to hove the item + * updated to reflect the that new data. + * + * @see elm_genlist_item_data_get() + * + * @deprecated Use elm_object_item_data_set() instead + * @ingroup Genlist + */ +EINA_DEPRECATED EAPI void elm_genlist_item_data_set(Elm_Object_Item *it, const void *data); #define ELM_IMAGE_ROTATE_90_CW 1 #define ELM_IMAGE_ROTATE_180_CW 2 diff --git a/src/lib/elm_genlist.h b/src/lib/elm_genlist.h index 16e3a16..f5be3c8 100644 --- a/src/lib/elm_genlist.h +++ b/src/lib/elm_genlist.h @@ -160,7 +160,7 @@ * There are also convenience functions. elm_genlist_item_genlist_get() will * return the genlist object the item belongs to. elm_genlist_item_show() * will make the scroller scroll to show that specific item so its visible. - * elm_genlist_item_data_get() returns the data pointer set by the item + * elm_object_item_data_get() returns the data pointer set by the item * creation functions. * * If an item changes (state of boolean changes, text or contents change), @@ -1386,40 +1386,6 @@ EAPI void elm_genlist_item_middle_bring_in(Elm_Object_I EAPI void elm_genlist_item_del(Elm_Object_Item *it); /** - * Return the data associated to a given genlist item - * - * @param it The genlist item. - * @return the data associated to this item. - * - * This returns the @c data value passed on the - * elm_genlist_item_append() and related item addition calls. - * - * @see elm_genlist_item_append() - * @see elm_genlist_item_data_set() - * - * @ingroup Genlist - */ -EAPI void *elm_genlist_item_data_get(const Elm_Object_Item *it); - -/** - * Set the data associated to a given genlist item - * - * @param it The genlist item - * @param data The new data pointer to set on it - * - * This @b overrides the @c data value passed on the - * elm_genlist_item_append() and related item addition calls. This - * function @b won't call elm_genlist_item_update() automatically, - * so you'd issue it afterwards if you want to hove the item - * updated to reflect the that new data. - * - * @see elm_genlist_item_data_get() - * - * @ingroup Genlist - */ -EAPI void elm_genlist_item_data_set(Elm_Object_Item *it, const void *data); - -/** * Tells genlist to "orphan" contents fetchs by the item class * * @param it The item @@ -1449,7 +1415,7 @@ EAPI void elm_genlist_item_contents_orphan(Elm_Object_I * lower level callbacks for events on that object. Do not delete * this object under any circumstances. * - * @see elm_genlist_item_data_get() + * @see elm_object_item_data_get() * * @ingroup Genlist */ diff --git a/src/lib/elm_store.c b/src/lib/elm_store.c index 5d6d558..61e1548 100644 --- a/src/lib/elm_store.c +++ b/src/lib/elm_store.c @@ -227,7 +227,7 @@ _store_genlist_item_realized(void *data, Evas_Object *obj __UNUSED__, void *even { Elm_Store *st = data; Elm_Object_Item *gli = event_info; - Elm_Store_Item *sti = elm_genlist_item_data_get(gli); + Elm_Store_Item *sti = elm_object_item_data_get(gli); if (!sti) return; st->realized_count++; sti->live = EINA_TRUE; @@ -240,7 +240,7 @@ _store_genlist_item_unrealized(void *data, Evas_Object *obj __UNUSED__, void *ev { Elm_Store *st = data; Elm_Object_Item *gli = event_info; - Elm_Store_Item *sti = elm_genlist_item_data_get(gli); + Elm_Store_Item *sti = elm_object_item_data_get(gli); if (!sti) return; st->realized_count--; sti->live = EINA_FALSE; -- 2.7.4