From: Daniel J. S. <seo...@gm...> - 2011-12-06 23:34:07
|
This is cool!! Please update ElementaryChanges wiki page for elementary API or whatever changes. http://trac.enlightenment.org/e/wiki/ElementaryChanges I just saw the elm_index code and there are a lot to be fixed in elm_index :( This will be done soon :) Thanks. Daniel Juyung Soe (SeoZ) On Tue, Dec 6, 2011 at 11:05 PM, Enlightenment SVN <no-...@en...> wrote: > Log: > elementary: API break ! using Elm_Index_Item instead of the item's data in the index widget. This was applied for function and smart callbacks > > Author: yoz > Date: 2011-12-06 06:05:55 -0800 (Tue, 06 Dec 2011) > New Revision: 65956 > Trac: http://trac.enlightenment.org/e/changeset/65956 > > Modified: > trunk/elementary/src/bin/test_index.c trunk/elementary/src/lib/Elementary.h.in trunk/elementary/src/lib/elm_index.c > > Modified: trunk/elementary/src/bin/test_index.c > =================================================================== > --- trunk/elementary/src/bin/test_index.c 2011-12-06 11:36:29 UTC (rev 65955) > +++ trunk/elementary/src/bin/test_index.c 2011-12-06 14:05:55 UTC (rev 65956) > @@ -20,7 +20,7 @@ > { > // called on a change but delayed in case multiple changes happen in a > // short timespan > - elm_genlist_item_top_bring_in(event_info); > + elm_genlist_item_top_bring_in(elm_index_item_data_get(event_info)); > } > > void > @@ -34,7 +34,7 @@ > index_selected(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) > { > // called on final select > - elm_genlist_item_top_bring_in(event_info); > + elm_genlist_item_top_bring_in(elm_index_item_data_get(event_info)); > } > > void > @@ -160,13 +160,15 @@ > Test_Index2_Elements *gui = data; > const char *label, *label_next; > Elm_List_Item *it, *it_next; > + Elm_Index_Item *iit; > > it = elm_list_selected_item_get(obj); > it_next = elm_list_item_next(it); > > if (!it_next) > { > - elm_index_item_del(gui->id, it); > + iit = elm_index_item_find(gui->id, it); > + if (iit) elm_index_item_del(gui->id, iit); > elm_list_item_del(it); > return; > } > @@ -174,14 +176,11 @@ > label = elm_list_item_label_get(it); > label_next = elm_list_item_label_get(it_next); > > + iit = elm_index_item_find(gui->id, it); > if (label[0] == label_next[0]) > - { > - Elm_Index_Item *iit; > - iit = elm_index_item_find(gui->id, it); > - elm_index_item_data_set(iit, it_next); > - } > + elm_index_item_data_set(iit, it_next); > else > - elm_index_item_del(gui->id, it); > + elm_index_item_del(gui->id, iit); > > elm_list_item_del(it); > } > @@ -189,7 +188,7 @@ > void > test_index2_id_changed(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) > { > - elm_list_item_show(event_info); > + elm_list_item_show(elm_index_item_data_get(event_info)); > } > > void > > Modified: trunk/elementary/src/lib/Elementary.h.in > =================================================================== > --- trunk/elementary/src/lib/Elementary.h.in 2011-12-06 11:36:29 UTC (rev 65955) > +++ trunk/elementary/src/lib/Elementary.h.in 2011-12-06 14:05:55 UTC (rev 65956) > @@ -22399,19 +22399,14 @@ > EAPI int elm_index_item_level_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); > > /** > - * Returns the last selected item's data, for a given index widget. > + * Returns the last selected item, for a given index widget. > * > * @param obj The index object. > - * @return The item @b data associated to the last selected item on > - * @p obj (or @c NULL, on errors). > + * @return The last item @b selected on @p obj (or @c NULL, on errors). > * > - * @warning The returned value is @b not an #Elm_Index_Item item > - * handle, but the data associated to it (see the @c item parameter > - * in elm_index_item_append(), as an example). > - * > * @ingroup Index > */ > - EAPI void *elm_index_item_selected_get(const Evas_Object *obj, int level) EINA_ARG_NONNULL(1); > + EAPI Elm_Index_Item *elm_index_item_selected_get(const Evas_Object *obj, int level) EINA_ARG_NONNULL(1); > > /** > * Append a new item on a given index widget. > @@ -22456,8 +22451,7 @@ > * @param obj The index object. > * @param letter Letter under which the item should be indexed > * @param item The item data to set for the index's item > - * @param relative The item data of the index item to be the > - * predecessor of this new one > + * @param relative The index item to be the predecessor of this new one > * > * Despite the most common usage of the @p letter argument is for > * single char strings, one could use arbitrary strings as index > @@ -22466,13 +22460,12 @@ > * @c item will be the pointer returned back on @c "changed", @c > * "delay,changed" and @c "selected" smart events. > * > - * @note If @p relative is @c NULL or if it's not found to be data > - * set on any previous item on @p obj, this function will behave as > + * @note If @p relative is @c NULL this function will behave as > * elm_index_item_append(). > * > * @ingroup Index > */ > - EAPI void elm_index_item_append_relative(Evas_Object *obj, const char *letter, const void *item, const void *relative) EINA_ARG_NONNULL(1); > + EAPI void elm_index_item_append_relative(Evas_Object *obj, const char *letter, const void *item, const Elm_Index_Item *relative) EINA_ARG_NONNULL(1); > > /** > * Prepend a new item, on a given index widget, <b>after the item > @@ -22481,8 +22474,7 @@ > * @param obj The index object. > * @param letter Letter under which the item should be indexed > * @param item The item data to set for the index's item > - * @param relative The item data of the index item to be the > - * successor of this new one > + * @param relative The index item to be the successor of this new one > * > * Despite the most common usage of the @p letter argument is for > * single char strings, one could use arbitrary strings as index > @@ -22491,13 +22483,12 @@ > * @c item will be the pointer returned back on @c "changed", @c > * "delay,changed" and @c "selected" smart events. > * > - * @note If @p relative is @c NULL or if it's not found to be data > - * set on any previous item on @p obj, this function will behave as > + * @note If @p relative is @c NULL this function will behave as > * elm_index_item_prepend(). > * > * @ingroup Index > */ > - EAPI void elm_index_item_prepend_relative(Evas_Object *obj, const char *letter, const void *item, const void *relative) EINA_ARG_NONNULL(1); > + EAPI void elm_index_item_prepend_relative(Evas_Object *obj, const char *letter, const void *item, const Elm_Index_Item *relative) EINA_ARG_NONNULL(1); > > /** > * Insert a new item into the given index widget, using @p cmp_func > @@ -22537,18 +22528,14 @@ > * it's data value</b>. > * > * @param obj The index object > - * @param item The item's data pointer for the item to be removed > - * from @p obj > + * @param item The item to be removed from @p obj > * > * If a deletion callback is set, via elm_index_item_del_cb_set(), > * that callback function will be called by this one. > * > - * @warning The item to be removed from @p obj will be found via > - * its item data pointer, and not by an #Elm_Index_Item handle. > - * > * @ingroup Index > */ > - EAPI void elm_index_item_del(Evas_Object *obj, const void *item) EINA_ARG_NONNULL(1); > + EAPI void elm_index_item_del(Evas_Object *obj, Elm_Index_Item *item) EINA_ARG_NONNULL(1); > > /** > * Find a given index widget's item, <b>using item data</b>. > > Modified: trunk/elementary/src/lib/elm_index.c > =================================================================== > --- trunk/elementary/src/lib/elm_index.c 2011-12-06 11:36:29 UTC (rev 65955) > +++ trunk/elementary/src/lib/elm_index.c 2011-12-06 14:05:55 UTC (rev 65956) > @@ -298,11 +298,11 @@ > _delay_change(void *data) > { > Widget_Data *wd = elm_widget_data_get(data); > - void *d; > + Elm_Index_Item *item; > if (!wd) return ECORE_CALLBACK_CANCEL; > wd->delay = NULL; > - d = (void *)elm_index_item_selected_get(data, wd->level); > - if (d) evas_object_smart_callback_call(data, SIG_DELAY_CHANGED, d); > + item = elm_index_item_selected_get(data, wd->level); > + if (item) evas_object_smart_callback_call(data, SIG_DELAY_CHANGED, item); > return ECORE_CALLBACK_CANCEL; > } > > @@ -386,7 +386,7 @@ > selectraise = edje_object_data_get(VIEW(it), "selectraise"); > if ((selectraise) && (!strcmp(selectraise, "on"))) > evas_object_raise(VIEW(it)); > - evas_object_smart_callback_call((void *)obj, SIG_CHANGED, (void *)it->base.data); > + evas_object_smart_callback_call((void *)obj, SIG_CHANGED, (void *)it); > if (wd->delay) ecore_timer_del(wd->delay); > wd->delay = ecore_timer_add(0.2, _delay_change, obj); > } > @@ -452,12 +452,12 @@ > { > Widget_Data *wd = elm_widget_data_get(data); > Evas_Event_Mouse_Up *ev = event_info; > - void *d; > + Elm_Index_Item *item; > if (!wd) return; > if (ev->button != 1) return; > wd->down = 0; > - d = (void *)elm_index_item_selected_get(data, wd->level); > - if (d) evas_object_smart_callback_call(data, SIG_SELECTED, d); > + item = elm_index_item_selected_get(data, wd->level); > + if (item) evas_object_smart_callback_call(data, SIG_SELECTED, item); > elm_index_active_set(data, 0); > edje_object_signal_emit(wd->base, "elm,state,level,0", "elm"); > edje_object_signal_emit(wd->base, "elm,indicator,state,inactive", "elm"); > @@ -628,7 +628,7 @@ > return wd->level; > } > > -EAPI void * > +EAPI Elm_Index_Item * > elm_index_item_selected_get(const Evas_Object *obj, int level) > { > ELM_CHECK_WIDTYPE(obj, widtype) NULL; > @@ -638,7 +638,7 @@ > if (!wd) return NULL; > EINA_LIST_FOREACH(wd->items, l, it) > if ((it->selected) && (it->level == level)) > - return elm_widget_item_data_get(it); > + return it; > return NULL; > } > > @@ -670,50 +670,38 @@ > } > > EAPI void > -elm_index_item_append_relative(Evas_Object *obj, const char *letter, const void *item, const void *relative) > +elm_index_item_append_relative(Evas_Object *obj, const char *letter, const void *item, const Elm_Index_Item *relative) > { > ELM_CHECK_WIDTYPE(obj, widtype); > Widget_Data *wd = elm_widget_data_get(obj); > - Elm_Index_Item *it, *it_rel; > + Elm_Index_Item *it; > if (!wd) return; > if (!relative) > { > elm_index_item_append(obj, letter, item); > return; > } > - it_rel = _item_find(obj, relative); > - if (!it_rel) > - { > - elm_index_item_append(obj, letter, item); > - return; > - } > it = _item_new(obj, letter, item); > if (!it) return; > - wd->items = eina_list_append_relative(wd->items, it, it_rel); > + wd->items = eina_list_append_relative(wd->items, it, relative); > _index_box_clear(obj, wd->bx[wd->level], wd->level); > } > > EAPI void > -elm_index_item_prepend_relative(Evas_Object *obj, const char *letter, const void *item, const void *relative) > +elm_index_item_prepend_relative(Evas_Object *obj, const char *letter, const void *item, const Elm_Index_Item *relative) > { > ELM_CHECK_WIDTYPE(obj, widtype); > Widget_Data *wd = elm_widget_data_get(obj); > - Elm_Index_Item *it, *it_rel; > + Elm_Index_Item *it; > if (!wd) return; > if (!relative) > { > elm_index_item_prepend(obj, letter, item); > return; > } > - it_rel = _item_find(obj, relative); > - if (!it_rel) > - { > - elm_index_item_append(obj, letter, item); > - return; > - } > it = _item_new(obj, letter, item); > if (!it) return; > - wd->items = eina_list_prepend_relative(wd->items, it, it_rel); > + wd->items = eina_list_prepend_relative(wd->items, it, relative); > _index_box_clear(obj, wd->bx[wd->level], wd->level); > } > > @@ -759,15 +747,13 @@ > } > > EAPI void > -elm_index_item_del(Evas_Object *obj, const void *item) > +elm_index_item_del(Evas_Object *obj, Elm_Index_Item *item) > { > ELM_CHECK_WIDTYPE(obj, widtype); > Widget_Data *wd = elm_widget_data_get(obj); > - Elm_Index_Item *it; > if (!wd) return; > - it = _item_find(obj, item); > - if (!it) return; > - _item_free(it); > + if (!item) return; > + _item_free(item); > _index_box_clear(obj, wd->bx[wd->level], wd->level); > } > > > > ------------------------------------------------------------------------------ > Cloud Services Checklist: Pricing and Packaging Optimization > This white paper is intended to serve as a reference, checklist and point of > discussion for anyone considering optimizing the pricing and packaging model > of a cloud services business. Read Now! > http://www.accelacomm.com/jaw/sfnl/114/51491232/ > _______________________________________________ > enlightenment-svn mailing list > enl...@li... > https://lists.sourceforge.net/lists/listinfo/enlightenment-svn |