fixed elm_navigationbar pop and push issues.
authorshilpa singh <shilpa.singh@samsung.com>
Fri, 10 Sep 2010 05:52:35 +0000 (14:52 +0900)
committershilpa singh <shilpa.singh@samsung.com>
Fri, 10 Sep 2010 05:52:35 +0000 (14:52 +0900)
src/lib/elm_navigationbar.c

index 72ebbda..e0844bd 100644 (file)
@@ -226,14 +226,20 @@ _transition_complete_cb(void *data)
        {
        Transit_Cb_Data *cb = data;
        if (!cb) return;
-
+       Evas_Object *navi_bar = NULL;
+       Evas_Object *content = NULL;
        Widget_Data *wd = NULL;
        Item *prev_it = cb->prev_it;
        Item *it = cb->it;
 
-       if (prev_it) wd = elm_widget_data_get(prev_it->obj);
-       else if (it) wd = elm_widget_data_get(it->obj);
-
+       if (prev_it) {
+                        navi_bar = prev_it->obj;
+               }
+       else if (it){
+                       navi_bar = it->obj;
+               }
+       
+       wd = elm_widget_data_get(navi_bar);
        if (cb->pop && prev_it)
        {
                Eina_List *ll;
@@ -305,9 +311,10 @@ _transition_complete_cb(void *data)
                {
                        edje_object_signal_emit(wd->base, "elm,state,extend,title", "elm");
                }
+               content = it->content;
        }
        edje_object_message_signal_process(wd->base);
-       evas_object_smart_callback_call(it->obj, "updated", it->content);
+       evas_object_smart_callback_call(navi_bar, "updated", content);
 }
 
 static void 
@@ -317,6 +324,24 @@ _back_button_clicked(void *data, Evas_Object *obj, void *event_info)
        elm_navigationbar_pop(it->obj);
 }
 
+static void
+_sub_del(void *data, Evas_Object *obj __UNUSED__, void *event_info)
+{
+   Widget_Data *wd = elm_widget_data_get(data);
+   Evas_Object *sub = event_info;
+   Eina_List *l;
+   Item *it;
+   if (!wd) return;
+   
+       if (wd->pager == sub)
+         {
+            wd->stack = eina_list_remove_list(wd->stack, l);
+            evas_object_del(wd->base);
+            return;
+         }
+}
+
+
 static int
 _set_button_width(Evas_Object *obj)
 {
@@ -452,6 +477,7 @@ elm_navigationbar_add(Evas_Object *parent)
        wd->pager = elm_pager_add(obj);
        elm_widget_sub_object_add(obj, wd->pager);
        edje_object_part_swallow(wd->base, "elm.swallow.content", wd->pager);   
+       evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
 
        evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, NULL);       
 
@@ -602,13 +628,10 @@ elm_navigationbar_pop(Evas_Object *obj)
        {
                prev_it = ll->data;
                ll = ll->prev;
-               while (ll) 
-               {
-                       it = ll->data;
-                       if (it->obj) break;  
-                       it = NULL;
-                       ll = ll->prev;
-               }
+               if(ll)
+                       {
+                               it = ll->data;
+                       }
        }
        
        //unswallow items and start trasition
@@ -635,6 +658,11 @@ elm_navigationbar_pop(Evas_Object *obj)
        _transition_complete_cb(cb);
        //pop content from pager
        elm_pager_content_pop(wd->pager);
+       if(prev_it && !it)
+               {
+                       printf("\n\nconditions met\n");
+                       evas_object_del(wd->pager);
+               }
        free(cb);
 }