apply FSL(Flora Software License)
authorKim Kibum <kb0929.kim@samsung.com>
Fri, 8 Jun 2012 05:54:02 +0000 (14:54 +0900)
committerKim Kibum <kb0929.kim@samsung.com>
Fri, 8 Jun 2012 05:54:02 +0000 (14:54 +0900)
14 files changed:
CMakeLists.txt [new file with mode: 0755]
LICENSE [new file with mode: 0755]
NOTICE [new file with mode: 0755]
debian/changelog [new file with mode: 0755]
debian/compat [new file with mode: 0755]
debian/control [new file with mode: 0755]
debian/org.tizen.image-viewer.install.in [new file with mode: 0755]
debian/org.tizen.image-viewer.postinst [new file with mode: 0755]
debian/rules [new file with mode: 0755]
include/image-viewer.h [new file with mode: 0755]
org.tizen.image-viewer.desktop.in [new file with mode: 0755]
org.tizen.image-viewer.png [new file with mode: 0755]
packaging/org.tizen.image-viewer.spec [new file with mode: 0755]
src/image-viewer.c [new file with mode: 0755]

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..1a7abcc
--- /dev/null
@@ -0,0 +1,47 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(image-viewer C)
+
+SET(DEBFILE_NAME org.tizen.image-viewer)
+
+SET(SRCS
+       src/image-viewer.c
+)
+
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}
+${CMAKE_CURRENT_SOURCE_DIR}/include/
+)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(pkgs REQUIRED appcore-efl appcore-common utilX elementary ui-gadget
+evas ecore-x ecore ecore-input appsvc)
+
+FOREACH(flag ${pkgs_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+
+#SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
+
+# install desktop file & icon
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+CONFIGURE_FILE(${DEBFILE_NAME}.desktop.in ${CMAKE_SOURCE_DIR}/${DEBFILE_NAME}.desktop)
+
+SET(BINDIR "${PREFIX}/bin")
+SET(RESDIR "${PREFIX}/res")
+SET(DATADIR "${PREFIX}/data")
+SET(LOCALEDIR "${RESDIR}/locale")
+SET(ICONDIR "${RESDIR}/icons/default/small")
+SET(EDJDIR "${RESDIR}/edje")
+
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/${DEBFILE_NAME}.desktop DESTINATION /opt/share/applications)
+INSTALL(DIRECTORY DESTINATION ${DATADIR})
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/${DEBFILE_NAME}.png DESTINATION ${ICONDIR})
+
+ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} )
+
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
+
diff --git a/LICENSE b/LICENSE
new file mode 100755 (executable)
index 0000000..7ccb5b5
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,75 @@
+Flora License
+
+Version 1.0, May, 2012
+
+http://www.tizenopensource.org/license
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+
+"Tizen Certified Platform" shall mean a software platform that complies with the standards set forth in the Compatibility Definition Document and passes the Compatibility Test Suite as defined from time to time by the Tizen Technical Steering Group and certified by the Tizen Association or its designated agent.
+
+2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work solely as incorporated into a Tizen Certified Platform, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work solely as incorporated into a Tizen Certified Platform to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof pursuant to the copyright license above, in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+
+  1. You must give any other recipients of the Work or Derivative Works a copy of this License; and
+
+  2. You must cause any modified files to carry prominent notices stating that You changed the files; and
+
+  3. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
+
+  4. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Flora License to your work
+
+To apply the Flora License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Flora License, Version 1.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.tizenopensource.org/license
+
+   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.
diff --git a/NOTICE b/NOTICE
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/debian/changelog b/debian/changelog
new file mode 100755 (executable)
index 0000000..8838543
--- /dev/null
@@ -0,0 +1,8 @@
+image-viewer (1.0-58) unstable; urgency=low
+
+   * Initial version
+   * Git: pkgs/i/image-viewer
+   * Tag: image-viewer_1.0-58 
+
+ -- Jisung Ahn <jcastle.ahn@samsung.com>  Fri, 17 Feb 2012 12:44:50 +0900
+
diff --git a/debian/compat b/debian/compat
new file mode 100755 (executable)
index 0000000..7ed6ff8
--- /dev/null
@@ -0,0 +1 @@
+5
diff --git a/debian/control b/debian/control
new file mode 100755 (executable)
index 0000000..d431800
--- /dev/null
@@ -0,0 +1,42 @@
+Source: image-viewer
+Section: misc
+Priority: extra
+Maintainer:  Li Suxia <suxia.li@samsung.com>, Tang Feng <feng.tang@samsung.com>, Hyunwoo Kim <hw4444.kim@samsung.com>, Jisung Ahn <jcastle.ahn@samsung.com>, Sangjin Han <sjhan.han@samsung.com>
+Uploaders: Tang Feng <feng.tang@samsung.com>, Hyunwoo Kim <hw4444.kim@samsung.com>
+Build-Depends: debhelper (>= 5), 
+       autotools-dev,
+       libappcore-efl-dev, 
+       libelm-dev, 
+       libedje-dev, 
+       libevas-dev, 
+       libecore-dev, 
+       libui-gadget-dev, 
+       libaul-1-dev,
+       libappsvc-dev,
+       libslp-setting-dev,
+       libslp-utilx-dev
+Standards-Version: 0.1.0
+
+Package: org.tizen.image-viewer
+Section: misc
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, 
+       libappcore-efl-0, 
+       libelm, 
+       libedje, 
+       libevas,
+       libecore, 
+       libui-gadget-0,
+       libslp-utilx-0,
+       libappsvc-0,
+       libslp-setting-0,
+       libug-image-viewer-efl
+Description: Image Viewer Application v1.0
+
+Package: org.tizen.image-viewer-dbg
+Section: debug
+Architecture: any
+Depends: ${misc:Depends}, org.tizen.image-viewer (= ${Source-Version})
+Description: Image Viewer Application (unstripped)
+
+
diff --git a/debian/org.tizen.image-viewer.install.in b/debian/org.tizen.image-viewer.install.in
new file mode 100755 (executable)
index 0000000..789a139
--- /dev/null
@@ -0,0 +1,6 @@
+@PREFIX@/bin/*
+@PREFIX@/res/icons/*
+@PREFIX@/data
+/opt/share/applications/*
+
+
diff --git a/debian/org.tizen.image-viewer.postinst b/debian/org.tizen.image-viewer.postinst
new file mode 100755 (executable)
index 0000000..7ea27e6
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+if [ ${USER} == "root" ]
+then
+       # 5000 is inhouse user id
+       # do not use relative path
+       chown -R 5000:5000 /opt/apps/org.tizen.image-viewer/data
+fi
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..702fa63
--- /dev/null
@@ -0,0 +1,132 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+CFLAGS ?= -Wall -g
+CXXFLAGS ?=  -Wall -g
+LDFLAGS ?=
+PREFIX ?= /opt/apps/org.tizen.image-viewer
+RESDIR ?= /opt/apps/org.tizen.image-viewer/res
+DATADIR ?= /opt/apps/org.tizen.image-viewer/data
+
+CFLAGS += -fpic
+CXXFLAGS += -fpic
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+       CFLAGS += -O0
+       CXXFLAGS += -O0
+else
+       CFLAGS += -O2
+       CXXFLAGS += -O2
+endif
+
+LDFLAGS += -Wl,--rpath=$(PREFIX)/lib -Wl,--as-needed -pie
+
+configure: configure-stamp
+configure-stamp:
+       dh_testdir
+       # Add here commands to configure the package.
+       CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" cmake . -DCMAKE_INSTALL_PREFIX=$(PREFIX)
+
+       touch configure-stamp
+
+build: build-stamp
+
+build-stamp: configure-stamp 
+       dh_testdir
+
+       # Add here commands to compile the package.
+       $(MAKE)
+       #docbook-to-man debian/wavplayer.sgml > wavplayer.1
+
+       for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
+               cat $$f > $${f%.in}; \
+               sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \
+               sed -i -e "s#@RESDIR@#$(RESDIR)#g" $${f%.in}; \
+               sed -i -e "s#@DATADIR@#$(DATADIR)#g" $${f%.in}; \
+       done
+
+
+       touch $@
+
+clean:
+       dh_testdir
+       dh_testroot
+       rm -f build-stamp configure-stamp
+
+       # Add here commands to clean up after the build process.
+       -$(MAKE) clean
+       rm -rf CMakeCache.txt
+       rm -rf CMakeFiles
+       rm -rf cmake_install.cmake
+       rm -rf Makefile
+       rm -rf install_manifest.txt
+       rm -rf *.so
+       rm -rf *.desktop
+       find -name CMakeFiles | xargs rm -rf
+       find -name cmake_install.cmake | xargs rm -rf
+       find -name Makefile | xargs rm -rf
+       find -name "*.cmake" | xargs rm -rf
+       find -name "*.edj" | xargs rm -rf
+
+       for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
+               rm -f $${f%.in}; \
+       done
+
+       dh_clean 
+
+
+install: build
+       dh_testdir
+       dh_testroot
+       dh_clean -k 
+       dh_installdirs
+
+       # Add here commands to install the package into debian/wavplayer.
+       $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+       dh_testdir
+       dh_testroot
+#      dh_installchangelogs 
+#      dh_installdocs
+       dh_installexamples
+       dh_install --sourcedir=debian/tmp
+#      dh_installmenu
+#      dh_installdebconf       
+#      dh_installlogrotate
+#      dh_installemacsen
+#      dh_installpam
+#      dh_installmime
+#      dh_python
+#      dh_installinit
+#      dh_installcron
+#      dh_installinfo
+       dh_installman
+       dh_link
+       dh_strip --dbg-package=org.tizen.image-viewer-dbg
+       dh_compress
+       dh_fixperms
+#      dh_perl
+       dh_makeshlibs
+       dh_installdeb
+       dh_shlibdeps
+       dh_gencontrol
+       dh_md5sums
+       dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
diff --git a/include/image-viewer.h b/include/image-viewer.h
new file mode 100755 (executable)
index 0000000..5e55a79
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2012  Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
+ *
+ * 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 <Elementary.h>
+
+#define IV_LOG_OUTPUT_DLOG
+
+#ifdef IV_LOG_OUTPUT_DLOG
+
+#include <dlog.h>
+
+#undef LOG_TAG
+#define LOG_TAG "IMAGE-VIEWER"
+
+#define iv_debug_msg(type, fmt, arg...)        LOGD("[%s : %05d]" fmt "\n", __func__, __LINE__, ##arg)
+
+#else /*IV_LOG_OUTPUT_DLOG*/
+
+#define iv_debug_msg(type, fmt,arg...) fprintf(stdout, "[%s: %d] [%s]" fmt "\n", __FILE__, __LINE__, __FUNCTION__, ##arg)
+
+#endif
+
+
+#  define iv_ret_if(expr) do { \
+                if(expr) { \
+                        fprintf(stderr, "(%s) -> %s:%d() return\n", #expr, __func__, __LINE__); \
+                        return; \
+                } \
+        } while (0)
+
+#  define iv_retv_if(expr, val) do { \
+                if(expr) { \
+                        fprintf(stderr, "(%s) -> %s():%d return\n", #expr, __func__, __LINE__); \
+                        return (val); \
+                } \
+        } while (0)
+
+typedef struct appdata_iv
+{
+       int win_w;
+       int win_h;
+
+       Evas *evas;
+       Evas_Object* win_main;
+       Evas_Object* ly_main;
+
+       struct ui_gadget *iv_ug;
+
+       Evas_Object* iv_bg;
+       const char* iv_param_path;
+       const char* sort_type;
+       const char* view_mode;
+       const char* media_type;
+       const char* view_by;
+
+} appdata_iv;
+
diff --git a/org.tizen.image-viewer.desktop.in b/org.tizen.image-viewer.desktop.in
new file mode 100755 (executable)
index 0000000..e7ced77
--- /dev/null
@@ -0,0 +1,12 @@
+Name=Image Viewer
+Type=Application
+Exec=${PREFIX}/bin/image-viewer
+Icon=org.tizen.image-viewer.png
+Nodisplay=True
+Version=0.1.0
+Comment=image viewer app 
+MimeType=image/jpeg;image/bmp;image/png;image/gif;image/vnd.wap.wbmp
+X-Tizen-TaskManage=True
+X-Tizen-Multiple=False
+X-Tizen-SVC=http://tizen.org/appsvc/operation/view|NULL|image/jpeg; http://tizen.org/appsvc/operation/view|NULL|image/bmp; http://tizen.org/appsvc/operation/view|NULL|image/png; http://tizen.org/appsvc/operation/view|NULL|image/gif; http://tizen.org/appsvc/operation/view|NULL|image/vnd.wap.wbmp; http://tizen.org/appsvc/operation/view|http|image/jpeg; http://tizen.org/appsvc/operation/view|http|image/bmp; http://tizen.org/appsvc/operation/view|http|image/png; http://tizen.org/appsvc/operation/view|http|image/gif; http://tizen.org/appsvc/operation/view|http|image/vnd.wap.wbmp;
+X-Tizen-Removable=False
diff --git a/org.tizen.image-viewer.png b/org.tizen.image-viewer.png
new file mode 100755 (executable)
index 0000000..1a0c715
Binary files /dev/null and b/org.tizen.image-viewer.png differ
diff --git a/packaging/org.tizen.image-viewer.spec b/packaging/org.tizen.image-viewer.spec
new file mode 100755 (executable)
index 0000000..f13e1dc
--- /dev/null
@@ -0,0 +1,51 @@
+Name:       org.tizen.image-viewer
+Summary:    Image Viewer Application v1.0
+Version:    1.0
+Release:    1
+Group:      misc
+License:    Flora Software License
+Source0:    %{name}-%{version}.tar.gz
+BuildRequires:  pkgconfig(appcore-efl)
+BuildRequires:  pkgconfig(elementary)
+BuildRequires:  pkgconfig(edje)
+BuildRequires:  pkgconfig(evas)
+BuildRequires:  pkgconfig(ecore-input)
+BuildRequires:  pkgconfig(ui-gadget)
+BuildRequires:  pkgconfig(aul)
+BuildRequires:  pkgconfig(utilX)
+BuildRequires:  pkgconfig(appsvc)
+BuildRequires:  pkgconfig(vconf)
+BuildRequires:  pkgconfig(dlog)
+
+BuildRequires:  cmake
+BuildRequires:  edje-bin
+BuildRequires:  embryo-bin
+
+%description
+Image Viewer Application v1.0.
+
+
+
+%prep
+%setup -q
+
+
+%build
+
+cmake . -DCMAKE_INSTALL_PREFIX="/opt/apps/org.tizen.image-viewer" -DRESDIR="/opt/apps/org.tizen.image-viewer/res" -DDATADIR="/opt/apps/org.tizen.image-viewer/data"
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+mkdir -p %{buildroot}/opt/apps/org.tizen.image-viewer/data
+
+%post
+chown -R 5000:5000 /opt/apps/org.tizen.image-viewer/data
+
+%files
+/opt/apps/org.tizen.image-viewer/bin/image-viewer
+/opt/apps/org.tizen.image-viewer/res/icons/default/small/org.tizen.image-viewer.png
+/opt/share/applications/org.tizen.image-viewer.desktop
+/opt/apps/org.tizen.image-viewer/data
diff --git a/src/image-viewer.c b/src/image-viewer.c
new file mode 100755 (executable)
index 0000000..b4c075e
--- /dev/null
@@ -0,0 +1,634 @@
+/*
+ * Copyright 2012  Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
+ *
+ * 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 <stdio.h>
+#include <Elementary.h>
+#include <appcore-efl.h>
+#include <appcore-common.h>
+#include <utilX.h>
+#include <Evas.h>
+#include <Ecore_X.h>
+
+#include <ui-gadget-module.h>
+#include <ui-gadget.h>
+#include <aul.h>
+#include <appsvc.h>
+#include <stdbool.h>
+#include <vconf.h>
+#include <vconf-keys.h>
+
+#include "image-viewer.h"
+
+#define PACKAGE "image-viewer"
+#define LOCALEDIR "/opt/apps/com.image-viewer/res/locale"
+
+#define UG_MODE_NORMAL "NORMAL"
+#define UG_MODE_SINGLE "SINGLE"
+#define UG_STANDALONE_VALUE "TRUE"
+
+void sample_cb(const char *k, const char *v, void *data)
+{
+       iv_debug_msg(MB_DEBUG_LOG,"%s -> %s", k, v);
+}
+
+
+static bool _parsing_bundle(bundle *b, void *data)
+{
+       iv_retv_if(data == NULL, false);
+       iv_retv_if(b == NULL, false);
+
+       appdata_iv *ap = (appdata_iv *)data;
+
+       const char *uri = NULL;
+       const char *operation = appsvc_get_operation(b);
+       if(operation != NULL && strcmp(operation, APPSVC_OPERATION_VIEW) == 0)
+       {
+               uri = appsvc_get_uri(b);
+               if(uri == NULL)
+               {
+                       iv_debug_msg(MB_DEBUG_LOG, "uri is NULL");
+                       return false;
+               }
+
+               ap->iv_param_path = uri;
+               ap->view_mode = appsvc_get_data(b, "View Mode");
+               ap->sort_type = appsvc_get_data(b, "Sort By");
+               ap->view_by = appsvc_get_data(b, "View By");
+               ap->media_type = appsvc_get_data(b, "Media type");
+
+               iv_debug_msg(MB_DEBUG_LOG,"*****************************");
+               iv_debug_msg(MB_DEBUG_LOG,"org.tizen.image-viewer : Case 1");
+               iv_debug_msg(MB_DEBUG_LOG,"  Operation : %s", operation);
+               iv_debug_msg(MB_DEBUG_LOG,"  URI path  : %s", ap->iv_param_path);
+               iv_debug_msg(MB_DEBUG_LOG,"  View Mode : %s", ap->view_mode);
+               iv_debug_msg(MB_DEBUG_LOG,"  Sort Type : %s", ap->sort_type);
+               iv_debug_msg(MB_DEBUG_LOG,"  View By   : %s", ap->view_by);
+               iv_debug_msg(MB_DEBUG_LOG,"  Media Type: %s", ap->media_type);
+               iv_debug_msg(MB_DEBUG_LOG,"*****************************");
+
+       }
+       else /* it is temp code, for backward compatability */
+       {
+               uri = bundle_get_val(b, AUL_K_MIME_CONTENT);
+               if(uri == NULL)
+               {
+                       iv_debug_msg(MB_DEBUG_LOG, "uri is NULL. %s", AUL_K_MIME_CONTENT);
+
+                       // iv_debug_msg(MB_DEBUG_LOG,"*****************************");
+
+                       // bundle_iterate(b, sample_cb, NULL);
+
+                       // iv_debug_msg(MB_DEBUG_LOG,"*****************************");
+
+                       if ( ap->iv_param_path == NULL )
+                       {
+                               iv_debug_msg(MB_DEBUG_LOG, "URI and Path is all empty. finish appl");
+                               return false;
+                       }
+               }
+               else
+               {
+                       ap->iv_param_path = uri;
+               }
+
+               ap->view_mode = bundle_get_val(b, "View Mode");
+               ap->sort_type = bundle_get_val(b, "Sort By");
+               ap->view_by = bundle_get_val(b, "View By");
+               ap->media_type = bundle_get_val(b, "Media type");
+
+               iv_debug_msg(MB_DEBUG_LOG,"*****************************");
+               iv_debug_msg(MB_DEBUG_LOG,"org.tizen.image-viewer : Case 2");
+               iv_debug_msg(MB_DEBUG_LOG,"  Operation : %s", operation);
+               iv_debug_msg(MB_DEBUG_LOG,"  URI path  : %s", ap->iv_param_path);
+               iv_debug_msg(MB_DEBUG_LOG,"  View Mode : %s", ap->view_mode);
+               iv_debug_msg(MB_DEBUG_LOG,"  Sort Type : %s", ap->sort_type);
+               iv_debug_msg(MB_DEBUG_LOG,"  View By   : %s", ap->view_by);
+               iv_debug_msg(MB_DEBUG_LOG,"  Media Type: %s", ap->media_type);
+               iv_debug_msg(MB_DEBUG_LOG,"*****************************");
+
+       }
+       return true;
+}
+
+static void __back_cb(void *data);
+
+/**
+* @brief       The win delete function
+*
+* @param data
+* @param obj
+* @param event_info
+*/
+static void win_del(void *data, Evas_Object *obj, void *event_info)
+{
+       elm_exit();
+}
+
+
+/**
+* @brief       The hard key up exit callback
+*
+* @param data  The app data
+* @param type
+* @param event The event key
+*
+* @return      0
+*/
+static Eina_Bool _keydown_event(void *data, int type, void *event)
+{
+       iv_retv_if(data == NULL, ECORE_CALLBACK_CANCEL);
+
+       Ecore_Event_Key *ev = event;
+       appdata_iv *ad = (appdata_iv *)data;
+
+       if (!strcmp(ev->keyname, KEY_END))
+       {
+               iv_debug_msg(MB_DEBUG_LOG, "End Key DOWN");
+               if (ad->iv_ug)
+               {
+                       ug_destroy(ad->iv_ug);
+               }
+
+               elm_exit();
+       }
+
+       return ECORE_CALLBACK_RENEW;
+}
+
+/**
+* @brief       The hard key up exit callback
+*
+* @param data  The app data
+* @param type
+* @param event The event key
+*
+* @return      0
+*/
+static Eina_Bool _keyup_event(void *data, int type, void *event)
+{
+       Ecore_Event_Key *ev = event;
+
+       if (!strcmp(ev->keyname, KEY_END))
+       {
+               iv_debug_msg(MB_DEBUG_LOG, "End Key UP");
+       }
+
+       return ECORE_CALLBACK_RENEW;
+
+}
+
+
+/**
+* @brief The language change  callback
+*
+* @param data  The user data
+*
+* @return      0 on sucess
+*/
+static int lang_changed(void *data)
+{
+       ug_send_event( UG_EVENT_LANG_CHANGE );
+       return 0;
+}
+
+/**
+* @brief       The low batter callback
+*
+* @param data  The user data
+*
+* @return      0 on sucess
+*/
+static int low_battery_cb(void *data)
+{
+       ug_send_event( APPCORE_EVENT_LOW_BATTERY );
+       return 0;
+}
+
+/**
+* @brief       The low memory callback
+*
+* @param data  The user data
+*
+* @return      0 on sucess
+*/
+static int low_memory_cb(void *data)
+{
+       ug_send_event( APPCORE_EVENT_LOW_MEMORY );
+       return 0;
+}
+
+
+/**
+* @brief       Create the main window
+*
+* @param name  The title of the window
+*
+* @return  the win on sucess
+*/
+static Evas_Object* create_win(const char *name)
+{
+       iv_retv_if(name == NULL, NULL);
+       Evas_Object *eo;
+       int w, h;
+
+       eo = elm_win_add(NULL, name, ELM_WIN_BASIC);
+       if (eo)
+       {
+               elm_win_title_set(eo, name);
+               elm_win_borderless_set(eo, EINA_TRUE);
+               evas_object_smart_callback_add(eo, "delete,request",
+                               win_del, NULL);
+               ecore_x_window_size_get(ecore_x_window_root_first_get(),
+                               &w, &h);
+               evas_object_resize(eo, w, h);
+       }
+
+       return eo;
+}
+
+/**
+* @brief Create the background
+*
+* @param ap    The app data
+*/
+static void
+iv_ui_background_create(appdata_iv* ap)
+{
+       iv_ret_if(ap == NULL);
+       Evas_Object *black = NULL;
+       ap->iv_bg = black =  evas_object_rectangle_add(ap->evas);
+       evas_object_color_set(black, 0, 0, 0,255);
+       elm_win_resize_object_add(ap->win_main, ap->iv_bg);
+       evas_object_show(black);
+       evas_object_repeat_events_set(black, EINA_FALSE);
+}
+
+
+
+/**
+* @brief The back callback to destroy UG created
+*
+* @param data The app data
+*/
+static void __back_cb(void *data)
+{
+       iv_ret_if(data == NULL);
+       appdata_iv *ap = (appdata_iv *)data;
+
+       if(ap->iv_ug)
+       {
+               ug_destroy(ap->iv_ug);
+       }
+}
+
+static Evas_Object* load_edj(Evas_Object *parent, const char *file,
+               const char *group)
+{
+       Evas_Object *eo;
+       int r;
+
+       eo = elm_layout_add(parent);
+       if (eo)
+       {
+               r = elm_layout_file_set(eo, file, group);
+               if (!r) {
+                       evas_object_del(eo);
+                       return NULL;
+               }
+
+               evas_object_size_hint_weight_set(eo,
+                               EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       }
+
+       return eo;
+}
+
+
+/**
+* @brief The layout callback after ug created
+*
+* @param ug    The ug created
+* @param mode  The UG mode, FULLVIEW or FRAMEVIEW
+* @param priv  The privite data
+*/
+void ug_layout_cb( struct ui_gadget *ug, enum ug_mode mode, void* priv)
+{
+       Evas_Object *base, *win;
+
+       if (!ug || !priv)
+       {
+               return;
+       }
+
+       base = ug_get_layout(ug);
+       if (!base)
+       {
+               return;
+       }
+
+       win = ug_get_window();
+
+       switch (mode) {
+       case UG_MODE_FULLVIEW:
+               evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+               elm_win_resize_object_add(win, base);
+               ug_disable_effect(ug);
+               evas_object_show(base);
+               break;
+       default:
+               iv_debug_msg(MB_DEBUG_LOG, "Unknow UG mode : %d", mode);
+               break;
+       }
+
+}
+
+/**
+* @brief       The return callback on ug send result
+*
+* @param ug    The ug created
+* @param result        The result received from ug
+* @param priv  The privite data
+*/
+void ug_return_cb( struct ui_gadget *ug, bundle *result, void *priv)
+{
+       appdata_iv *ap;
+
+       if (!ug || !priv)
+       {
+               return;
+       }
+       ap = priv;
+
+       ug_destroy(ug);
+       ap->iv_ug = NULL;
+}
+
+/**
+* @brief The close callback on ug destroy
+*
+* @param ug    The ug created
+* @param priv  The privite data
+*/
+void ug_closed_cb( struct ui_gadget *ug, void *priv)
+{
+       if(ug)
+       {
+               ug_destroy(ug);
+       }
+
+       elm_exit();
+}
+
+/**
+* @brief       Create the image-viewer-ug
+*
+* @param data  The app data
+*
+* @return  ug on sucess, NULL on fail
+*/
+struct ui_gadget *create_ug(void* data)
+{
+       iv_retv_if(data == NULL, NULL);
+
+       appdata_iv *ap = (struct appdata_iv *)data;
+
+       iv_debug_msg(MB_DEBUG_LOG, "");
+       if(!(ap->iv_param_path))
+       {
+               return NULL;
+       }
+
+       struct ui_gadget *ug;
+       struct ug_cbs cbs;
+       memset(&cbs, 0x0, sizeof(struct ug_cbs));
+
+       bundle *b;
+
+       b = bundle_create();
+       if (!b)
+       {
+               iv_debug_msg(MB_DEBUG_LOG, "Bundle create error!");
+               return NULL;
+       }
+
+       if(ap->view_mode && strcmp(ap->view_mode, UG_MODE_NORMAL) == 0)
+       {
+               bundle_add(b, "View Mode", UG_MODE_NORMAL);
+       }
+       else
+       {
+               bundle_add(b, "View Mode", UG_MODE_SINGLE);
+       }
+
+       if(ap->sort_type)
+       {
+               bundle_add(b, "Sort By", ap->sort_type);
+       }
+
+       if(ap->view_by)
+       {
+               bundle_add(b, "View By", ap->view_by);
+       }
+
+       if(ap->media_type)
+       {
+               bundle_add(b, "Media type", ap->media_type);
+       }
+
+       bundle_add(b, "Path", ap->iv_param_path);
+
+       bundle_add(b, "Standalone", UG_STANDALONE_VALUE);
+
+       cbs.layout_cb = ug_layout_cb;
+       cbs.result_cb = ug_return_cb;
+       cbs.destroy_cb = ug_closed_cb;
+       cbs.priv = ap;
+
+       ug = ug_create(NULL, "image-viewer-efl", UG_MODE_FULLVIEW, b, &cbs);
+
+       bundle_free(b);
+
+       iv_debug_msg(MB_DEBUG_LOG, "");
+       return ug;
+}
+
+/**
+* @brief Called before main loop
+*
+* @param data The user data
+*
+* @return      0 on sucess
+*/
+static int app_create(void *data)
+{
+       iv_retv_if(data == NULL, -1);
+       iv_debug_msg(MB_DEBUG_LOG, "");
+       appdata_iv *ap = (appdata_iv *) data;
+
+       Evas_Object *win = create_win(PACKAGE);
+
+       Evas_Object *ly;
+       iv_retv_if(win == NULL, -1);
+
+       ap->win_main = win;
+
+       UG_INIT_EFL(ap->win_main, UG_OPT_INDICATOR_ENABLE);
+
+       lang_changed(ap);
+
+       /* add system event callback */
+       appcore_set_event_callback(APPCORE_EVENT_LANG_CHANGE, lang_changed, ap);
+       appcore_set_event_callback(APPCORE_EVENT_LOW_BATTERY, low_battery_cb, ap);
+       appcore_set_event_callback(APPCORE_EVENT_LOW_MEMORY, low_memory_cb, ap);
+
+       ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, _keydown_event, ap);
+       ecore_event_handler_add(ECORE_EVENT_KEY_UP, _keyup_event, ap);
+
+       return 0;
+}
+
+/**
+* @brief Called after main loop, terminate the app
+*
+* @param data The user data
+*
+* @return      0 on sucess
+*/
+static int app_terminate(void *data)
+{
+
+       if(data)
+       {
+               __back_cb(data);
+       }
+
+       elm_exit();
+
+       iv_debug_msg(MB_DEBUG_LOG, "exit");
+
+       return 0;
+}
+
+/**
+* @brief Called when every window goes back
+*
+* @param data The user data
+*
+* @return      0 on sucess
+*/
+static int app_pause(void *data)
+{
+       iv_debug_msg(MB_DEBUG_LOG, "");
+       ug_pause();
+       return -1;
+}
+
+/**
+* @brief Called when any window comes on top
+*
+* @param data  The user data
+*
+* @return      0 on sucess
+*/
+static int app_resume(void *data)
+{
+       iv_debug_msg(MB_DEBUG_LOG, "");
+
+       ug_resume();
+       return 0;
+}
+
+/**
+* @brief Called at the first idler and every relaunching
+*
+* @param b     The bundle param
+* @param data  The user data
+*
+* @return 0 on sucess
+*/
+static int app_reset(bundle *b, void *data)
+{
+       iv_retv_if(data == NULL, -1);
+       iv_debug_msg(MB_DEBUG_LOG, "");
+
+       appdata_iv *ap = (appdata_iv *)data;
+
+       if (ap->win_main)
+       {
+               elm_win_activate(ap->win_main);
+               evas_object_show(ap->win_main);
+       }
+
+       bool ret = false;
+
+       ret = _parsing_bundle(b, data);
+       if(ret == false)
+       {
+               iv_debug_msg(MB_DEBUG_LOG, "Cannot lauch Image Viewer");
+               return 0;
+       }
+
+       if(ap->iv_ug != NULL)
+       {
+               // Create Previous UG if exist
+               iv_debug_msg(MB_DEBUG_LOG, "Removing previous UG=0x%08x", ap->iv_ug);
+               ug_destroy(ap->iv_ug);
+               ap->iv_ug = NULL;
+       }
+
+       ap->iv_ug = create_ug(ap);
+       if(ap->iv_ug == NULL)
+       {
+               iv_debug_msg(MB_DEBUG_LOG, "create_ug failed. Terminated");
+               elm_exit();
+               return ;
+       }
+
+       return 0;
+}
+
+/**
+* @brief The main function
+*
+* @param argc  The number of arguments
+* @param argv[] The arguments
+*
+* @return 0 on sucess, others on fail
+*/
+int main(int argc, char *argv[])
+{
+       struct appcore_ops ops = {
+               .create = app_create,
+               .terminate = app_terminate,
+               .pause = app_pause,
+               .resume = app_resume,
+               .reset = app_reset,
+       };
+
+       appdata_iv ap;
+
+       memset( &ap, 0x0, sizeof( appdata_iv ) );
+       ops.data = &ap;
+
+       if ( argc == 2 )
+       {
+               ap.iv_param_path = strdup(argv[1]);
+       }
+
+       return appcore_efl_main(PACKAGE, &argc, &argv, &ops);
+}
+