make ELM_CHECK_WIDTYPE & co macros useful. would you believe this macro came from my first ever code patch :D

SVN revision: 63334
This commit is contained in:
Mike Blumenkrantz 2011-09-12 02:06:27 +00:00
parent 550156cfdc
commit c705290b44
3 changed files with 7 additions and 6 deletions

View File

@ -2212,7 +2212,7 @@ _transit_effect_image_animation_op(Elm_Transit_Effect *effect, Elm_Transit *tran
EINA_LIST_FOREACH(transit->objs, elist, obj)
{
if (elm_widget_type_check(obj, type))
if (elm_widget_type_check(obj, type, __func__))
elm_icon_file_set(obj,
eina_list_nth(image_animation->images, count), NULL);
}

View File

@ -2447,7 +2447,8 @@ elm_widget_is_check(const Evas_Object *obj)
EAPI Eina_Bool
elm_widget_type_check(const Evas_Object *obj,
const char *type)
const char *type,
const char *func)
{
const char *provided, *expected = "(unknown)";
static int abort_on_warn = -1;
@ -2460,7 +2461,7 @@ elm_widget_type_check(const Evas_Object *obj,
if ((!provided) || (!provided[0]))
provided = "(unknown)";
}
ERR("Passing Object: %p, of type: '%s' when expecting type: '%s'", obj, provided, expected);
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;

View File

@ -401,7 +401,7 @@ EAPI Eina_Bool elm_widget_theme_object_set(Evas_Object *obj, Evas_Object
EAPI void elm_widget_type_register(const char **ptr);
EAPI void elm_widget_type_unregister(const char **ptr);
EAPI Eina_Bool elm_widget_is_check(const Evas_Object *obj);
EAPI Eina_Bool elm_widget_type_check(const Evas_Object *obj, const char *type);
EAPI Eina_Bool elm_widget_type_check(const Evas_Object *obj, const char *type, const char *func);
EAPI Eina_List *elm_widget_stringlist_get(const char *str);
EAPI void elm_widget_stringlist_free(Eina_List *list);
EAPI void elm_widget_focus_hide_handle(Evas_Object *obj);
@ -676,7 +676,7 @@ EAPI void elm_widget_tree_dot_dump(const Evas_Object *top, FILE *out
if (!elm_widget_is_check(obj)) return
#define ELM_CHECK_WIDTYPE(obj, widtype) \
if (!elm_widget_type_check((obj), (widtype))) return
if (!elm_widget_type_check((obj), (widtype), __func__)) return
#define ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, ...) \
ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item *)it, __VA_ARGS__); \
@ -684,7 +684,7 @@ EAPI void elm_widget_tree_dot_dump(const Evas_Object *top, FILE *out
#define ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_GOTO(it, label) \
ELM_WIDGET_ITEM_CHECK_OR_GOTO((Elm_Widget_Item *)it, label); \
if (!elm_widget_type_check((it->base.widget), (widtype))) goto label;
if (!elm_widget_type_check((it->base.widget), (widtype), __func__)) goto label;
#define ELM_WIDGET_STANDARD_SETUP(wdat, wdtype, par, evas, ob, ret) \
do { \