terminate the app when there is no active view 98/45298/1 accepted/tizen/tv/20150804.235436 submit/tizen/20150804.130905
authorJehun Lim <jehun.lim@samsung.com>
Tue, 4 Aug 2015 10:17:11 +0000 (19:17 +0900)
committerJehun Lim <jehun.lim@samsung.com>
Tue, 4 Aug 2015 12:33:53 +0000 (21:33 +0900)
Change-Id: Idbca1e46b1ab6031cad0f5cf51c1b2378dbdea8e
Signed-off-by: Jehun Lim <jehun.lim@samsung.com>
src/view/mplayer.c
src/view/viewer.c

index 6062725..7c5ac35 100644 (file)
@@ -14,6 +14,7 @@
  * limitations under the License.
  */
 
+#include <app.h>
 #include <Elementary.h>
 #include <app_debug.h>
 #include <viewmgr.h>
@@ -440,10 +441,15 @@ static void _pop_view(struct _priv *priv)
 {
        struct view_update_data vdata;
 
-       vdata.index = priv->playlist.cur;
+       if (viewmgr_active_view_count() > 1) {
+               vdata.index = priv->playlist.cur;
+               viewmgr_update_view(VIEW_BASE, UPDATE_FOCUS, &vdata);
+       }
 
-       viewmgr_update_view(VIEW_BASE, UPDATE_FOCUS, &vdata);
        viewmgr_pop_view();
+
+       if (viewmgr_active_view_count() == 0)
+               ui_app_exit();
 }
 
 static void _key_down(int id, void *data, Evas *e, Evas_Object *obj,
@@ -457,9 +463,8 @@ static void _key_down(int id, void *data, Evas *e, Evas_Object *obj,
        priv = data;
 
        if (!strcmp(ev->keyname, KEY_BACK) ||
-                       !strcmp(ev->keyname, KEY_BACK_REMOTE)) {
+                       !strcmp(ev->keyname, KEY_BACK_REMOTE))
                _pop_view(priv);
-       }
 }
 
 static void _list_set_focus(struct _priv *priv)
index 1d658fa..e6fcd53 100644 (file)
@@ -14,6 +14,7 @@
  * limitations under the License.
  */
 
+#include <app.h>
 #include <Elementary.h>
 #include <app_debug.h>
 #include <viewmgr.h>
@@ -637,10 +638,15 @@ static void _pop_view(struct _priv *priv)
                        priv->viewer.cur == VIEWER_VIDEO)
                _player_stop(priv);
 
-       vdata.index = priv->playlist.cur;
+       if (viewmgr_active_view_count() > 1) {
+               vdata.index = priv->playlist.cur;
+               viewmgr_update_view(VIEW_BASE, UPDATE_FOCUS, &vdata);
+       }
 
-       viewmgr_update_view(VIEW_BASE, UPDATE_FOCUS, &vdata);
        viewmgr_pop_view();
+
+       if (viewmgr_active_view_count() == 0)
+               ui_app_exit();
 }
 
 static void _timeout_cb(void *data, int type, void *ei)