add initial view_user_edit 81/42081/1
authorSoohye Shin <soohye.shin@samsung.com>
Tue, 23 Jun 2015 04:21:24 +0000 (13:21 +0900)
committerSoohye Shin <soohye.shin@samsung.com>
Tue, 23 Jun 2015 04:21:24 +0000 (13:21 +0900)
Change-Id: Id3406a6830600c1e7db45a70ae475fdc0c7afdda
Signed-off-by: Soohye Shin <soohye.shin@samsung.com>
CMakeLists.txt
include/defs.h
include/view_user_edit.h [new file with mode: 0644]
src/view/view_user.c
src/view/view_user_edit.c [new file with mode: 0644]

index 166c86d..546b4df 100644 (file)
@@ -47,6 +47,7 @@ SET(SRCS
                src/data/data_home.c
                src/data/data_recent.c
                src/data/data_user.c
+               src/view/view_user_edit.c
                src/view/view_user.c
                src/view/view_recent.c
                src/view/view_home.c)
index 4cbf787..081520d 100644 (file)
@@ -20,6 +20,7 @@
 #define VIEW_HOME "VIEW_HOME"
 #define VIEW_RECENT "VIEW_RECENT"
 #define VIEW_USER "VIEW_USER"
+#define VIEW_USER_EDIT "VIEW_USER_EDIT"
 
 #define SRC_PROG "prog"
 #define SRC_EDJE "edje"
diff --git a/include/view_user_edit.h b/include/view_user_edit.h
new file mode 100644 (file)
index 0000000..088b7cf
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * 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_VIEW_USER_EDIT_H__
+#define __AIR_HOME_VIEW_USER_EDIT_H__
+
+view_class *view_user_edit_get_vclass(void);
+
+#endif /* __AIR_HOME_VIEW_USER_EDIT_H__ */
index d9d9a12..b37a454 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "defs.h"
 #include "view_user.h"
+#include "view_user_edit.h"
 #include "data_user.h"
 #include "datamgr.h"
 #include "utils.h"
@@ -72,6 +73,7 @@ static Evas_Object *_create(Evas_Object *win, void *data)
        priv->dm = dm;
 
        viewmgr_set_view_data(VIEW_USER, priv);
+       viewmgr_add_view(view_user_edit_get_vclass(), dm);
 
        return base;
 }
@@ -115,6 +117,7 @@ static void _destroy(void *data)
 
        priv = data;
 
+       viewmgr_remove_view(VIEW_USER_EDIT);
        datamgr_fini(priv->dm);
        evas_object_del(priv->base);
        free(priv);
diff --git a/src/view/view_user_edit.c b/src/view/view_user_edit.c
new file mode 100644 (file)
index 0000000..89de84c
--- /dev/null
@@ -0,0 +1,124 @@
+/*
+
+ * 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 <Elementary.h>
+#include <app_debug.h>
+#include <viewmgr.h>
+#include <inputmgr.h>
+
+#include "defs.h"
+#include "view_user_edit.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;
+       Evas_Object *base;
+
+       if (!win || !data) {
+               _ERR("Invalid argument");
+               return NULL;
+       }
+
+       priv = calloc(1, sizeof(*priv));
+       if (!priv) {
+               _ERR("failed to calloc priv");
+               return NULL;
+       }
+
+       base = utils_add_layout(win, GRP_USER_EDIT, false, NULL);
+       if (!base) {
+               _ERR("failed to create base");
+               free(priv);
+               return NULL;
+       }
+       evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       elm_win_resize_object_add(win, base);
+
+       priv->win = win;
+       priv->base = base;
+       priv->dm = data;
+
+       viewmgr_set_view_data(VIEW_USER_EDIT, priv);
+
+       return base;
+}
+
+static void _show(void *data)
+{
+       struct _priv *priv;
+
+       if (!data) {
+               _ERR("Invalid argument");
+               return;
+       }
+
+       priv = data;
+
+       evas_object_show(priv->base);
+}
+
+static void _hide(void *data)
+{
+       struct _priv *priv;
+
+       if (!data) {
+               _ERR("Invalid argument");
+               return;
+       }
+
+       priv = data;
+
+       evas_object_hide(priv->base);
+}
+
+static void _destroy(void *data)
+{
+       struct _priv *priv;
+
+       if (!data) {
+               _ERR("Invalid argument");
+               return;
+       }
+
+       priv = data;
+
+       evas_object_del(priv->base);
+       free(priv);
+}
+
+static view_class vclass = {
+       .view_id = VIEW_USER_EDIT,
+       .create = _create,
+       .show = _show,
+       .hide = _hide,
+       .destroy = _destroy
+};
+
+view_class *view_user_edit_get_vclass(void)
+{
+       return &vclass;
+}
+