Reload apps grid when app launched and sort type is 'recent' 22/45122/1
authorHyojung Jo <hj903.jo@samsung.com>
Sun, 2 Aug 2015 07:46:20 +0000 (16:46 +0900)
committerHyojung Jo <hj903.jo@samsung.com>
Sun, 2 Aug 2015 07:46:20 +0000 (16:46 +0900)
Change-Id: I16faba377a9875041a32bb7630efd607a352302a
Signed-off-by: Hyojung Jo <hj903.jo@samsung.com>
include/view_base.h
src/main.c
src/view/view_base.c

index 0afd592..5c6282a 100644 (file)
@@ -19,4 +19,6 @@
 
 view_class *view_base_get_vclass(void);
 
+#define UPDATE_LIST 0
+
 #endif /* __AIR_APPS_VIEW_BASE_H__ */
index 52e3631..05a1321 100644 (file)
@@ -117,6 +117,17 @@ static void _app_control(app_control_h control, void *data)
                _ERR("Push view failed.");
 }
 
+static void _resume(void *data)
+{
+       if (!data) {
+               _ERR("Get data failed.");
+               return;
+       }
+
+       if (!viewmgr_update_view(VIEW_BASE, UPDATE_LIST, NULL))
+               _ERR("Update view failed.");
+}
+
 int main(int argc, char *argv[])
 {
        struct _appdata ad;
@@ -124,6 +135,7 @@ int main(int argc, char *argv[])
                .create = _create,
                .terminate = _terminate,
                .app_control = _app_control,
+               .resume = _resume,
        };
 
        memset(&ad, 0x00, sizeof(ad));
index 344e998..309058c 100644 (file)
@@ -26,6 +26,7 @@
 #include "define.h"
 #include "utils.h"
 #include "data/app.h"
+#include "view_base.h"
 #include "grid_myapps.h"
 
 enum menu_type {
@@ -817,6 +818,22 @@ static void _hide(void *data)
                evas_object_hide(priv->base);
 }
 
+static void _update(void *view_data, int update_type, void *data)
+{
+       struct _priv *priv;
+
+       if (!view_data) {
+               _ERR("Get data failed.");
+               return;
+       }
+       priv = view_data;
+
+       if (update_type == UPDATE_LIST && priv->sort_type == SORT_RECENT) {
+               _sort_by_recently_used(priv);
+               gridmgr_append_list(priv->gmgr, STR_MYAPPS, priv->app_list);
+       }
+}
+
 static void _destroy(void *data)
 {
        struct _priv *priv;
@@ -841,6 +858,7 @@ static view_class _vclass = {
        .create = _create,
        .show = _show,
        .hide = _hide,
+       .update = _update,
        .destroy = _destroy,
 };