From: cedric Date: Mon, 23 Jan 2012 13:26:45 +0000 (+0000) Subject: elementary: revert r67371. X-Git-Tag: REL_F_I9500_20120323_1~17^2~842 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8bf3ba35a229813f9734bfe59e926bbd41bb21e1;p=framework%2Fuifw%2Felementary.git elementary: revert r67371. NOTE: gengrid and genlist code are still half merged. The specific code for checking widget type is still needed. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@67470 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c index abfcd80..8c076e7 100644 --- a/src/lib/elm_genlist.c +++ b/src/lib/elm_genlist.c @@ -218,6 +218,46 @@ static const Evas_Smart_Cb_Description _signals[] = { {NULL, NULL} }; +/* TEMPORARY */ +#undef ELM_CHECK_WIDTYPE +#define ELM_CHECK_WIDTYPE(obj, widtype) \ + if ((!obj) || (!elm_genlist_type_check((obj), __func__))) return +#undef ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN +#define ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, ...) \ + ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item *)it, __VA_ARGS__); \ + ELM_CHECK_WIDTYPE(WIDGET((it)), widtype) __VA_ARGS__; + +static const char *_gengrid = NULL; +static const char *_genlist = NULL; + +/* THIS FUNCTION IS HACKY AND TEMPORARY!!! */ +Eina_Bool +elm_genlist_type_check(const Evas_Object *obj, + const char *func) +{ + const char *provided, *expected = "(unknown)"; + static int abort_on_warn = -1; + provided = elm_widget_type_get(obj); + if (!_genlist) _genlist = eina_stringshare_add("genlist"); + if (!_gengrid) _gengrid = eina_stringshare_add("gengrid"); + if (EINA_LIKELY(provided == _genlist) || EINA_LIKELY(provided == _gengrid)) + return EINA_TRUE; + if ((!provided) || (!provided[0])) + { + provided = evas_object_type_get(obj); + if ((!provided) || (!provided[0])) + provided = "(unknown)"; + } + ERR("Passing Object: %p in function: %s, of type: '%s' when expecting type: '%s'", obj, func, provided, expected); + if (abort_on_warn == -1) + { + if (getenv("ELM_ERROR_ABORT")) abort_on_warn = 1; + else abort_on_warn = 0; + } + if (abort_on_warn == 1) abort(); + return EINA_FALSE; +} + static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__,