add initial data_user 33/42033/1
authorSoohye Shin <soohye.shin@samsung.com>
Mon, 22 Jun 2015 08:32:24 +0000 (17:32 +0900)
committerSoohye Shin <soohye.shin@samsung.com>
Mon, 22 Jun 2015 08:33:06 +0000 (17:33 +0900)
Change-Id: Id00bb8fe38040e75881285b18565360556a84bad
Signed-off-by: Soohye Shin <soohye.shin@samsung.com>
CMakeLists.txt
include/data_user.h [new file with mode: 0644]
src/data/data_user.c [new file with mode: 0644]
src/view/view_user.c

index 77c56f2..166c86d 100644 (file)
@@ -46,6 +46,7 @@ SET(SRCS
                src/data/datamgr.c
                src/data/data_home.c
                src/data/data_recent.c
+               src/data/data_user.c
                src/view/view_user.c
                src/view/view_recent.c
                src/view/view_home.c)
diff --git a/include/data_user.h b/include/data_user.h
new file mode 100644 (file)
index 0000000..d6e14aa
--- /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_USER_H__
+#define __AIR_HOME_DATA_USER_H__
+
+#include <datamgr.h>
+
+struct data_class *datamgr_user_get_dclass(void);
+
+#endif /* __AIR_HOME_DATA_USER_H__ */
diff --git a/src/data/data_user.c b/src/data/data_user.c
new file mode 100644 (file)
index 0000000..664e690
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * 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 "data_user.h"
+#include "datamgr.h"
+
+static void _select(struct datamgr_item *di)
+{
+       /* It should be implemented later */
+}
+
+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,
+       .select = _select
+};
+
+struct data_class *datamgr_user_get_dclass(void)
+{
+       return &dclass;
+}
+
index 3f9c282..d9d9a12 100644 (file)
 
 #include "defs.h"
 #include "view_user.h"
+#include "data_user.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) {
@@ -46,9 +50,17 @@ static Evas_Object *_create(Evas_Object *win, void *data)
                return NULL;
        }
 
+       dm = datamgr_init(datamgr_user_get_dclass(), VIEW_USER);
+       if (!dm) {
+               _ERR("failed to initialize datamgr");
+               free(priv);
+               return NULL;
+       }
+
        base = utils_add_layout(win, GRP_USER, false, NULL);
        if (!base) {
                _ERR("failed to create base");
+               datamgr_fini(dm);
                free(priv);
                return NULL;
        }
@@ -57,6 +69,7 @@ static Evas_Object *_create(Evas_Object *win, void *data)
 
        priv->win = win;
        priv->base = base;
+       priv->dm = dm;
 
        viewmgr_set_view_data(VIEW_USER, priv);
 
@@ -101,6 +114,8 @@ static void _destroy(void *data)
        }
 
        priv = data;
+
+       datamgr_fini(priv->dm);
        evas_object_del(priv->base);
        free(priv);
 }