initial commit 98/46098/1
authorSoohye Shin <soohye.shin@samsung.com>
Sun, 16 Aug 2015 02:07:23 +0000 (11:07 +0900)
committerSoohye Shin <soohye.shin@samsung.com>
Sun, 16 Aug 2015 02:08:04 +0000 (11:08 +0900)
Change-Id: If43d2fc2aff47dfc1165f10e6ae5b4286444d6f5
Signed-off-by: Soohye Shin <soohye.shin@samsung.com>
CMakeLists.txt [new file with mode: 0644]
edje/CMakeLists.txt [new file with mode: 0644]
edje/etg.edc [new file with mode: 0644]
include/defs.h [new file with mode: 0644]
org.tizen.etg.xml.in [new file with mode: 0644]
packaging/org.tizen.etg.manifest [new file with mode: 0644]
packaging/org.tizen.etg.spec [new file with mode: 0644]
src/main.c [new file with mode: 0644]

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644 (file)
index 0000000..e9f4ccd
--- /dev/null
@@ -0,0 +1,62 @@
+# 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("etg" C)
+
+IF(NOT DEFINED PACKAGE_NAME)
+       SET(PACKAGE_NAME "org.tizen.etg")
+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 MANIFESTDIR)
+       SET(MANIFESTDIR "/usr/share/packages")
+ENDIF(NOT DEFINED MANIFESTDIR)
+
+SET(TARGET_EDJ "${PROJECT_NAME}.edj")
+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}\"")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(PKGS REQUIRED
+               elementary
+               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} -Wall -Werror")
+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)
diff --git a/edje/CMakeLists.txt b/edje/CMakeLists.txt
new file mode 100644 (file)
index 0000000..42622bb
--- /dev/null
@@ -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/etg.edc b/edje/etg.edc
new file mode 100644 (file)
index 0000000..2c43ca4
--- /dev/null
@@ -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/include/defs.h b/include/defs.h
new file mode 100644 (file)
index 0000000..996fa87
--- /dev/null
@@ -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_ETG_DEFS_H__
+#define __AIR_ETG_DEFS_H__
+
+#endif /* __AIR_ETG_DEFS_H__ */
diff --git a/org.tizen.etg.xml.in b/org.tizen.etg.xml.in
new file mode 100644 (file)
index 0000000..2e46f9e
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="@PACKAGE_NAME@" version="@VERSION@" install-location="internal-only">
+       <label>etg</label>
+       <author email="soohye.shin@samsung.com" href="www.samsung.com">Soohye Shin</author>
+       <description>ETG Application</description>
+       <ui-application appid="@PACKAGE_NAME@" exec="@BINDIR@/@PROJECT_NAME@" nodisplay="true" multiple="false" type="capp" taskmanage="true">
+               <label>etg</label>
+       </ui-application>
+</manifest>
diff --git a/packaging/org.tizen.etg.manifest b/packaging/org.tizen.etg.manifest
new file mode 100644 (file)
index 0000000..97e8c31
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+       <request>
+               <domain name="_"/>
+       </request>
+</manifest>
diff --git a/packaging/org.tizen.etg.spec b/packaging/org.tizen.etg.spec
new file mode 100644 (file)
index 0000000..267133e
--- /dev/null
@@ -0,0 +1,52 @@
+Name:      org.tizen.etg
+Summary:   TV ETG application
+Version: 0.1
+Release: 1
+Group: Applications/Core Applications
+License: Apache-2.0
+Source0:   %{name}-%{version}.tar.gz
+Source1:   %{name}.manifest
+
+BuildRequires: cmake
+BuildRequires: pkgconfig(capi-appfw-application)
+BuildRequires: pkgconfig(elementary)
+BuildRequires: pkgconfig(app-utils)
+
+%define _pkgdir /usr/apps/%{name}
+%define _bindir %{_pkgdir}/bin
+%define _resdir %{_pkgdir}/res
+%define _imagedir %{_resdir}/images
+%define _edjedir %{_resdir}/edje
+%define _manifestdir /usr/share/packages
+
+%description
+Application for Interface of Connectivity
+
+%prep
+%setup -q
+cp %{SOURCE1} .
+
+%build
+cmake \
+       -DCMAKE_INSTALL_PREFIX=%{_pkgdir} \
+       -DPACKAGE_NAME=%{name} \
+       -DBINDIR=%{_bindir} \
+       -DEDJEDIR=%{_edjedir} \
+       -DIMAGEDIR=%{_imagedir} \
+       -DMANIFESTDIR=%{_manifestdir} \
+       -DVERSION=%{version}
+
+make %{?jobs:-j%jobs}
+
+%install
+%make_install
+
+%clean
+rm -rf %{buildroot}
+
+%files
+%manifest %{name}.manifest
+%defattr(-,root,root,-)
+%{_bindir}/*
+%{_resdir}/*
+%{_manifestdir}/%{name}.xml
diff --git a/src/main.c b/src/main.c
new file mode 100644 (file)
index 0000000..47b494f
--- /dev/null
@@ -0,0 +1,127 @@
+/*
+ * 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 <app.h>
+#include <Elementary.h>
+#include <app_debug.h>
+
+#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_focus_highlight_enabled_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;
+
+       if (ad->win) {
+               elm_win_activate(ad->win);
+               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);
+}
+