more wanring-- and safety checks.

SVN revision: 47096
This commit is contained in:
Carsten Haitzler 2010-03-10 00:31:54 +00:00
parent b07e49d435
commit df611db335
5 changed files with 67 additions and 68 deletions

View File

@ -15,6 +15,7 @@ static void
_del_hook(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
free(wd);
}
@ -23,7 +24,6 @@ _sizing_eval(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
Evas_Coord minw, minh;
if (!wd) return;
evas_object_size_hint_min_get(wd->scroller, &minw, &minh);
evas_object_size_hint_min_set(obj, minw, minh);
@ -34,6 +34,7 @@ static void
_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
if (elm_widget_focus_get(obj))
elm_widget_focus_steal(wd->entry);
}
@ -42,7 +43,7 @@ static void
_disable_hook(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
elm_object_disabled_set(wd->entry, elm_widget_disabled_get(obj));
}
@ -219,7 +220,7 @@ elm_scrolled_entry_entry_set(Evas_Object *obj, const char *entry)
EAPI const char *
elm_scrolled_entry_entry_get(const Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype);
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return NULL;
return elm_entry_entry_get(wd->entry);
@ -228,7 +229,7 @@ elm_scrolled_entry_entry_get(const Evas_Object *obj)
EAPI const char *
elm_scrolled_entry_selection_get(const Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype);
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return NULL;
return elm_entry_selection_get(wd->entry);
@ -291,7 +292,7 @@ elm_scrolled_entry_select_all(Evas_Object *obj)
EAPI Eina_Bool
elm_scrolled_entry_cursor_next(Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype);
ELM_CHECK_WIDTYPE(obj, widtype) 0;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return 0;
return elm_entry_cursor_next(wd->entry);
@ -300,7 +301,7 @@ elm_scrolled_entry_cursor_next(Evas_Object *obj)
EAPI Eina_Bool
elm_scrolled_entry_cursor_prev(Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype);
ELM_CHECK_WIDTYPE(obj, widtype) 0;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return 0;
return elm_entry_cursor_prev(wd->entry);
@ -309,7 +310,7 @@ elm_scrolled_entry_cursor_prev(Evas_Object *obj)
EAPI Eina_Bool
elm_scrolled_entry_cursor_up(Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype);
ELM_CHECK_WIDTYPE(obj, widtype) 0;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return 0;
return elm_entry_cursor_up(wd->entry);
@ -318,7 +319,7 @@ elm_scrolled_entry_cursor_up(Evas_Object *obj)
EAPI Eina_Bool
elm_scrolled_entry_cursor_down(Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype);
ELM_CHECK_WIDTYPE(obj, widtype) 0;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return 0;
return elm_entry_cursor_down(wd->entry);
@ -381,7 +382,7 @@ elm_scrolled_entry_cursor_selection_end(Evas_Object *obj)
EAPI Eina_Bool
elm_scrolled_entry_cursor_is_format_get(Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype);
ELM_CHECK_WIDTYPE(obj, widtype) 0;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return 0;
return elm_entry_cursor_is_format_get(wd->entry);
@ -390,7 +391,7 @@ elm_scrolled_entry_cursor_is_format_get(Evas_Object *obj)
EAPI Eina_Bool
elm_scrolled_entry_cursor_is_visible_format_get(Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype);
ELM_CHECK_WIDTYPE(obj, widtype) 0;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return 0;
return elm_entry_cursor_is_visible_format_get(wd->entry);
@ -399,7 +400,7 @@ elm_scrolled_entry_cursor_is_visible_format_get(Evas_Object *obj)
EAPI const char *
elm_scrolled_entry_cursor_content_get(Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype);
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return NULL;
return elm_entry_cursor_content_get(wd->entry);
@ -462,7 +463,7 @@ elm_scrolled_entry_context_menu_disabled_set(Evas_Object *obj, Eina_Bool disable
EAPI Eina_Bool
elm_scrolled_entry_context_menu_disabled_get(Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype);
ELM_CHECK_WIDTYPE(obj, widtype) 0;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return 0;
return elm_entry_context_menu_disabled_get(wd->entry);

View File

@ -35,7 +35,7 @@ static void
_del_pre_hook(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
evas_object_event_callback_del_full
(wd->box, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
evas_object_box_remove_all(wd->box, 0);
@ -45,6 +45,7 @@ static void
_del_hook(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
free(wd);
}
@ -54,7 +55,7 @@ _sizing_eval(Evas_Object *obj)
Widget_Data *wd = elm_widget_data_get(obj);
Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
Evas_Coord w, h;
if (!wd) return;
evas_object_size_hint_min_get(wd->box, &minw, &minh);
evas_object_size_hint_max_get(wd->box, &maxw, &maxh);
evas_object_size_hint_min_set(obj, minw, minh);
@ -83,7 +84,7 @@ static void
_layout(Evas_Object *o, Evas_Object_Box_Data *priv, void *data)
{
Widget_Data *wd = data;
if (!wd) return;
_els_box_layout(o, priv, wd->horizontal, wd->homogeneous);
}
@ -144,6 +145,7 @@ elm_box_horizontal_set(Evas_Object *obj, Eina_Bool horizontal)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
wd->horizontal = !!horizontal;
evas_object_smart_calculate(wd->box);
/*if (wd->horizontal)
@ -182,6 +184,7 @@ elm_box_homogenous_set(Evas_Object *obj, Eina_Bool homogenous)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
wd->homogeneous = !!homogenous;
evas_object_smart_calculate(wd->box);
/*if (wd->horizontal)
@ -220,6 +223,7 @@ elm_box_pack_start(Evas_Object *obj, Evas_Object *subobj)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
elm_widget_sub_object_add(obj, subobj);
evas_object_box_prepend(wd->box, subobj);
}
@ -240,6 +244,7 @@ elm_box_pack_end(Evas_Object *obj, Evas_Object *subobj)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
elm_widget_sub_object_add(obj, subobj);
evas_object_box_append(wd->box, subobj);
}
@ -263,6 +268,7 @@ elm_box_pack_before(Evas_Object *obj, Evas_Object *subobj, Evas_Object *before)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
elm_widget_sub_object_add(obj, subobj);
evas_object_box_insert_before(wd->box, subobj, before);
}
@ -286,6 +292,7 @@ elm_box_pack_after(Evas_Object *obj, Evas_Object *subobj, Evas_Object *after)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
elm_widget_sub_object_add(obj, subobj);
evas_object_box_insert_after(wd->box, subobj, after);
}
@ -304,6 +311,7 @@ elm_box_clear(Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
evas_object_box_remove_all(wd->box, 1);
}
@ -322,6 +330,7 @@ elm_box_unpack(Evas_Object *obj, Evas_Object *subobj)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
evas_object_box_remove(wd->box, subobj);
}
@ -340,5 +349,6 @@ elm_box_unpack_all(Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
evas_object_box_remove_all(wd->box, 0);
}

View File

@ -169,7 +169,6 @@ _hov_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *eve
static void
_hov_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
Widget_Data *wd = elm_widget_data_get(data);
const Eina_List *l;
const Subinfo *si;
@ -319,7 +318,7 @@ elm_hover_parent_set(Evas_Object *obj, Evas_Object *parent)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
if (wd->parent)
{
evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_MOVE,

View File

@ -52,9 +52,8 @@ _del_pre_hook(Evas_Object *obj)
static void
_del_hook(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
elm_notify_content_set(obj, NULL);
elm_notify_parent_set(obj, NULL);
elm_notify_repeat_events_set(obj, EINA_TRUE);
@ -69,9 +68,7 @@ _del_hook(Evas_Object *obj)
static void
_theme_hook(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
_elm_theme_set(wd->notify, "notify", "base", "default");
if (wd->block_events)
@ -84,10 +81,9 @@ _theme_hook(Evas_Object *obj)
static void
_sizing_eval(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
Evas_Coord x,y,w,h;
if (!wd) return;
if (!wd->parent) return;
evas_object_geometry_get(wd->parent, &x, &y, &w, &h);
evas_object_move(obj, x, y);
@ -103,17 +99,14 @@ _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__,
static void
_sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
{
Widget_Data *wd = elm_widget_data_get(obj);
if (event_info == wd->content)
wd->content = NULL;
if (!wd) return;
if (event_info == wd->content) wd->content = NULL;
}
static void
_signal_block_clicked(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
{
Widget_Data *wd = elm_widget_data_get(data);
if (!wd) return;
evas_object_smart_callback_call(data, "block,clicked", NULL);
@ -134,11 +127,10 @@ _content_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, voi
static void
_calc(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
Evas_Coord minw = -1, minh = -1;
Evas_Coord x, y, w, h;
if (!wd) return;
evas_object_geometry_get(obj, &x, &y, &w, &h);
edje_object_size_min_calc(wd->notify, &minw, &minh);
@ -186,9 +178,8 @@ static int
_timer_cb(void *data)
{
Evas_Object *obj = data;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return 0;
wd->timer = NULL;
evas_object_hide(obj);
return 0;
@ -197,9 +188,8 @@ _timer_cb(void *data)
static void
_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
{
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
evas_object_show(wd->notify);
if (!wd->repeat_events)
evas_object_show(wd->block_events);
@ -215,9 +205,8 @@ _show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_i
static void
_hide(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
{
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
evas_object_hide(wd->notify);
if (!wd->repeat_events)
evas_object_hide(wd->block_events);
@ -231,9 +220,8 @@ _hide(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_i
static void
_parent_del(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
{
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
wd->parent = NULL;
evas_object_hide(obj);
}
@ -241,9 +229,8 @@ _parent_del(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *e
static void
_parent_hide(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
{
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
wd->parent = NULL;
evas_object_hide(obj);
}
@ -304,7 +291,7 @@ elm_notify_content_set(Evas_Object *obj, Evas_Object *content)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
if (wd->content)
{
evas_object_event_callback_del_full(wd->content,
@ -315,7 +302,7 @@ elm_notify_content_set(Evas_Object *obj, Evas_Object *content)
evas_object_del(wd->content);
wd->content = NULL;
}
if (content)
{
elm_widget_sub_object_add(obj, content);
@ -326,7 +313,7 @@ elm_notify_content_set(Evas_Object *obj, Evas_Object *content)
evas_object_event_callback_add(content, EVAS_CALLBACK_RESIZE,
_content_resize, obj);
edje_object_part_swallow(wd->notify, "elm.swallow.content", content);
_sizing_eval(obj);
}
_calc(obj);
@ -345,8 +332,8 @@ elm_notify_parent_set(Evas_Object *obj, Evas_Object *parent)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if(wd->parent)
if (!wd) return;
if (wd->parent)
{
evas_object_event_callback_del_full(wd->parent,
EVAS_CALLBACK_CHANGED_SIZE_HINTS,
@ -361,7 +348,7 @@ elm_notify_parent_set(Evas_Object *obj, Evas_Object *parent)
_parent_hide, obj);
wd->parent = NULL;
}
if (parent)
{
wd->parent = parent;
@ -393,39 +380,38 @@ elm_notify_orient_set(Evas_Object *obj, Elm_Notify_Orient orient)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
wd->orient = orient;
switch (orient)
{
case ELM_NOTIFY_ORIENT_TOP:
case ELM_NOTIFY_ORIENT_TOP:
_elm_theme_set(wd->notify, "notify", "base", "default");
break;
case ELM_NOTIFY_ORIENT_CENTER:
case ELM_NOTIFY_ORIENT_CENTER:
_elm_theme_set(wd->notify, "notify", "base", "center");
break;
case ELM_NOTIFY_ORIENT_BOTTOM:
case ELM_NOTIFY_ORIENT_BOTTOM:
_elm_theme_set(wd->notify, "notify", "base", "bottom");
break;
case ELM_NOTIFY_ORIENT_LEFT:
case ELM_NOTIFY_ORIENT_LEFT:
_elm_theme_set(wd->notify, "notify", "base", "left");
break;
case ELM_NOTIFY_ORIENT_RIGHT:
case ELM_NOTIFY_ORIENT_RIGHT:
_elm_theme_set(wd->notify, "notify", "base", "right");
break;
case ELM_NOTIFY_ORIENT_TOP_LEFT:
case ELM_NOTIFY_ORIENT_TOP_LEFT:
_elm_theme_set(wd->notify, "notify", "base", "top_left");
break;
case ELM_NOTIFY_ORIENT_TOP_RIGHT:
case ELM_NOTIFY_ORIENT_TOP_RIGHT:
_elm_theme_set(wd->notify, "notify", "base", "top_right");
break;
case ELM_NOTIFY_ORIENT_BOTTOM_LEFT:
case ELM_NOTIFY_ORIENT_BOTTOM_LEFT:
_elm_theme_set(wd->notify, "notify", "base", "bottom_left");
break;
case ELM_NOTIFY_ORIENT_BOTTOM_RIGHT:
case ELM_NOTIFY_ORIENT_BOTTOM_RIGHT:
_elm_theme_set(wd->notify, "notify", "base", "bottom_right");
break;
}
_resize(obj, NULL, obj, NULL);
}
@ -441,7 +427,7 @@ elm_notify_timeout_set(Evas_Object *obj, int timeout)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
wd->timeout = timeout;
elm_notify_timer_init(obj);
}
@ -455,7 +441,7 @@ elm_notify_timer_init(Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
if (wd->timer) ecore_timer_del(wd->timer);
wd->timer = NULL;
if (wd->timeout > 0)
@ -477,7 +463,7 @@ elm_notify_repeat_events_set(Evas_Object *obj, Eina_Bool repeat)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
if (repeat == wd->repeat_events) return;
wd->repeat_events = repeat;
if (!repeat)

View File

@ -25,30 +25,28 @@ static void _sub_del(void *data, Evas_Object *obj, void *event_info);
static void
_del_pre_hook(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
evas_object_event_callback_del_full
(wd->tbl, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
evas_object_event_callback_del_full
(wd->tbl, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
evas_object_del(wd->tbl);
}
static void
_del_hook(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
free(wd);
}
static void
_sizing_eval(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
Evas_Coord w, h;
if (!wd) return;
evas_object_size_hint_min_get(wd->tbl, &minw, &minh);
evas_object_size_hint_max_get(wd->tbl, &maxw, &maxh);
evas_object_size_hint_min_set(obj, minw, minh);
@ -131,6 +129,7 @@ elm_table_homogenous_set(Evas_Object *obj, Eina_Bool homogenous)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
evas_object_table_homogeneous_set(wd->tbl, homogenous);
}
@ -148,6 +147,7 @@ elm_table_padding_set(Evas_Object *obj, Evas_Coord horizontal, Evas_Coord vertic
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
evas_object_table_padding_set(wd->tbl, horizontal, vertical);
}
@ -168,6 +168,7 @@ elm_table_pack(Evas_Object *obj, Evas_Object *subobj, int x, int y, int w, int h
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
elm_widget_sub_object_add(obj, subobj);
evas_object_table_pack(wd->tbl, subobj, x, y, w, h);
}
@ -185,6 +186,7 @@ elm_table_unpack(Evas_Object *obj, Evas_Object *subobj)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
elm_widget_sub_object_del(obj, subobj);
evas_object_table_unpack(wd->tbl, subobj);
}
@ -202,5 +204,6 @@ elm_table_clear(Evas_Object *obj, Eina_Bool clear)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
evas_object_table_clear(wd->tbl, clear);
}