From: Soohye Shin Date: Wed, 3 Jun 2015 12:32:24 +0000 (+0900) Subject: initial commit X-Git-Tag: accepted/tizen/tv/20150728.070602~78 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F24%2F40424%2F6;p=profile%2Ftv%2Fapps%2Fnative%2Fair_home.git initial commit Change-Id: I508c13a144060df1c4bac9497d34cd5135271767 Signed-off-by: Soohye Shin --- diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..a48fdb0 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,74 @@ +# 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. +# + +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT("home" C) + +IF(NOT DEFINED PACKAGE_NAME) + SET(PACKAGE_NAME "org.tizen.home") +ENDIF(NOT DEFINED PACKAGE_NAME) + +SET(PREFIX ${CMAKE_INSTALL_PREFIX}) +IF(NOT DEFINED BINDIR) + SET(BINDIR"${PREFIX}/bin") +ENDIF(NOT DEFINED BINDIR) +IF(NOT DEFINED IMAGEDIR) + SET(IMAGEDIR "${PREFIX}/res/images") +ENDIF(NOT DEFINED IMAGEDIR) +IF(NOT DEFINED CFGDIR) + SET(CFGDIR "${PREFIX}/res/config") +ENDIF(NOT DEFINED CFGDIR) +IF(NOT DEFINED LOCALEDIR) + SET(LOCALEDIR "${PREFIX}/res/locale") +ENDIF(NOT DEFINED LOCALEDIR) +IF(NOT DEFINED MANIFESTDIR) + SET(MANIFESTDIR "/usr/share/packages") +ENDIF(NOT DEFINED MANIFESTDIR) + +SET(TARGET_EDJ "${PROJECT_NAME}.edj") +SET(DEFCONFIG "${PROJECT_NAME}.json") +SET(SRCS + src/main.c) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) +ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE_NAME}\"") +ADD_DEFINITIONS("-DEDJEDIR=\"${EDJEDIR}\"") +ADD_DEFINITIONS("-DEDJEFILE=\"${EDJEDIR}/${TARGET_EDJ}\"") +ADD_DEFINITIONS("-DIMAGEDIR=\"${IMAGEDIR}\"") +ADD_DEFINITIONS("-DDEFCONFIG=\"${CFGDIR}/${DEFCONFIG}\"") + +INCLUDE(FindPkgConfig) +pkg_check_modules(PKGS REQUIRED + elementary + json-glib-1.0 + gio-2.0 + libgum + app-utils + capi-appfw-application) + +FOREACH(flag ${PKGS_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") +ENDFOREACH(flag) + +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") +ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS}) +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${PKGS_LDFLAGS}) +CONFIGURE_FILE(${PACKAGE_NAME}.xml.in ${PACKAGE_NAME}.xml) + +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR}) +INSTALL(FILES ${PACKAGE_NAME}.xml DESTINATION ${MANIFESTDIR}) +INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/images/ DESTINATION ${IMAGEDIR} FILES_MATCHING PATTERN "*.png") + +ADD_SUBDIRECTORY(edje) +ADD_SUBDIRECTORY(config) diff --git a/config/CMakeLists.txt b/config/CMakeLists.txt new file mode 100644 index 0000000..9e5da62 --- /dev/null +++ b/config/CMakeLists.txt @@ -0,0 +1,17 @@ +# 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. +# + +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${DEFCONFIG}.in ${CMAKE_CURRENT_SOURCE_DIR}/${DEFCONFIG}) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${DEFCONFIG} DESTINATION ${CFGDIR}) diff --git a/config/home.json.in b/config/home.json.in new file mode 100644 index 0000000..0c48276 --- /dev/null +++ b/config/home.json.in @@ -0,0 +1,40 @@ +{ + "item": [ + { + "name": "Owner", + "icon": "@IMAGEDIR@/ico_man.png", + "package": "", + "notification": false + }, + { + "name": "Favorites", + "icon": "@IMAGEDIR@/icn_app_foc.png", + "package": "org.tizen.app-launcher-tv-ref", + "notification": false + }, + { + "name": "Media Hub", + "icon": "@IMAGEDIR@/icn_movie_foc.png", + "package": "org.tizen.gallery-tv-ref", + "notification": false + }, + { + "name": "APP", + "icon": "@IMAGEDIR@/icn_app_foc.png", + "package": "org.tizen.app-launcher-tv-ref", + "notification": false + }, + { + "name": "Notification", + "icon": "@IMAGEDIR@/icn_noti_foc.png", + "package": "org.tizen.music-player-tv-ref", + "notification": true + }, + { + "name": "Settings", + "icon": "@IMAGEDIR@/icn_history_foc.png", + "package": "org.tizen.file-broswer-tv-ref", + "notification": false + } + ] +} diff --git a/edje/CMakeLists.txt b/edje/CMakeLists.txt new file mode 100644 index 0000000..42622bb --- /dev/null +++ b/edje/CMakeLists.txt @@ -0,0 +1,8 @@ +ADD_CUSTOM_TARGET(${TARGET_EDJ} + COMMAND edje_cc -id images + ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.edc + ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_EDJ} + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.edc +) +ADD_DEPENDENCIES(${PROJECT_NAME} ${TARGET_EDJ}) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_EDJ} DESTINATION ${EDJEDIR}) diff --git a/edje/home.edc b/edje/home.edc new file mode 100644 index 0000000..2c43ca4 --- /dev/null +++ b/edje/home.edc @@ -0,0 +1,20 @@ +/* + * 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" + +collections { +} diff --git a/edje/images/ico_arrow_down.png b/edje/images/ico_arrow_down.png new file mode 100644 index 0000000..94336fc Binary files /dev/null and b/edje/images/ico_arrow_down.png differ diff --git a/edje/images/ico_arrow_up.png b/edje/images/ico_arrow_up.png new file mode 100644 index 0000000..2677c97 Binary files /dev/null and b/edje/images/ico_arrow_up.png differ diff --git a/images/icn_app_foc.png b/images/icn_app_foc.png new file mode 100644 index 0000000..168cff4 Binary files /dev/null and b/images/icn_app_foc.png differ diff --git a/images/icn_history_foc.png b/images/icn_history_foc.png new file mode 100644 index 0000000..31724a4 Binary files /dev/null and b/images/icn_history_foc.png differ diff --git a/images/icn_movie_foc.png b/images/icn_movie_foc.png new file mode 100644 index 0000000..4df351e Binary files /dev/null and b/images/icn_movie_foc.png differ diff --git a/images/icn_noti_foc.png b/images/icn_noti_foc.png new file mode 100644 index 0000000..682df4b Binary files /dev/null and b/images/icn_noti_foc.png differ diff --git a/images/ico_man.png b/images/ico_man.png new file mode 100644 index 0000000..541717e Binary files /dev/null and b/images/ico_man.png differ diff --git a/include/defs.h b/include/defs.h new file mode 100644 index 0000000..e066d89 --- /dev/null +++ b/include/defs.h @@ -0,0 +1,20 @@ +/* + * 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_DEFS_H__ +#define __AIR_HOME_DEFS_H__ + +#endif /* __AIR_HOME_DEFS_H__ */ diff --git a/org.tizen.home.xml.in b/org.tizen.home.xml.in new file mode 100644 index 0000000..a33e3df --- /dev/null +++ b/org.tizen.home.xml.in @@ -0,0 +1,9 @@ + + + + Soohye Shin + home + + + + diff --git a/packaging/org.tizen.home.manifest b/packaging/org.tizen.home.manifest new file mode 100644 index 0000000..97e8c31 --- /dev/null +++ b/packaging/org.tizen.home.manifest @@ -0,0 +1,5 @@ + + + + + diff --git a/packaging/org.tizen.home.path b/packaging/org.tizen.home.path new file mode 100644 index 0000000..4d7d360 --- /dev/null +++ b/packaging/org.tizen.home.path @@ -0,0 +1,5 @@ +[Unit] +Description=This path will tell you that home is ready to launch + +[Path] +PathExists=/run/.wm_ready diff --git a/packaging/org.tizen.home.service b/packaging/org.tizen.home.service new file mode 100644 index 0000000..a8dcbbd --- /dev/null +++ b/packaging/org.tizen.home.service @@ -0,0 +1,5 @@ +[Unit] +Description=Home-tv + +[Service] +ExecStart=/bin/sh -c -l '/usr/bin/aul_test launch org.tizen.home' diff --git a/packaging/org.tizen.home.spec b/packaging/org.tizen.home.spec new file mode 100644 index 0000000..594c5b3 --- /dev/null +++ b/packaging/org.tizen.home.spec @@ -0,0 +1,74 @@ +Name: org.tizen.home +Summary: TV home application +Version: 0.1 +Release: 1 +Group: Applications/Core Applications +License: Apache-2.0 +Source0: %{name}-%{version}.tar.gz +Source1: %{name}.service +Source2: %{name}.path +Source3: %{name}.manifest + +BuildRequires: cmake +BuildRequires: pkgconfig(capi-appfw-application) +BuildRequires: pkgconfig(elementary) +BuildRequires: pkgconfig(json-glib-1.0) +BuildRequires: pkgconfig(gio-2.0) +BuildRequires: pkgconfig(libgum) +BuildRequires: pkgconfig(app-utils) +BuildRequires: edje-bin +BuildRequires: gettext-devel + +%define _pkgdir /usr/apps/%{name} +%define _bindir %{_pkgdir}/bin +%define _resdir %{_pkgdir}/res +%define _datadir %{_pkgdir}/data +%define _imagedir %{_resdir}/images +%define _cfgdir %{_resdir}/config +%define _edjedir %{_resdir}/edje +%define _manifestdir /usr/share/packages +%define _sysuserdir /systemd/user +%define _servicedir /systemd/user/default.target.wants + +%description +Application for providing user status and launching other applications + +%prep +%setup -q +cp %{SOURCE3} . + +%build +cmake \ + -DCMAKE_INSTALL_PREFIX=%{_pkgdir} \ + -DPACKAGE_NAME=%{name} \ + -DBINDIR=%{_bindir} \ + -DEDJEDIR=%{_edjedir} \ + -DIMAGEDIR=%{_imagedir} \ + -DCFGDIR=%{_cfgdir} \ + -DMANIFESTDIR=%{_manifestdir} \ + -DVERSION=%{version} + +make %{?jobs:-j%jobs} + +%install +%make_install +install --directory %{buildroot}/%{_datadir} +install --directory %{buildroot}%{_libdir}%{_servicedir} +install -m 0644 %{SOURCE1} %{buildroot}%{_libdir}%{_sysuserdir} +install -m 0644 %{SOURCE2} %{buildroot}%{_libdir}%{_sysuserdir} +ln -sf ../%{name}.path %{buildroot}%{_libdir}%{_servicedir} + +%clean +rm -rf %{buildroot} + +%files +%manifest %{name}.manifest +%defattr(-,root,root,-) +%{_bindir}/* +%{_resdir}/* +%{_datadir} +%{_manifestdir}/%{name}.xml +%{_libdir}%{_sysuserdir}/%{name}.service +%{_libdir}%{_sysuserdir}/%{name}.path +%{_libdir}%{_servicedir}/%{name}.path + diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..4e98a9d --- /dev/null +++ b/src/main.c @@ -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 +#include +#include + +#include "defs.h" + +SET_TAG(PACKAGE); + +struct _appdata { + const char *name; + Evas_Object *win; +}; + +static Evas_Object *_add_win(const char *name) +{ + Evas_Object *win; + + win = elm_win_add(NULL, name, ELM_WIN_BASIC); + if (!win) + return NULL; + + elm_win_title_set(win, name); + elm_win_alpha_set(win, EINA_TRUE); + evas_object_show(win); + + return win; +} + +static bool _create(void *user_data) +{ + struct _appdata *ad; + Evas_Object *win; + + if (!user_data) { + _ERR("Invalid argument"); + return false; + } + + ad = user_data; + + elm_config_focus_move_policy_set(ELM_FOCUS_MOVE_POLICY_CLICK); + + win = _add_win(ad->name); + if (!win) { + _ERR("failed to create window"); + return false; + } + + ad->win = win; + + return true; +} + +static void _terminate(void *user_data) +{ + struct _appdata *ad; + + if (!user_data) + return; + + ad = user_data; + + if (ad->win) + evas_object_del(ad->win); +} + +static void _pause(void *user_data) +{ + +} + +static void _resume(void *user_data) +{ + +} + +static void _control(app_control_h app_control, void *user_data) +{ + struct _appdata *ad; + + if (!user_data) { + _ERR("Invalid argument"); + return; + } + + ad = user_data; + + evas_object_show(ad->win); +} + +int main(int argc, char **argv) +{ + struct _appdata ad; + + ui_app_lifecycle_callback_s event_callback = {0,}; + + event_callback.create = _create; + event_callback.terminate = _terminate; + event_callback.pause = _pause; + event_callback.resume = _resume; + event_callback.app_control = _control; + + memset(&ad, 0x00, sizeof(ad)); + ad.name = PACKAGE; + + return ui_app_main(argc, argv, &event_callback, &ad); +} +