From: Jehun Lim Date: Fri, 19 Jun 2015 05:35:10 +0000 (+0900) Subject: add initial base view X-Git-Tag: accepted/tizen/tv/20150728.070555~128 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F04%2F41904%2F1;p=profile%2Ftv%2Fapps%2Fnative%2Fair_mediahub.git add initial base view : convert movie, gallery, music view to movie, gallery, music layout Change-Id: Ie8a2034ec4d2e12eb5019a9a194d9876546d9e83 Signed-off-by: Jehun Lim --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 9aef68f..d6ee7b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,11 +48,11 @@ ENDIF(NOT DEFINED PACKAGEDIR) SET(SRCS src/main.c -src/view/movie.c -src/view/gallery.c -src/view/music.c +src/view/base.c src/view/viewer.c -src/layout/menu_layout.c +src/layout/movie.c +src/layout/gallery.c +src/layout/music.c ) SET(TARGET_EDJ "${PROJECT_NAME}.edj") diff --git a/include/define.h b/include/define.h index 82d8927..8fd4bf9 100644 --- a/include/define.h +++ b/include/define.h @@ -18,13 +18,13 @@ #define __AIR_MEDIAHUB_DEFINE_H__ /* views */ -#include "view/movie.h" -#include "view/gallery.h" -#include "view/music.h" +#include "view/base.h" #include "view/viewer.h" /* layouts */ -#include "layout/menu.h" +#include "layout/movie.h" +#include "layout/gallery.h" +#include "layout/music.h" /* defines */ #define STYLE_INVISIBLE "invisible" diff --git a/include/layout.h b/include/layout.h index 5b3f2b5..d20ddee 100644 --- a/include/layout.h +++ b/include/layout.h @@ -17,7 +17,13 @@ #ifndef __AIR_MEDIAHUB_LAYOUT_H__ #define __AIR_MEDIAHUB_LAYOUT_H__ -/* menu */ -layout_class *layout_menu_get_lclass(void); +/* movie */ +layout_class *layout_movie_get_lclass(void); + +/* gallery */ +layout_class *layout_gallery_get_lclass(void); + +/* music */ +layout_class *layout_music_get_lclass(void); #endif /* __AIR_MEDIAHUB_LAYOUT_H__ */ diff --git a/include/layout/gallery.h b/include/layout/gallery.h new file mode 100644 index 0000000..aa7e914 --- /dev/null +++ b/include/layout/gallery.h @@ -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_MEDIAHUB_LAYOUT_GALLERY_H__ +#define __AIR_MEDIAHUB_LAYOUT_GALLERY_H__ + +#define LAYOUT_GALLERY "LAYOUT_GALLERY" + +#define GRP_GALLERY_LAYOUT "group.gallery_layout" + +#endif /* __AIR_MEDIAHUB_LAYOUT_GALLERY_H__ */ diff --git a/include/view/gallery.h b/include/layout/movie.h similarity index 75% rename from include/view/gallery.h rename to include/layout/movie.h index 830899f..a0aaa9f 100644 --- a/include/view/gallery.h +++ b/include/layout/movie.h @@ -14,11 +14,11 @@ * limitations under the License. */ -#ifndef __AIR_MEDIAHUB_VIEW_GALLERY_H__ -#define __AIR_MEDIAHUB_VIEW_GALLERY_H__ +#ifndef __AIR_MEDIAHUB_LAYOUT_MOVIE_H__ +#define __AIR_MEDIAHUB_LAYOUT_MOVIE_H__ -#define VIEW_GALLERY "VIEW_GALLERY" +#define LAYOUT_MOVIE "LAYOUT_MOVIE" -#define GRP_GALLERY_VIEW "group.gallery_view" +#define GRP_MOVIE_LAYOUT "group.movie_layout" -#endif /* __AIR_MEDIAHUB_VIEW_GALLERY_H__ */ +#endif /* __AIR_MEDIAHUB_LAYOUT_MOVIE_H__ */ diff --git a/include/view/music.h b/include/layout/music.h similarity index 75% rename from include/view/music.h rename to include/layout/music.h index d727a59..89ac040 100644 --- a/include/view/music.h +++ b/include/layout/music.h @@ -14,11 +14,11 @@ * limitations under the License. */ -#ifndef __AIR_MEDIAHUB_VIEW_MUSIC_H__ -#define __AIR_MEDIAHUB_VIEW_MUSIC_H__ +#ifndef __AIR_MEDIAHUB_LAYOUT_MUSIC_H__ +#define __AIR_MEDIAHUB_LAYOUT_MUSIC_H__ -#define VIEW_MUSIC "VIEW_MUSIC" +#define LAYOUT_MUSIC "LAYOUT_MUSIC" -#define GRP_MUSIC_VIEW "group.music_view" +#define GRP_MUSIC_LAYOUT "group.music_layout" -#endif /* __AIR_MEDIAHUB_VIEW_MUSIC_H__ */ +#endif /* __AIR_MEDIAHUB_LAYOUT_MUSIC_H__ */ diff --git a/include/view.h b/include/view.h index c28e0d1..aabb6ae 100644 --- a/include/view.h +++ b/include/view.h @@ -17,14 +17,8 @@ #ifndef __AIR_MEDIAHUB_VIEW_H__ #define __AIR_MEDIAHUB_VIEW_H__ -/* movie */ -view_class *view_movie_get_vclass(void); - -/* gallery */ -view_class *view_gallery_get_vclass(void); - -/* music */ -view_class *view_music_get_vclass(void); +/* base */ +view_class *view_base_get_vclass(void); /* viewer */ view_class *view_viewer_get_vclass(void); diff --git a/include/layout/menu.h b/include/view/base.h similarity index 66% rename from include/layout/menu.h rename to include/view/base.h index 2232c2e..201d07f 100644 --- a/include/layout/menu.h +++ b/include/view/base.h @@ -14,13 +14,15 @@ * limitations under the License. */ -#ifndef __AIR_MEDIAHUB_LAYOUT_MENU_H__ -#define __AIR_MEDIAHUB_LAYOUT_MENU_H__ +#ifndef __AIR_MEDIAHUB_VIEW_BASE_H__ +#define __AIR_MEDIAHUB_VIEW_BASE_H__ -#define LAYOUT_MENU "LAYOUT_MENU" +#define VIEW_BASE "VIEW_BASE" -#define GRP_MENU_LAYOUT "group.menu_layout" +#define GRP_BASE_VIEW "group.base_view" -#define PART_MENU_LAYOUT "part.menu_layout" +#define PART_MENU_AREA "part.menu_area" +#define PART_THUMBNAIL_AREA "part.thumbnail_area" +#define PART_BOTTOM_AREA "part.bottom_area" -#endif /* __AIR_MEDIAHUB_LAYOUT_MENU_H__ */ +#endif /* __AIR_MEDIAHUB_VIEW_BASE_H__ */ diff --git a/include/view/movie.h b/res/edc/layout/gallery.edc similarity index 76% rename from include/view/movie.h rename to res/edc/layout/gallery.edc index 323843b..520e09a 100644 --- a/include/view/movie.h +++ b/res/edc/layout/gallery.edc @@ -14,11 +14,6 @@ * limitations under the License. */ -#ifndef __AIR_MEDIAHUB_VIEW_MOVIE_H__ -#define __AIR_MEDIAHUB_VIEW_MOVIE_H__ - -#define VIEW_MOVIE "VIEW_MOVIE" - -#define GRP_MOVIE_VIEW "group.movie_view" - -#endif /* __AIR_MEDIAHUB_VIEW_MOVIE_H__ */ +group { + name: GRP_GALLERY_LAYOUT; +} diff --git a/res/edc/view/movie.edc b/res/edc/layout/movie.edc similarity index 96% rename from res/edc/view/movie.edc rename to res/edc/layout/movie.edc index f0de4bf..85385a5 100644 --- a/res/edc/view/movie.edc +++ b/res/edc/layout/movie.edc @@ -15,5 +15,5 @@ */ group { - name: GRP_MOVIE_VIEW; + name: GRP_MOVIE_LAYOUT; } diff --git a/res/edc/layout/menu_layout.edc b/res/edc/layout/music.edc similarity index 96% rename from res/edc/layout/menu_layout.edc rename to res/edc/layout/music.edc index ec1e28f..e2b0788 100644 --- a/res/edc/layout/menu_layout.edc +++ b/res/edc/layout/music.edc @@ -15,5 +15,5 @@ */ group { - name: GRP_MENU_LAYOUT; + name: GRP_MUSIC_LAYOUT; } diff --git a/res/edc/mediahub.edc b/res/edc/mediahub.edc index bacbbec..1366e00 100644 --- a/res/edc/mediahub.edc +++ b/res/edc/mediahub.edc @@ -17,9 +17,9 @@ #include "../../include/define.h" collections { - #include "view/movie.edc" - #include "view/gallery.edc" - #include "view/music.edc" + #include "view/base.edc" #include "view/viewer.edc" - #include "layout/menu_layout.edc" + #include "layout/movie.edc" + #include "layout/gallery.edc" + #include "layout/music.edc" } diff --git a/res/edc/view/gallery.edc b/res/edc/view/base.edc similarity index 72% rename from res/edc/view/gallery.edc rename to res/edc/view/base.edc index cd292a7..029bb9c 100644 --- a/res/edc/view/gallery.edc +++ b/res/edc/view/base.edc @@ -15,7 +15,7 @@ */ group { - name: GRP_GALLERY_VIEW; + name: GRP_BASE_VIEW; parts { part { name: "bg"; @@ -27,7 +27,7 @@ group { } } part { - name: PART_MENU_LAYOUT; + name: PART_MENU_AREA; type: SWALLOW; scale: 1; description { @@ -37,16 +37,16 @@ group { } } part { - name: "padding_content_layout"; + name: "padding_thumbnail_area"; type: RECT; scale: 1; description { state: "default" 0.0; rel1 { - to: PART_MENU_LAYOUT; + to: PART_MENU_AREA; relative: 0.0 1.0; } - rel2.to: PART_MENU_LAYOUT; + rel2.to: PART_MENU_AREA; min: 0 71; align: 0.5 0.0; color: 223 223 223 255; @@ -54,19 +54,31 @@ group { } } part { - name: PART_CONTENT_LAYOUT; + name: PART_THUMBNAIL_AREA; type: SWALLOW; scale: 1; description { state: "default" 0.0; rel1 { - to: "padding_content_layout"; + to: "padding_thumbnail_area"; relative: 0.0 1.0; } - rel2.to: "padding_content_layout"; - min: 0 678; + rel2.to: "padding_thumbnail_area"; + align: 0.5 0.0; + } + } + part { + name: PART_BOTTOM_AREA; + type: SWALLOW; + scale: 1; + description { + state: "default" 0.0; + rel1 { + to: PART_THUMBNAIL_AREA; + relative: 0.0 1.0; + } + rel2.to: PART_THUMBNAIL_AREA; align: 0.5 0.0; - fixed: 0 1; } } } diff --git a/res/edc/view/music.edc b/res/edc/view/music.edc deleted file mode 100644 index 946f756..0000000 --- a/res/edc/view/music.edc +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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. - */ - -group { - name: GRP_MUSIC_VIEW; - parts { - part { - name: "bg"; - type: RECT; - scale: 1; - description { - state: "default" 0.0; - color: 255 255 255 255; - } - } - part { - name: PART_MENU_LAYOUT; - type: SWALLOW; - scale: 1; - description { - state: "default" 0.0; - rel2.relative: 1.0 0.0; - align: 0.5 0.0; - } - } - part { - name: "padding_content_layout"; - type: RECT; - scale: 1; - description { - state: "default" 0.0; - rel1 { - to: PART_MENU_LAYOUT; - relative: 0.0 1.0; - } - rel2.to: PART_MENU_LAYOUT; - min: 0 71; - align: 0.5 0.0; - color: 223 223 223 255; - fixed: 0 1; - } - } - part { - name: PART_CONTENT_LAYOUT; - type: SWALLOW; - scale: 1; - description { - state: "default" 0.0; - rel1 { - to: "padding_content_layout"; - relative: 0.0 1.0; - } - rel2.to: "padding_content_layout"; - min: 0 678; - align: 0.5 0.0; - fixed: 0 1; - } - } - } -} diff --git a/src/layout/gallery.c b/src/layout/gallery.c new file mode 100644 index 0000000..85df1b1 --- /dev/null +++ b/src/layout/gallery.c @@ -0,0 +1,137 @@ +/* + * 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 "define.h" + +struct _priv { + Evas_Object *base; + Evas_Object *layout; + + layoutmgr *lmgr; +}; + +static bool _create(layoutmgr *lmgr, void *data) +{ + struct _priv *priv; + Evas_Object *base, *layout; + + if (!lmgr) { + _ERR("failed to get layoutmgr"); + return false; + } + + priv = calloc(1, sizeof(*priv)); + if (!priv) { + _ERR("failed to allocate priv"); + return false; + } + + base = layoutmgr_get_base(lmgr); + if (!base) { + _ERR("failed to get base object"); + free(priv); + return false; + } + + layout = elm_layout_add(base); + if (!layout) { + _ERR("failed to create layout"); + free(priv); + return false; + } + + if (!elm_layout_file_set(layout, EDJEFILE, GRP_GALLERY_LAYOUT)) { + _ERR("failed to set layout file"); + evas_object_del(layout); + free(priv); + } + + priv->base = base; + priv->layout = layout; + priv->lmgr = lmgr; + + layoutmgr_set_layout_data(lmgr, LAYOUT_GALLERY, priv); + + return true; +} + +static void _destroy(void *layout_data) +{ + struct _priv *priv; + + if (!layout_data) { + _ERR("failed to get layout data"); + return; + } + + priv = layout_data; + + evas_object_del(priv->layout); + free(priv); +} + +static void _show(void *layout_data) +{ + struct _priv *priv; + + if (!layout_data) { + _ERR("failed to layout data"); + return; + } + + priv = layout_data; + + evas_object_show(priv->layout); + elm_object_part_content_set(priv->base, + PART_THUMBNAIL_AREA, priv->layout); +} + +static void _hide(void *layout_data) +{ + struct _priv *priv; + + if (!layout_data) { + _ERR("failed to get layout data"); + return; + } + + priv = layout_data; + + evas_object_hide(priv->layout); + elm_object_part_content_unset(priv->base, PART_THUMBNAIL_AREA); +} + +static void _update(void *layout_data, int update_type, void *data) +{ +} + +static layout_class _lclass = { + .layout_id = LAYOUT_GALLERY, + .create = _create, + .show = _show, + .hide = _hide, + .destroy = _destroy, + .update = _update, +}; + +layout_class *layout_gallery_get_lclass(void) +{ + return &_lclass; +} diff --git a/src/layout/menu_layout.c b/src/layout/movie.c similarity index 77% rename from src/layout/menu_layout.c rename to src/layout/movie.c index a5c2cb1..14a8c16 100644 --- a/src/layout/menu_layout.c +++ b/src/layout/movie.c @@ -32,6 +32,11 @@ static bool _create(layoutmgr *lmgr, void *data) struct _priv *priv; Evas_Object *base, *layout; + if (!lmgr) { + _ERR("failed to get layoutmgr"); + return false; + } + priv = calloc(1, sizeof(*priv)); if (!priv) { _ERR("failed to allocate priv"); @@ -52,18 +57,18 @@ static bool _create(layoutmgr *lmgr, void *data) return false; } - if (!elm_layout_file_set(layout, EDJEFILE, GRP_MENU_LAYOUT)) { + if (!elm_layout_file_set(layout, EDJEFILE, GRP_MOVIE_LAYOUT)) { _ERR("failed to set layout file"); evas_object_del(layout); free(priv); } - layoutmgr_set_layout_data(lmgr, LAYOUT_MENU, priv); - priv->base = base; priv->layout = layout; priv->lmgr = lmgr; + layoutmgr_set_layout_data(lmgr, LAYOUT_MOVIE, priv); + return true; } @@ -71,8 +76,10 @@ static void _destroy(void *layout_data) { struct _priv *priv; - if (!layout_data) + if (!layout_data) { + _ERR("failed to get layout data"); return; + } priv = layout_data; @@ -84,26 +91,31 @@ static void _show(void *layout_data) { struct _priv *priv; - if (!layout_data) + if (!layout_data) { + _ERR("failed to layout data"); return; + } priv = layout_data; evas_object_show(priv->layout); - elm_object_part_content_set(priv->base, PART_MENU_LAYOUT, priv->layout); + elm_object_part_content_set(priv->base, + PART_THUMBNAIL_AREA, priv->layout); } static void _hide(void *layout_data) { struct _priv *priv; - if (!layout_data) + if (!layout_data) { + _ERR("failed to get layout data"); return; + } priv = layout_data; evas_object_hide(priv->layout); - elm_object_part_content_unset(priv->base, PART_MENU_LAYOUT); + elm_object_part_content_unset(priv->base, PART_THUMBNAIL_AREA); } static void _update(void *layout_data, int update_type, void *data) @@ -111,7 +123,7 @@ static void _update(void *layout_data, int update_type, void *data) } static layout_class _lclass = { - .layout_id = LAYOUT_MENU, + .layout_id = LAYOUT_MOVIE, .create = _create, .show = _show, .hide = _hide, @@ -119,7 +131,7 @@ static layout_class _lclass = { .update = _update, }; -layout_class *layout_menu_get_lclass(void) +layout_class *layout_movie_get_lclass(void) { return &_lclass; } diff --git a/src/layout/music.c b/src/layout/music.c new file mode 100644 index 0000000..4a95782 --- /dev/null +++ b/src/layout/music.c @@ -0,0 +1,137 @@ +/* + * 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 "define.h" + +struct _priv { + Evas_Object *base; + Evas_Object *layout; + + layoutmgr *lmgr; +}; + +static bool _create(layoutmgr *lmgr, void *data) +{ + struct _priv *priv; + Evas_Object *base, *layout; + + if (!lmgr) { + _ERR("failed to get layoutmgr"); + return false; + } + + priv = calloc(1, sizeof(*priv)); + if (!priv) { + _ERR("failed to allocate priv"); + return false; + } + + base = layoutmgr_get_base(lmgr); + if (!base) { + _ERR("failed to get base object"); + free(priv); + return false; + } + + layout = elm_layout_add(base); + if (!layout) { + _ERR("failed to create layout"); + free(priv); + return false; + } + + if (!elm_layout_file_set(layout, EDJEFILE, GRP_MUSIC_LAYOUT)) { + _ERR("failed to set layout file"); + evas_object_del(layout); + free(priv); + } + + priv->base = base; + priv->layout = layout; + priv->lmgr = lmgr; + + layoutmgr_set_layout_data(lmgr, LAYOUT_MUSIC, priv); + + return true; +} + +static void _destroy(void *layout_data) +{ + struct _priv *priv; + + if (!layout_data) { + _ERR("failed to get layout data"); + return; + } + + priv = layout_data; + + evas_object_del(priv->layout); + free(priv); +} + +static void _show(void *layout_data) +{ + struct _priv *priv; + + if (!layout_data) { + _ERR("failed to layout data"); + return; + } + + priv = layout_data; + + evas_object_show(priv->layout); + elm_object_part_content_set(priv->base, + PART_THUMBNAIL_AREA, priv->layout); +} + +static void _hide(void *layout_data) +{ + struct _priv *priv; + + if (!layout_data) { + _ERR("failed to get layout data"); + return; + } + + priv = layout_data; + + evas_object_hide(priv->layout); + elm_object_part_content_unset(priv->base, PART_THUMBNAIL_AREA); +} + +static void _update(void *layout_data, int update_type, void *data) +{ +} + +static layout_class _lclass = { + .layout_id = LAYOUT_MUSIC, + .create = _create, + .show = _show, + .hide = _hide, + .destroy = _destroy, + .update = _update, +}; + +layout_class *layout_music_get_lclass(void) +{ + return &_lclass; +} diff --git a/src/main.c b/src/main.c index 538d955..3b01bb5 100644 --- a/src/main.c +++ b/src/main.c @@ -73,9 +73,7 @@ static bool _create(void *data) return false; } - viewmgr_add_view(view_movie_get_vclass(), NULL); - viewmgr_add_view(view_gallery_get_vclass(), NULL); - viewmgr_add_view(view_music_get_vclass(), NULL); + viewmgr_add_view(view_base_get_vclass(), NULL); viewmgr_add_view(view_viewer_get_vclass(), NULL); elm_win_focus_highlight_enabled_set(win, EINA_TRUE); @@ -97,9 +95,7 @@ static void _terminate(void *data) ad = data; - viewmgr_remove_view(VIEW_MOVIE); - viewmgr_remove_view(VIEW_GALLERY); - viewmgr_remove_view(VIEW_MUSIC); + viewmgr_remove_view(VIEW_BASE); viewmgr_remove_view(VIEW_VIEWER); viewmgr_destroy(); @@ -124,7 +120,7 @@ static void _app_control(app_control_h app_control, void *data) if (ad->win) elm_win_activate(ad->win); - viewmgr_push_view(VIEW_MOVIE); + viewmgr_push_view(VIEW_BASE); } static void _pause(void *data) diff --git a/src/view/movie.c b/src/view/base.c similarity index 86% rename from src/view/movie.c rename to src/view/base.c index 4e82af6..92d5399 100644 --- a/src/view/movie.c +++ b/src/view/base.c @@ -53,20 +53,21 @@ static Evas_Object *_create(Evas_Object *win, void *data) return NULL; } - elm_layout_file_set(base, EDJEFILE, GRP_MOVIE_VIEW); + elm_layout_file_set(base, EDJEFILE, GRP_BASE_VIEW); evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, base); lmgr = layoutmgr_create(base); - layoutmgr_add_layout(lmgr, layout_menu_get_lclass(), NULL); - layoutmgr_show_layout(lmgr, LAYOUT_MENU); + layoutmgr_add_layout(lmgr, layout_movie_get_lclass(), NULL); + layoutmgr_add_layout(lmgr, layout_gallery_get_lclass(), NULL); + layoutmgr_add_layout(lmgr, layout_music_get_lclass(), NULL); priv->win = win; priv->base = base; priv->lmgr = lmgr; - viewmgr_set_view_data(VIEW_MOVIE, priv); + viewmgr_set_view_data(VIEW_BASE, priv); return base; } @@ -117,14 +118,14 @@ static void _destroy(void *view_data) } static view_class _vclass = { - .view_id = VIEW_MOVIE, + .view_id = VIEW_BASE, .create = _create, .show = _show, .hide = _hide, .destroy = _destroy, }; -view_class *view_movie_get_vclass(void) +view_class *view_base_get_vclass(void) { return &_vclass; } diff --git a/src/view/gallery.c b/src/view/gallery.c deleted file mode 100644 index 970ca82..0000000 --- a/src/view/gallery.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * 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 "define.h" -#include "layout.h" - -struct _priv { - Evas_Object *win; - Evas_Object *base; - - layoutmgr *lmgr; -}; - -static Evas_Object *_create(Evas_Object *win, void *data) -{ - struct _priv *priv; - Evas_Object *base; - layoutmgr *lmgr; - - if (!win) { - _ERR("failed to get win object"); - return NULL; - } - - priv = calloc(1, sizeof(*priv)); - if (!priv) { - _ERR("failed to allocate priv"); - return NULL; - } - - base = elm_layout_add(win); - if (!base) { - _ERR("failed to create base object"); - free(priv); - return NULL; - } - - elm_layout_file_set(base, EDJEFILE, GRP_GALLERY_VIEW); - - evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_win_resize_object_add(win, base); - - lmgr = layoutmgr_create(base); - layoutmgr_add_layout(lmgr, layout_menu_get_lclass(), NULL); - layoutmgr_show_layout(lmgr, LAYOUT_MENU); - - priv->win = win; - priv->base = base; - priv->lmgr = lmgr; - - viewmgr_set_view_data(VIEW_GALLERY, priv); - - return base; -} - -static void _show(void *view_data) -{ - struct _priv *priv; - - if (!view_data) { - _ERR("failed to get view data"); - return; - } - - priv = view_data; - - evas_object_show(priv->base); -} - -static void _hide(void *view_data) -{ - struct _priv *priv; - - if (!view_data) { - _ERR("failed to get view data"); - return; - } - - priv = view_data; - - evas_object_hide(priv->base); -} - -static void _destroy(void *view_data) -{ - struct _priv *priv; - - if (!view_data) { - _ERR("failed to get view data"); - return; - } - - priv = view_data; - - layoutmgr_destroy(priv->lmgr); - evas_object_del(priv->base); - - free(priv); -} - -static view_class _vclass = { - .view_id = VIEW_GALLERY, - .create = _create, - .show = _show, - .hide = _hide, - .destroy = _destroy, -}; - -view_class *view_gallery_get_vclass(void) -{ - return &_vclass; -} diff --git a/src/view/music.c b/src/view/music.c deleted file mode 100644 index 4280f66..0000000 --- a/src/view/music.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * 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 "define.h" -#include "layout.h" - -struct _priv { - Evas_Object *win; - Evas_Object *base; - - layoutmgr *lmgr; -}; - -static Evas_Object *_create(Evas_Object *win, void *data) -{ - struct _priv *priv; - Evas_Object *base; - layoutmgr *lmgr; - - if (!win) { - _ERR("failed to get win object"); - return NULL; - } - - priv = calloc(1, sizeof(*priv)); - if (!priv) { - _ERR("failed to allocate priv"); - return NULL; - } - - base = elm_layout_add(win); - if (!base) { - _ERR("failed to create base object"); - free(priv); - return NULL; - } - - elm_layout_file_set(base, EDJEFILE, GRP_MUSIC_VIEW); - - evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_win_resize_object_add(win, base); - - lmgr = layoutmgr_create(base); - layoutmgr_add_layout(lmgr, layout_menu_get_lclass(), NULL); - layoutmgr_show_layout(lmgr, LAYOUT_MENU); - - priv->win = win; - priv->base = base; - priv->lmgr = lmgr; - - viewmgr_set_view_data(VIEW_MUSIC, priv); - - return base; -} - -static void _show(void *view_data) -{ - struct _priv *priv; - - if (!view_data) { - _ERR("failed to get view data"); - return; - } - - priv = view_data; - - evas_object_show(priv->base); -} - -static void _hide(void *view_data) -{ - struct _priv *priv; - - if (!view_data) { - _ERR("failed to get view data"); - return; - } - - priv = view_data; - - evas_object_hide(priv->base); -} - -static void _destroy(void *view_data) -{ - struct _priv *priv; - - if (!view_data) { - _ERR("failed to get view data"); - return; - } - - priv = view_data; - - layoutmgr_destroy(priv->lmgr); - evas_object_del(priv->base); - - free(priv); -} - -static view_class _vclass = { - .view_id = VIEW_MUSIC, - .create = _create, - .show = _show, - .hide = _hide, - .destroy = _destroy, -}; - -view_class *view_music_get_vclass(void) -{ - return &_vclass; -}