forked from enlightenment/efl
elementary/naviframe - title_content_set refactored.
1. Modified to support NULL content. 2. Unnecessary parameter removed. 3. Number of lines Optimization. Signed-Off-By: ShilpaOnkar Singh <shilpa.singh@samsung.com> Signed-Off-By: ChunEon Park <hermet@hermet.pe.kr> SVN revision: 65777
This commit is contained in:
parent
da302ac7c7
commit
2917a8bab2
|
@ -117,7 +117,6 @@ static void _title_icon_del(void *data,
|
||||||
Evas_Object *obj,
|
Evas_Object *obj,
|
||||||
void *event_info);
|
void *event_info);
|
||||||
static void _title_content_set(Elm_Naviframe_Item *it,
|
static void _title_content_set(Elm_Naviframe_Item *it,
|
||||||
Elm_Naviframe_Content_Item_Pair *pair,
|
|
||||||
const char *part,
|
const char *part,
|
||||||
Evas_Object *content);
|
Evas_Object *content);
|
||||||
static void _title_prev_btn_set(Elm_Naviframe_Item *it,
|
static void _title_prev_btn_set(Elm_Naviframe_Item *it,
|
||||||
|
@ -321,7 +320,6 @@ _item_content_set_hook(Elm_Object_Item *it,
|
||||||
{
|
{
|
||||||
ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
|
ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
|
||||||
|
|
||||||
Elm_Naviframe_Content_Item_Pair *pair = NULL;
|
|
||||||
Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *) it;
|
Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *) it;
|
||||||
|
|
||||||
//specified parts
|
//specified parts
|
||||||
|
@ -347,7 +345,7 @@ _item_content_set_hook(Elm_Object_Item *it,
|
||||||
}
|
}
|
||||||
|
|
||||||
//common part
|
//common part
|
||||||
_title_content_set(navi_it, pair, part, content);
|
_title_content_set(navi_it, part, content);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Evas_Object *
|
static Evas_Object *
|
||||||
|
@ -555,16 +553,35 @@ _item_content_del(void *data,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_title_content_set(Elm_Naviframe_Item *it,
|
_title_content_set(Elm_Naviframe_Item *it,
|
||||||
Elm_Naviframe_Content_Item_Pair *pair,
|
|
||||||
const char *part,
|
const char *part,
|
||||||
Evas_Object *content)
|
Evas_Object *content)
|
||||||
{
|
{
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
Elm_Naviframe_Content_Item_Pair *pair = NULL;
|
||||||
|
|
||||||
EINA_INLIST_FOREACH(it->content_list, pair)
|
EINA_INLIST_FOREACH(it->content_list, pair)
|
||||||
if (!strcmp(part, pair->part)) break;
|
if (!strcmp(part, pair->part)) break;
|
||||||
|
|
||||||
if (!pair)
|
if ((pair) && (pair->content))
|
||||||
|
{
|
||||||
|
if (!content)
|
||||||
|
{
|
||||||
|
evas_object_del(pair->content);
|
||||||
|
pair->content = NULL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (pair->content == content) return;
|
||||||
|
evas_object_event_callback_del(pair->content,
|
||||||
|
EVAS_CALLBACK_DEL,
|
||||||
|
_title_content_del);
|
||||||
|
evas_object_event_callback_del(pair->content,
|
||||||
|
EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
||||||
|
_changed_size_hints);
|
||||||
|
evas_object_del(pair->content);
|
||||||
|
snprintf(buf, sizeof(buf), "elm,state,%s,hide", part);
|
||||||
|
edje_object_signal_emit(VIEW(it), buf, "elm");
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
pair = ELM_NEW(Elm_Naviframe_Content_Item_Pair);
|
pair = ELM_NEW(Elm_Naviframe_Content_Item_Pair);
|
||||||
if (!pair)
|
if (!pair)
|
||||||
|
@ -578,15 +595,6 @@ _title_content_set(Elm_Naviframe_Item *it,
|
||||||
EINA_INLIST_GET(pair));
|
EINA_INLIST_GET(pair));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pair->content != content)
|
|
||||||
{
|
|
||||||
evas_object_event_callback_del(pair->content,
|
|
||||||
EVAS_CALLBACK_DEL,
|
|
||||||
_title_content_del);
|
|
||||||
evas_object_event_callback_del(pair->content,
|
|
||||||
EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
|
||||||
_changed_size_hints);
|
|
||||||
evas_object_del(pair->content);
|
|
||||||
elm_widget_sub_object_add(WIDGET(it), content);
|
elm_widget_sub_object_add(WIDGET(it), content);
|
||||||
evas_object_event_callback_add(content,
|
evas_object_event_callback_add(content,
|
||||||
EVAS_CALLBACK_DEL,
|
EVAS_CALLBACK_DEL,
|
||||||
|
@ -596,22 +604,12 @@ _title_content_set(Elm_Naviframe_Item *it,
|
||||||
EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
||||||
_changed_size_hints,
|
_changed_size_hints,
|
||||||
WIDGET(it));
|
WIDGET(it));
|
||||||
}
|
|
||||||
if (content)
|
|
||||||
{
|
|
||||||
edje_object_part_swallow(VIEW(it), part, content);
|
edje_object_part_swallow(VIEW(it), part, content);
|
||||||
snprintf(buf, sizeof(buf), "elm,state,%s,show", part);
|
snprintf(buf, sizeof(buf), "elm,state,%s,show", part);
|
||||||
edje_object_signal_emit(VIEW(it), buf, "elm");
|
edje_object_signal_emit(VIEW(it), buf, "elm");
|
||||||
pair->content = content;
|
pair->content = content;
|
||||||
_sizing_eval(WIDGET(it));
|
_sizing_eval(WIDGET(it));
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
snprintf(buf, sizeof(buf), "elm,state,%s,hide", part);
|
|
||||||
edje_object_signal_emit(VIEW(it), buf, "elm");
|
|
||||||
pair->content = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_title_prev_btn_set(Elm_Naviframe_Item *it,
|
_title_prev_btn_set(Elm_Naviframe_Item *it,
|
||||||
|
|
Loading…
Reference in New Issue