add initial data_recent 49/41849/1
authorSoohye Shin <soohye.shin@samsung.com>
Thu, 18 Jun 2015 09:31:50 +0000 (18:31 +0900)
committerSoohye Shin <soohye.shin@samsung.com>
Thu, 18 Jun 2015 09:31:50 +0000 (18:31 +0900)
Change-Id: I8df19a703a20f4fee390b17a53453ed3881a2478
Signed-off-by: Soohye Shin <soohye.shin@samsung.com>
CMakeLists.txt
include/data_recent.h [new file with mode: 0644]
src/data/data_recent.c [new file with mode: 0644]
src/view/view_recent.c

index b980692..e8f16d7 100644 (file)
@@ -45,6 +45,7 @@ SET(SRCS
                src/utils.c
                src/data/datamgr.c
                src/data/data_home.c
+               src/data/data_recent.c
                src/view/view_recent.c
                src/view/view_home.c)
 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
diff --git a/include/data_recent.h b/include/data_recent.h
new file mode 100644 (file)
index 0000000..be7fa8f
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __AIR_HOME_DATA_RECENT_H__
+#define __AIR_HOME_DATA_RECENT_H__
+
+#include <datamgr.h>
+
+struct data_class *datamgr_recent_get_dclass(void);
+
+#endif /* __AIR_HOME_DATA_RECENT_H__ */
diff --git a/src/data/data_recent.c b/src/data/data_recent.c
new file mode 100644 (file)
index 0000000..5bad2b3
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <app_debug.h>
+#include <Eina.h>
+#include <stdbool.h>
+#include <app_contents.h>
+
+#include "data_recent.h"
+#include "datamgr.h"
+
+static Eina_List *_get_items(struct datamgr *dm)
+{
+       if (!dm) {
+               _ERR("Invalid argument");
+               return NULL;
+       }
+
+       return dm->list;
+}
+
+static void _fini(struct datamgr *dm)
+{
+       /* It should be implemented later */
+}
+
+static bool _init(struct datamgr *dm)
+{
+       /* It should be implemented later */
+
+       return true;
+}
+
+static struct data_class dclass = {
+       .init = _init,
+       .fini = _fini,
+       .get_items = _get_items
+};
+
+struct data_class *datamgr_recent_get_dclass(void)
+{
+       return &dclass;
+}
+
index 6fe5fc7..3978df7 100644 (file)
 
 #include "defs.h"
 #include "view_recent.h"
+#include "data_recent.h"
+#include "datamgr.h"
+#include "utils.h"
 
 struct _priv {
        Evas_Object *win;
        Evas_Object *base;
+
+       struct datamgr *dm;
 };
 
 static Evas_Object *_create(Evas_Object *win, void *data)
 {
        struct _priv *priv;
+       struct datamgr *dm;
        Evas_Object *base;
 
        if (!win) {
@@ -44,9 +50,17 @@ static Evas_Object *_create(Evas_Object *win, void *data)
                return NULL;
        }
 
+       dm = datamgr_init(datamgr_recent_get_dclass(), VIEW_RECENT);
+       if (!dm) {
+               _ERR("failed to initialize datamgr");
+               free(priv);
+               return NULL;
+       }
+
        base = elm_layout_add(win);
        if (!base) {
                _ERR("failed to create base");
+               datamgr_fini(dm);
                free(priv);
                return NULL;
        }
@@ -56,6 +70,7 @@ static Evas_Object *_create(Evas_Object *win, void *data)
 
        priv->win = win;
        priv->base = base;
+       priv->dm = dm;
 
        viewmgr_set_view_data(VIEW_RECENT, priv);
 
@@ -101,7 +116,7 @@ static void _destroy(void *data)
        }
 
        priv = data;
-
+       datamgr_fini(priv->dm);
        evas_object_del(priv->base);
        free(priv);
 }