add view_recent 47/41247/1
authorSoohye Shin <soohye.shin@samsung.com>
Fri, 12 Jun 2015 03:59:01 +0000 (12:59 +0900)
committerSoohye Shin <soohye.shin@samsung.com>
Fri, 12 Jun 2015 03:59:31 +0000 (12:59 +0900)
Change-Id: I0d61c9195cb9acc1dc12f6c0d8a2bce82f72727c
Signed-off-by: Soohye Shin <soohye.shin@samsung.com>
CMakeLists.txt
include/defs.h
include/view_recent.h [new file with mode: 0644]
src/main.c
src/view/view_recent.c [new file with mode: 0644]

index 92a4c14..d4aee44 100644 (file)
@@ -41,6 +41,7 @@ SET(TARGET_EDJ "${PROJECT_NAME}.edj")
 SET(DEFCONFIG "${PROJECT_NAME}.json")
 SET(SRCS
                src/main.c
+               src/view/view_recent.c
                src/view/view_home.c)
 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
 ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE_NAME}\"")
index af6549d..bc4b785 100644 (file)
@@ -27,6 +27,7 @@
 #define GRP_HOME_UP_ARROW "group.home.up.arrow"
 #define GRP_HOME_DOWN_ARROW "group.home.down.arrow"
 #define GRP_HOME_ITEM "group.home.item"
+#define GRP_RECENT "group.recent"
 
 #define PART_HOME_MENU_BAR "part.home.menu.bar"
 #define PART_HOME_UP_ARROW "part.home.up.arrow"
@@ -46,5 +47,7 @@
 #define SIG_UNFOCUS "sig.unfocus"
 #define SIG_UNFOCUS_TO_RIGHT "sig.unfocus.to.right"
 #define SIG_UNFOCUS_TO_LEFT "sig.unfocus.to.left"
+#define SIG_SHOW_RECENT "sig.show.recent"
+#define SIG_HIDE_RECENT "sig.hide.recent"
 
 #endif /* __AIR_HOME_DEFS_H__ */
diff --git a/include/view_recent.h b/include/view_recent.h
new file mode 100644 (file)
index 0000000..fcf0768
--- /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_RECENT_H__
+#define __AIR_HOME_VIEW_RECENT_H__
+
+view_class *view_recent_get_vclass(void);
+
+#endif /* __AIR_HOME_VIEW_RECENT_H__ */
index 8dfcaa0..23eb860 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "defs.h"
 #include "view_home.h"
+#include "view_recent.h"
 
 SET_TAG(PACKAGE);
 
@@ -71,6 +72,7 @@ static bool _create(void *user_data)
        }
 
        viewmgr_add_view(view_home_get_vclass(), NULL);
+       viewmgr_add_view(view_recent_get_vclass(), NULL);
 
        ad->win = win;
 
diff --git a/src/view/view_recent.c b/src/view/view_recent.c
new file mode 100644 (file)
index 0000000..6fe5fc7
--- /dev/null
@@ -0,0 +1,121 @@
+/*
+
+ * 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_recent.h"
+
+struct _priv {
+       Evas_Object *win;
+       Evas_Object *base;
+};
+
+static Evas_Object *_create(Evas_Object *win, void *data)
+{
+       struct _priv *priv;
+       Evas_Object *base;
+
+       if (!win) {
+               _ERR("Invalid argument");
+               return NULL;
+       }
+
+       priv = calloc(1, sizeof(*priv));
+       if (!priv) {
+               _ERR("failed to calloc priv");
+               return NULL;
+       }
+
+       base = elm_layout_add(win);
+       if (!base) {
+               _ERR("failed to create base");
+               free(priv);
+               return NULL;
+       }
+       elm_layout_file_set(base, EDJEFILE, GRP_RECENT);
+       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;
+
+       viewmgr_set_view_data(VIEW_RECENT, priv);
+
+       return base;
+}
+
+static void _show(void *data)
+{
+       struct _priv *priv;
+
+       if (!data) {
+               _ERR("Invalid argument");
+               return;
+       }
+
+       priv = data;
+
+       evas_object_show(priv->base);
+       elm_object_signal_emit(priv->base, SIG_SHOW_RECENT, SRC_PROG);
+}
+
+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_RECENT,
+       .create = _create,
+       .show = _show,
+       .hide = _hide,
+       .destroy = _destroy
+};
+
+view_class *view_recent_get_vclass(void)
+{
+       return &vclass;
+}
+