From: Soohye Shin Date: Fri, 19 Jun 2015 01:27:24 +0000 (+0900) Subject: add initial view_user X-Git-Tag: accepted/tizen/tv/20150728.070602~59 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ee2498df0181281e5b4f412f2bb2e06205ca3f00;p=profile%2Ftv%2Fapps%2Fnative%2Fair_home.git add initial view_user Change-Id: I9d1e4eaa4a2463a55e15a3d837cf84ba02a66088 Signed-off-by: Soohye Shin --- diff --git a/CMakeLists.txt b/CMakeLists.txt index e8f16d7..77c56f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,6 +46,7 @@ SET(SRCS src/data/datamgr.c src/data/data_home.c src/data/data_recent.c + src/view/view_user.c src/view/view_recent.c src/view/view_home.c) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) diff --git a/edje/home.edc b/edje/home.edc index 0071986..cf65362 100644 --- a/edje/home.edc +++ b/edje/home.edc @@ -19,4 +19,5 @@ collections { #include "view/home.edc" #include "view/recent.edc" + #include "view/user.edc" } diff --git a/edje/view/user.edc b/edje/view/user.edc new file mode 100644 index 0000000..ff790e1 --- /dev/null +++ b/edje/view/user.edc @@ -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. + */ + +#include "../../include/defs.h" +group { + name, GRP_USER; + parts { + } +} diff --git a/include/defs.h b/include/defs.h index 3c7f608..42f66ab 100644 --- a/include/defs.h +++ b/include/defs.h @@ -28,9 +28,10 @@ #define GRP_HOME_DOWN_ARROW "group.home.down.arrow" #define GRP_HOME_ITEM "group.home.item" #define GRP_RECENT "group.recent" -#define GRP_RECENT_DELETE "grp.recent.delete" -#define GRP_RECENT_ICON "grp.recent.icon" -#define GRP_RECENT_PREVIEW "grp.recent.preview" +#define GRP_RECENT_DELETE "group.recent.delete" +#define GRP_RECENT_ICON "group.recent.icon" +#define GRP_RECENT_PREVIEW "group.recent.preview" +#define GRP_USER "group.user" #define PART_HOME_MENU_BAR "part.home.menu.bar" #define PART_HOME_UP_ARROW "part.home.up.arrow" diff --git a/include/view_user.h b/include/view_user.h new file mode 100644 index 0000000..c9c622c --- /dev/null +++ b/include/view_user.h @@ -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_H__ +#define __AIR_HOME_VIEW_USER_H__ + +view_class *view_user_get_vclass(void); + +#endif /* __AIR_HOME_VIEW_USER_H__ */ diff --git a/src/main.c b/src/main.c index c4e1027..e00a82c 100644 --- a/src/main.c +++ b/src/main.c @@ -22,6 +22,7 @@ #include "defs.h" #include "view_home.h" #include "view_recent.h" +#include "view_user.h" SET_TAG(PACKAGE); @@ -74,6 +75,7 @@ static bool _create(void *user_data) viewmgr_add_view(view_home_get_vclass(), NULL); viewmgr_add_view(view_recent_get_vclass(), NULL); + viewmgr_add_view(view_user_get_vclass(), NULL); ad->win = win; diff --git a/src/view/view_user.c b/src/view/view_user.c new file mode 100644 index 0000000..3f9c282 --- /dev/null +++ b/src/view/view_user.c @@ -0,0 +1,120 @@ +/* + + * 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 +#include +#include +#include + +#include "defs.h" +#include "view_user.h" +#include "datamgr.h" +#include "utils.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 = utils_add_layout(win, GRP_USER, 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; + + viewmgr_set_view_data(VIEW_USER, 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, + .create = _create, + .show = _show, + .hide = _hide, + .destroy = _destroy +}; + +view_class *view_user_get_vclass(void) +{ + return &vclass; +} +