elementary/pager - prevent to push a existed content. if existed content could be pushed, content_promote will be not working as user expects.

SVN revision: 59954
This commit is contained in:
ChunEon Park 2011-06-04 08:08:48 +00:00
parent 6206f5f4a4
commit d6c443b57d
1 changed files with 22 additions and 0 deletions

View File

@ -49,6 +49,7 @@ static void _theme_hook(Evas_Object *obj);
static void _sizing_eval(Evas_Object *obj);
static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _sub_del(void *data, Evas_Object *obj, void *event_info);
static Item *_item_get(Evas_Object *obj, Evas_Object *content);
static const char SIG_HIDE_FINISHED[] = "hide,finished";
@ -96,6 +97,23 @@ _theme_hook(Evas_Object *obj)
_sizing_eval(obj);
}
static Item *
_item_get(Evas_Object *obj, Evas_Object *content)
{
Widget_Data *wd = elm_widget_data_get(obj);
Item *it;
Eina_List *l;
if (!wd) return;
EINA_LIST_FOREACH(wd->stack, l, it)
{
if (it->content == content)
return it;
}
return NULL;
}
static Eina_Bool
_elm_pager_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
{
@ -311,6 +329,7 @@ elm_pager_add(Evas_Object *parent)
* @param content The object to push
*
* @ingroup Pager
* @warning It will be failed if the content exists on the stack already.
*/
EAPI void
elm_pager_content_push(Evas_Object *obj, Evas_Object *content)
@ -320,6 +339,9 @@ elm_pager_content_push(Evas_Object *obj, Evas_Object *content)
Item *it = ELM_NEW(Item);
Evas_Coord x, y, w, h;
if (!wd) return;
if (_item_get(obj, content)) return;
if (!it) return;
it->obj = obj;
it->content = content;