EFL App for Tizen example
authorMichal Szczecinski <m.szczecinsk@partner.samsung.com>
Tue, 23 Apr 2013 12:15:00 +0000 (14:15 +0200)
committerMichal Szczecinski <m.szczecinsk@partner.samsung.com>
Tue, 23 Apr 2013 12:17:57 +0000 (14:17 +0200)
CMakeLists.sub [new file with mode: 0644]
CMakeLists.txt [new file with mode: 0644]
include/etest.h [new file with mode: 0644]
org.tizen.etest.xml [new file with mode: 0644]
packaging/org.tizen.etest.spec [new file with mode: 0644]
packaging/org.tizen.etest.spec~ [new file with mode: 0644]
res/icons/etest.png [new file with mode: 0644]
src/etest.c [new file with mode: 0755]

diff --git a/CMakeLists.sub b/CMakeLists.sub
new file mode 100644 (file)
index 0000000..a3c4e42
--- /dev/null
@@ -0,0 +1,26 @@
+## PROJECT NAME
+PROJECT(etest C)
+
+## INCLUDES
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
+
+## DEFINITIONS
+ADD_DEFINITIONS("")
+
+## LIBRARY PATH
+SET(SLP_LD_PATH_FLAGS "")
+
+## LIBRARY
+SET(SLP_LD_FLAGS "")
+
+## DEBUG
+SET(SLP_DEBUG_FLAGS "-g")
+
+## OPTIMIZATION
+SET(SLP_OPT_FLAGS "-O0")
+
+## COMPILER FLAGS
+SET(SLP_COMPILER_FLAGS "-Wall -Wunused")
+
+## LINKER FLAGS
+SET(SLP_LINKER_FLAGS "")
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644 (file)
index 0000000..ce79cdd
--- /dev/null
@@ -0,0 +1,42 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+
+# FIND ALL SOURCE IN A SOURCE DIRECTORY
+AUX_SOURCE_DIRECTORY(${CMAKE_SOURCE_DIR}/src SRCS)
+
+#INCLUDE FILE 
+INCLUDE(CMakeLists.sub)
+SET(RESOURCE_DIR "${CMAKE_SOURCE_DIR}/res")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(pkgs REQUIRED
+       bundle
+       appcore-efl
+       evas
+       elementary
+       ecore
+       eina
+)
+
+
+FOREACH(flag ${pkgs_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+
+SET(CMAKE_C_FLAGS "${SLP_DEBUG_FLAGS} ${SLP_OPT_FLAGS} ${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} ${SLP_COMPILER_FLAGS}")
+SET(CMAKE_CXX_FLAGS "${SLP_DEBUG_FLAGS} ${SLP_OPT_FLAGS} ${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} ${SLP_COMPILER_FLAGS}")
+
+MESSAGE(${CMAKE_C_FLAGS})
+
+ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
+
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} ${SLP_LD_PATH_FLAGS} ${SLP_LD_FLAGS} ${SLP_LINKER_FLAGS})
+
+# Install 
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
+INSTALL(DIRECTORY ${RESOURCE_DIR}/icons DESTINATION res) 
+# Install Manifest File
+INSTALL(FILES org.tizen.etest.xml DESTINATION /opt/share/packages)
+
+# End of a file
diff --git a/include/etest.h b/include/etest.h
new file mode 100644 (file)
index 0000000..4b1656e
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef __ETEST_H__
+#define __ETEST_H__
+
+#include <Elementary.h>
+#include <Ecore_X.h>
+#include <Elementary.h>
+#include <Evas.h>
+
+struct appdata {
+       Evas_Object *win;
+};
+
+#endif 
\ No newline at end of file
diff --git a/org.tizen.etest.xml b/org.tizen.etest.xml
new file mode 100644 (file)
index 0000000..24bafa9
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.etest" version="0.1.0" install-location="internal-only">
+       <label>etest</label>
+       <author email="m.szczecinsk@partner.samsung.com" href="www.samsung.com">Michal Szczecinski</author>
+       <description>EFL TEST APPLICATION</description>
+       <ui-application appid="org.tizen.etest" exec="/opt/usr/apps/org.tizen.etetst/bin/etest" nodisplay="false" multiple="false" type="capp" taskmanage="true">
+               <label>etest</label>
+               <icon>/usr/apps/org.tizen.etest/res/icons/etest.png</icon>
+               <label xml:lang="en-us">etest</label>
+       </ui-application>
+</manifest>
diff --git a/packaging/org.tizen.etest.spec b/packaging/org.tizen.etest.spec
new file mode 100644 (file)
index 0000000..23a17fa
--- /dev/null
@@ -0,0 +1,44 @@
+%define AppInstallPath /usr/apps/%{name}
+%define Exec etest
+
+
+Name:       org.tizen.etest
+Summary:    Empty app
+Version:    0.0.1
+Release:    1
+License:    Apache-2.0
+Source0:    %{name}-%{version}.tar.gz
+
+BuildRequires:  pkgconfig(appcore-efl)
+BuildRequires:  pkgconfig(ecore)
+BuildRequires:  pkgconfig(eina)
+BuildRequires:  pkgconfig(evas)
+BuildRequires:  pkgconfig(bundle)
+BuildRequires:  cmake
+
+
+%description
+An utility library for developers of the menu screen.
+
+%prep
+%setup -q
+
+%build
+cmake . -DCMAKE_INSTALL_PREFIX="%{AppInstallPath}" -DCMAKE_TARGET="%{Exec}" -DCMAKE_PACKAGE="%{name}"
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+%post 
+/sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%files
+%{AppInstallPath}/bin/etest
+%{AppInstallPath}/res/icons/etest.png
+/opt/share/packages/%{name}.xml
+
+
diff --git a/packaging/org.tizen.etest.spec~ b/packaging/org.tizen.etest.spec~
new file mode 100644 (file)
index 0000000..1966ae5
--- /dev/null
@@ -0,0 +1,44 @@
+%define AppInstallPath /opt/usr/apps/%{name}
+%define Exec etest
+
+
+Name:       org.tizen.etest
+Summary:    Empty app
+Version:    0.0.1
+Release:    1
+License:    Apache-2.0
+Source0:    %{name}-%{version}.tar.gz
+
+BuildRequires:  pkgconfig(appcore-efl)
+BuildRequires:  pkgconfig(ecore)
+BuildRequires:  pkgconfig(eina)
+BuildRequires:  pkgconfig(evas)
+BuildRequires:  pkgconfig(bundle)
+BuildRequires:  cmake
+
+
+%description
+An utility library for developers of the menu screen.
+
+%prep
+%setup -q
+
+%build
+cmake . -DCMAKE_INSTALL_PREFIX="%{AppInstallPath}" -DCMAKE_TARGET="%{Exec}" -DCMAKE_PACKAGE="%{name}"
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+%post 
+/sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%files
+%{AppInstallPath}/bin/etest
+%{AppInstallPath}/res/icons/etest.png
+/opt/share/packages/%{name}.xml
+
+
diff --git a/res/icons/etest.png b/res/icons/etest.png
new file mode 100644 (file)
index 0000000..778d06b
Binary files /dev/null and b/res/icons/etest.png differ
diff --git a/src/etest.c b/src/etest.c
new file mode 100755 (executable)
index 0000000..4d4b62c
--- /dev/null
@@ -0,0 +1,73 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <appcore-efl.h>
+#include <Evas.h>
+#include <Elementary.h>
+#include <Ecore_X.h>
+#include <Eina.h>
+
+#define BUF_SIZE 1024
+
+typedef struct _Win_Data
+{
+    Evas_Object *win;
+} App_Data;
+
+static int _create_app(void *data)
+{
+       printf("Application Create Callback \n");
+    App_Data *app_data = data;
+
+    Evas_Object *win;
+    int w, h;
+
+    win = elm_win_add(NULL, "Contact-viewer", ELM_WIN_BASIC);
+
+    if (!win)
+        return -1;
+
+    app_data->win = win;
+
+    elm_win_borderless_set(win, EINA_TRUE);
+    w = 100;
+    h = 200;
+    evas_object_resize(win, w, h);
+    evas_object_show(win);
+    return 0;
+}
+
+static int _terminate_app(void *data)
+{
+       printf("Application Terminate Callback \n");
+    App_Data *app_data = data;
+
+    if (app_data->win)
+        evas_object_del(app_data->win);
+
+    return 0;
+}
+
+int main(int argc, char **argv)
+{
+       printf("Application Main Function \n");
+    App_Data app_data;
+    int ret;
+    struct appcore_ops ops =
+    {
+        .create = _create_app,
+        .terminate = _terminate_app,
+        .pause = NULL,
+        .resume = NULL,
+        .reset = NULL
+    };
+    eina_init();
+    evas_init();
+    ecore_init();
+    ops.data = &app_data;
+    ret = appcore_efl_main("Etest", &argc, &argv, &ops);
+    ecore_shutdown();
+    evas_shutdown();
+    eina_shutdown();
+
+    return ret;
+}