apply FSL(Flora Software License)
authorKim Kibum <kb0929.kim@samsung.com>
Fri, 8 Jun 2012 05:54:06 +0000 (14:54 +0900)
committerKim Kibum <kb0929.kim@samsung.com>
Fri, 8 Jun 2012 05:54:06 +0000 (14:54 +0900)
52 files changed:
CMakeLists.txt [new file with mode: 0644]
LICENSE [new file with mode: 0644]
NOTICE [new file with mode: 0644]
data/CMakeLists.txt [new file with mode: 0644]
data/edje/CMakeLists.txt [new file with mode: 0644]
data/edje/all_apps_portrait.edc [new file with mode: 0644]
data/edje/group_4x4_portrait.edc [new file with mode: 0644]
data/edje/item_4x4.edc [new file with mode: 0644]
data/edje/layout_portrait.edc [new file with mode: 0644]
data/edje/pagecontrol.edc [new file with mode: 0644]
data/menu-screen-env.sh [new file with mode: 0755]
data/org.tizen.menu-screen.desktop.in [new file with mode: 0644]
debian/changelog [new file with mode: 0644]
debian/compat [new file with mode: 0644]
debian/control [new file with mode: 0644]
debian/copyright [new file with mode: 0644]
debian/jobs [new file with mode: 0644]
debian/org.tizen.menu-screen.install.in [new file with mode: 0644]
debian/org.tizen.menu-screen.postinst [new file with mode: 0644]
debian/rules [new file with mode: 0755]
include/all_apps/layout.h [new file with mode: 0644]
include/all_apps/list.h [new file with mode: 0644]
include/conf.h [new file with mode: 0644]
include/index.h [new file with mode: 0644]
include/item.h [new file with mode: 0644]
include/item_event.h [new file with mode: 0644]
include/layout.h [new file with mode: 0644]
include/list.h [new file with mode: 0644]
include/mapbuf.h [new file with mode: 0644]
include/menu_screen.h [new file with mode: 0644]
include/mouse.h [new file with mode: 0644]
include/page.h [new file with mode: 0644]
include/page_scroller.h [new file with mode: 0644]
include/pkgmgr.h [new file with mode: 0644]
include/popup.h [new file with mode: 0644]
include/util.h [new file with mode: 0644]
packaging/org.tizen.menu-screen.spec [new file with mode: 0644]
src/all_apps/layout.c [new file with mode: 0644]
src/all_apps/list.c [new file with mode: 0644]
src/index.c [new file with mode: 0644]
src/item.c [new file with mode: 0644]
src/item_event.c [new file with mode: 0644]
src/layout.c [new file with mode: 0644]
src/list.c [new file with mode: 0644]
src/mapbuf.c [new file with mode: 0644]
src/menu_screen.c [new file with mode: 0644]
src/mouse.c [new file with mode: 0644]
src/page.c [new file with mode: 0644]
src/page_scroller.c [new file with mode: 0644]
src/pkgmgr.c [new file with mode: 0644]
src/popup.c [new file with mode: 0644]
src/util.c [new file with mode: 0644]

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644 (file)
index 0000000..0c437bc
--- /dev/null
@@ -0,0 +1,85 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(menu-screen C)
+
+SET(PACKAGE_NAME "org.tizen.${PROJECT_NAME}")
+SET(PREFIX "/opt/apps/${PACKAGE_NAME}")
+SET(EXEC_PREFIX "${PREFIX}/bin")
+SET(LIBDIR "${PREFIX}/lib")
+SET(DATADIR "${PREFIX}/data")
+SET(RESDIR "${PREFIX}/res")
+SET(IMAGEDIR "${RESDIR}/images")
+SET(EDJEDIR "${RESDIR}/edje")
+SET(LOCALEDIR "${RESDIR}/locale")
+SET(VERSION 0.1.0)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(MENU_PKGS REQUIRED
+       ail
+       aul
+       bundle
+       capi-appfw-application
+       dlog
+       ecore
+       ecore-evas
+       ecore-file
+       ecore-imf
+       ecore-input
+       ecore-x
+       edje
+       eet
+       eina
+       elementary
+       evas
+       heynoti
+       pkgmgr
+       sysman
+       syspopup-caller
+       utilX
+)
+
+ADD_DEFINITIONS("-DENABLE_BGIMAGE")
+ADD_DEFINITIONS("-DLOG_TAG=\"menu-screen\"")
+ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
+ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE_NAME}\"")
+ADD_DEFINITIONS("-DVERSION=\"${VERSION}\"")
+ADD_DEFINITIONS("-DDATADIR=\"${DATADIR}\"")
+ADD_DEFINITIONS("-DRESDIR=\"${RESDIR}\"")
+ADD_DEFINITIONS("-DIMAGEDIR=\"${IMAGEDIR}\"")
+ADD_DEFINITIONS("-DEDJEDIR=\"${EDJEDIR}\"")
+ADD_DEFINITIONS("-DLOCALEDIR=\"${LOCALEDIR}\"")
+
+FOREACH (flag ${MENU_PKGS_CFLAGS})
+    SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
+
+ADD_EXECUTABLE(${PROJECT_NAME}
+       src/index.c
+       src/item.c
+       src/item_event.c
+       src/layout.c
+       src/list.c
+       src/mapbuf.c
+       src/menu_screen.c
+       src/mouse.c
+       src/page.c
+       src/page_scroller.c
+       src/pkgmgr.c
+       src/popup.c
+       src/util.c
+       src/all_apps/layout.c
+       src/all_apps/list.c
+)
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} -lm)
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${MENU_PKGS_LDFLAGS})
+
+# Install 
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${EXEC_PREFIX})
+
+ADD_SUBDIRECTORY(data)
+
+# End of a file
diff --git a/LICENSE b/LICENSE
new file mode 100644 (file)
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 100644 (file)
index 0000000..e69de29
diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt
new file mode 100644 (file)
index 0000000..ffcbd6a
--- /dev/null
@@ -0,0 +1,6 @@
+CONFIGURE_FILE(${PACKAGE_NAME}.desktop.in ${CMAKE_BINARY_DIR}/${PACKAGE_NAME}.desktop)
+INSTALL(FILES ${CMAKE_BINARY_DIR}/${PACKAGE_NAME}.desktop DESTINATION /opt/share/applications)
+
+ADD_SUBDIRECTORY(edje)
+
+# End of a file
diff --git a/data/edje/CMakeLists.txt b/data/edje/CMakeLists.txt
new file mode 100644 (file)
index 0000000..2f3351e
--- /dev/null
@@ -0,0 +1,41 @@
+ADD_CUSTOM_TARGET(item_4x4.edj
+               COMMAND edje_cc -id ${CMAKE_CURRENT_SOURCE_DIR}/../images ${EDJE_CFLAGS}
+               ${CMAKE_CURRENT_SOURCE_DIR}/item_4x4.edc item_4x4.edj
+               DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/item_4x4.edc
+)
+ADD_DEPENDENCIES(${PROJECT_NAME} item_4x4.edj)
+INSTALL(FILES item_4x4.edj DESTINATION ${EDJEDIR})
+
+
+
+ADD_CUSTOM_TARGET(group_4x4_portrait.edj
+               COMMAND edje_cc -id ${CMAKE_CURRENT_SOURCE_DIR}/../images ${EDJE_CFLAGS}
+               ${CMAKE_CURRENT_SOURCE_DIR}/group_4x4_portrait.edc group_4x4_portrait.edj
+               DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/group_4x4_portrait.edc
+)
+ADD_DEPENDENCIES(${PROJECT_NAME} group_4x4_portrait.edj)
+INSTALL(FILES group_4x4_portrait.edj DESTINATION ${EDJEDIR})
+
+
+
+ADD_CUSTOM_TARGET(all_apps_portrait.edj
+               COMMAND edje_cc -id ${CMAKE_CURRENT_SOURCE_DIR}/../images ${EDJE_CFLAGS}
+               ${CMAKE_CURRENT_SOURCE_DIR}/all_apps_portrait.edc all_apps_portrait.edj
+               DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/all_apps_portrait.edc
+)
+ADD_DEPENDENCIES(${PROJECT_NAME} all_apps_portrait.edj)
+INSTALL(FILES all_apps_portrait.edj DESTINATION ${EDJEDIR})
+
+
+
+ADD_CUSTOM_TARGET(layout_portrait.edj
+               COMMAND edje_cc -id ${CMAKE_CURRENT_SOURCE_DIR}/../images ${EDJE_CFLAGS}
+               ${CMAKE_CURRENT_SOURCE_DIR}/layout_portrait.edc layout_portrait.edj
+               DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/layout_portrait.edc
+)
+ADD_DEPENDENCIES(${PROJECT_NAME} layout_portrait.edj)
+INSTALL(FILES layout_portrait.edj DESTINATION ${EDJEDIR})
+
+
+
+# End of a file
diff --git a/data/edje/all_apps_portrait.edc b/data/edje/all_apps_portrait.edc
new file mode 100644 (file)
index 0000000..e7985ee
--- /dev/null
@@ -0,0 +1,132 @@
+ /*
+  * 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.
+  */
+
+
+
+collections {
+       group {
+               name: "all_apps";
+               parts {
+                       part {
+                               name: "bg";
+                               type: RECT;
+                               scale: 1;
+                               mouse_events: 1;
+                               description {
+                                       state: "default" 0.0;
+                                       rel1 { relative: 0.0 0.0; }
+                                       rel2 { relative: 1.0 1.0; }
+                                       visible: 0;
+                               }
+                       }
+
+                       part {
+                               name: "index_bg";
+                               type: RECT;
+                               scale: 1;
+                               mouse_events: 0;
+                               description {
+                                       state: "default" 0.0;
+                                       rel1 { relative: 0.0 50/1280; to, "bg";}
+                                       rel2 { relative: 1.0 154/1280; to, "bg";}
+                                       color: 0 0 0 255;
+                                       visible: 0;
+                               }
+                       }
+            part {
+                name: "index";
+                type: SWALLOW;
+                mouse_events: 0;
+                description {
+                    state: "default" 0.0;
+                    align: 0.5 0.5;
+                                       rel1 { relative: 0.0 0.0; to, "index_bg";}
+                                       rel2 { relative: 1.0 1.0; to, "index_bg";}
+                                       visible: 1;
+                }   
+            }
+
+            part {
+               name: "content_bg";
+               type: RECT;
+               scale: 1;
+               mouse_events: 1;
+               description {
+                                       state: "default" 0.0;
+                                       rel1 { relative: 0.0 154/1280; to, "bg"; }
+                                       rel2 { relative: 1.0 1214/1280; to, "bg"; }
+                                       color: 34 34 34 255;
+                                       visible: 0;
+               }
+            }
+
+                       part {
+                               name: "content";
+                               type: SWALLOW;
+                               scale: 1;
+                               mouse_events: 1;
+                               description {
+                                       state: "default" 0.0;
+                    align: 0.5 0.0;
+                                       rel1 { relative: 0.0 0.0; to, "content_bg";}
+                                       rel2 { relative: 1.0 1.0; to, "content_bg";}
+                                       visible: 1;
+                               }
+                       }
+
+                       part {
+                               name: "content,blocker";
+                               type: RECT;
+                               scale: 1;
+                               mouse_events: 1;
+                               description {
+                                       state: "default" 0.0;
+                                       rel1 { relative: 0.0 0.0; to, "bg";}
+                                       rel2 { relative: 1.0 1.0; to, "bg";}
+                                       color: 0 0 0 0;
+                                       visible: 0;
+                               }
+                               description {
+                                       state: "block" 0.0;
+                                       inherit: "default" 0.0;
+                                       color: 0 0 0 0;
+                                       visible: 1;
+                               }
+                       }
+               }
+
+               programs {
+                       program {
+                               name: "block,content";
+                               signal: "block";
+                               source: "layout";
+                               action: STATE_SET "block" 0.0;
+                               target: "content,blocker";
+                       }
+                       program {
+                               name: "unblock,content";
+                               signal: "unblock";
+                               source: "layout";
+                               action: STATE_SET "default" 0.0;
+                               target: "content,blocker";
+                       }
+               }
+       } // group
+} // collections
+
+
+
+// End of file
diff --git a/data/edje/group_4x4_portrait.edc b/data/edje/group_4x4_portrait.edc
new file mode 100644 (file)
index 0000000..a4a5132
--- /dev/null
@@ -0,0 +1,196 @@
+ /*
+  * 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.
+  */
+
+
+
+#define MENU(part_name, p_relx, p_rely, relx, rely, n_relx, n_rely, ratio)  \
+       part { \
+               name: "menu_swallow_"part_name; \
+               type: SWALLOW; \
+               scale: 1; \
+               mouse_events: 1; \
+               description { \
+                       state: "default" 0.0;   \
+                       visible: 1; \
+                       fixed: 1 1; \
+                       rel1 { relative: (relx)+(ratio) (rely)+(ratio); to, "bg"; } \
+                       rel2 { relative: (relx)+(ratio) (rely)+(ratio); to, "bg"; } \
+               } \
+               description { \
+                       state: "prev" 0.0;      \
+                       inherit: "default" 0.0; \
+                       rel1.relative: (p_relx)+(ratio) (p_rely)+(ratio); \
+                       rel2.relative: (p_relx)+(ratio) (p_rely)+(ratio); \
+               } \
+               description { \
+                       state: "next" 0.0;      \
+                       inherit: "default" 0.0; \
+                       rel1.relative: (n_relx)+(ratio) (n_rely)+(ratio); \
+                       rel2.relative: (n_relx)+(ratio) (n_rely)+(ratio); \
+               } \
+               description { \
+                       state: "invisible" 0.0; \
+                       inherit: "default" 0.0; \
+                       visible: 0; \
+                       rel1.relative: (n_relx)+(ratio) (n_rely)+(ratio); \
+                       rel2.relative: (n_relx)+(ratio) (n_rely)+(ratio); \
+               } \
+       } \
+
+#define MENU_PROGRAM(part_name)  \
+       program { \
+               name: "menu_"part_name"_prev"; \
+               signal: "move,prev"; \
+               source: "menu"part_name; \
+               action:  STATE_SET "prev" 0.0; \
+               target: "menu_swallow_"part_name; \
+       } \
+       program { \
+               name: "menu_"part_name"_next"; \
+               signal: "move,next"; \
+               source: "menu"part_name; \
+               action:  STATE_SET "next" 0.0; \
+               target: "menu_swallow_"part_name; \
+       } \
+       program { \
+               name: "menu_"part_name"_ani"; \
+               signal: "ani,return"; \
+               source: "menu"part_name; \
+               action:  STATE_SET "default" 0.0; \
+               target: "menu_swallow_"part_name; \
+               transition: DECELERATE 0.4; \
+       } \
+       program { \
+               name: "menu_"part_name"_invisible"; \
+               signal: "invisible"; \
+               source: "menu"part_name; \
+               action:  STATE_SET "invisible" 0.0; \
+               target: "menu_swallow_"part_name; \
+       }
+
+
+collections {
+       group {
+               name: "menu_bg";
+               parts {
+                       part {
+                               name: "bg";
+                               type: SWALLOW;
+                               mouse_events: 1;
+                               description {
+                                       state: "default" 0.0;
+                                       rel1 { relative: 0.0 0.0; }
+                                       rel2 { relative: 1.0 1.0; }
+                               }
+                       }
+
+                       MENU("0", -0.25, 0.0, 0.0, 0.0, 0.25, 0.0, 0.125)
+                       MENU("1", 0.0, 0.0, 0.25, 0.0, 0.50, 0.0, 0.125)
+                       MENU("2", 0.25, 0.0, 0.50, 0.0, 0.75, 0.0, 0.125)
+                       MENU("3", 0.50, 0.0, 0.75, 0.0, 0.0, 0.20, 0.125)
+
+                       MENU("4", 0.75, 0.0, 0.0, 0.20, 0.25, 0.20, 0.125)
+                       MENU("5", 0.0, 0.20, 0.25, 0.20, 0.50, 0.20, 0.125)
+                       MENU("6", 0.25, 0.20, 0.50, 0.20, 0.75, 0.20, 0.125)
+                       MENU("7", 0.50, 0.20, 0.75, 0.20, 0.0, 0.40, 0.125)
+
+                       MENU("8", 0.75, 0.20, 0.0, 0.40, 0.25, 0.40, 0.125)
+                       MENU("9", 0.0, 0.40, 0.25, 0.40, 0.50, 0.40, 0.125)
+                       MENU("10", 0.25, 0.40, 0.50, 0.40, 0.75, 0.40, 0.125)
+                       MENU("11", 0.50, 0.40, 0.75, 0.40, 0.0, 0.60, 0.125)
+
+                       MENU("12", 0.75, 0.40, 0.0, 0.60, 0.25, 0.60, 0.125)
+                       MENU("13", 0.0, 0.60, 0.25, 0.60, 0.50, 0.60, 0.125)
+                       MENU("14", 0.25, 0.60, 0.50, 0.60, 0.75, 0.60, 0.125)
+                       MENU("15", 0.50, 0.60, 0.75, 0.60, 1.0, 0.80, 0.125)
+
+                       MENU("16", 0.75, 0.60, 0.0, 0.80, 0.25, 0.80, 0.125)
+                       MENU("17", 0.0, 0.80, 0.25, 0.80, 0.50, 0.80, 0.125)
+                       MENU("18", 0.25, 0.80, 0.50, 0.80, 0.75, 0.80, 0.125)
+                       MENU("19", 0.50, 0.80, 0.75, 0.80, 1.0, 0.80, 0.125)
+
+                       part {
+                               name: "dim";
+                               type: RECT;
+                               scale: 1;
+                               mouse_events: 1;
+                               description {
+                                       state: "default" 0.0;
+                                       visible: 0;
+                                       rel1 { relative: 0.0 0.0; to, "bg"; }
+                                       rel2 { relative: 1.0 1.0; to, "bg"; }
+                               }
+                               description {
+                                       state: "edit" 0.0;
+                                       inherit: "default" 0.0;
+                                       visible: 1;
+                                       color: 0 0 0 102;
+                               }
+                       }
+               }
+
+               programs {
+                       MENU_PROGRAM("0")
+                       MENU_PROGRAM("1")
+                       MENU_PROGRAM("2")
+                       MENU_PROGRAM("3")
+                       MENU_PROGRAM("4")
+                       MENU_PROGRAM("5")
+                       MENU_PROGRAM("6")
+                       MENU_PROGRAM("7")
+                       MENU_PROGRAM("8")
+                       MENU_PROGRAM("9")
+                       MENU_PROGRAM("10")
+                       MENU_PROGRAM("11")
+                       MENU_PROGRAM("12")
+                       MENU_PROGRAM("13")
+                       MENU_PROGRAM("14")
+                       MENU_PROGRAM("15")
+                       MENU_PROGRAM("16")
+                       MENU_PROGRAM("17")
+                       MENU_PROGRAM("18")
+                       MENU_PROGRAM("19")
+
+                       program {
+                               name: "dim,on";
+                               signal: "dim,on";
+                               source: "menu";
+                               action: STATE_SET "edit" 0.0;
+                               target: "dim";
+                       }
+                       program {
+                               name: "dim,off";
+                               signal: "dim,off";
+                               source: "menu";
+                               action: STATE_SET "default" 0.0;
+                               target: "dim";
+                       }
+
+                       program {
+                               name: "dim,down";
+                               signal: "mouse,down,1";
+                               source: "dim";
+                               action: SIGNAL_EMIT "dim,down" "menu";
+                       }
+                       program {
+                               name: "dim,up";
+                               signal: "mouse,up,1";
+                               source: "dim";
+                               action: SIGNAL_EMIT "dim,up" "menu";
+                       }
+               }
+       } // group
+} // collections
diff --git a/data/edje/item_4x4.edc b/data/edje/item_4x4.edc
new file mode 100644 (file)
index 0000000..03f1e05
--- /dev/null
@@ -0,0 +1,156 @@
+ /*
+  * 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.
+  */
+
+
+
+styles {
+       style {
+               name: "app_name_style";
+               base: "font=SLP:style=MEDIUM font_size=27 align=center valign=top color=#FFFFFF style=soft_shadow shadow_color=#00000060 ellipsis=1";
+
+               tag: "br" "\n";
+       }
+}
+
+
+
+collections {
+       group {
+               name: "icon";
+
+               parts {
+                       part {
+                               name: "bg";
+                               type: SWALLOW;
+                               mouse_events: 1;
+                               scale: 1;
+                               description {
+                                       state: "default" 0.0;
+                                       rel1 { relative: 0.0 0.0; }
+                                       rel2 { relative: 1.0 1.0; }
+                                       color: 0 0 0 0;
+                               }
+                       }
+
+                       part {
+                               name: "icon_bg";
+                               type: RECT;
+                               scale: 1;
+                               mouse_events: 1;
+                               description {
+                                       state: "default" 0.0;
+                                       rel1 { relative: 48/180 30/180; to, "bg"; }
+                                       rel2 { relative: 132/180 114/180; to, "bg"; }
+                                       color: 0 0 0 0;
+                               }
+                       }
+                       part {
+                               name: "icon_image";
+                               type: SWALLOW;
+                               scale: 1;
+                               mouse_events: 1;
+                               description {
+                                       state: "default" 0.0;
+                                       rel1 { relative: 0.0 0.0; to, "icon_bg"; }
+                                       rel2 { relative: 1.0 1.0; to, "icon_bg"; }
+                               }
+                       }
+                       part {
+                               name: "icon_image_event";
+                               type: RECT;
+                               scale: 1;
+                               mouse_events: 1;
+                               description {
+                                       state: "default" 0.0;
+                                       rel1 { relative: 15/180 10/180; to, "bg"; }
+                                       rel2 { relative: 165/180 160/180; to, "bg"; }
+                                       color: 0 0 0 0;
+                                       visible: 1;
+                               }
+                       }
+
+                       part {
+                               name: "block_event";
+                               type: RECT;
+                               scale: 1;
+                               mouse_events: 1;
+                               description {
+                                       state: "default" 0.0;
+                                       visible: 0;
+                                       rel1 { relative: 0.0 0.0; to, "bg"; }
+                                       rel2 { relative: 1.0 1.0; to, "bg"; }
+                                       color: 0 0 0 0;
+                               }
+                               description {
+                                       state: "edit,release" 0.0;
+                                       inherit: "default" 0.0;
+                                       visible: 0;
+                               }
+                       }
+                       part {
+                               name: "txt";
+                               //type: TEXTBLOCK;
+                               type: TEXT;
+                               effect: SOFT_SHADOW;
+                               scale: 1;
+                               mouse_events: 1;
+                               description
+                               {
+                                       state: "default" 0.0;
+                                       //rel1 { relative: 0.0 120/180; to, "bg"; }
+                                       //rel2 { relative: 1.0 180/180; to, "bg"; }
+                                       rel1 { relative: 0.0 114/180; to, "bg"; }
+                                       rel2 { relative: 1.0 175/180; to, "bg"; }
+                                       align: 0.5 0.5;
+                                       color: 255 255 255 255;
+                                       color2: 0 0 0 35;
+                                       color3: 0 0 0 35;
+                                       text {
+                                               //style: "app_name_style";
+                                               text_class: "menu_item";
+                                               font: "SLP:style=medium";
+                                               size: 16;
+                                               text: "Icon";
+                                               align: 0.5 0.1;
+                                       }
+                               }
+                               description
+                               {
+                                       state: "hide" 0.0;
+                                       inherit: "default" 0.0;
+                                       visible: 0;
+                                       color: 0 0 0 0;
+                               }
+                       }
+               }
+               
+               programs {
+                       program {
+                               name: "item,down";
+                               signal: "mouse,down,1";
+                               source: "icon_image_event";
+                               action: SIGNAL_EMIT "item,down" "menu";
+                       }
+                       program {
+                               name: "item,up";
+                               signal: "mouse,up,1";
+                               source: "icon_image_event";
+                               action: SIGNAL_EMIT "item,up" "menu";
+                       }
+
+               }
+       } // group
+} // collections
diff --git a/data/edje/layout_portrait.edc b/data/edje/layout_portrait.edc
new file mode 100644 (file)
index 0000000..da4dff1
--- /dev/null
@@ -0,0 +1,57 @@
+ /*
+  * 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.
+  */
+
+
+
+collections {
+       group {
+               name: "layout";
+               parts {
+                       part {
+                               name: "bg";
+                               type: RECT;
+                               scale: 1;
+                               mouse_events: 1;
+                               description {
+                                       state: "default" 0.0;
+                                       rel1 { relative: 0.0 0.0; }
+                                       rel2 { relative: 1.0 1.0; }
+                                       color: 0 0 0 0;
+                                       visible: 0;
+                               }
+                       }
+                       part {
+                               name: "content";
+                               type: SWALLOW;
+                               scale: 1;
+                               mouse_events: 1;
+                               description {
+                                       state: "default" 0.0;
+                                       rel1 { relative: 0.0 0.0; to, "bg";}
+                                       rel2 { relative: 1.0 1.0; to, "bg";}
+                                       visible: 1;
+                               }
+                       }
+               }
+
+               programs {
+               }
+       } // group
+} // collections
+
+
+
+// End of file
diff --git a/data/edje/pagecontrol.edc b/data/edje/pagecontrol.edc
new file mode 100644 (file)
index 0000000..ebb5c31
--- /dev/null
@@ -0,0 +1,155 @@
+ /*
+  * 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.
+  */
+
+
+
+collections {
+       group { 
+          name: "elm/pagecontrol/base/default";
+
+          parts {
+                 part {
+                        name: "bg";
+                        type: RECT;
+                        mouse_events: 1;
+                        scale: 1;
+                        description {
+                               state: "default" 0.0;
+                               color: 0 0 0 0;
+                        }
+                 }
+                 part {
+                        name: "elm.swallow.page";
+                        type: SWALLOW;
+                        mouse_events: 1;
+                        scale: 1;
+                        description {
+                               state: "default" 0.0;
+                               min: 332 32;
+                        }
+                 }
+          }
+       }
+
+       #define PAGE_ITEM(number) \
+       group { \
+          name: "elm/page/item/default_"number; \
+          images { \
+                 image: "../images/RM06_App tray_page indicator.png" COMP; \
+                 image: "../images/RM06_App tray_page indicator_focus.png" COMP; \
+          } \
+          parts { \
+                 part { \
+                        name: "bg"; \
+                        type: RECT; \
+                        mouse_events: 0; \
+                        scale: 1; \
+                        description { \
+                               state: "default" 0.0; \
+                               min: 44 40; \
+                               max: 44 40; \
+                               align: 0.5 0.5; \
+                               color: 0 0 0 0; \
+                        } \
+                 } \
+                 part { \
+                        name: "indicator_1"; \
+                        mouse_events: 0; \
+                        scale: 1; \
+                        description { \
+                               state: "default" 0.0; \
+                               min: 8 8; \
+                               max: 8 8; \
+                               fixed: 1 1; \
+                               align: 0.5 0.5; \
+                               visible: 1; \
+                               rel1 { to: "bg"; } \
+                               rel2 { to: "bg"; } \
+                               image { \
+                                  normal: "../images/RM06_App tray_page indicator.png"; \
+                               } \
+                        } \
+                        description { \
+                               state: "selected" 0.0; \
+                               inherit: "default" 0.0; \
+                               min: 8 8; \
+                               max: 8 8; \
+                               visible: 0; \
+                        } \
+                 } \
+                 part { \
+                        name: "indicator_2"; \
+                        mouse_events: 0; \
+                        scale: 1; \
+                        description { \
+                               state: "default" 0.0; \
+                               min: 8 8; \
+                               max: 8 8; \
+                               fixed: 1 1; \
+                               align: 0.5 0.5; \
+                               visible: 0; \
+                               rel1 { to: "bg"; } \
+                               rel2 { to: "bg"; } \
+                               image { \
+                                  normal: "../images/RM06_App tray_page indicator_focus.png"; \
+                               } \
+                        } \
+                        description { \
+                               state: "selected" 0.0; \
+                               inherit: "default" 0.0; \
+                               min: 8 8; \
+                               max: 8 8; \
+                               visible: 1; \
+                        } \
+                 } \
+          } \
+          programs { \
+                 program { \
+                        name: "indicator_on"; \
+                        signal: "elm,state,indicator,on"; \
+                        source: "elm"; \
+                        action: STATE_SET "selected" 0.0; \
+                        target: "indicator_1"; \
+                        target: "indicator_2"; \
+                 } \
+                 program { \
+                        name: "indicator_off"; \
+                        signal: "elm,state,indicator,off"; \
+                        source: "elm"; \
+                        action: STATE_SET "default" 0.0; \
+                        target: "indicator_1"; \
+                        target: "indicator_2"; \
+                 } \
+                 program { \
+                        name: "indicator_clicked"; \
+                        signal: "mouse,clicked,1"; \
+                        source: "bg"; \
+                        action: SIGNAL_EMIT "clicked" "indicator_clicked"; \
+                 } \
+          } \
+       } \
+
+       PAGE_ITEM(1)
+       PAGE_ITEM(2)
+       PAGE_ITEM(3)
+       PAGE_ITEM(4)
+       PAGE_ITEM(5)
+       PAGE_ITEM(6)
+       PAGE_ITEM(7)
+       PAGE_ITEM(8)
+       PAGE_ITEM(9)
+       PAGE_ITEM(10)
+}
diff --git a/data/menu-screen-env.sh b/data/menu-screen-env.sh
new file mode 100755 (executable)
index 0000000..284a0ba
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+export LAUNCHER_ENGINE=gl
+export LAUNCHER_FPS=6000
+
+# End of a file
diff --git a/data/org.tizen.menu-screen.desktop.in b/data/org.tizen.menu-screen.desktop.in
new file mode 100644 (file)
index 0000000..a762e53
--- /dev/null
@@ -0,0 +1,7 @@
+Name=Simple Menu Screen
+Type=Application
+Exec=@EXEC_PREFIX@/@PROJECT_NAME@
+Icon=@PACKAGE_NAME@.png
+NoDisplay=True
+X-Tizen-TaskManage=False
+X-Tizen-Removable=False
diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..1e1f01a
--- /dev/null
@@ -0,0 +1,8 @@
+menu-screen (1.0.12) unstable; urgency=low
+
+  * Git: shared/pkgs/m/menu-screen
+  * Tag: menu-screen_1.0.12
+
+  * [Modify] Environment for ELM_ENGINE, ELM_FPS
+
+ -- Jin Yoon <jinny.yoon@samsung.com>  Wed, 02 May 2012 19:00:43 +0900
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..7ed6ff8
--- /dev/null
@@ -0,0 +1 @@
+5
diff --git a/debian/control b/debian/control
new file mode 100644 (file)
index 0000000..1a1fe81
--- /dev/null
@@ -0,0 +1,19 @@
+Source: menu-screen
+Section: utils
+Priority: extra
+Maintainer: Jin Yoon <jinny.yoon@samsung.com>
+Build-Depends: debhelper (>= 5), libelm-dev, libslp-utilx-dev, libslp-setting-dev, libefreet-dev, libslp-sysman-dev, libslp-pm-dev, dlog-dev, libecore-dev, libaul-1-dev, libpkgmgr-client-dev, syspopup-caller-dev, libheynoti-dev, libail-0-dev, librua-dev, libslp-shortcut-dev, menu-daemon, capi-appfw-application-dev
+Homepage: N/A
+Standards-Version: 0.1.0
+
+Package: org.tizen.menu-screen
+Section: utils
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, libelm, libeina, libslp-utilx-0, libslp-setting-0, libefreet, libslp-sysman, libslp-pm-0, libdlog-0, libaul-1, libpkgmgr-client-0, syspopup-caller-0, libheynoti-0, libail-0, menu-daemon, capi-appfw-application
+Description: inhouse menu-screen
+
+Package: org.tizen.menu-screen-dbg
+Section: debug
+Architecture: any
+Depends: org.tizen.menu-screen (= ${Source-Version})
+Description: inhouse menu-screen (unstripped)
diff --git a/debian/copyright b/debian/copyright
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/debian/jobs b/debian/jobs
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/debian/org.tizen.menu-screen.install.in b/debian/org.tizen.menu-screen.install.in
new file mode 100644 (file)
index 0000000..c48fbc3
--- /dev/null
@@ -0,0 +1,2 @@
+/opt/apps/org.tizen.menu-screen/*
+/opt/share/applications/*
diff --git a/debian/org.tizen.menu-screen.postinst b/debian/org.tizen.menu-screen.postinst
new file mode 100644 (file)
index 0000000..42421bf
--- /dev/null
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+INHOUSE_ID="5000"
+
+init_vconf()
+{
+       # for menu daemon
+       vconftool set -t int memory/menu-screen/is_menu_screen_done 0 -i
+
+       # for menu-screen
+       vconftool set -t int db/setting/menu_scroll_unit 1 -i -u 5000
+       vconftool set -t int memory/idle_screen/top 0 -i -u 5000
+}
+
+
+
+
+make_notifier_directory()
+{
+       NOTIFIER_DIR=`cat /usr/share/install-info/desktop.conf`
+       for I in $NOTIFIER_DIR
+       do
+               #echo "notifier directory :: $I"
+               if [ ! -d $I ]; then
+                       mkdir -p $I
+               fi
+               chmod 775 $I
+               chown :$INHOUSE_ID $I
+               touch $I/.notify_this_directory
+       done
+}
+
+
+
+init_vconf
+make_notifier_directory
+
+# End of a file
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..7fb4408
--- /dev/null
@@ -0,0 +1,153 @@
+#!/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 -fPIC -fpie
+CXXFLAGS +=  -Wall -fPIC -fpie
+LDFLAGS ?= 
+PREFIX ?= /usr
+DATADIR ?= /opt
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+       CFLAGS += -O0
+       CXXFLAGS += -O0
+else
+       CFLAGS += -O2
+       CXXFLAGS += -O2
+endif
+
+ifneq (,$(findstring arm,$(DEB_HOST_ARCH)))
+       export ARCH = arm
+else
+       export ARCH = i686
+endif
+
+LDFLAGS += -Wl,--rpath=$(PREFIX)/lib -Wl,--hash-style=both -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#@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 data/CMakeCache.txt
+       rm -rf data/CMakeFiles
+       rm -rf data/cmake_install.cmake
+       rm -rf data/install_manifest.txt
+       rm -rf data/Makefile
+
+       rm -rf data/themes/CMakeCache.txt
+       rm -rf data/themes/CMakeFiles
+       rm -rf data/themes/cmake_install.cmake
+       rm -rf data/themes/install_manifest.txt
+       rm -rf data/themes/Makefile
+
+       rm -rf data/kdm/CMakeCache.txt
+       rm -rf data/kdm/CMakeFiles
+       rm -rf data/kdm/cmake_install.cmake
+       rm -rf data/kdm/install_manifest.txt
+       rm -rf data/kdm/Makefile
+                                       
+       rm -rf data/po/CMakeCache.txt
+       rm -rf data/po/CMakeFiles
+       rm -rf data/po/cmake_install.cmake
+       rm -rf data/po/install_manifest.txt
+       rm -rf data/po/Makefile
+                                       
+       rm -rf data/themes/*.edj
+       rm -rf data/*.edj
+       rm -rf *.so
+
+       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.menu-screen-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/all_apps/layout.h b/include/all_apps/layout.h
new file mode 100644 (file)
index 0000000..71eac50
--- /dev/null
@@ -0,0 +1,31 @@
+ /*
+  * 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.
+  */
+
+
+
+#ifndef _MENU_SCREEN_CONTROLBAR_ALL_APPS_H_
+#define _MENU_SCREEN_CONTROLBAR_ALL_APPS_H_
+
+#include <Evas.h>
+
+#define PAGE_MAX_APP 20
+
+extern Evas_Object *all_apps_layout_create(Evas_Object *controlbar, int rotate);
+extern void all_apps_layout_destroy(Evas_Object *all_apps);
+
+#endif // _MENU_SCREEN_CONTROLBAR_ALL_APPS_H_
+
+// End of a file
diff --git a/include/all_apps/list.h b/include/all_apps/list.h
new file mode 100644 (file)
index 0000000..7197f50
--- /dev/null
@@ -0,0 +1,27 @@
+ /*
+  * 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.
+  */
+
+
+
+#ifndef __MENU_SCREEN_LIST_ALL_APPS_H__
+#define __MENU_SCREEN_LIST_ALL_APPS_H__
+
+extern app_list *all_apps_list_create(void);
+extern void all_apps_list_destroy(app_list *list);
+
+#endif //__MENU_SCREEN_LIST_ALL_APPS_H__
+
+// End of a file
diff --git a/include/conf.h b/include/conf.h
new file mode 100644 (file)
index 0000000..0df39be
--- /dev/null
@@ -0,0 +1,31 @@
+ /*
+  * 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.
+  */
+
+
+
+#ifndef _MENU_SCREEN_CONF_H_
+#define _MENU_SCREEN_CONF_H_
+
+#define MAX_PAGE_NO 9
+
+#define BASE_HEIGHT 1280.0f
+#define BASE_WIDTH 720.0f
+
+#define PAGE_PORTRAIT_HEIGHT 1060.0f
+
+#endif // _MENU_SCREEN_CONF_H_
+
+// End of a file
diff --git a/include/index.h b/include/index.h
new file mode 100644 (file)
index 0000000..1f3b75b
--- /dev/null
@@ -0,0 +1,35 @@
+ /*
+  * 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.
+  */
+
+
+
+#ifndef __APP_TRAY_PAGE_CONTROL_H__
+#define __APP_TRAY_PAGE_CONTROL_H__
+
+#include <Evas.h>
+
+extern void index_bring_in(Evas_Object *index, int idx);
+
+extern Evas_Object *index_create(Evas_Object *layout, unsigned int count);
+extern Evas_Object *index_update(Evas_Object *layout, Evas_Object *index, unsigned int count);
+extern void index_destroy(Evas_Object *index);
+
+extern void index_show(Evas_Object *index);
+extern void index_hide(Evas_Object *index);
+
+#endif //__APP_TRAY_PAGE_CONTROL_H__
+
+// End of the file
diff --git a/include/item.h b/include/item.h
new file mode 100644 (file)
index 0000000..70844a3
--- /dev/null
@@ -0,0 +1,68 @@
+ /*
+  * 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.
+  */
+
+
+
+#ifndef __MENU_SCREEN_ITEM_H__
+#define __MENU_SCREEN_ITEM_H__
+
+#include <Evas.h>
+
+#include "list.h"
+#include "util.h"
+
+extern char *item_get_icon(Evas_Object *item);
+extern void item_set_icon(Evas_Object *item, char *icon, int sync);
+
+extern char *item_get_name(Evas_Object *item);
+extern void item_set_name(Evas_Object *item, char *name, int sync);
+
+extern char *item_get_package(Evas_Object *item);
+extern void item_set_package(Evas_Object *item, char *package, int sync);
+
+extern int item_get_removable(Evas_Object *item);
+extern void item_set_removable(Evas_Object *item, int removable, int sync);
+
+extern Evas_Object *item_get_page(Evas_Object *edje);
+extern void item_set_page(Evas_Object *edje, Evas_Object *page, int sync);
+
+extern char *item_get_desktop(Evas_Object *item);
+extern void item_set_desktop(Evas_Object *item, char *name, int sync);
+
+extern void item_enable_delete(Evas_Object *obj);
+extern void item_disable_delete(Evas_Object *item);
+
+extern Evas_Object *item_create(Evas_Object *scroller, app_info_t* ai);
+extern void item_update(Evas_Object *item, app_info_t *ai);
+extern void item_destroy(Evas_Object *obj);
+
+extern void item_launch(Evas_Object *obj);
+
+extern void item_enable_progress(Evas_Object *obj);
+extern int item_is_enabled_progress(Evas_Object *obj);
+extern void item_update_progress(Evas_Object *obj, int value);
+extern void item_disable_progress(Evas_Object *obj);
+
+extern menu_screen_error_e item_is_edje_icon(const char *icon);
+extern int item_get_position(Evas_Object *item);
+
+extern void item_mark_dirty(Evas_Object *item);
+extern void item_unmark_dirty(Evas_Object *item);
+extern int item_is_dirty(Evas_Object *item);
+
+#endif //__MENU_SCREEN_ITEM_H__
+
+// End of a file
diff --git a/include/item_event.h b/include/item_event.h
new file mode 100644 (file)
index 0000000..3e65df3
--- /dev/null
@@ -0,0 +1,29 @@
+ /*
+  * 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.
+  */
+
+
+
+#ifndef __MENU_SCREEN_ITEM_EVENT_H__
+#define __MENU_SCREEN_ITEM_EVENT_H__
+
+#include <Evas.h>
+
+extern void item_event_register(Evas_Object *obj);
+extern void item_event_unregister(Evas_Object *obj);
+
+#endif //__MENU_SCREEN_ITEM_EVENT_H__
+
+// End of a file
diff --git a/include/layout.h b/include/layout.h
new file mode 100644 (file)
index 0000000..8dc322d
--- /dev/null
@@ -0,0 +1,36 @@
+ /*
+  * 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.
+  */
+
+
+
+#ifndef __MENU_SCREEN_LAYOUT_H__
+#define __MENU_SCREEN_LAYOUT_H__
+
+#include <Evas.h>
+#include "util.h"
+
+extern Evas_Object *layout_create(Evas_Object *win, const char *file, const char *group, int rotate);
+extern void layout_destroy(Evas_Object *layout);
+
+extern void layout_enable_block(Evas_Object *layout);
+extern void layout_disable_block(Evas_Object *layout);
+
+extern Evas_Object* layout_load_edj(Evas_Object *parent, const char *edjname, const char *grpname);
+extern void layout_unload_edj(Evas_Object *layout);
+
+#endif //__MENU_SCREEN_LAYOUT_H__
+
+// End of a file
diff --git a/include/list.h b/include/list.h
new file mode 100644 (file)
index 0000000..7e5465b
--- /dev/null
@@ -0,0 +1,69 @@
+ /*
+  * 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.
+  */
+
+
+
+#ifndef __MENU_SCREEN_LIST_H__
+#define __MENU_SCREEN_LIST_H__
+
+#include <Evas.h>
+#include <stdbool.h>
+
+#include "util.h"
+
+typedef struct
+{
+       char *package;
+       char *exec;
+       char *name;
+       char *icon;
+       char *desktop;
+       bool nodisplay;
+       bool x_slp_removable;
+       bool x_slp_taskmanage;
+       pid_t pid;
+       Evas_Object *image;
+} app_info_t;
+
+typedef struct _app_list {
+       Eina_List *list;
+       unsigned int cur_idx;
+} app_list;
+
+typedef struct _app_list_item {
+       char *package;
+       pid_t pid;
+       time_t launch_time;
+       long long installed_time;
+       void *data;
+} app_list_item;
+
+extern menu_screen_error_e list_count(app_list *list, int *count);
+extern menu_screen_error_e list_first(app_list *list);
+extern menu_screen_error_e list_next(app_list *list);
+extern menu_screen_error_e list_is_ended(app_list *list, bool *flag);
+
+extern menu_screen_error_e list_get_item(app_list *list, app_list_item **item);
+extern menu_screen_error_e list_get_values(const char *package, app_info_t *ai);
+extern void list_free_values(app_info_t *ai);
+
+extern menu_screen_error_e list_append_item(app_list *list, app_list_item *item);
+extern menu_screen_error_e list_remove_item(app_list *list, app_list_item *item);
+extern menu_screen_error_e list_sort(app_list *list, int (*_sort_cb)(const void *d1, const void *d2));
+
+#endif //__MENU_SCREEN_LIST_H__
+
+// End of a file
diff --git a/include/mapbuf.h b/include/mapbuf.h
new file mode 100644 (file)
index 0000000..839ddc7
--- /dev/null
@@ -0,0 +1,40 @@
+ /*
+  * 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.
+  */
+
+
+
+#ifndef __MENU_SCREEN_MAPBUF_H__
+#define __MENU_SCREEN_MAPBUF_H__
+
+#include <Evas.h>
+
+#include "util.h"
+
+extern menu_screen_error_e mapbuf_enable(Evas_Object *obj, int force);
+extern int mapbuf_disable(Evas_Object *obj, int force);
+
+extern Evas_Object *mapbuf_bind(Evas_Object *box, Evas_Object *page);
+extern Evas_Object *mapbuf_unbind(Evas_Object *obj);
+
+extern Evas_Object *mapbuf_get_mapbuf(Evas_Object *obj);
+extern Evas_Object *mapbuf_get_page(Evas_Object *obj);
+
+extern int mapbuf_is_enabled(Evas_Object *obj);
+
+
+#endif //__MENU_SCREEN_MAPBUF_H__
+
+// End of a file
diff --git a/include/menu_screen.h b/include/menu_screen.h
new file mode 100644 (file)
index 0000000..12ed017
--- /dev/null
@@ -0,0 +1,36 @@
+ /*
+  * 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.
+  */
+
+
+
+#ifndef __MENU_SCREEN_H__
+#define __MENU_SCREEN_H__
+
+#include <Ecore_Evas.h>
+#include <Evas.h>
+#include <stdbool.h>
+
+extern int menu_screen_get_root_width(void);
+extern int menu_screen_get_root_height(void);
+extern double menu_screen_get_yscale(void);
+extern Evas *menu_screen_get_evas(void);
+extern Evas_Object *menu_screen_get_win(void);
+extern bool menu_screen_get_done(void);
+extern void menu_screen_set_done(bool is_done);
+
+#endif //__MENU_SCREEN_H__
+
+// End of a file
diff --git a/include/mouse.h b/include/mouse.h
new file mode 100644 (file)
index 0000000..8d4a5ea
--- /dev/null
@@ -0,0 +1,33 @@
+ /*
+  * 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.
+  */
+
+
+
+#ifndef __MENU_SCREEN_EVENT_H__
+#define __MENU_SCREEN_EVENT_H__
+
+#include <stdbool.h>
+
+#include "util.h"
+
+extern bool mouse_is_scrolling(void);
+
+extern void mouse_register(void);
+extern void mouse_unregister(void);
+
+#endif //__MENU_SCREEN_EVENT_H__
+
+// End of a file
diff --git a/include/page.h b/include/page.h
new file mode 100644 (file)
index 0000000..f0921fc
--- /dev/null
@@ -0,0 +1,50 @@
+ /*
+  * 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.
+  */
+
+
+
+#ifndef __MENU_SCREEN_PAGE_H__
+#define __MENU_SCREEN_PAGE_H__
+
+#include <Evas.h>
+#include "util.h"
+#include "list.h"
+
+extern void page_mark_dirty(Evas_Object *page);
+extern void page_clean_dirty(Evas_Object *page);
+extern void page_unmark_dirty(Evas_Object *page);
+extern int page_is_dirty(Evas_Object *page);
+
+extern Evas_Object *page_get_item_at(Evas_Object *menu, unsigned int idx);
+
+extern menu_screen_error_e page_unpack_item(Evas_Object *page, Evas_Object *item);
+extern Evas_Object *page_unpack_item_at(Evas_Object *page, int idx);
+
+extern void page_pack_item(Evas_Object *menu, int idx, Evas_Object *item);
+extern void page_set_item(Evas_Object *page, int idx, Evas_Object *item);
+
+extern unsigned int page_count_item(Evas_Object *page);
+
+extern Evas_Object *page_create(Evas_Object *scroller, int idx, int rotate);
+extern void page_destroy(Evas_Object *scroller, Evas_Object *page);
+
+extern int page_find_empty_near(Evas_Object *menu_edje, int pivot);
+extern int page_find_first_empty(Evas_Object *page, int pivot);
+extern void page_trim_items(Evas_Object *page);
+
+#endif //__MENU_SCREEN_PAGE_H__
+// End of a file
+
diff --git a/include/page_scroller.h b/include/page_scroller.h
new file mode 100644 (file)
index 0000000..4f12bda
--- /dev/null
@@ -0,0 +1,50 @@
+ /*
+  * 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.
+  */
+
+
+
+#ifndef __MENU_SCREEN_PAGE_SCROLLER_H__
+#define __MENU_SCREEN_PAGE_SCROLLER_H__
+
+#include <stdbool.h>
+#include <Eina.h>
+#include <Evas.h>
+#include "list.h"
+
+typedef enum {
+       PAGE_SCROLLER_SORT_BY_DEFAULT = 0,
+       PAGE_SCROLLER_SORT_BY_PACKAGE,
+       PAGE_SCROLLER_SORT_BY_NAME,
+       PAGE_SCROLLER_SORT_MAX,
+} page_scroller_sort_type_e;
+
+extern Evas_Object *page_scroller_create(Evas_Object *tab, Evas_Object *index, page_scroller_sort_type_e sort_type, int rotate);
+extern void page_scroller_destroy(Evas_Object *scroller);
+extern void page_scroller_clean(Evas_Object *scroller);
+
+extern Evas_Object *page_scroller_get_page_at(Evas_Object *scroller, unsigned int idx);
+extern unsigned int page_scroller_count_page(Evas_Object *scroller);
+extern int page_scroller_get_page_no(Evas_Object* scroller, Evas_Object *page);
+
+extern menu_screen_error_e page_scroller_push_item(Evas_Object *scroller, app_info_t *ai);
+extern Evas_Object *page_scroller_find_item_by_package(Evas_Object *scroller, const char *package, int *page_no);
+extern void page_scroller_trim_items(Evas_Object *scroller);
+extern void page_scroller_bring_in(Evas_Object *scroller, int idx);
+extern void page_scroller_show_region(Evas_Object *scroller, int idx);
+
+#endif //__MENU_SCREEN_PAGE_SCROLLER_H__
+
+// End of a file
diff --git a/include/pkgmgr.h b/include/pkgmgr.h
new file mode 100644 (file)
index 0000000..179732c
--- /dev/null
@@ -0,0 +1,66 @@
+ /*
+  * 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.
+  */
+
+
+
+#ifndef __MENU_SCREEN_PKGMGR_H__
+#define __MENU_SCREEN_PKGMGR_H__
+
+#include <Evas.h>
+
+#include "list.h"
+#include "util.h"
+
+
+
+enum package_install_status {
+       UNKNOWN = 0x00,
+       DOWNLOAD_BEGIN,
+       DOWNLOADING,
+       DOWNLOAD_END,
+       INSTALL_BEGIN,
+       INSTALLING,
+       INSTALL_END,
+       UNINSTALL_BEGIN,
+       UNINSTALLING,
+       UNINSTALL_END,
+       UPDATE_BEGIN,
+       UPDATING,
+       UPDATE_END,
+       MAX_STATUS,
+};
+
+
+
+struct package_info {
+       enum package_install_status status;
+       app_info_t ai;
+       Evas_Object *item;
+       Evas_Object *page;
+       Eina_Bool desktop_file_found;
+       int error_count;
+};
+
+
+
+extern menu_screen_error_e pkgmgr_init(Evas_Object *scroller);
+extern void pkgmgr_fini(void);
+extern Evas_Object *pkgmgr_find_pended_object(const char *package, int with_desktop_file, Evas_Object *scroller, Evas_Object **page);
+extern menu_screen_error_e pkgmgr_uninstall(Evas_Object *obj);
+
+#endif //__MENU_SCREEN_PKGMGR_H__
+
+// End of a file
diff --git a/include/popup.h b/include/popup.h
new file mode 100644 (file)
index 0000000..f07d162
--- /dev/null
@@ -0,0 +1,31 @@
+ /*
+  * 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.
+  */
+
+
+
+#ifndef __APP_TRAY_POPUP_H__
+#define __APP_TRAY_POPUP_H__
+
+extern void popup_append_list(Evas_Object *popup);
+extern void popup_remove_list(Evas_Object *popup);
+extern void popup_free_list();
+
+extern Evas_Object *popup_create(Evas_Object *parent, const char *warning);
+extern void popup_destroy(Evas_Object *popup);
+
+#endif //__APP_TRAY_POPUP_H__
+
+// End of a file
diff --git a/include/util.h b/include/util.h
new file mode 100644 (file)
index 0000000..68d6e66
--- /dev/null
@@ -0,0 +1,149 @@
+ /*
+  * 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.
+  */
+
+
+
+#ifndef __MENU_SCREEN_UTIL_H__
+#define __MENU_SCREEN_UTIL_H__
+#include <dlog.h>
+#include <Evas.h>
+
+#define STR_MOVE_PREV "move,prev"
+#define STR_MOVE_NEXT "move,next"
+#define STR_ANI_RETURN "ani,return"
+#define STR_ENV_MAPBUF "BEATUX_MAPBUF"
+
+#define ALL_APPS_TABLE "all_apps"
+
+/* Multi-language */
+#define D_(str) dgettext("sys_string", str)
+
+/* Log */
+#if !defined(_W)
+#define _W(fmt, arg...) LOGW("[%s:%d] "fmt"\n", __func__, __LINE__, ##arg)
+#endif
+
+#if !defined(_D)
+#define _D(fmt, arg...) LOGD("[%s:%d] "fmt"\n", __func__, __LINE__, ##arg)
+#endif
+
+#if !defined(_E)
+#define _E(fmt, arg...) LOGE("[%s:%d] "fmt"\n", __func__, __LINE__, ##arg)
+#endif
+
+#if !defined(_T)
+#define _T(package) LOG(LOG_DEBUG, "LAUNCH", "[%s:Menuscreen:launch:done]", package);
+#endif
+
+#ifdef APPFWK_MEASUREMENT
+#define PRINT_APPFWK() do {            \
+    struct timeval tv;                         \
+    char str_time[64] = {0,};          \
+    int re;                                                    \
+    gettimeofday(&tv, NULL);           \
+    sprintf(str_time, "APP_START_TIME=%u %u", (int)tv.tv_sec, (int)tv.tv_usec); \
+    re = putenv(str_time);                     \
+} while (0)
+#else
+#define PRINT_APPFWK()
+#endif
+
+#if defined(TIME_CHECK)
+#define PRINT_TIME() do { \
+    struct timeval tv; \
+    gettimeofday(&tv, NULL); \
+    _D("[%s:%d] TIME=%u %u", __func__, __LINE__, (int)tv.tv_sec, (int)tv.tv_usec); \
+} while (0)
+#else
+#define PRINT_TIME()
+#endif
+
+#define retv_if(expr, val) do { \
+       if(expr) { \
+               _E("(%s) -> %s() return", #expr, __FUNCTION__); \
+               return (val); \
+       } \
+} while (0)
+
+#define ret_if(expr) do { \
+       if(expr) { \
+               _E("(%s) -> %s() return", #expr, __FUNCTION__); \
+               return; \
+       } \
+} while (0)
+
+#define goto_if(expr, val) do { \
+       if(expr) { \
+               _E("(%s) -> goto", #expr); \
+               goto val; \
+       } \
+} while (0)
+
+#define break_if(expr) { \
+       if(expr) { \
+               _E("(%s) -> break", #expr); \
+               break; \
+       } \
+}
+
+#define continue_if(expr) { \
+       if(expr) { \
+               _E("(%s) -> continue", #expr); \
+               continue; \
+       } \
+}
+
+#if !defined(_EDJ)
+#define _EDJ(a) elm_layout_edje_get(a)
+#endif
+
+typedef enum {
+       MENU_SCREEN_ERROR_OK = 0,
+       MENU_SCREEN_ERROR_FAIL = -1,
+       MENU_SCREEN_ERROR_DB_FAILED = -2,
+       MENU_SCREEN_ERROR_OUT_OF_MEMORY = -3,
+       MENU_SCREEN_ERROR_INVALID_PARAMETER = -4,
+       MENU_SCREEN_ERROR_NO_DATA = -5,
+} menu_screen_error_e;
+
+typedef enum {
+       TRAY_TYPE_ALL_APPS = 0,
+       TRAY_TYPE_RUNNING_APPS,
+       TRAY_TYPE_DOWNLOADED_APPS,
+       TRAY_TYPE_FAVORITE_APPS,
+       TRAY_TYPE_FREQUENTLY_USED_APPS,
+       TRAY_TYPE_MAX,
+} tray_type_e;
+
+enum {
+       APP_STATE_PAUSE = 1,
+       APP_STATE_RESUME,
+};
+
+enum {
+       MENU_SCREEN_ROTATE_PORTRAIT = 0,
+       MENU_SCREEN_ROTATE_LANDSCAPE,
+};
+
+
+
+extern void _evas_object_resize_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
+extern void _evas_object_event_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
+extern void _evas_object_event_move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
+extern void _evas_object_event_show_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
+
+
+#endif /* __MENU_SCREEN_UTIL_H__ */
diff --git a/packaging/org.tizen.menu-screen.spec b/packaging/org.tizen.menu-screen.spec
new file mode 100644 (file)
index 0000000..5744ad1
--- /dev/null
@@ -0,0 +1,114 @@
+%define _optdir /opt
+%define _appdir %{_optdir}/apps
+%define _opt_datadir %{_optdir}/share
+
+Name:       org.tizen.menu-screen
+Summary:    An utility library of the menu screen
+Version:    1.0.12
+Release:    1.1
+Group:      TO_BE/FILLED_IN
+License:    Flora Software License
+Source0:    %{name}-%{version}.tar.gz
+BuildRequires:  pkgconfig(elementary)
+BuildRequires:  pkgconfig(appcore-efl)
+BuildRequires:  pkgconfig(utilX)
+BuildRequires:  pkgconfig(aul)
+BuildRequires:  pkgconfig(dlog)
+BuildRequires:  pkgconfig(sysman)
+BuildRequires:  pkgconfig(bundle)
+BuildRequires:  pkgconfig(pkgmgr)
+BuildRequires:  pkgconfig(syspopup-caller)
+BuildRequires:  pkgconfig(heynoti)
+BuildRequires:  pkgconfig(evas)
+BuildRequires:  pkgconfig(ecore-evas)
+BuildRequires:  pkgconfig(edje)
+BuildRequires:  pkgconfig(ecore)
+BuildRequires:  pkgconfig(ecore-file)
+BuildRequires:  pkgconfig(ecore-imf)
+BuildRequires:  pkgconfig(ecore-input)
+BuildRequires:  pkgconfig(eet)
+BuildRequires:  pkgconfig(eina)
+BuildRequires:  pkgconfig(ail)
+BuildRequires:  pkgconfig(capi-appfw-application)
+BuildRequires:  cmake
+BuildRequires:  edje-tools
+BuildRequires:  gettext-tools
+
+
+%description
+An utility library for developers of the menu screen.
+
+
+
+%package devel
+Summary:    An utility library of the menu screen (devel)
+Group:      Development/Libraries
+Requires:   %{name} = %{version}-%{release}
+
+%description devel
+An utility library for developers of the menu screen (devel)
+
+
+%prep
+%setup -q
+
+%build
+CFLAGS="-I/usr/lib/glib-2.0/include/ -I/usr/include/glib-2.0 -I/usr/lib/dbus-1.0/include -I/usr/include/dbus-1.0 -I/usr/include/e_dbus-1 -I/usr/include/ethumb-0 -I/usr/include/edje-1 -I/usr/include/efreet-1 -I/usr/include/embryo-1 -I/usr/include/ecore-1 -I/usr/include/eet-1 -I/usr/include/evas-1 -I/usr/include/eina-1 -I/usr/include/eina-1/eina $CFLAGS" CXXFLAGS=$CXXFLAGS cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix}
+
+make %{?jobs:-j%jobs}
+
+%install
+%make_install
+mkdir %{buildroot}/opt/apps/org.tizen.menu-screen/data
+
+
+%post
+
+INHOUSE_ID="5000"
+
+chown -R 5000:5000 /opt/apps/org.tizen.menu-screen/data
+
+init_vconf()
+{
+       # for menu daemon
+       vconftool set -t int memory/menu-screen/is_menu_screen_done 0 -i
+
+       # for menu-screen
+       vconftool set -t int db/setting/menu_scroll_unit 1 -i -u 5000
+       vconftool set -t int memory/idle_screen/top 0 -i -u 5000
+       vconftool set -t string db/menuscreen/pkgname "org.tizen.menu-screen" -i -u 5000
+}
+
+
+
+make_notifier_directory()
+{
+       NOTIFIER_DIR=`cat /usr/share/install-info/desktop.conf`
+       for I in $NOTIFIER_DIR
+       do
+               #echo "notifier directory :: $I"
+               if [ ! -d $I ]; then
+                       mkdir -p $I
+               fi
+               chmod 775 $I
+               chown :$INHOUSE_ID $I
+               touch $I/.notify_this_directory
+       done
+}
+
+
+
+init_vconf
+make_notifier_directory
+
+#%files -f %{name}.lang
+%files 
+%dir %attr(-,inhouse,inhouse) /opt/apps/org.tizen.menu-screen/data
+%{_appdir}/org.tizen.menu-screen/bin/menu-screen
+%{_appdir}/org.tizen.menu-screen/res/edje/all_apps_portrait.edj
+%{_appdir}/org.tizen.menu-screen/res/edje/group_4x4_portrait.edj
+%{_appdir}/org.tizen.menu-screen/res/edje/item_4x4.edj
+%{_appdir}/org.tizen.menu-screen/res/edje/layout_portrait.edj
+%{_opt_datadir}/applications/org.tizen.menu-screen.desktop
+
+
diff --git a/src/all_apps/layout.c b/src/all_apps/layout.c
new file mode 100644 (file)
index 0000000..e22070f
--- /dev/null
@@ -0,0 +1,206 @@
+ /*
+  * 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>
+
+#include "menu_screen.h"
+#include "conf.h"
+#include "index.h"
+#include "item_event.h"
+#include "layout.h"
+#include "list.h"
+#include "page_scroller.h"
+#include "util.h"
+#include "all_apps/layout.h"
+#include "all_apps/list.h"
+
+#define ALL_APPS_EDJE_PORTRAIT EDJEDIR"/all_apps_portrait.edj"
+#define ALL_APPS_GROUP "all_apps"
+
+#define GROUP_4X4_EDJE_PORTRAIT EDJEDIR"/group_4x4_portrait.edj";
+
+
+
+static menu_screen_error_e _load_item(Evas_Object *scroller, app_list_item *item)
+{
+       app_info_t *ai;
+
+       retv_if(NULL == item, MENU_SCREEN_ERROR_FAIL);
+       ai = item->data;
+       if (ai->nodisplay == true) {
+               return MENU_SCREEN_ERROR_FAIL;
+       }
+
+       retv_if(MENU_SCREEN_ERROR_FAIL == page_scroller_push_item(scroller, ai), MENU_SCREEN_ERROR_FAIL);
+
+       return MENU_SCREEN_ERROR_OK;
+
+}
+
+
+
+static Eina_Bool _push_items_idler_cb(void *all_apps)
+{
+       bool flag = true;
+       app_list *list;
+       app_list_item *item;
+       Evas_Object *scroller;
+
+       list = evas_object_data_get(all_apps, "list");
+       scroller = evas_object_data_get(all_apps, "scroller");
+
+       retv_if(NULL == list, ECORE_CALLBACK_CANCEL);
+       goto_if(NULL == scroller, ERROR);
+       goto_if(MENU_SCREEN_ERROR_OK != list_is_ended(list, &flag), ERROR);
+       goto_if(flag == true, ERROR);
+       goto_if(MENU_SCREEN_ERROR_OK != list_get_item(list, &item), ERROR);
+       goto_if(MENU_SCREEN_ERROR_OK != _load_item(scroller, item), ERROR);
+       goto_if(MENU_SCREEN_ERROR_OK != list_next(list), ERROR);
+
+       return ECORE_CALLBACK_RENEW;
+
+ERROR:
+       all_apps_list_destroy(list);
+       evas_object_data_del(all_apps, "list");
+       page_scroller_bring_in(scroller, 0);
+       menu_screen_set_done(true);
+
+       return ECORE_CALLBACK_CANCEL;
+}
+
+
+
+static menu_screen_error_e _push_items(Evas_Object *all_apps)
+{
+       app_list *list;
+       Ecore_Idler *idle_timer;
+
+       list = all_apps_list_create();
+       retv_if(MENU_SCREEN_ERROR_OK != list_first(list), MENU_SCREEN_ERROR_FAIL);
+
+       evas_object_data_set(all_apps, "list", list);
+       idle_timer = ecore_idler_add(_push_items_idler_cb, all_apps);
+
+       return MENU_SCREEN_ERROR_OK;
+}
+
+
+
+Evas_Object *all_apps_layout_create(Evas_Object *controlbar, int rotate)
+{
+       Evas_Object *all_apps;
+       Evas_Object *index;
+       Evas_Object *scroller;
+
+       static const char item_edje[] = EDJEDIR"/item_4x4.edj";
+       static const char *page_edje;
+       static const char *all_apps_edje;
+       int item_width;
+       int width;
+       int height;
+
+       all_apps = elm_layout_add(controlbar);
+       retv_if(NULL == all_apps, NULL);
+
+       all_apps_edje = ALL_APPS_EDJE_PORTRAIT;
+       page_edje = GROUP_4X4_EDJE_PORTRAIT;
+       width = menu_screen_get_root_width();
+       height = menu_screen_get_root_height();
+       item_width = width / 4.0f;
+
+       if (EINA_FALSE == elm_layout_file_set(all_apps, all_apps_edje, ALL_APPS_GROUP)) {
+               evas_object_del(all_apps);
+               _E("cannot load layout");
+               return NULL;
+       }
+
+       evas_object_data_set(all_apps, "win", evas_object_data_get(controlbar, "win"));
+       evas_object_data_set(all_apps, "layout", evas_object_data_get(controlbar, "layout"));
+       evas_object_data_set(all_apps, "controlbar", controlbar);
+       evas_object_data_set(all_apps, "page_edje", (void *) page_edje);
+       evas_object_data_set(all_apps, "page_max_app", (void *) PAGE_MAX_APP);
+       evas_object_data_set(all_apps, "item_edje", (void *) item_edje);
+       evas_object_data_set(all_apps, "item_width", (void *) item_width);
+       evas_object_data_set(all_apps, "item_height", (void *) item_width);
+       evas_object_data_set(all_apps, "item_enable_long_press", (void *) true);
+       evas_object_data_set(all_apps, "item_text_dual_line", (void *) true);
+       evas_object_data_set(all_apps, "is_under_pkgmgr", (void *) true);
+       evas_object_data_set(all_apps, "rotate", (void *) rotate);
+       evas_object_data_set(all_apps, "enable_bg_image", (void *) true);
+       evas_object_resize(all_apps, width, height);
+
+       index = index_create(all_apps, 0);
+       if (NULL == index) {
+               evas_object_del(all_apps);
+               _E("cannot create index.");
+               return NULL;
+       }
+       elm_object_part_content_set(all_apps, "index", index);
+       evas_object_data_set(all_apps, "index", index);
+
+       scroller = page_scroller_create(all_apps, index, PAGE_SCROLLER_SORT_BY_PACKAGE, rotate);
+       if (NULL == scroller) {
+               evas_object_del(all_apps);
+               index_destroy(index);
+               _E("cannot create scroller.");
+               return NULL;
+       }
+
+       elm_object_part_content_set(all_apps, "content", scroller);
+       evas_object_data_set(all_apps, "scroller", scroller);
+
+       retv_if(MENU_SCREEN_ERROR_FAIL == _push_items(all_apps), NULL);
+
+       return all_apps;
+}
+
+
+
+void all_apps_layout_destroy(Evas_Object *all_apps)
+{
+       Evas_Object *index;
+       Evas_Object *scroller;
+
+       index = evas_object_data_get(all_apps, "index");
+       scroller = evas_object_data_get(all_apps, "scroller");
+
+       if (scroller) page_scroller_destroy(scroller);
+       if (index) index_destroy(index);
+
+       evas_object_data_del(all_apps, "win");
+       evas_object_data_del(all_apps, "layout");
+       evas_object_data_del(all_apps, "controlbar");
+       evas_object_data_del(all_apps, "index");
+       evas_object_data_del(all_apps, "scroller");
+       evas_object_data_del(all_apps, "page_edje");
+       evas_object_data_del(all_apps, "page_max_app");
+       evas_object_data_del(all_apps, "item_edje");
+       evas_object_data_del(all_apps, "item_width");
+       evas_object_data_del(all_apps, "item_height");
+       evas_object_data_del(all_apps, "item_enable_long_press");
+       evas_object_data_del(all_apps, "item_text_dual_line");
+       evas_object_data_del(all_apps, "is_under_pkgmgr");
+       evas_object_data_del(all_apps, "rotate");
+       evas_object_data_del(all_apps, "enable_bg_image");
+
+       evas_object_del(all_apps);
+}
+
+
+
+// End of a file
diff --git a/src/all_apps/list.c b/src/all_apps/list.c
new file mode 100644 (file)
index 0000000..e3bc0b8
--- /dev/null
@@ -0,0 +1,145 @@
+ /*
+  * 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>
+#include <ail.h>
+
+#include "menu_screen.h"
+#include "conf.h"
+#include "list.h"
+
+
+
+static ail_cb_ret_e _all_apps_cb(ail_appinfo_h ai, void *data)
+{
+       app_list *list = data;
+       app_list_item *item;
+       char *value;
+
+       retv_if(ail_appinfo_get_str(ai, AIL_PROP_PACKAGE_STR, &value) == AIL_ERROR_FAIL, AIL_CB_RET_CANCEL);
+       retv_if(NULL == (item = calloc(1, sizeof(struct _app_list_item))), AIL_CB_RET_CANCEL);
+
+       if (NULL == (item->package = strdup(value))) {
+               free(item);
+               return AIL_CB_RET_CANCEL;
+       }
+
+       if (NULL == (item->data = calloc(1, sizeof(app_info_t)))) {
+               free(item->package);
+               free(item);
+               return AIL_CB_RET_CANCEL;
+       }
+
+       if (MENU_SCREEN_ERROR_OK != list_get_values(item->package, item->data)) {
+               free(item->data);
+               free(item->package);
+               free(item);
+               return AIL_CB_RET_CANCEL;
+       }
+
+       if (list_append_item(list, item) != MENU_SCREEN_ERROR_OK) {
+               free(item->data);
+               free(item->package);
+               free(item);
+               return AIL_CB_RET_CANCEL;
+       }
+
+       _D("[ALL Apps] package=%s", item->package);
+
+       return AIL_CB_RET_CONTINUE;
+}
+
+
+
+static int _all_apps_sort_cb(const void *d1, const void *d2)
+{
+       app_info_t *ai[2];
+       app_list_item *item[2];
+
+       retv_if(NULL == d1, 0);
+       retv_if(NULL == d2, 0);
+
+       item[0] = (app_list_item *) d1;
+       item[1] = (app_list_item *) d2;
+
+       ai[0] = item[0]->data;
+       ai[1] = item[1]->data;
+
+       return strcmp(ai[0]->name, ai[1]->name);
+}
+
+
+
+app_list *all_apps_list_create(void)
+{
+       int count = 0;
+       app_list *list;
+       ail_filter_h f;
+
+       list = calloc(1, sizeof(app_list));
+       retv_if(NULL == list, NULL);
+
+       retv_if(ail_filter_new(&f) != AIL_ERROR_OK, NULL);
+       if (ail_filter_add_bool(f, AIL_PROP_NODISPLAY_BOOL, false) != AIL_ERROR_OK){
+               _E("Failed to add filter");
+               ail_filter_destroy(f);
+               free(list);
+               return NULL;
+       }
+
+       ail_filter_list_appinfo_foreach(f, _all_apps_cb, list);
+       ail_filter_destroy(f);
+
+       if(MENU_SCREEN_ERROR_FAIL == list_sort(list, _all_apps_sort_cb)) {
+               _D("Cannot sort apps.");
+       }
+
+       if(MENU_SCREEN_ERROR_FAIL == list_count(list, &count)) {
+               _D("Cannot count apps.");
+       }
+       _D("Total package count = %d", count);
+
+       return list;
+}
+
+
+
+void all_apps_list_destroy(app_list *list)
+{
+       app_list_item *item;
+
+       ret_if(NULL == list);
+       ret_if(NULL == list->list);
+
+       EINA_LIST_FREE(list->list, item) {
+               if (NULL == item) break;
+               if (item->package) free(item->package);
+               if (item->data) {
+                       list_free_values(item->data);
+                       free(item->data);
+               }
+               free(item);
+       }
+
+       eina_list_free(list->list);
+       free(list);
+}
+
+
+
+// End of a file
diff --git a/src/index.c b/src/index.c
new file mode 100644 (file)
index 0000000..296acac
--- /dev/null
@@ -0,0 +1,130 @@
+ /*
+  * 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>
+
+#include "conf.h"
+#include "util.h"
+#include "page.h"
+#include "layout.h"
+#include "menu_screen.h"
+
+#define PAGE_CONTROLLER_GROUP_NAME "index"
+
+
+
+inline void index_bring_in(Evas_Object *index, int idx)
+{
+       Elm_Object_Item *idx_it;
+
+       idx_it = elm_index_item_find(index, (void *) idx);
+       ret_if(NULL == idx_it);
+       elm_index_item_selected_set(idx_it, EINA_TRUE);
+}
+
+
+
+void index_destroy(Evas_Object *index)
+{
+       evas_object_data_del(index, "win");
+       evas_object_data_del(index, "layout");
+       evas_object_data_del(index, "controlbar");
+       evas_object_data_del(index, "tab");
+       evas_object_data_del(index, "count");
+       elm_index_item_clear(index);
+       evas_object_del(index);
+}
+
+
+
+Evas_Object *index_create(Evas_Object *tab, unsigned int count)
+{
+       Evas_Object *index;
+       Evas_Object *scroller;
+       register int i;
+       char *number;
+
+       retv_if(NULL == tab, NULL);
+       index = elm_index_add(tab);
+       retv_if(NULL == index, NULL);
+
+       elm_object_style_set(index, "pagecontrol");
+       elm_index_horizontal_set(index, EINA_TRUE);
+       elm_index_autohide_disabled_set(index, EINA_TRUE);
+
+       number = malloc(((size_t) log10((double) MAX_PAGE_NO)) + 2);
+       retv_if(NULL == number, NULL);
+
+       for (i = 0; i < count; i++) {
+               sprintf(number, "%d", i + 1);
+               elm_index_item_append(index, number, NULL, (void *) i);
+       }
+       elm_index_level_go(index, 0);
+
+       if (count > 0) {
+               index_bring_in(index, 0);
+       }
+
+       elm_object_part_content_set(tab, PAGE_CONTROLLER_GROUP_NAME, index);
+
+       // FIXME : This part will be removed when fixing Elementary API for index_update.
+       scroller = evas_object_data_get(tab, "scroller");
+       if (scroller) {
+               evas_object_data_set(scroller, "index", index);
+       }
+
+       evas_object_data_set(index, "win", evas_object_data_get(tab, "win"));
+       evas_object_data_set(index, "layout", evas_object_data_get(tab, "layout"));
+       evas_object_data_set(index, "controlbar", evas_object_data_get(tab, "controlbar"));
+       evas_object_data_set(index, "tab", tab);
+       evas_object_data_set(index, "count", (void *) count);
+
+       evas_object_data_set(tab, "index", index);
+       _D("COUNT:%d", count);
+
+       evas_object_show(index);
+
+       return index;
+}
+
+
+
+Evas_Object *index_update(Evas_Object *layout, Evas_Object *index, unsigned int count)
+{
+
+       index_destroy(index);
+       return index_create(layout, count);
+}
+
+
+
+void index_hide(Evas_Object *index)
+{
+       edje_object_signal_emit(_EDJ(index), "hide", "index");
+}
+
+
+
+void index_show(Evas_Object *index)
+{
+       edje_object_signal_emit(_EDJ(index), "show", "index");
+}
+
+
+
+// End of the file
diff --git a/src/item.c b/src/item.c
new file mode 100644 (file)
index 0000000..a9dd107
--- /dev/null
@@ -0,0 +1,740 @@
+ /*
+  * 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 <stdlib.h>
+#include <Elementary.h>
+#include <aul.h>
+#include <ail.h>
+
+#include "menu_screen.h"
+#include "conf.h"
+#include "item.h"
+#include "item_event.h"
+#include "layout.h"
+#include "list.h"
+#include "mapbuf.h"
+#include "page.h"
+#include "popup.h"
+#include "util.h"
+
+#define LINE_SIZE 10
+#define LAYOUT_BLOCK_INTERVAL          1.0
+#define ITEM_GROUP_NAME "icon"
+
+#define STR_ATTRIBUTE_NAME "name"
+#define STR_ATTRIBUTE_ICON "icon"
+#define STR_ATTRIBUTE_PKG_NAME "package"
+#define STR_ATTRIBUTE_REMOVABLE        "removable"
+#define STR_ATTRIBUTE_DESKTOP "desktop"
+#define STR_ATTRIBUTE_PAGE "pending,page"
+#define STR_ICON_IMAGE_TYPE_OBJECT "object"
+#define STR_ICON_IMAGE_TYPE_EDJE "edje"
+
+#define BUFSZE 1024
+
+
+
+#if 0 // Dual line is disabled temporarily.
+static char *_space_to_new_line(const char *str)
+{
+       char *tmp;
+       int len;
+       int space_idx = 0;
+
+       retv_if(NULL == str, NULL);
+       len = strlen(str);
+
+       if (len > LINE_SIZE) {
+               for (space_idx = LINE_SIZE - 1; str[space_idx] != ' ' && space_idx > 0; space_idx--);
+               if (!space_idx) {
+                       space_idx = strcspn(str, " ");
+                       space_idx = (space_idx == len ? 0 : space_idx);
+               }
+       }
+
+       if (space_idx) {
+               int i;
+               retv_if(NULL == (tmp = calloc(1, len + 4)), NULL);
+
+               for (i = 0; i < space_idx; i++) {
+                       tmp[i] = str[i];
+               }
+               strcat(tmp, "<br>");
+               for (i = space_idx + 1; i < len; i++) {
+                       tmp[i + 3] = str[i];
+               }
+       } else {
+               retv_if(NULL == (tmp = strdup(str)), NULL);
+       }
+
+       return tmp;
+}
+#endif
+
+
+
+void item_set_icon(Evas_Object *edje, char *icon, int sync)
+{
+       char *tmp;
+       int changed;
+
+       tmp = evas_object_data_get(edje, STR_ATTRIBUTE_ICON);
+       changed = (tmp && icon) ? strcmp(icon, tmp) : 1;
+
+       if (!changed) {
+               return;
+       }
+
+       free(tmp);
+       evas_object_data_del(edje, STR_ATTRIBUTE_ICON);
+       if (icon) {
+               tmp = strdup(icon);
+               if (tmp) {
+                       evas_object_data_set(edje, STR_ATTRIBUTE_ICON, tmp);
+               }else {
+                       _E("No more memory for allocating space \"%s\"", icon);
+               }
+       }
+}
+
+
+
+inline char *item_get_icon(Evas_Object *edje)
+{
+       return evas_object_data_get(edje, STR_ATTRIBUTE_ICON);
+}
+
+
+
+
+void item_set_name(Evas_Object *edje, char *name, int sync)
+{
+       char *tmp;
+       int changed;
+       bool is_dual_line;
+
+       tmp = evas_object_data_get(edje, STR_ATTRIBUTE_NAME);
+       changed = (tmp && name) ? strcmp(name, tmp) : 1;
+
+       if (!changed) {
+               return;
+       }
+
+       free(tmp);
+       evas_object_data_del(edje, STR_ATTRIBUTE_NAME);
+       if (name) {
+               tmp = strdup(name);
+               if (tmp) {
+                       evas_object_data_set(edje, STR_ATTRIBUTE_NAME, tmp);
+               }else {
+                       _E("No more memory for allocating space \"%s\"", name);
+               }
+
+               is_dual_line = (bool) evas_object_data_get(edje, "item_text_dual_line");
+               if (is_dual_line) {
+                       char *dual_txt;
+
+                       # if 0 // Dual line is disabled temporarily.
+                       dual_txt = _space_to_new_line(name);
+                       #else
+                       dual_txt = strdup(name);
+                       #endif
+                       if (edje_object_part_text_set(_EDJ(edje), "txt", dual_txt) == EINA_FALSE){
+                               //_E("Failed to set text on the part");
+                       }
+                       free(dual_txt);
+               } else {
+                       if (edje_object_part_text_set(_EDJ(edje), "txt", name) == EINA_FALSE){
+                               //_E("Failed to set text on the part");
+                       }
+               }
+       }
+}
+
+
+
+inline char *item_get_name(Evas_Object *edje)
+{
+       return evas_object_data_get(edje, STR_ATTRIBUTE_NAME);
+}
+
+
+
+void item_set_desktop(Evas_Object *edje, char *name, int sync)
+{
+       char *tmp;
+       int changed;
+
+       tmp = evas_object_data_get(edje, STR_ATTRIBUTE_DESKTOP);
+       changed = (tmp && name) ? strcmp(name, tmp) : 1;        // We have to do sync when an attribute is created
+
+       if (!changed) {
+               return;
+       }
+
+       free(tmp);      // NOTE: I can accept this, "free" will not do anything for NULL
+       evas_object_data_del(edje, STR_ATTRIBUTE_DESKTOP);
+       if (name) {
+               tmp = strdup(name);
+               if (!tmp) {
+                       _E("No more memory for allocating space \"%s\"", name);
+               } else {
+                       evas_object_data_set(edje, STR_ATTRIBUTE_DESKTOP, tmp);
+               }
+       }
+}
+
+
+
+inline char *item_get_desktop(Evas_Object *edje)
+{
+       return evas_object_data_get(edje, STR_ATTRIBUTE_DESKTOP);
+}
+
+
+
+void item_set_package(Evas_Object *edje, char *package, int sync)
+{
+       char *tmp;
+       int changed;
+
+       tmp = evas_object_data_get(edje, STR_ATTRIBUTE_PKG_NAME);
+       changed = (package && tmp) ? strcmp(tmp, package) : 1;
+
+       if (!changed) {
+               return;
+       }
+
+       free(tmp);
+       evas_object_data_del(edje, STR_ATTRIBUTE_PKG_NAME);
+
+       if (package) {
+               tmp = strdup(package);
+               if (!tmp) {
+                       _E("No more space for string \"%s\"", package);
+               } else {
+                       evas_object_data_set(edje, STR_ATTRIBUTE_PKG_NAME, tmp);
+               }
+       }
+}
+
+
+
+inline char *item_get_package(Evas_Object *edje)
+{
+       return evas_object_data_get(edje, STR_ATTRIBUTE_PKG_NAME);
+}
+
+
+
+void item_set_removable(Evas_Object *edje, int removable, int sync)
+{
+       int value;
+       int changed;
+
+       value = (int)evas_object_data_get(edje, STR_ATTRIBUTE_REMOVABLE);
+       changed = (int)(value != removable);
+
+       if (!changed) {
+               return;
+       }
+
+       evas_object_data_del(edje, STR_ATTRIBUTE_REMOVABLE);
+
+       if (removable >= 0) {
+               evas_object_data_set(edje, STR_ATTRIBUTE_REMOVABLE, (void*) removable);
+       }
+}
+
+
+
+inline int item_get_removable(Evas_Object *edje)
+{
+       return (int) evas_object_data_get(edje, STR_ATTRIBUTE_REMOVABLE);
+}
+
+
+
+void item_set_page(Evas_Object *edje, Evas_Object *page, int sync)
+{
+       Evas_Object *value;
+       int changed;
+
+       value = evas_object_data_get(edje, STR_ATTRIBUTE_PAGE);
+       changed = (int)(value != page);
+
+       if (!changed) {
+               return;
+       }
+
+       evas_object_data_del(edje, STR_ATTRIBUTE_PAGE);
+
+       if (page) {
+               evas_object_data_set(edje, STR_ATTRIBUTE_PAGE, page);
+       }
+}
+
+
+
+inline Evas_Object *item_get_page(Evas_Object *edje)
+{
+       return evas_object_data_get(edje, STR_ATTRIBUTE_PAGE);
+}
+
+
+
+
+inline void item_enable_delete(Evas_Object *item)
+{
+       if (item_get_removable(item) > 0) {
+               edje_object_signal_emit(_EDJ(item), "delete,on", "menu");
+       }
+}
+
+
+
+inline void item_disable_delete(Evas_Object *item)
+{
+       if (item_get_removable(item) > 0) {
+               edje_object_signal_emit(_EDJ(item), "delete,off", "menu");
+       }
+}
+
+
+void item_enable_progress(Evas_Object *obj)
+{
+       Evas_Object *progress;
+
+       ret_if(evas_object_data_get(obj, "progress,enabled"));
+
+       progress = elm_object_part_content_unset(obj, "progress,swallow");
+       if (progress) {
+               _D("Progress bar is already registered... Hmm.. just remove it");
+               evas_object_del(progress);
+       }
+
+       progress = elm_progressbar_add(menu_screen_get_win());
+       ret_if(NULL == progress);
+
+       elm_object_part_content_set(obj, "progress,swallow", progress);
+
+       evas_object_size_hint_weight_set(progress, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_size_hint_align_set(progress, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+       elm_progressbar_value_set(progress, 0.0f);
+       elm_progressbar_horizontal_set(progress, EINA_TRUE);
+       evas_object_show(progress);
+
+       edje_object_signal_emit(_EDJ(obj), "progress,enable", "item");
+
+       evas_object_data_set(obj, "progress,enabled", "true");
+}
+
+
+
+void item_update_progress(Evas_Object *obj, int value)
+{
+       Evas_Object *progress;
+
+       ret_if(NULL == evas_object_data_get(obj, "progress,enabled"));
+
+       progress = edje_object_part_swallow_get(_EDJ(obj), "progress,swallow");
+       ret_if(NULL == progress);
+
+       elm_progressbar_value_set(progress, (float)value/100.0f);
+
+       _D("progress is updated to %d", value);
+}
+
+
+
+void item_disable_progress(Evas_Object *obj)
+{
+       Evas_Object *progress;
+
+       ret_if(NULL == evas_object_data_get(obj, "progress,enabled"));
+
+       edje_object_signal_emit(_EDJ(obj), "progress,disable", "item");
+
+       progress = elm_object_part_content_unset(obj, "progress,swallow");
+       if (progress) {
+               evas_object_del(progress);
+       }
+
+       evas_object_data_del(obj, "progress,enabled");
+}
+
+
+
+int item_is_enabled_progress(Evas_Object *obj)
+{
+       return evas_object_data_get(obj, "progress,enabled") != NULL;
+}
+
+
+
+static Evas_Object *_add_icon_image(const char *icon_file)
+{
+       Evas_Object *icon;
+
+       icon = elm_icon_add(menu_screen_get_win());
+       if (elm_icon_file_set(icon, icon_file, NULL) == EINA_FALSE) {
+               _E("Icon file is not accessible (%s)", icon_file);
+               evas_object_del(icon);
+               icon = NULL;
+       }
+
+       elm_icon_resizable_set(icon, EINA_TRUE, EINA_TRUE);
+
+       if (menu_screen_get_root_height() >= BASE_HEIGHT || menu_screen_get_root_width() >= BASE_WIDTH) {
+               elm_icon_no_scale_set(icon, EINA_TRUE);
+       }
+
+       return icon;
+}
+
+
+
+static Evas_Object *_add_edje_icon(const char *icon_file)
+{
+       Evas_Object *icon;
+       if (access(icon_file, R_OK) != 0) {
+               _E("Failed to get an icon");
+               return NULL;
+       }
+
+       icon = layout_load_edj(menu_screen_get_win(), (char*)icon_file, ITEM_GROUP_NAME);
+       if (!icon) {
+               _E("Failed to load an edje, [%s] group icon", icon_file);
+               evas_object_del(icon);
+               icon = NULL;
+       }
+
+       return icon;
+}
+
+
+
+menu_screen_error_e item_is_edje_icon(const char *icon)
+{
+       int len;
+       const char *ext = "jde.";
+
+       retv_if(!icon, MENU_SCREEN_ERROR_FAIL);
+
+       len = strlen(icon) - 1;
+
+       while (len >= 0 && *ext && icon[len] == *ext) {
+               len --;
+               ext ++;
+       }
+
+       return *ext ? MENU_SCREEN_ERROR_FAIL : MENU_SCREEN_ERROR_OK;
+}
+
+
+
+void item_update(Evas_Object *item, app_info_t *ai)
+{
+       Evas_Object *icon;
+
+       if (!ai->image) {
+               if (item_is_edje_icon(ai->icon) == MENU_SCREEN_ERROR_OK) {
+                       icon = _add_edje_icon(ai->icon);
+                       evas_object_data_set(item, "icon_image_type", STR_ICON_IMAGE_TYPE_EDJE);
+               } else {
+                       icon = _add_icon_image(ai->icon);
+                       evas_object_data_set(item, "icon_image_type", STR_ICON_IMAGE_TYPE_OBJECT);
+               }
+       } else {
+               icon = ai->image;
+               evas_object_data_set(item, "icon_image_type", STR_ICON_IMAGE_TYPE_OBJECT);
+       }
+
+       if (icon) {
+               Evas_Object *temp_item;
+               temp_item = elm_object_part_content_unset(item, "icon_image");
+               if (temp_item) {
+                       evas_object_del(temp_item);
+               }
+
+               elm_object_part_content_set(item, "icon_image", icon);
+               evas_object_data_set(item, "icon_image", icon);
+       }
+
+       item_set_package(item, ai->package, 0);
+       item_set_desktop(item, ai->desktop, 0);
+       item_set_name(item, ai->name, 0);
+       item_set_icon(item, ai->icon, 0);
+       evas_object_data_set(item, STR_ATTRIBUTE_REMOVABLE, (void*) ai->x_slp_removable);
+       evas_object_data_set(item, "pid", (void *) ai->pid);
+}
+
+
+
+Evas_Object *item_create(Evas_Object *scroller, app_info_t* ai)
+{
+       Evas_Object *item;
+       Evas_Object *bg;
+
+       char *item_edje;
+       int item_width;
+       int item_height;
+
+       item_edje = evas_object_data_get(scroller, "item_edje");
+       item = layout_load_edj(menu_screen_get_win(), item_edje, ITEM_GROUP_NAME);
+       if (!item) {
+               _E("Failed to load an item object");
+               return NULL;
+       }
+
+       bg = evas_object_rectangle_add(menu_screen_get_evas());
+       if (!bg) {
+               evas_object_del(item);
+               return NULL;
+       }
+
+       item_width = (int) evas_object_data_get(scroller, "item_width");
+       item_height = (int) evas_object_data_get(scroller, "item_height");
+
+       evas_object_color_set(bg, 0, 0, 0, 0);
+       evas_object_resize(bg, item_width, item_height);
+       evas_object_size_hint_min_set(bg, item_width, item_height);
+       evas_object_size_hint_max_set(bg, item_width, item_height);
+       elm_object_part_content_set(item, "bg", bg);
+
+       edje_object_text_class_set(_EDJ(item), "menu_item", "SLP:style=medium", 24);
+
+       evas_object_data_set(item, "win", evas_object_data_get(scroller, "win"));
+       evas_object_data_set(item, "layout", evas_object_data_get(scroller, "layout"));
+       evas_object_data_set(item, "controlbar", evas_object_data_get(scroller, "controlbar"));
+       evas_object_data_set(item, "tab", evas_object_data_get(scroller, "tab"));
+       evas_object_data_set(item, "scroller", scroller);
+       evas_object_data_set(item, "item_enable_long_press", evas_object_data_get(scroller, "item_enable_long_press"));
+       evas_object_data_set(item, "item_text_dual_line", evas_object_data_get(scroller, "item_text_dual_line"));
+       evas_object_data_set(item, "pending,idx", (void *) 0);
+       evas_object_data_set(item, "x", (void *) 0);
+       evas_object_data_set(item, "y", (void *) 0);
+       evas_object_data_set(item, "dirty", (void *) 0);
+
+       item_update(item, ai);
+       item_event_register(item);
+
+       return item;
+}
+
+
+
+void item_destroy(Evas_Object *item)
+{
+       Evas_Object *icon;
+       Evas_Object *bg;
+       Evas_Object *page;
+       Eina_List *pending_list;
+       Eina_List *n;
+       Eina_List *t;
+       Evas_Object *pend_item;
+       int pending_idx;
+       const char *icon_image_type;
+
+       ret_if(NULL == item);
+
+       page = item_get_page(item);
+       pending_list = evas_object_data_get(page, "pending,list");
+       EINA_LIST_FOREACH_SAFE(pending_list, n, t, pend_item) {
+               if (pend_item == item) {
+                       pending_idx = (int)evas_object_data_get(pend_item, "pending,idx");
+                       pending_list = eina_list_remove(pending_list, pend_item);
+                       evas_object_data_set(page, "pending,list", pending_list);
+                       evas_object_data_del(pend_item, "pending,idx");
+               }
+       }
+
+       item_event_unregister(item);
+
+       item_set_package(item, NULL, 1);
+       item_set_desktop(item, NULL, 1);
+       item_set_name(item, NULL, 1);
+       item_set_icon(item, NULL, 1);
+       item_set_page(item, NULL, 1);
+       evas_object_data_del(item, STR_ATTRIBUTE_REMOVABLE);
+       evas_object_data_del(item, "pid");
+       evas_object_data_del(_EDJ(item), "evas_object");
+       bg = elm_object_part_content_unset(item, "bg");
+       if (bg) {
+               evas_object_del(bg);
+       }
+
+       elm_object_part_content_unset(item, "icon_image");
+       icon = evas_object_data_del(item, "icon_image");
+       icon_image_type = evas_object_data_get(item, "icon_image_type");
+       if (icon_image_type) {
+               if (!strcmp(icon_image_type, STR_ICON_IMAGE_TYPE_OBJECT)) {
+                       evas_object_del(icon);
+               } else if (!strcmp(icon_image_type, STR_ICON_IMAGE_TYPE_EDJE)) {
+                       layout_unload_edj(icon);
+               }
+       }
+
+       evas_object_data_del(item, "win");
+       evas_object_data_del(item, "layout");
+       evas_object_data_del(item, "controlbar");
+       evas_object_data_del(item, "tab");
+       evas_object_data_del(item, "scroller");
+       evas_object_data_del(item, "item_enable_long_press");
+       evas_object_data_del(item, "item_text_dual_line");
+       evas_object_data_del(item, "pending,idx");
+       evas_object_data_del(item, "x");
+       evas_object_data_del(item, "y");
+       evas_object_data_del(item, "dirty");
+       layout_unload_edj(item);
+}
+
+
+
+static Eina_Bool _unblock_cb(void *data)
+{
+       Evas_Object *layout;
+       layout = evas_object_data_get(menu_screen_get_win(), "layout_current");
+       layout_disable_block(layout);
+       return EINA_FALSE;
+}
+
+
+
+void item_launch(Evas_Object *obj)
+{
+       char *package;
+       char *name;
+       int ret_aul;
+       Evas_Object *layout;
+
+       ret_if(NULL == obj);
+
+       name = item_get_name(obj);
+       package = item_get_package(obj);
+       ret_if(NULL == package);
+
+       layout = evas_object_data_get(menu_screen_get_win(), "layout_current");
+       layout_enable_block(layout);
+
+       ret_aul = aul_open_app(package);
+       if (ret_aul == AUL_R_EINVAL) {
+               char* sinform;
+               int len;
+
+               // IDS_IDLE_POP_UNABLE_TO_LAUNCH_PS : "Unable to launch %s"
+               len = strlen(D_("IDS_IDLE_POP_UNABLE_TO_LAUNCH_PS")) + strlen(name) + 1;
+
+               sinform = calloc(len, sizeof(char));
+               if (!sinform) {
+                       _E("cannot calloc for popup.");
+                       return;
+               }
+
+               snprintf(sinform, len, D_("IDS_IDLE_POP_UNABLE_TO_LAUNCH_PS"), name);
+               popup_create(obj, sinform);
+
+               free(sinform);
+               layout_disable_block(layout);
+       } else {
+               _D("Launch app's ret : [%d]", ret_aul);
+               _T(package);
+               ecore_timer_add(LAYOUT_BLOCK_INTERVAL, _unblock_cb, NULL);
+       }
+}
+
+
+
+int item_get_position(Evas_Object *item)
+{
+       Evas_Object *scroller;
+       Evas_Object *layout;
+
+       Evas_Coord item_x;
+       Evas_Coord item_y;
+
+       Evas_Coord scroller_x;
+       Evas_Coord scroller_y;
+       Evas_Coord scroller_w;
+       Evas_Coord scroller_h;
+
+       int layout_width;
+
+       int items_per_line;
+       int nth_line;
+       int nth_item;
+
+       int item_width;
+       int item_height;
+
+       layout = evas_object_data_get(item, "layout");
+       scroller = evas_object_data_get(item, "scroller");
+
+       layout_width = (int) evas_object_data_get(layout, "width");
+       item_width = (int) evas_object_data_get(scroller, "item_width");
+       item_height = (int) evas_object_data_get(scroller, "item_height");
+
+       evas_object_geometry_get(item, &item_x, &item_y, NULL, NULL);
+       evas_object_geometry_get(scroller, &scroller_x, &scroller_y, &scroller_w, &scroller_h);
+
+       if (item_x < ((float) layout_width) * 0.005f) {
+               return -1;
+       }
+
+       if (item_x + ((float) item_width * 0.85f) > ((float) layout_width) * 0.98f) {
+               return (int) evas_object_data_get(scroller, "page_max_app");
+       }
+
+       if (0 == item_width || 0 == item_height) {
+               _E("item_widht or item_heiht is zero.");
+               return 0;
+       }
+
+       items_per_line = scroller_w / item_width;
+       nth_line = (item_y - (float) item_height * 0.3) / item_height;
+       nth_line = nth_line < 0 ? 0 : nth_line;
+       nth_item = (item_x + (float) item_width * 0.5) / item_width;
+
+       return (nth_line * items_per_line) + nth_item;
+}
+
+
+
+void item_mark_dirty(Evas_Object *item)
+{
+       evas_object_data_set(item, "dirty", (void *) 1);
+}
+
+
+
+void item_unmark_dirty(Evas_Object *item)
+{
+       evas_object_data_set(item, "dirty", (void *) 0);
+}
+
+
+
+int item_is_dirty(Evas_Object *item)
+{
+       return (int) evas_object_data_get(item, "dirty");
+}
+
+
+
+// End of a file
diff --git a/src/item_event.c b/src/item_event.c
new file mode 100644 (file)
index 0000000..4742b9b
--- /dev/null
@@ -0,0 +1,130 @@
+ /*
+  * 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>
+#include <string.h>
+#include <aul.h>
+#include <stdbool.h>
+
+#include "menu_screen.h"
+#include "conf.h"
+#include "item.h"
+#include "item_event.h"
+#include "mapbuf.h"
+#include "mouse.h"
+#include "page.h"
+#include "page_scroller.h"
+#include "util.h"
+#include "all_apps/layout.h"
+
+#define LONG_PRESS_TIME 1.0f
+#define BUFSZE 1024
+
+
+
+static struct {
+       Evas_Object *pressed_item;
+} item_event_info = {
+       .pressed_item = NULL,
+};
+
+
+
+static void _item_down_cb(void *data, Evas_Object *obj, const char* emission, const char* source)
+{
+       Evas_Object *icon_image;
+       Evas_Object *item;
+       bool item_enable_long_press;
+
+       item = evas_object_data_get(obj, "item");
+       item_enable_long_press = (bool) evas_object_data_get(item, "item_enable_long_press");
+
+       _D("ITEM: mouse down event callback is invoked for %p", item);
+
+       item_event_info.pressed_item = item;
+
+       icon_image = evas_object_data_get(item, "icon_image");
+       evas_object_color_set(icon_image, 100, 100, 100, 100);
+
+       if (!item_enable_long_press) {
+               return;
+       }
+}
+
+
+
+static void _item_up_cb(void *data, Evas_Object *obj, const char* emission, const char* source)
+{
+       Evas_Object *icon_image;
+       Evas_Object *item;
+
+       item = evas_object_data_get(obj, "item");
+       ret_if(NULL == item);
+
+       _D("ITEM: mouse up event callback is invoked for %p", item);
+       PRINT_APPFWK();
+
+       icon_image = evas_object_data_get(item, "icon_image");
+       evas_object_color_set(icon_image, 255, 255, 255, 255);
+
+       ret_if(NULL == item_event_info.pressed_item);
+
+       if (item_event_info.pressed_item == item) {
+               bool item_enable_long_press;
+
+               item_enable_long_press = (bool) evas_object_data_get(item, "item_enable_long_press");
+               _D("Not Edit Mode");
+
+               if (mouse_is_scrolling()) {
+                       return;
+               }
+
+               item_launch(item);
+       }
+
+       item_event_info.pressed_item = NULL;
+}
+
+
+
+void item_event_register(Evas_Object *item)
+{
+       Evas_Object *item_edje;
+       item_edje = _EDJ(item);
+       evas_object_data_set(item_edje, "item", item);
+
+       edje_object_signal_callback_add(item_edje, "item,down", "menu", _item_down_cb, NULL);
+       edje_object_signal_callback_add(item_edje, "item,up", "menu", _item_up_cb, NULL);
+}
+
+
+
+void item_event_unregister(Evas_Object *item)
+{
+       Evas_Object *item_edje;
+       item_edje = _EDJ(item);
+
+       edje_object_signal_callback_del(item_edje, "item,down", "menu", _item_down_cb);
+       edje_object_signal_callback_del(item_edje, "item,up", "menu", _item_up_cb);
+
+       evas_object_data_del(item_edje, "item");
+}
+
+
+
+// End of a file
diff --git a/src/layout.c b/src/layout.c
new file mode 100644 (file)
index 0000000..cc5a60d
--- /dev/null
@@ -0,0 +1,144 @@
+ /*
+  * 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>
+#include <Ecore_X.h>
+#include <utilX.h>
+#include <vconf.h>
+
+#include "menu_screen.h"
+#include "conf.h"
+#include "item_event.h"
+#include "layout.h"
+#include "mapbuf.h"
+#include "page.h"
+#include "item.h"
+#include "util.h"
+#include "all_apps/layout.h"
+
+
+
+Evas_Object *layout_create(Evas_Object *win, const char *file, const char *group, int rotate)
+{
+       Evas_Object *layout;
+       Evas_Object *all_apps;
+       int width;
+       int height;
+
+       layout = layout_load_edj(win, file, group);
+       retv_if(NULL == layout, NULL);
+
+       evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       elm_win_resize_object_add(win, layout);
+
+       evas_object_data_set(layout, "win", win);
+       evas_object_data_set(layout, "rotate", (void *) rotate);
+
+       width = menu_screen_get_root_width();
+       height = menu_screen_get_root_height();
+
+       evas_object_data_set(layout, "width", (void *) width);
+       evas_object_data_set(layout, "height", (void *) height);
+
+       all_apps = all_apps_layout_create(layout, rotate);
+       if (NULL == all_apps) {
+               _E("Failed to create scroller");
+               layout_destroy(layout);
+               return NULL;
+       }
+       evas_object_data_set(layout, "all_apps", all_apps);
+       elm_object_part_content_set(layout, "content", all_apps);
+
+       return layout;
+}
+
+
+
+void layout_destroy(Evas_Object *layout)
+{
+       Evas_Object *all_apps;
+
+       all_apps = evas_object_data_get(layout, "all_apps");
+       all_apps_layout_destroy(all_apps);
+
+       evas_object_data_del(layout, "win");
+       evas_object_data_del(layout, "all_apps");
+       evas_object_data_del(layout, "rotate");
+       evas_object_data_del(layout, "width");
+       evas_object_data_del(layout, "height");
+
+       layout_unload_edj(layout);
+}
+
+
+
+void layout_enable_block(Evas_Object *layout)
+{
+       ret_if(NULL == layout);
+
+       _D("Enable layout blocker");
+       edje_object_signal_emit(_EDJ(layout), "block", "layout");
+}
+
+
+
+void layout_disable_block(Evas_Object *layout)
+{
+       ret_if(NULL == layout);
+
+       _D("Disable layout blocker");
+       edje_object_signal_emit(_EDJ(layout), "unblock", "layout");
+}
+
+
+
+Evas_Object* layout_load_edj(Evas_Object *parent, const char *edjname, const char *grpname)
+{
+       Evas_Object *eo;
+
+       retv_if(NULL == parent, NULL);
+
+       eo = elm_layout_add(parent);
+       retv_if(NULL == eo, NULL);
+       retv_if(EINA_FALSE == elm_layout_file_set(eo, edjname, grpname), NULL);
+
+       evas_object_data_set(_EDJ(eo), "evas_object", eo);
+       evas_object_show(eo);
+
+       return eo;
+}
+
+
+
+void layout_unload_edj(Evas_Object *layout)
+{
+       Evas_Object *evas_object;
+
+       ret_if(NULL == layout);
+
+       evas_object = evas_object_data_get(_EDJ(layout), "evas_object");
+       if (evas_object) {
+               evas_object_data_del(_EDJ(layout), "evas_object");
+       }
+
+       evas_object_del(layout);
+}
+
+
+
+// End of file
diff --git a/src/list.c b/src/list.c
new file mode 100644 (file)
index 0000000..5109904
--- /dev/null
@@ -0,0 +1,193 @@
+ /*
+  * 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 <stdbool.h>
+#include <stdlib.h>
+#include <Elementary.h>
+#include <ail.h>
+
+#include "list.h"
+#include "util.h"
+#include "all_apps/list.h"
+
+
+
+menu_screen_error_e list_count(app_list *list, int *count)
+{
+       retv_if(NULL == list, MENU_SCREEN_ERROR_INVALID_PARAMETER);
+       retv_if(NULL == list->list, MENU_SCREEN_ERROR_INVALID_PARAMETER);
+       retv_if(NULL == count, MENU_SCREEN_ERROR_INVALID_PARAMETER);
+
+       *count = eina_list_count(list->list);
+
+       return MENU_SCREEN_ERROR_OK;
+}
+
+
+
+menu_screen_error_e list_first(app_list *list)
+{
+       retv_if(NULL == list, MENU_SCREEN_ERROR_INVALID_PARAMETER);
+
+       list->cur_idx = 0;
+
+       return MENU_SCREEN_ERROR_OK;
+}
+
+
+
+menu_screen_error_e list_next(app_list *list)
+{
+       int count;
+
+       retv_if(NULL == list, MENU_SCREEN_ERROR_INVALID_PARAMETER);
+       retv_if(NULL == list->list, MENU_SCREEN_ERROR_INVALID_PARAMETER);
+
+       count = eina_list_count(list->list);
+       if (list->cur_idx + 1 == count) return MENU_SCREEN_ERROR_NO_DATA;
+
+       list->cur_idx ++;
+
+       return MENU_SCREEN_ERROR_OK;
+}
+
+
+
+menu_screen_error_e list_is_ended(app_list *list, bool *flag)
+{
+       int count;
+
+       retv_if(NULL == list, MENU_SCREEN_ERROR_INVALID_PARAMETER);
+       retv_if(NULL == list->list, MENU_SCREEN_ERROR_INVALID_PARAMETER);
+
+       count = eina_list_count(list->list);
+       *flag = (list->cur_idx == count) ? true : false;
+
+       return MENU_SCREEN_ERROR_OK;
+}
+
+
+
+menu_screen_error_e list_get_item(app_list *list, app_list_item **item)
+{
+       retv_if(NULL == list, MENU_SCREEN_ERROR_INVALID_PARAMETER);
+       retv_if(NULL == list->list, MENU_SCREEN_ERROR_INVALID_PARAMETER);
+
+       *item = eina_list_nth(list->list, list->cur_idx);
+
+       return MENU_SCREEN_ERROR_OK;
+}
+
+
+
+
+menu_screen_error_e list_get_values(const char *package, app_info_t *ai)
+{
+       ail_appinfo_h appinfo_h;
+       char *exec;
+       char *name;
+       char *icon;
+       ail_error_e ret;
+
+       retv_if(NULL == package, MENU_SCREEN_ERROR_FAIL);
+       retv_if(NULL == ai, MENU_SCREEN_ERROR_FAIL);
+       retv_if(NULL == (ai->package = strdup(package)), MENU_SCREEN_ERROR_FAIL);
+
+       ret = ail_package_get_appinfo(ai->package, &appinfo_h);
+       if (AIL_ERROR_OK == ret) {
+               do {
+                       break_if(ail_appinfo_get_str(appinfo_h, AIL_PROP_EXEC_STR, &exec) < 0);
+                       break_if(ail_appinfo_get_str(appinfo_h, AIL_PROP_NAME_STR, &name) < 0);
+                       break_if(ail_appinfo_get_str(appinfo_h, AIL_PROP_ICON_STR, &icon) < 0);
+                       break_if(ail_appinfo_get_bool(appinfo_h, AIL_PROP_NODISPLAY_BOOL, &ai->nodisplay) < 0);
+                       break_if(ail_appinfo_get_bool(appinfo_h, AIL_PROP_X_SLP_REMOVABLE_BOOL, &ai->x_slp_removable) < 0);
+                       break_if(ail_appinfo_get_bool(appinfo_h, AIL_PROP_X_SLP_TASKMANAGE_BOOL, &ai->x_slp_taskmanage) < 0);
+
+                       break_if(NULL == exec || NULL == (ai->exec = strdup(exec)));
+                       break_if(NULL == name || NULL == (ai->name = strdup(name)));
+                       break_if(NULL == icon || NULL == (ai->icon = strdup(icon)));
+
+                       ail_package_destroy_appinfo(appinfo_h);
+
+                       return MENU_SCREEN_ERROR_OK;
+               } while(0);
+
+               ail_package_destroy_appinfo(appinfo_h);
+               list_free_values(ai);
+               return MENU_SCREEN_ERROR_FAIL;
+       } else if (AIL_ERROR_NO_DATA == ret) {
+               return MENU_SCREEN_ERROR_OK;
+       }
+
+       return MENU_SCREEN_ERROR_FAIL;
+}
+
+
+
+void list_free_values(app_info_t *ai)
+{
+       ret_if(NULL == ai);
+
+       /* Origin field */
+       if (ai->package) free(ai->package);
+       if (ai->exec) free(ai->exec);
+       if (ai->name) free(ai->name);
+       if (ai->icon) free(ai->icon);
+}
+
+
+
+menu_screen_error_e list_append_item(app_list *list, app_list_item *item)
+{
+       retv_if(NULL == list, MENU_SCREEN_ERROR_INVALID_PARAMETER);
+       retv_if(NULL == item, MENU_SCREEN_ERROR_INVALID_PARAMETER);
+
+       list->list = eina_list_append(list->list, item);
+       retv_if(NULL == list->list, MENU_SCREEN_ERROR_FAIL);
+
+       return MENU_SCREEN_ERROR_OK;
+}
+
+
+
+menu_screen_error_e list_remove_item(app_list *list, app_list_item *item)
+{
+       retv_if(NULL == list, MENU_SCREEN_ERROR_INVALID_PARAMETER);
+       retv_if(NULL == list->list, MENU_SCREEN_ERROR_INVALID_PARAMETER);
+       retv_if(NULL == item, MENU_SCREEN_ERROR_INVALID_PARAMETER);
+
+       list->list = eina_list_remove(list->list, item);
+
+       return MENU_SCREEN_ERROR_OK;
+}
+
+
+
+menu_screen_error_e list_sort(app_list *list, int (*_sort_cb)(const void *d1, const void *d2))
+{
+       retv_if(NULL == list, MENU_SCREEN_ERROR_INVALID_PARAMETER);
+
+       list->list = eina_list_sort(list->list, eina_list_count(list->list), _sort_cb);
+       retv_if(NULL == list->list, MENU_SCREEN_ERROR_FAIL);
+
+       return MENU_SCREEN_ERROR_OK;
+}
+
+
+
+// End of a file
diff --git a/src/mapbuf.c b/src/mapbuf.c
new file mode 100644 (file)
index 0000000..e2ac478
--- /dev/null
@@ -0,0 +1,192 @@
+ /*
+  * 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>
+
+#include "menu_screen.h"
+#include "conf.h"
+#include "layout.h"
+#include "mapbuf.h"
+#include "util.h"
+
+
+
+Evas_Object *mapbuf_get_mapbuf(Evas_Object *obj)
+{
+       Evas_Object *mapbuf;
+
+       if (obj == NULL) return NULL;
+
+       mapbuf = evas_object_data_get(obj, "mapbuf");
+       if (!mapbuf && evas_object_data_get(obj, "page")) {
+               mapbuf = obj;
+       }
+
+       return mapbuf;
+}
+
+
+
+Evas_Object *mapbuf_get_page(Evas_Object *obj)
+{
+       Evas_Object *page;
+
+       if (obj == NULL) return NULL;
+
+       page = evas_object_data_get(obj, "page");
+       if (!page && evas_object_data_get(obj, "mapbuf")) {
+               page = obj;
+       }
+
+       return page;
+}
+
+
+
+menu_screen_error_e mapbuf_enable(Evas_Object *obj, int force)
+{
+       Evas_Object *mapbuf;
+       int cnt;
+
+       mapbuf = mapbuf_get_mapbuf(obj);
+       if (!mapbuf) {
+               _D("Failed to get the mapbuf object");
+               return MENU_SCREEN_ERROR_FAIL;
+       }
+
+       if (force) {
+               evas_object_data_set(mapbuf, "mapbuf_enabled", (void*)0);
+               elm_mapbuf_enabled_set(mapbuf, 1);
+               return MENU_SCREEN_ERROR_OK;
+       }
+
+       cnt = (int)evas_object_data_get(mapbuf, "mapbuf_enabled");
+       cnt ++;
+       evas_object_data_set(mapbuf, "mapbuf_enabled", (void*)cnt);
+       //_D("[%s] CNT = %d", __func__, cnt);
+
+       if (cnt == 0) {
+               if (!elm_mapbuf_enabled_get(mapbuf)) {
+                       elm_mapbuf_enabled_set(mapbuf, 1);
+                       //_D("[%s] mapbuf enabled", __func__);
+               }
+       }
+
+       return MENU_SCREEN_ERROR_OK;
+}
+
+
+
+int mapbuf_is_enabled(Evas_Object *obj)
+{
+       Evas_Object *mapbuf;
+       mapbuf = mapbuf_get_mapbuf(obj);
+       if (!mapbuf) {
+               return 0;
+       }
+
+       return elm_mapbuf_enabled_get(mapbuf);
+}
+
+
+
+int mapbuf_disable(Evas_Object *obj, int force)
+{
+       Evas_Object *mapbuf;
+       int cnt;
+
+       mapbuf = mapbuf_get_mapbuf(obj);
+       if (!mapbuf) {
+               _D("Failed to get the mapbuf object");
+               return MENU_SCREEN_ERROR_FAIL;
+       }
+
+       if (force) {
+               evas_object_data_set(mapbuf, "mapbuf_enabled", (void*)-1);
+               elm_mapbuf_enabled_set(mapbuf, 0);
+               return MENU_SCREEN_ERROR_OK;
+       }
+
+       cnt = (int)evas_object_data_get(mapbuf, "mapbuf_enabled");
+       if (cnt == 0) {
+               if (elm_mapbuf_enabled_get(mapbuf)) {
+                       elm_mapbuf_enabled_set(mapbuf, 0);
+                       //_D("[%s] disableld mapbuf", __func__);
+               }
+       }
+
+       cnt --;
+       evas_object_data_set(mapbuf, "mapbuf_enabled", (void*)cnt);
+       //_D("[%s] CNT = %d", __func__, cnt);
+
+       return MENU_SCREEN_ERROR_OK;
+}
+
+
+
+Evas_Object *mapbuf_bind(Evas_Object *box, Evas_Object *page)
+{
+       Evas_Object *mapbuf;
+
+       mapbuf = elm_mapbuf_add(box);
+       if (!mapbuf) {
+               _D("Failed to create a new mapbuf");
+               return NULL;
+       }
+
+       elm_mapbuf_smooth_set(mapbuf, EINA_TRUE);
+       elm_mapbuf_alpha_set(mapbuf, EINA_TRUE);
+       elm_object_content_set(mapbuf, page);
+
+       evas_object_data_set(page, "mapbuf", mapbuf);
+       evas_object_data_set(mapbuf, "page", page);
+       mapbuf_disable(mapbuf, 1);
+       evas_object_show(mapbuf);
+
+       return mapbuf;
+}
+
+
+
+Evas_Object *mapbuf_unbind(Evas_Object *obj)
+{
+       Evas_Object *page;
+       Evas_Object *mapbuf;
+
+       page = evas_object_data_get(obj, "page");
+       if (page) {
+               mapbuf = obj;
+       } else {
+               page = obj;
+               mapbuf = evas_object_data_get(obj, "mapbuf");
+       }
+
+       if (mapbuf) {
+               elm_mapbuf_enabled_set(mapbuf, 0);
+               evas_object_data_del(page, "mapbuf");
+               evas_object_data_del(mapbuf, "page");
+               evas_object_data_del(mapbuf, "mapbuf_enabled");
+               page = elm_object_content_unset(mapbuf);
+               evas_object_del(mapbuf);
+       }
+       return page;
+}
+
+
+
+// End of a file
diff --git a/src/menu_screen.c b/src/menu_screen.c
new file mode 100644 (file)
index 0000000..20e4beb
--- /dev/null
@@ -0,0 +1,506 @@
+ /*
+  * 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>
+#include <Ecore_X.h>
+#include <ail.h>
+#include <app.h>
+#include <stdbool.h>
+#include <vconf.h>
+#include <utilX.h>
+#include <aul.h>
+
+#include "conf.h"
+#include "item.h"
+#include "layout.h"
+#include "mapbuf.h"
+#include "menu_screen.h"
+#include "mouse.h"
+#include "page.h"
+#include "page_scroller.h"
+#include "util.h"
+
+#define STR_ENV_ENGINE "LAUNCHER_ENGINE"
+#define STR_ENV_FPS "LAUNCHER_FPS"
+
+#define LAYOUT_EDJE_PORTRAIT EDJEDIR"/layout_portrait.edj"
+#define LAYOUT_GROUP_NAME "layout"
+
+
+
+// Define prototype of the "hidden API of AUL"
+extern int aul_listen_app_dead_signal(int (*func)(int signal, void *data), void *data);
+static struct {
+       int state;
+       int root_width;
+       int root_height;
+       double xscale;
+       double yscale;
+       Evas *evas;
+       Ecore_Evas *ee;
+       Evas_Object *win;
+       bool is_done;
+} menu_screen_info = {
+       .state = APP_STATE_PAUSE,
+       .evas = NULL,
+       .ee = NULL,
+       .win = NULL,
+       .is_done = false,
+};
+
+
+
+Evas *menu_screen_get_evas(void)
+{
+       return menu_screen_info.evas;
+}
+
+
+
+int menu_screen_get_root_width(void)
+{
+       return menu_screen_info.root_width;
+}
+
+
+
+int menu_screen_get_root_height(void)
+{
+       return menu_screen_info.root_height;
+}
+
+
+
+double menu_screen_get_yscale(void)
+{
+       return menu_screen_info.yscale;
+}
+
+
+
+Evas_Object *menu_screen_get_win(void)
+{
+       return menu_screen_info.win;
+}
+
+
+
+bool menu_screen_get_done(void)
+{
+       return menu_screen_info.is_done;
+}
+
+
+
+void menu_screen_set_done(bool is_done)
+{
+       menu_screen_info.is_done = is_done;
+}
+
+
+
+static menu_screen_error_e _create_canvas(char *name, char *title)
+{
+       Ecore_X_Atom ATOM_WM_WINDOW_ROLE;
+
+       menu_screen_info.win = elm_win_add(NULL, name, ELM_WIN_BASIC);
+       retv_if(NULL == menu_screen_info.win, MENU_SCREEN_ERROR_FAIL);
+
+       if (title) {
+               elm_win_title_set(menu_screen_info.win, title);
+       }
+       elm_win_borderless_set(menu_screen_info.win, EINA_TRUE);
+
+       ecore_x_icccm_name_class_set(elm_win_xwindow_get(menu_screen_info.win), "MENU_SCREEN", "MENU_SCREEN");
+       ATOM_WM_WINDOW_ROLE = ecore_x_atom_get("WM_WINDOW_ROLE");
+       if (ATOM_WM_WINDOW_ROLE) {
+               ecore_x_window_prop_string_set(elm_win_xwindow_get(menu_screen_info.win), ATOM_WM_WINDOW_ROLE, "MENU_SCREEN");
+       } else {
+               _D("Failed to set the window role as MENU_SCREEN");
+       }
+
+       menu_screen_info.evas = evas_object_evas_get(menu_screen_info.win);
+       if (!menu_screen_info.evas) {
+               _E("[%s] Failed to get the evas object", __func__);
+       }
+
+       menu_screen_info.ee = ecore_evas_ecore_evas_get(menu_screen_info.evas);
+       if (!menu_screen_info.ee) {
+               _E("[%s] Failed to get ecore_evas object", __func__);
+       }
+
+       evas_object_move(menu_screen_info.win, 0, 0);
+       evas_object_resize(menu_screen_info.win, menu_screen_info.root_width, menu_screen_info.root_height);
+       evas_object_show(menu_screen_info.win);
+
+       return MENU_SCREEN_ERROR_OK;
+}
+
+
+
+static void _destroy_canvas(void)
+{
+       evas_object_del(menu_screen_info.win);
+}
+
+
+
+static int _dead_cb(int pid, void *data)
+{
+       utilx_hide_fake_effect(
+               ecore_x_display_get(),
+               ecore_x_window_root_get(ecore_evas_window_get(menu_screen_info.ee))
+       );
+
+       return EXIT_SUCCESS;
+}
+
+
+
+static void _set_scale(void)
+{
+       double scale;
+       Ecore_X_Window focus_win;
+       Ecore_X_Window root_win;
+
+       focus_win = ecore_x_window_focus_get();
+       root_win = ecore_x_window_root_get(focus_win);
+       ecore_x_window_size_get(root_win, &menu_screen_info.root_width, &menu_screen_info.root_height);
+
+       menu_screen_info.xscale = (double) menu_screen_info.root_width / (double) BASE_WIDTH;
+       menu_screen_info.yscale = (double) menu_screen_info.root_height / (double) BASE_HEIGHT;
+       scale = menu_screen_info.xscale < menu_screen_info.yscale ? menu_screen_info.xscale : menu_screen_info.yscale;
+       _D("width:%d, height:%d, scale:%f", menu_screen_info.root_width, menu_screen_info.root_height, scale);
+       elm_config_scale_set(scale);
+}
+
+
+
+static void _create_bg(void)
+{
+       char *buf;
+       Evas_Coord w;
+       Evas_Coord h;
+       Evas_Object *bg;
+       double f, wf, hf;
+       static int trigger = 0;
+       const char *key;
+       int width;
+       int height;
+
+       buf = vconf_get_str(VCONFKEY_BGSET);
+       ret_if(NULL == buf);
+
+       width = menu_screen_get_root_width();
+       height = menu_screen_get_root_height();
+
+       bg = evas_object_data_get(menu_screen_get_win(), "bg");
+       if (NULL == bg) {
+               Evas_Object *rect;
+
+               rect = evas_object_rectangle_add(menu_screen_get_evas());
+               ret_if(NULL == rect);
+               evas_object_data_set(menu_screen_get_win(), "rect", rect);
+               evas_object_color_set(rect, 0, 0, 0, 255);
+               evas_object_size_hint_min_set(rect, width, height);
+               evas_object_size_hint_max_set(rect, width, height);
+               evas_object_resize(rect, width, height);
+               evas_object_show(rect);
+
+               bg = evas_object_image_add(menu_screen_get_evas());
+               if (NULL == bg) {
+                       free(buf);
+                       return;
+               }
+               evas_object_data_set(menu_screen_get_win(), "bg", bg);
+       }
+
+       if (trigger == 0) {
+               key = "/";
+               trigger = 1;
+       } else {
+               key = NULL;
+               trigger = 0;
+       }
+
+       evas_object_image_file_set(bg, buf, key);
+       evas_object_image_size_get(bg, &w, &h);
+       evas_object_image_filled_set(bg, 1);
+
+       wf = (double) width / (double) w;
+       hf = (double) height / (double) h;
+
+       f = wf > hf ? hf : wf;
+
+       w = (int) ((double) f * (double) w);
+       h = (int) ((double) f * (double) h);
+
+       evas_object_image_load_size_set(bg, w, h);
+       evas_object_image_fill_set(bg, 0, 0, w, h);
+       evas_object_move(bg, (width - w) / 2, (height - h) / 2);
+       evas_object_resize(bg, w, h);
+       evas_object_show(bg);
+
+       free(buf);
+}
+
+
+
+
+static void _destroy_bg()
+{
+       Evas_Object *rect;
+       Evas_Object *bg;
+
+       rect = evas_object_data_del(menu_screen_get_win(), "rect");
+       evas_object_del(rect);
+
+       bg = evas_object_data_del(menu_screen_get_win(), "bg");
+       evas_object_del(bg);
+}
+
+
+
+static void _change_bg_cb(keynode_t *node, void *data)
+{
+       _D("Background image is changed.");
+       _create_bg();
+}
+
+
+
+static bool _create_cb(void *data)
+{
+       Evas_Object *layout;
+
+       _set_scale();
+       retv_if(MENU_SCREEN_ERROR_FAIL == _create_canvas(PACKAGE, PACKAGE), EXIT_FAILURE);
+       elm_win_indicator_mode_set(menu_screen_info.win, ELM_WIN_INDICATOR_SHOW);
+
+       if (vconf_notify_key_changed(VCONFKEY_BGSET, _change_bg_cb, NULL) < 0) {
+               _E("Failed to register a vconf cb for %s\n", VCONFKEY_BGSET);
+       }
+       _create_bg();
+
+       layout = layout_create(menu_screen_info.win, LAYOUT_EDJE_PORTRAIT,
+                               LAYOUT_GROUP_NAME, MENU_SCREEN_ROTATE_PORTRAIT);
+       if (NULL == layout) {
+               _E("Faield to load an edje object");
+               evas_object_del(menu_screen_info.win);
+               return EXIT_FAILURE;
+       }
+       evas_object_data_set(menu_screen_info.win, "layout", layout);
+       evas_object_show(layout);
+
+       mouse_register();
+       aul_listen_app_dead_signal(_dead_cb, NULL);
+
+       return true;
+}
+
+
+
+static void _terminate_cb(void *data)
+{
+       Evas_Object *layout;
+
+       if (vconf_ignore_key_changed(VCONFKEY_BGSET, _change_bg_cb) < 0) {
+               _E("Failed to remove bgset %s\n", VCONFKEY_BGSET);
+       }
+
+       evas_object_hide(menu_screen_info.win);
+
+       mouse_unregister();
+
+       layout = evas_object_data_del(menu_screen_info.win, "layout");
+       layout_destroy(layout);
+
+       _destroy_bg();
+       _destroy_canvas();
+       evas_object_del(menu_screen_info.win);
+}
+
+
+
+static void _pause_cb(void *data)
+{
+       _D("Pause start");
+
+       if (vconf_set_int(VCONFKEY_IDLE_SCREEN_TOP, VCONFKEY_IDLE_SCREEN_TOP_FALSE) < 0) {
+               _E("Failed to set memory/idle/top to 0");
+       }
+
+       menu_screen_info.state = APP_STATE_PAUSE;
+}
+
+
+
+static void _resume_cb(void *data)
+{
+       _D("START RESUME");
+
+       if (vconf_set_int(VCONFKEY_IDLE_SCREEN_TOP, VCONFKEY_IDLE_SCREEN_TOP_TRUE) < 0) {
+               _E("Failed to set memory/idle/top to 1");
+       }
+
+       utilx_hide_fake_effect(
+               ecore_x_display_get(),
+               ecore_x_window_root_get(ecore_evas_window_get(menu_screen_info.ee))
+       );
+
+       menu_screen_info.state = APP_STATE_RESUME;
+}
+
+
+
+static void _service_cb(service_h service, void *data)
+{
+       _D("START RESET : %d", menu_screen_info.state);
+
+       if (vconf_set_int(VCONFKEY_IDLE_SCREEN_TOP, VCONFKEY_IDLE_SCREEN_TOP_TRUE) < 0) {
+               _E("Failed to set memory/idle/top to 1");
+       }
+
+       utilx_hide_fake_effect(
+               ecore_x_display_get(),
+               ecore_x_window_root_get(ecore_evas_window_get(menu_screen_info.ee))
+       );
+}
+
+
+
+static void _language_changed_cb(void *data)
+{
+       register unsigned int i;
+       register unsigned int j;
+       unsigned int count;
+       Evas_Object *layout;
+       Evas_Object *all_apps;
+       Evas_Object *scroller;
+       Evas_Object *page;
+       Evas_Object *item;
+       unsigned int page_max_app;
+
+       _D("Language is changed");
+
+       if (false == menu_screen_info.is_done) {
+               elm_exit();
+       }
+
+       layout = evas_object_data_get(menu_screen_info.win, "layout");
+       ret_if(NULL == layout);
+       all_apps = evas_object_data_get(layout, "all_apps");
+       ret_if(NULL == all_apps);
+       scroller = elm_object_part_content_get(all_apps, "content");
+       ret_if(NULL == scroller);
+
+       count = page_scroller_count_page(scroller);
+       page_max_app = (unsigned int) evas_object_data_get(scroller, "page_max_app");
+       for (i = 0; i < count; i ++) {
+               page = page_scroller_get_page_at(scroller, i);
+               if (!page) continue;
+               if (mapbuf_is_enabled(page)) {
+                       mapbuf_disable(page, 1);
+               }
+
+               for (j = 0; j < page_max_app; j ++) {
+                       ail_appinfo_h ai;
+                       char *name;
+
+                       item = page_get_item_at(page, j);
+                       if (!item) continue;
+
+                       if (ail_package_get_appinfo(item_get_package(item), &ai) < 0) continue;
+                       if (ail_appinfo_get_str(ai, AIL_PROP_NAME_STR, &name) < 0) {
+                               ail_package_destroy_appinfo(ai);
+                               continue;
+                       }
+
+                       if (!name) {
+                               _D("Faield to get name for %s", item_get_package(item));
+                               ail_package_destroy_appinfo(ai);
+                               continue;
+                       }
+
+                       item_set_name(item, name, 0);
+                       ail_package_destroy_appinfo(ai);
+               }
+
+               mapbuf_enable(page, 1);
+       }
+}
+
+
+
+static void _init(app_event_callback_s *event_callback)
+{
+       event_callback->create = _create_cb;
+       event_callback->terminate = _terminate_cb;
+       event_callback->pause = _pause_cb;
+       event_callback->resume = _resume_cb;
+       event_callback->service = _service_cb;
+       event_callback->low_memory = NULL;
+       event_callback->low_battery = NULL;
+       event_callback->device_orientation = NULL;
+       event_callback->language_changed = _language_changed_cb;
+       event_callback->region_format_changed = NULL;
+}
+
+
+
+static void _fini(void)
+{
+}
+
+
+
+int main(int argc, char *argv[])
+{
+       const char *env;
+       app_event_callback_s event_callback;
+
+       env = getenv(STR_ENV_ENGINE);
+       if (env) {
+               _D("ELM_ENGINE is set as [%s]", env);
+               setenv("ELM_ENGINE", env, 1);
+       } else {
+               _D("ELM_ENGINE is set as [%s]", "gl");
+               setenv("ELM_ENGINE", "gl", 1);
+       }
+
+       env = getenv(STR_ENV_FPS);
+       if (env) {
+               _D("ELM_FPS is set as [%s]", env);
+               setenv("ELM_FPS", env, 1);
+       } else {
+               _D("ELM_FPS is set as [%s]", "6000");
+               setenv("ELM_FPS", "6000", 1);
+       }
+
+       _init(&event_callback);
+       app_efl_main(&argc, &argv, &event_callback, NULL);
+       _fini();
+
+       return EXIT_SUCCESS;
+}
+
+
+
+
+
+// End of a file
diff --git a/src/mouse.c b/src/mouse.c
new file mode 100644 (file)
index 0000000..078323f
--- /dev/null
@@ -0,0 +1,191 @@
+ /*
+  * 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 <stdlib.h>
+#include <stdbool.h>
+#include <assert.h>
+#include <Elementary.h>
+
+#include "menu_screen.h"
+#include "conf.h"
+#include "item.h"
+#include "mouse.h"
+#include "page.h"
+#include "page_scroller.h"
+#include "util.h"
+
+#define CHAGNE_POSITION_TIME 0.1f
+#define CHANGE_POSITION_COUNT 5
+#define MOVE_THRESHOLD 10
+
+
+
+static struct {
+       Ecore_Event_Handler *mouse_down;
+       Ecore_Event_Handler *mouse_up;
+       Ecore_Event_Handler *mouse_move;
+       bool pressed;
+
+       Evas_Coord pre_x;
+       Evas_Coord pre_y;
+       bool is_initialized;
+
+       Evas_Coord down_x;
+       Evas_Coord down_y;
+       Evas_Coord move_x;
+       Evas_Coord move_y;
+} mouse_info = {
+       .mouse_down = NULL,
+       .mouse_up = NULL,
+       .mouse_move = NULL,
+       .pressed = false,
+
+       .pre_x = 0,
+       .pre_y = 0,
+       .is_initialized = false,
+
+       .down_x = 0,
+       .down_y = 0,
+       .move_x = 0,
+       .move_y = 0,
+};
+
+
+
+bool mouse_is_scrolling(void)
+{
+       bool scroll_x = false;
+       bool scroll_y = false;
+
+       if (mouse_info.move_x > mouse_info.down_x + MOVE_THRESHOLD
+               || mouse_info.move_x < mouse_info.down_x - MOVE_THRESHOLD)
+       {
+               scroll_x = true;
+       }
+
+       if (mouse_info.move_y > mouse_info.down_y + MOVE_THRESHOLD
+               || mouse_info.move_y < mouse_info.down_y - MOVE_THRESHOLD)
+       {
+               scroll_y = true;
+       }
+
+       return scroll_x || scroll_y;
+}
+
+
+
+static Eina_Bool _down_cb(void *data, int type, void *event)
+{
+       Ecore_Event_Mouse_Button *move = event;
+
+       retv_if(true == mouse_info.pressed, ECORE_CALLBACK_RENEW);
+
+       _D("Mouse down (%d,%d)", move->root.x, move->root.y);
+
+       mouse_info.pressed = true;
+       mouse_info.is_initialized = false;
+
+       mouse_info.down_x = move->root.x;
+       mouse_info.down_y = move->root.y;
+
+       return ECORE_CALLBACK_RENEW;
+}
+
+
+
+static Eina_Bool _up_cb(void *data, int type, void *event)
+{
+       Ecore_Event_Mouse_Button *move = event;
+
+       _D("Mouse up (%d,%d)", move->root.x, move->root.y);
+
+       retv_if(mouse_info.pressed == false, ECORE_CALLBACK_RENEW);
+       mouse_info.pressed = false;
+       mouse_info.pre_x = 0;
+       mouse_info.pre_y = 0;
+
+       return ECORE_CALLBACK_RENEW;
+}
+
+
+
+static Eina_Bool _move_cb(void *data, int type, void *event)
+{
+       Ecore_Event_Mouse_Move *move = event;
+
+       mouse_info.move_x = move->root.x;
+       mouse_info.move_y = move->root.y;
+
+       if (mouse_info.pressed == false) {
+               return ECORE_CALLBACK_RENEW;
+       }
+
+       return ECORE_CALLBACK_RENEW;
+}
+
+
+
+void mouse_register(void)
+{
+       mouse_info.mouse_down = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _down_cb, NULL);
+       if (!mouse_info.mouse_down) {
+               _D("Failed to register the mouse down event callback");
+       }
+
+       mouse_info.mouse_move = ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, _move_cb, NULL);
+       if (!mouse_info.mouse_move) {
+               _D("Failed to register the mouse move event callback");
+               ecore_event_handler_del(mouse_info.mouse_down);
+               mouse_info.mouse_down = NULL;
+       }
+
+       mouse_info.mouse_up = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, _up_cb, NULL);
+       if (!mouse_info.mouse_up) {
+               _D("Failed to register the mouse up event callback");
+               ecore_event_handler_del(mouse_info.mouse_down);
+               ecore_event_handler_del(mouse_info.mouse_move);
+
+               mouse_info.mouse_down = NULL;
+               mouse_info.mouse_move = NULL;
+       }
+}
+
+
+
+void mouse_unregister(void)
+{
+       if (mouse_info.mouse_down) {
+               ecore_event_handler_del(mouse_info.mouse_down);
+               mouse_info.mouse_down = NULL;
+       }
+
+       if (mouse_info.mouse_up) {
+               ecore_event_handler_del(mouse_info.mouse_up);
+               mouse_info.mouse_up = NULL;
+       }
+
+       if (mouse_info.mouse_move) {
+               ecore_event_handler_del(mouse_info.mouse_move);
+               mouse_info.mouse_move = NULL;
+       }
+}
+
+
+
+// End of a file
diff --git a/src/page.c b/src/page.c
new file mode 100644 (file)
index 0000000..c37cc8d
--- /dev/null
@@ -0,0 +1,561 @@
+ /*
+  * 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>
+
+#include "menu_screen.h"
+#include "conf.h"
+#include "index.h"
+#include "item.h"
+#include "item_event.h"
+#include "layout.h"
+#include "mapbuf.h"
+#include "page.h"
+#include "page_scroller.h"
+#include "util.h"
+
+#define PAGE_GROUP_NAME "menu_bg"
+#define PROP_PORTRAIT_HEIGHT (PAGE_PORTRAIT_HEIGHT / BASE_HEIGHT)
+
+
+
+inline void page_mark_dirty(Evas_Object *page)
+{
+       int value;
+       value = (int) evas_object_data_get(page, "dirty");
+       evas_object_data_set(page, "dirty", (void*)(value + 1));
+}
+
+
+
+inline void page_unmark_dirty(Evas_Object *page)
+{
+       int value;
+       value = (int) evas_object_data_get(page, "dirty");
+       if (value > 0) {
+               evas_object_data_set(page, "dirty", (void*)(value - 1));
+       }
+}
+
+
+
+inline void page_clean_dirty(Evas_Object *page)
+{
+       evas_object_data_set(page, "dirty", 0);
+}
+
+
+
+inline int page_is_dirty(Evas_Object *page)
+{
+       return (int) evas_object_data_get(page, "dirty");
+}
+
+
+
+static void _changed_size_hints_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+       Evas_Object *map;
+       Evas_Coord w, h;
+
+       evas_object_size_hint_min_get(obj, &w, &h);
+
+       map = mapbuf_get_mapbuf(obj);
+       if (map) {
+               evas_object_size_hint_min_set(map, w, h);
+       }
+}
+
+
+
+static menu_screen_error_e _insert_page_at(Evas_Object *scroller, Evas_Object *page, int index)
+{
+       unsigned int nr_of_pages;
+       Evas_Object *mapbuf;
+       Evas_Object *box;
+
+       retv_if(NULL == page, MENU_SCREEN_ERROR_FAIL);
+
+       if (index < 0) {
+               _D("Out of range");
+               index = 0;
+       }
+
+       box = evas_object_data_get(scroller, "box");
+       retv_if(NULL == box, MENU_SCREEN_ERROR_FAIL);
+
+       nr_of_pages = page_scroller_count_page(scroller);
+       if (index >= nr_of_pages) {
+               _D("Out of range. index : %d, total : %d", index, nr_of_pages);
+               mapbuf = evas_object_data_get(page, "mapbuf");
+               if (mapbuf) {
+                       elm_box_pack_end(box, mapbuf);
+               } else {
+                       elm_box_pack_end(box, page);
+               }
+       } else {
+               Evas_Object *current;
+               Evas_Object *current_mapbuf;
+               const Eina_List *page_list;
+
+               page_list = elm_box_children_get(box);
+               retv_if(NULL == page_list, MENU_SCREEN_ERROR_FAIL);
+
+               current = eina_list_nth(page_list, index);
+               retv_if(NULL == current, MENU_SCREEN_ERROR_FAIL);
+
+               current_mapbuf = mapbuf_get_mapbuf(current);
+               mapbuf = mapbuf_get_mapbuf(page);
+
+               if (current_mapbuf && mapbuf) {
+                       elm_box_pack_before(box, mapbuf, current_mapbuf);
+               } else if (!current_mapbuf && !mapbuf) {
+                       elm_box_pack_before(box, page, current);
+               } else {
+                       _D("Page has mapbuf, invalid");
+               }
+       }
+
+       page_mark_dirty(page);
+
+       return MENU_SCREEN_ERROR_OK;
+}
+
+
+
+static void _dim_down_cb(void *data, Evas_Object *obj, const char* emission, const char* source)
+{
+       _D("Dim down");
+}
+
+
+
+static void _dim_up_cb(void *data, Evas_Object *obj, const char* emission, const char* source)
+{
+       _D("Dim up");
+}
+
+
+
+Evas_Object *page_create(Evas_Object *scroller, int idx, int rotate)
+{
+       Evas_Object *page;
+       Evas_Object *bg;
+       Evas_Object *index;
+       Evas_Object *tab;
+       Evas_Object *mapbuf;
+       Evas_Object *box;
+
+       char *page_edje;
+       bool enable_bg_image;
+
+       unsigned int count;
+       int page_height;
+       int page_width;
+
+       _D("Create a new page[%d]", idx);
+
+       page_edje = evas_object_data_get(scroller, "page_edje");
+       enable_bg_image = (bool) evas_object_data_get(scroller, "enable_bg_image");
+
+       page = layout_load_edj(scroller, page_edje, PAGE_GROUP_NAME);
+       retv_if(!page, NULL);
+
+       evas_object_event_callback_add(page, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints_cb, NULL);
+       edje_object_signal_callback_add(_EDJ(page), "dim,down", "menu", _dim_down_cb, NULL);
+       edje_object_signal_callback_add(_EDJ(page), "dim,up", "menu", _dim_up_cb, NULL);
+
+       box = evas_object_data_get(scroller, "box");
+       mapbuf = mapbuf_bind(box, page);
+       if (!mapbuf) {
+               _D("Failed to bind the object with mapbuf");
+       }
+
+       bg = evas_object_rectangle_add(menu_screen_get_evas());
+       if (!bg) {
+               evas_object_del(page);
+               return NULL;
+       }
+       evas_object_color_set(bg, 0, 0, 0, 0);
+
+       page_width = menu_screen_get_root_width();
+       page_height = (int) ((double) PROP_PORTRAIT_HEIGHT * ((double) menu_screen_get_root_height()));
+
+       evas_object_size_hint_min_set(bg, page_width, page_height);
+       evas_object_size_hint_max_set(bg, page_width, page_height);
+       elm_object_part_content_set(page, "bg", bg);
+
+       evas_object_data_set(page, "win", evas_object_data_get(scroller, "win"));
+       evas_object_data_set(page, "layout", evas_object_data_get(scroller, "layout"));
+       evas_object_data_set(page, "controlbar", evas_object_data_get(scroller, "controlbar"));
+       evas_object_data_set(page, "tab", evas_object_data_get(scroller, "tab"));
+       evas_object_data_set(page, "scroller", scroller);
+       evas_object_data_set(page, "page_edje", page_edje);
+       evas_object_data_set(page, "page_max_app", evas_object_data_get(scroller, "page_max_app"));
+       evas_object_data_set(page, "bg", bg);
+       evas_object_data_set(page, "pending,list", NULL);
+       evas_object_data_set(page, "dirty", (void *) 0);
+
+       if (_insert_page_at(scroller, page, idx) != MENU_SCREEN_ERROR_OK) {
+               evas_object_del(bg);
+               evas_object_del(page);
+               return NULL;
+       }
+
+       index = evas_object_data_get(scroller, "index");
+       if (index) {
+               tab = evas_object_data_get(scroller, "tab");
+               count = page_scroller_count_page(scroller);
+               index_update(tab, index, count);
+       }
+
+       return page;
+}
+
+
+
+void page_destroy(Evas_Object *scroller, Evas_Object *page)
+{
+       Evas_Object *mapbuf;
+       Evas_Object *bg;
+       Evas_Object *item;
+       Evas_Object *box;
+       Evas_Object *index;
+       Evas_Object *tab;
+       Eina_List *pending_list;
+
+       register unsigned int i;
+       int page_max_app;
+       unsigned int count;
+
+       evas_object_event_callback_del(page, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints_cb);
+
+       page_max_app = (int) evas_object_data_get(scroller, "page_max_app");
+       for (i = 0; i < page_max_app; i ++) {
+               item = page_unpack_item_at(page, i);
+               if (!item) continue;
+
+               item_destroy(item);
+       }
+
+       pending_list = evas_object_data_get(page, "pending,list");
+       eina_list_free(pending_list);
+
+       bg = evas_object_data_get(page, "bg");
+       evas_object_del(bg);
+
+       box = evas_object_data_get(scroller, "box");
+       ret_if(NULL == box);
+
+       mapbuf = mapbuf_get_mapbuf(page);
+       if (mapbuf) {
+               elm_box_unpack(box, mapbuf);
+               mapbuf_unbind(mapbuf);
+       } else {
+               elm_box_unpack(box, page);
+       }
+
+       index = evas_object_data_get(scroller, "index");
+       if (index) {
+               tab = evas_object_data_get(scroller, "tab");
+               count = page_scroller_count_page(scroller);
+               index_update(tab, index, count);
+       }
+
+       evas_object_data_del(page, "win");
+       evas_object_data_del(page, "layout");
+       evas_object_data_del(page, "controlbar");
+       evas_object_data_del(page, "tab");
+       evas_object_data_del(page, "scroller");
+       evas_object_data_del(page, "page_edje");
+       evas_object_data_del(page, "page_max_app");
+       evas_object_data_del(page, "bg");
+       evas_object_data_del(page, "pending,list");
+       evas_object_data_del(page, "dirty");
+       layout_unload_edj(page);
+}
+
+
+
+Evas_Object *page_get_item_at(Evas_Object *page, unsigned int idx)
+{
+       Eina_List *pending_list;
+       Eina_List *n;
+       Eina_List *t;
+
+       Evas_Object *pending_item;
+
+       char swallow_name[PATH_MAX];
+       int pending_idx;
+
+       pending_list = evas_object_data_get(page, "pending,list");
+       EINA_LIST_FOREACH_SAFE(pending_list, n, t, pending_item) {
+               pending_idx = (int) evas_object_data_get(pending_item, "pending,idx");
+               if (pending_idx == idx) {
+                       return pending_item;
+               }
+       }
+
+       snprintf(swallow_name, sizeof(swallow_name), "menu_swallow_%d", idx);
+
+       return edje_object_part_swallow_get(_EDJ(page), swallow_name);
+}
+
+
+
+menu_screen_error_e page_unpack_item(Evas_Object *page, Evas_Object *item)
+{
+       char tmp[PATH_MAX];
+       Evas_Object *check_item;
+
+       Eina_List *pending_list;
+       Eina_List *n;
+       Eina_List *t;
+       Evas_Object *pend_item;
+       int pending_idx = -1;
+
+       retv_if(NULL == item, MENU_SCREEN_ERROR_FAIL);
+
+       pending_list = evas_object_data_get(page, "pending,list");
+       EINA_LIST_FOREACH_SAFE(pending_list, n, t, pend_item) {
+               if (pend_item == item) {
+                       pending_idx = (int)evas_object_data_get(pend_item, "pending,idx");
+                       pending_list = eina_list_remove(pending_list, pend_item);
+                       evas_object_data_set(page, "pending,list", pending_list);
+               }
+       }
+
+       retv_if(pending_idx == -1, MENU_SCREEN_ERROR_FAIL);
+       sprintf(tmp, "menu_swallow_%d", pending_idx);
+
+       check_item = edje_object_part_swallow_get(_EDJ(page), tmp);
+       retv_if(check_item != item, MENU_SCREEN_ERROR_FAIL);
+
+       check_item = elm_object_part_content_unset(page, tmp);
+       if (check_item) {
+               elm_object_part_content_set(page, tmp, NULL);
+               page_mark_dirty(page);
+       }
+
+       return MENU_SCREEN_ERROR_OK;
+}
+
+
+
+Evas_Object *page_unpack_item_at(Evas_Object *page, int idx)
+{
+       Eina_List *pending_list;
+       Eina_List *n;
+       Eina_List *t;
+
+       Evas_Object *object;
+       Evas_Object *pending_item;
+
+       char tmp[PATH_MAX];
+       int pending_idx;
+
+       pending_list = evas_object_data_get(page, "pending,list");
+       EINA_LIST_FOREACH_SAFE(pending_list, n, t, pending_item) {
+               pending_idx = (int) evas_object_data_get(pending_item, "pending,idx");
+               if (pending_idx == idx) {
+                       pending_list = eina_list_remove(pending_list, pending_item);
+                       evas_object_data_set(page, "pending,list", pending_list);
+               }
+       }
+
+       object = page_get_item_at(page, idx);
+       if (object) {
+               Evas_Object *check_object;
+               sprintf(tmp, "menu_swallow_%d", idx);
+
+               check_object = elm_object_part_content_unset(page, tmp);
+               if (check_object != object) {
+                       elm_object_part_content_set(page, tmp, NULL);
+                       _D("page_unpack_item_at - different object is picked up");
+               }
+
+               page_mark_dirty(page);
+       }
+       return object;
+}
+
+
+
+void page_pack_item(Evas_Object *page, int idx, Evas_Object *item)
+{
+       char tmp[PATH_MAX];
+       Evas_Object *object;
+       Eina_List *list;
+
+       ret_if(NULL == page);
+       ret_if(NULL == item);
+
+       list = evas_object_data_get(page, "pending,list");
+       if (NULL == eina_list_data_find(list, item)) {
+               list = eina_list_append(list, item);
+               evas_object_data_set(page, "pending,list", list);
+       }
+       evas_object_data_set(item, "pending,idx", (void*)idx);
+
+       mapbuf_disable(page, 0);
+
+       snprintf(tmp, sizeof(tmp), "menu_swallow_%d", idx);
+       object = elm_object_part_content_unset(page, tmp);
+       if (object) {
+               elm_object_part_content_set(page, tmp, NULL);
+               item_destroy(object);
+       }
+
+       item_set_page(item, page, 1);
+       item_mark_dirty(item);
+       elm_object_part_content_set(page, tmp, item);
+       page_mark_dirty(page);
+       mapbuf_enable(page, 0);
+}
+
+
+
+void page_set_item(Evas_Object *page, int idx, Evas_Object *item)
+{
+       Eina_List *list;
+
+       ret_if(NULL == page);
+       ret_if(NULL == item);
+
+       list = evas_object_data_get(page, "pending,list");
+       if (NULL == eina_list_data_find(list, item)) {
+               list = eina_list_append(list, item);
+               evas_object_data_set(page, "pending,list", list);
+       }
+       evas_object_data_set(item, "pending,idx", (void *) idx);
+
+       item_set_page(item, page, 1);
+}
+
+
+
+inline unsigned int page_count_item(Evas_Object *page)
+{
+       register unsigned int i;
+       unsigned int count = 0;
+       int page_max_app;
+
+       page_max_app = (int) evas_object_data_get(page, "page_max_app");
+       for (i = 0; i < page_max_app; i++) {
+               if (page_get_item_at(page, i)) {
+                       count ++;
+               }
+       }
+
+       return count;
+}
+
+
+
+int page_find_empty_near(Evas_Object *page, int pivot)
+{
+       int pivot_saved = pivot;
+       Evas_Object *obj;
+       int page_max_app;
+
+       retv_if(NULL == page, -1);
+
+       obj = page_get_item_at(page, pivot);
+       if (NULL == obj) return pivot;
+
+       for (pivot --; pivot >= 0; pivot --) {
+               obj = page_get_item_at(page, pivot);
+               if (!obj) {
+                       break;
+               }
+       }
+
+       if (pivot >= 0) {
+               return (int) pivot;
+       }
+
+       page_max_app = (int) evas_object_data_get(page, "page_max_app");
+       for (pivot = pivot_saved + 1; pivot < page_max_app; pivot ++) {
+               obj = page_get_item_at(page, pivot);
+               if (!obj) break;
+       }
+
+       if (pivot < page_max_app) {
+               return pivot;
+       }
+
+       return -1;
+}
+
+
+
+int page_find_first_empty(Evas_Object *page, int pivot)
+{
+       Evas_Object *item;
+       Evas_Object *scroller;
+       int idx;
+       int page_max_app;
+
+       scroller = evas_object_data_get(page, "tab");
+       page_max_app = (int) evas_object_data_get(scroller, "page_max_app");
+
+       for (idx = pivot; idx < page_max_app; idx ++) {
+               item = page_get_item_at(page, idx);
+               if (!item) {
+                       break;
+               }
+       }
+
+       return idx;
+}
+
+
+
+void page_trim_items(Evas_Object *page)
+{
+       Evas_Object *item;
+       register unsigned int i;
+       char buf[32];
+       int to = -1;
+       int page_max_app;
+
+       page_max_app = (int) evas_object_data_get(page, "page_max_app");
+       for (i = 0; i < page_max_app; i ++) {
+               item = page_get_item_at(page, i);
+               if (!item) {
+                       if (to < 0) {
+                               to = i;
+                       }
+                       continue;
+               }
+
+               if (to >= 0) {
+                       item = page_unpack_item_at(page, i);
+                       page_pack_item(page, to, item);
+                       snprintf(buf, 32, "menu%d", to);
+                       edje_object_signal_emit(_EDJ(page), STR_MOVE_NEXT, buf);
+                       edje_object_signal_emit(_EDJ(page), STR_ANI_RETURN, buf);
+                       to ++;
+               }
+       }
+}
+
+
+
+
+// End of a file
diff --git a/src/page_scroller.c b/src/page_scroller.c
new file mode 100644 (file)
index 0000000..337cabb
--- /dev/null
@@ -0,0 +1,1131 @@
+ /*
+  * 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>
+#include <vconf.h>
+
+#include "menu_screen.h"
+#include "conf.h"
+#include "list.h"
+#include "mapbuf.h"
+#include "page.h"
+#include "index.h"
+#include "item.h"
+#include "item_event.h"
+#include "layout.h"
+#include "page_scroller.h"
+#include "pkgmgr.h"
+#include "util.h"
+
+#define BUFSZE 1024
+#define PAGE_SCROLL_SENSITIVE 0.2
+#define PROP_PORTRAIT_HEIGHT (PAGE_PORTRAIT_HEIGHT / BASE_HEIGHT)
+
+
+
+static int _count_pages(Evas_Object *scroller)
+{
+       const Eina_List *children;
+       Evas_Object *box;
+
+       box = evas_object_data_get(scroller, "box");
+       retv_if(NULL == box, 0);
+
+       children = elm_box_children_get(box);
+       return eina_list_count(children);
+}
+
+
+
+void page_scroller_bring_in(Evas_Object *scroller, int idx)
+{
+       Evas_Object *index;
+       int w, h;
+
+       _D("BRING IN TO %d", idx);
+
+       evas_object_data_set(scroller, "current_idx", (void *) idx);
+
+       evas_object_geometry_get(scroller, NULL, NULL, &w, &h);
+       elm_scroller_region_bring_in(scroller, idx * w, 0, w, h);
+
+       index = evas_object_data_get(scroller, "index");
+       if (!index) {
+               _E("cannot find index.");
+       }
+       _D("page index bring in to %d", idx);
+       index_bring_in(index, idx);
+}
+
+
+
+void page_scroller_show_region(Evas_Object *scroller, int idx)
+{
+       Evas_Object *index;
+       int w, h;
+
+       evas_object_geometry_get(scroller, NULL, NULL, &w, &h);
+       elm_scroller_region_show(scroller, idx * w, 0, w, h);
+
+       index = evas_object_data_get(scroller, "index");
+       if (!index) {
+               _E("cannot find index.");
+       }
+       _D("page index bring in to %d", idx);
+       index_bring_in(index, idx);
+}
+
+
+
+static void _anim_stop_cb(void *data, Evas_Object *scroller, void *event_info)
+{
+       _D("Invoked");
+}
+
+
+
+static void _anim_start_cb(void *data, Evas_Object *scroller, void *event_info)
+{
+       Evas_Coord x;
+       Evas_Coord y;
+       Evas_Coord w;
+       Evas_Coord h;
+       Evas_Object *index;
+       Elm_Object_Item *idx_it;
+
+       int idx;
+       int drag_start;
+       int previous_x;
+       int threshold;
+
+       _D("Invoked");
+
+       drag_start = (int) evas_object_data_get(scroller, "drag_start");
+       previous_x = (int) evas_object_data_get(scroller, "previous_x");
+       index = evas_object_data_get(scroller, "index");
+
+       ret_if(drag_start == 0);
+       evas_object_data_set(scroller, "drag_start", (void *) 0);
+
+       elm_scroller_region_get(scroller, &x, &y, &w, &h);
+       threshold = w * PAGE_SCROLL_SENSITIVE;
+
+       idx_it = elm_index_selected_item_get(index, 0);
+       idx = (int) elm_object_item_data_get(idx_it);
+
+       if (abs(previous_x - x) > threshold) {
+               if (x > previous_x) idx ++;
+               else if ((x < previous_x) && (idx != 0)) idx --;
+       }
+
+       ret_if(idx >= _count_pages(scroller) || idx < 0);
+
+       page_scroller_bring_in(scroller, idx);
+}
+
+
+
+static void _drag_start_cb(void *data, Evas_Object *scroller, void *event_info)
+{
+       int previous_x;
+
+       _D("Invoked");
+
+       elm_scroller_region_get(scroller, &previous_x, NULL, NULL, NULL);
+       evas_object_data_set(scroller, "previous_x", (void *) previous_x);
+       evas_object_data_set(scroller, "drag_start", (void *) 1);
+}
+
+
+
+static void _drag_stop_cb(void *data, Evas_Object *scroller, void *event_info)
+{
+       Evas_Coord x;
+       Evas_Coord w;
+       Evas_Coord y;
+       Evas_Coord h;
+       int previous_x;
+
+       _D("Invoked");
+
+       elm_scroller_region_get(scroller, &x, &y, &w, &h);
+       previous_x = (int) evas_object_data_get(scroller, "previous_x");
+       if (x == previous_x) {
+               _D("\e[33mHold scroller (previous) %d (current) %d\e[0m", previous_x, x);
+       }
+}
+
+
+
+static void _scroller_register(Evas_Object *scroller)
+{
+       evas_object_smart_callback_add(scroller, "scroll,anim,start", _anim_start_cb, NULL);
+       evas_object_smart_callback_add(scroller, "scroll,anim,stop", _anim_stop_cb, NULL);
+       evas_object_smart_callback_add(scroller, "scroll,drag,start", _drag_start_cb, NULL);
+       evas_object_smart_callback_add(scroller, "scroll,drag,stop", _drag_stop_cb, NULL);
+}
+
+
+
+static void _scroller_unregister(Evas_Object *scroller)
+{
+       evas_object_smart_callback_del(scroller, "scroll,anim,start", _anim_start_cb);
+       evas_object_smart_callback_del(scroller, "scroll,anim,stop", _anim_stop_cb);
+       evas_object_smart_callback_del(scroller, "scroll,drag,start", _drag_start_cb);
+       evas_object_smart_callback_del(scroller, "scroll,drag,stop", _drag_stop_cb);
+}
+
+
+
+menu_screen_error_e _find_position_by_default(Evas_Object *scroller, int *candidate_page, int *candidate_pos, void *data)
+{
+       Evas_Object *page;
+       Evas_Object *item;
+       register unsigned int page_no;
+       register unsigned int position_no;
+       unsigned int nr_of_pages;
+       int page_max_app;
+
+       retv_if(NULL == scroller, MENU_SCREEN_ERROR_INVALID_PARAMETER);
+       retv_if(NULL == candidate_page, MENU_SCREEN_ERROR_INVALID_PARAMETER);
+       retv_if(NULL == candidate_pos, MENU_SCREEN_ERROR_INVALID_PARAMETER);
+
+       *candidate_page = 0;
+       *candidate_pos = 0;
+       nr_of_pages = page_scroller_count_page(scroller);
+       page_max_app = (int) evas_object_data_get(scroller, "page_max_app");
+       for (page_no = 0; page_no < nr_of_pages; page_no ++) {
+               page = page_scroller_get_page_at(scroller, page_no);
+               if (!page) {
+                       _D("Page is not found at %d", page_no);
+                       return MENU_SCREEN_ERROR_FAIL;
+               }
+
+               for (position_no = 0; position_no < page_max_app; position_no ++) {
+                       item = page_get_item_at(page, position_no);
+                       if (!item) {
+                               *candidate_page = page_no;
+                               *candidate_pos = position_no;
+                               return MENU_SCREEN_ERROR_OK;
+                       }
+               }
+       }
+
+       *candidate_page = page_no;
+       *candidate_pos = 0;
+
+       return MENU_SCREEN_ERROR_OK;
+}
+
+
+
+menu_screen_error_e _find_position_by_package(Evas_Object *scroller, int *candidate_page, int *candidate_pos, void *data)
+{
+       Evas_Object *page;
+       Evas_Object *item;
+       register int page_no;
+       register int position_no;
+       unsigned int nr_of_pages;
+       int page_max_app;
+       app_info_t *ai = data;
+
+       retv_if(NULL == scroller, MENU_SCREEN_ERROR_INVALID_PARAMETER);
+       retv_if(NULL == candidate_page, MENU_SCREEN_ERROR_INVALID_PARAMETER);
+       retv_if(NULL == candidate_pos, MENU_SCREEN_ERROR_INVALID_PARAMETER);
+       retv_if(NULL == data, MENU_SCREEN_ERROR_INVALID_PARAMETER);
+       retv_if(NULL == ai->package, MENU_SCREEN_ERROR_INVALID_PARAMETER);
+
+       *candidate_page = 0;
+       *candidate_pos = 0;
+       nr_of_pages = page_scroller_count_page(scroller);
+       page_max_app = (int) evas_object_data_get(scroller, "page_max_app");
+       for (page_no = 0; page_no < nr_of_pages; page_no ++) {
+               page = page_scroller_get_page_at(scroller, page_no);
+               if (!page) {
+                       _D("Page is not found at %d", page_no);
+                       return MENU_SCREEN_ERROR_FAIL;
+               }
+
+               for (position_no = 0; position_no < page_max_app; position_no ++) {
+                       char *package;
+
+                       item = page_get_item_at(page, position_no);
+                       if (!item) {
+                               *candidate_page = page_no;
+                               *candidate_pos = position_no;
+                               return MENU_SCREEN_ERROR_OK;
+                       } else if ((package = item_get_package(item)) && strcmp(package, ai->package) > 0) {
+                               *candidate_page = page_no;
+                               *candidate_pos = position_no;
+                               return MENU_SCREEN_ERROR_OK;
+                       }
+               }
+       }
+
+       return MENU_SCREEN_ERROR_OK;
+}
+
+
+
+static menu_screen_error_e _animated_pack_item(Evas_Object *item, Evas_Object *scroller, Evas_Object *page, int from)
+{
+       Evas_Object *item_out_page = NULL;
+       char buf[32];
+       int to;
+       int page_no;
+
+       retv_if(NULL == item, MENU_SCREEN_ERROR_INVALID_PARAMETER);
+       retv_if(NULL == scroller, MENU_SCREEN_ERROR_INVALID_PARAMETER);
+       retv_if(NULL == page, MENU_SCREEN_ERROR_INVALID_PARAMETER);
+
+       page_no = page_scroller_get_page_no(scroller, page);
+       do {
+               to = page_find_empty_near(page, from);
+               if (to < 0) {
+                       int page_max_app;
+                       page_max_app = (int) evas_object_data_get(page, "page_max_app");
+                       to = page_max_app - 1;
+                       item_out_page = page_unpack_item_at(page, to);
+               }
+
+               for (to --; to >= from; to --) {
+                       Evas_Object *item_in_page;
+                       item_in_page = page_unpack_item_at(page, to);
+                       page_pack_item(page, to + 1, item_in_page);
+                       snprintf(buf, 32, "menu%d", to + 1);
+                       edje_object_signal_emit(_EDJ(page), STR_MOVE_PREV, buf);
+                       edje_object_signal_emit(_EDJ(page), STR_ANI_RETURN, buf);
+               }
+
+               page_pack_item(page, from, item);
+
+               if (!item_out_page) break;
+
+               page_no ++;
+               page = page_scroller_get_page_at(scroller, page_no);
+               if (!page) {
+                       int rotate;
+                       rotate = (int) evas_object_data_get(scroller, "rotate");
+                       page = page_create(scroller, page_no, rotate);
+                       retv_if(NULL == page, MENU_SCREEN_ERROR_FAIL);
+                       mapbuf_enable(page, 0);
+               }
+
+               from = 0;
+               item = item_out_page;
+               item_out_page = NULL;
+       } while (page && item);
+
+       return MENU_SCREEN_ERROR_OK;
+}
+
+
+
+static Evas_Object *_animated_unpack_item(Evas_Object *scroller, Evas_Object *page, unsigned int pos)
+{
+       Evas_Object *out = NULL;
+       Evas_Object *item;
+       Evas_Object *next_page;
+
+       char buf[32];
+       unsigned int page_max_app;
+       unsigned int page_no;
+       page_scroller_sort_type_e sort_type;
+
+       out = page_unpack_item_at(page, pos);
+       retv_if(NULL == out, NULL);
+
+       page_no = page_scroller_get_page_no(scroller, page);
+       page_max_app = (unsigned int) evas_object_data_get(scroller, "page_max_app");
+       sort_type = (page_scroller_sort_type_e) evas_object_data_get(scroller, "sort_type");
+
+       pos ++;
+       while (page && page_no < MAX_PAGE_NO) {
+               if (0 == page_count_item(page)) {
+                       page_destroy(scroller, page);
+                       break;
+               }
+
+               for (; pos < page_max_app; pos ++) {
+                       item = page_unpack_item_at(page, pos);
+                       page_pack_item(page, pos - 1, item);
+                       snprintf(buf, 32, "menu%d", pos - 1);
+                       edje_object_signal_emit(_EDJ(page), STR_MOVE_NEXT, buf);
+                       edje_object_signal_emit(_EDJ(page), STR_ANI_RETURN, buf);
+               }
+
+               if (sort_type == PAGE_SCROLLER_SORT_MAX) {
+                       return NULL;
+               }
+
+               page_no ++;
+               next_page = page_scroller_get_page_at(scroller, page_no);
+               if (next_page) {
+                       item = page_unpack_item_at(next_page, 0);
+                       page_pack_item(page, page_max_app - 1, item);
+               } else break;
+
+               pos = 1;
+               page = next_page;
+       }
+
+       return out;
+}
+
+
+
+menu_screen_error_e page_scroller_push_item(Evas_Object *scroller, app_info_t *ai)
+{
+       Evas_Object *page;
+       Evas_Object *item;
+       unsigned int nr_of_pages;
+       int candidate_page = -1;
+       int candidate_pos = 0;
+       int sort_type;
+       register int i;
+
+       struct {
+               page_scroller_sort_type_e sort_type;
+               menu_screen_error_e (*sort_func)(Evas_Object *scroller, int *candidate_page, int *candidate_pos, void *data);
+       } sort_type_map[] = {
+               {
+                       .sort_type = PAGE_SCROLLER_SORT_BY_DEFAULT,
+                       .sort_func = _find_position_by_default,
+               },
+               {
+                       .sort_type = PAGE_SCROLLER_SORT_BY_PACKAGE,
+                       .sort_func = _find_position_by_package,
+               },
+               {
+                       .sort_type = PAGE_SCROLLER_SORT_BY_NAME,
+                       .sort_func = NULL,
+               },
+               {
+                       .sort_type = PAGE_SCROLLER_SORT_MAX,
+                       .sort_func = NULL,
+               },
+       };
+
+       sort_type = (int) evas_object_data_get(scroller, "sort_type");
+       sort_type_map[sort_type].sort_func(scroller, &candidate_page, &candidate_pos, ai);
+
+       nr_of_pages = page_scroller_count_page(scroller);
+
+       for (i = nr_of_pages; i <= candidate_page; i ++) {
+               Evas_Object *new_page;
+               int rotate;
+
+               rotate = (int) evas_object_data_get(scroller, "rotate");
+               new_page = page_create(scroller, nr_of_pages, rotate);
+               retv_if(NULL == new_page, MENU_SCREEN_ERROR_FAIL);
+               mapbuf_enable(new_page, 0);
+       }
+
+       item = item_create(scroller, ai);
+       retv_if(NULL == item, MENU_SCREEN_ERROR_FAIL);
+
+       page = page_scroller_get_page_at(scroller, candidate_page);
+       if (!page) {
+               _D("Impossible, page is not found");
+               item_destroy(item);
+               return MENU_SCREEN_ERROR_FAIL;
+       }
+
+       retv_if(MENU_SCREEN_ERROR_OK !=
+                       _animated_pack_item(item, scroller, page, candidate_pos),
+                       MENU_SCREEN_ERROR_FAIL);
+
+       return MENU_SCREEN_ERROR_OK;
+}
+
+
+
+static inline menu_screen_error_e _create_cb(const char *package, void *data)
+{
+       app_info_t ai = {0,};
+       Evas_Object *item;
+       Evas_Object *scroller = data;
+
+       if (MENU_SCREEN_ERROR_FAIL == list_get_values(package, &ai)) {
+               list_free_values(&ai);
+               return MENU_SCREEN_ERROR_FAIL;
+       }
+
+       do {
+               if (!scroller) {
+                       _D("Scroller is NULL.");
+                       break;
+               }
+
+               if (ai.nodisplay) {
+                       Evas_Object *page;
+
+                       _D("package %s is not visible", package);
+                       item = pkgmgr_find_pended_object(ai.package, 1, scroller, &page);
+                       if (item) {
+                               if (page) {
+                                       page_unpack_item(page, item);
+                                       page_trim_items(page);
+                               }
+
+                               item_destroy(item);
+                       }
+
+                       break;
+               }
+
+               item = pkgmgr_find_pended_object(ai.package, 1, scroller, NULL);
+               if (!item) {
+                       item = page_scroller_find_item_by_package(scroller, ai.package, NULL);
+                       if (!item) {
+                               int ret;
+
+                               _D("package %s is installed directly", package);
+                               ret = page_scroller_push_item(scroller, &ai);
+                               if (ret == MENU_SCREEN_ERROR_OK) {
+                                       break;
+                               } else {
+                                       list_free_values(&ai);
+                                       retv_if(1, MENU_SCREEN_ERROR_FAIL);
+                               }
+                       }
+               }
+
+               _D("Package %s is found, update it!", package);
+               item_update(item, &ai);
+       } while(0);
+
+       list_free_values(&ai);
+       return MENU_SCREEN_ERROR_OK;
+}
+
+
+
+static inline menu_screen_error_e _update_cb(const char *package, void *data)
+{
+       Evas_Object *scroller = data;
+       Evas_Object *item;
+       int page_no = 0;
+       app_info_t ai = {0,};
+
+       if (MENU_SCREEN_ERROR_FAIL == list_get_values(package, &ai)) {
+               list_free_values(&ai);
+               return MENU_SCREEN_ERROR_FAIL;
+       }
+
+       do {
+               if (!scroller) {
+                       _D("Scroller is NULL.");
+                       break;
+               }
+
+               item = page_scroller_find_item_by_package(scroller, package, &page_no);
+               if (!item) {
+                       Evas_Object *page;
+                       _D("There is no loaded item is found");
+                       item = pkgmgr_find_pended_object(package, 1, scroller, &page);
+                       if (item) {
+                               if (!ai.nodisplay) {
+                                       _D("Item is found for updating from the install list, Ignore this.");
+                                       item_update(item, &ai);
+                               } else {
+                                       _D("Item is found for updating from the install list, But nodisplay");
+                                       if (page) {
+                                               page_unpack_item(page, item);
+                                               page_trim_items(page);
+                                       }
+                                       item_destroy(item);
+                               }
+                       } else {
+                               int ret;
+                               _D("Item is not found. Create a new one");
+
+                               ret = (ai.nodisplay == false ? page_scroller_push_item(scroller, &ai) : MENU_SCREEN_ERROR_OK);
+                               if (ret == MENU_SCREEN_ERROR_OK) {
+                                       break;
+                               } else {
+                                       list_free_values(&ai);
+                                       retv_if(1, MENU_SCREEN_ERROR_FAIL);
+                               }
+                       }
+               } else {
+                       Evas_Object *page;
+                       Evas_Object *pended_item;
+
+                       pended_item = pkgmgr_find_pended_object(package, 1, scroller, &page);
+                       if (!pended_item ) {
+                               _D("Cannot find package in the install list");
+                       }
+
+                       if (ai.nodisplay == false) {
+                               item_update(item, &ai);
+                               break;
+                       }
+
+                       page = page_scroller_get_page_at(scroller, page_no);
+                       if (page) {
+                               page_unpack_item(page, item);
+                               page_trim_items(page);
+                       }
+                       item_destroy(item);
+               }
+       } while (0);
+
+       list_free_values(&ai);
+       return MENU_SCREEN_ERROR_OK;
+}
+
+
+
+static inline menu_screen_error_e _delete_cb(const char *package, void *data)
+{
+       Evas_Object *item;
+       Evas_Object *page;
+       Evas_Object *scroller = data;
+       Evas_Object *tmp;
+       int page_no = 0;
+       register unsigned int i;
+       unsigned int page_max_app;
+
+       do {
+               if (!scroller) {
+                       _D("Scroller is NULL.");
+                       break;
+               }
+
+               tmp = pkgmgr_find_pended_object(package, 1, scroller, NULL);
+
+               item = page_scroller_find_item_by_package(scroller, package, &page_no);
+               retv_if(NULL == item, MENU_SCREEN_ERROR_FAIL);
+
+               if (tmp != item) {
+                       _D("Pended item is %p, Found item is %p", tmp, item);
+               }
+
+               page = page_scroller_get_page_at(scroller, page_no);
+               retv_if(NULL == page, MENU_SCREEN_ERROR_FAIL);
+
+               page_max_app = (unsigned int) evas_object_data_get(scroller, "page_max_app");
+               for (i = 0; i < page_max_app; i++) {
+                       if (item == page_get_item_at(page, i)) {
+                               break;
+                       }
+               }
+
+               item = _animated_unpack_item(scroller, page, i);
+               retv_if(NULL == item, MENU_SCREEN_ERROR_FAIL);
+               item_destroy(item);
+       } while (0);
+
+       return MENU_SCREEN_ERROR_OK;
+}
+
+
+
+static struct pkg_event_handler {
+       const char *event_name;
+       int (*event_handler)(const char *package, void *data);
+} event_table[] = {
+       {
+               .event_name = "create",
+               .event_handler = _create_cb,
+       },
+       {
+               .event_name = "update",
+               .event_handler = _update_cb,
+       },
+       {
+               .event_name = "delete",
+               .event_handler = _delete_cb,
+       },
+       {
+               .event_name = NULL,
+               .event_handler = NULL,
+       },
+};
+
+
+
+static void _desktop_cb(keynode_t *node, void *data)
+{
+       char *event;
+       char type[10];
+       char package[BUFSZE];
+       register int i;
+
+       event = vconf_get_str(vconf_keynode_get_name(node));
+       ret_if(NULL == event);
+
+       if (sscanf(event, "%10[^:]:%1023s", type, package) != 2) {
+               _D("Failed to parse the event format : [%s], [%s]", type, package);
+       }
+
+       _D("command[%s], package[%s]", type, package);
+
+       for (i = 0; event_table[i].event_name; i ++) {
+               if (!strcasecmp(type, event_table[i].event_name)) {
+                       if (event_table[i].event_handler(package, data) == MENU_SCREEN_ERROR_FAIL) {
+                               _E("Failed to handles the desktop notification event");
+                       }
+
+                       free(event);
+                       return;
+               }
+       }
+
+       _E("Failed to find a proper event handler");
+       free(event);
+}
+
+
+
+static void _mapbuf_cb(keynode_t *node, void *data)
+{
+       int value;
+       int nr_of_pages;
+       register int i;
+       Evas_Object *page;
+
+       if (vconf_get_int("memory/menuscreen/mapbuf", &value) < 0) {
+               _D("Failed to get mapbuf status");
+               return;
+       }
+
+       nr_of_pages = page_scroller_count_page(data);
+       if (value) {
+               for (i = 0; i < nr_of_pages; i ++) {
+                       page = page_scroller_get_page_at(data, i);
+                       if (!page) continue;
+
+                       if (!mapbuf_is_enabled(page)) {
+                               _D("Enable mapbuf %d", i);
+                               mapbuf_enable(page, 1);
+                       }
+               }
+       } else {
+               for (i = 0; i < nr_of_pages; i ++) {
+                       page = page_scroller_get_page_at(data, i);
+                       if (!page) continue;
+
+                       if (mapbuf_is_enabled(page)) {
+                               _D("Disable mapbuf %d", i);
+                               mapbuf_disable(page, 1);
+                       }
+               }
+       }
+}
+
+
+
+Evas_Object *page_scroller_create(Evas_Object *tab, Evas_Object *index, page_scroller_sort_type_e sort_type, int rotate)
+{
+       Evas_Object *box;
+       Evas_Object *scroller;
+       int width;
+       int height;
+
+       scroller = elm_scroller_add(tab);
+       retv_if(NULL == scroller, NULL);
+
+       elm_scroller_content_min_limit(scroller, EINA_FALSE, EINA_FALSE);
+       elm_scroller_bounce_set(scroller, EINA_TRUE, EINA_FALSE);
+       elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
+
+       width = menu_screen_get_root_width();
+       height = (int) ((double) PROP_PORTRAIT_HEIGHT * ((double) menu_screen_get_root_height()));
+       elm_scroller_page_size_set(scroller, width, height);
+
+       evas_object_size_hint_weight_set(scroller, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_size_hint_align_set(scroller, EVAS_HINT_FILL, EVAS_HINT_FILL);
+       evas_object_size_hint_min_set(scroller, width, height);
+       evas_object_size_hint_max_set(scroller, width, height);
+
+       _scroller_register(scroller);
+
+       box = elm_box_add(scroller);
+       if (!box) {
+               _D("Failed to create box");
+               evas_object_del(scroller);
+               return NULL;
+       }
+       elm_box_horizontal_set(box, 1);
+       evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+       evas_object_data_set(scroller, "win", evas_object_data_get(tab, "win"));
+       evas_object_data_set(scroller, "layout", evas_object_data_get(tab, "layout"));
+       evas_object_data_set(scroller, "controlbar", evas_object_data_get(tab, "controlbar"));
+       evas_object_data_set(scroller, "tab", tab);
+       evas_object_data_set(scroller, "page_edje", evas_object_data_get(tab, "page_edje"));
+       evas_object_data_set(scroller, "page_max_app", evas_object_data_get(tab, "page_max_app"));
+       evas_object_data_set(scroller, "item_edje", evas_object_data_get(tab, "item_edje"));
+       evas_object_data_set(scroller, "item_width", evas_object_data_get(tab, "item_width"));
+       evas_object_data_set(scroller, "item_height", evas_object_data_get(tab, "item_height"));
+       evas_object_data_set(scroller, "item_enable_long_press", evas_object_data_get(tab, "item_enable_long_press"));
+       evas_object_data_set(scroller, "item_text_dual_line", evas_object_data_get(tab, "item_text_dual_line"));
+       evas_object_data_set(scroller, "enable_bg_image", evas_object_data_get(tab, "enable_bg_image"));
+       evas_object_data_set(scroller, "box", box);
+       evas_object_data_set(scroller, "drag_start", (void *) 0);
+       evas_object_data_set(scroller, "previous_x", (void *) 0);
+       evas_object_data_set(scroller, "index", index);
+       evas_object_data_set(scroller, "sort_type", (void *) sort_type);
+       evas_object_data_set(scroller, "install_list", (void *) 0);
+       evas_object_data_set(scroller, "rotate", (void *) rotate);
+       evas_object_data_set(scroller, "is_edited", (void *) false);
+       elm_object_content_set(scroller, box);
+
+       evas_object_event_callback_add(box, EVAS_CALLBACK_DEL, _evas_object_event_del_cb, "BOX");
+
+       evas_object_show(box);
+       evas_object_show(scroller);
+
+       if (vconf_notify_key_changed("memory/menuscreen/desktop", _desktop_cb, scroller) < 0) {
+               _E("Failed to register a desktop change event handler");
+       }
+
+       if (vconf_notify_key_changed("memory/menuscreen/mapbuf", _mapbuf_cb, scroller) < 0) {
+               _E("Failed to register a vconf cb for %s", "memory/menuscreen/mapbuf");
+       }
+
+       pkgmgr_init(scroller);
+
+       return scroller;
+}
+
+
+
+void page_scroller_destroy(Evas_Object *scroller)
+{
+       Evas_Object *box;
+       Evas_Object *page;
+       Evas_Object *tmp;
+       Evas_Object *tab;
+
+       const Eina_List *page_list;
+       const Eina_List *l;
+       const Eina_List *ln;
+
+       ret_if(NULL == scroller);
+       ret_if(NULL == (box = evas_object_data_get(scroller, "box")));
+       ret_if(NULL == (page_list = elm_box_children_get(box)));
+
+       tab = evas_object_data_get(scroller, "tab");
+
+       pkgmgr_fini();
+
+       EINA_LIST_FOREACH_SAFE(page_list, l, ln, page) {
+               int count;
+
+               if (!page) {
+                       _D("page list contains nil item");
+                       continue;
+               }
+
+               count = eina_list_count(page_list);
+               _D("page_list count : %d", count);
+               if (count < 1) {
+                       elm_box_unpack(box, page);
+               }
+
+               tmp = mapbuf_get_page(page);
+               if (tmp) page = tmp;
+
+               page_destroy(scroller, page);
+       }
+
+       box = elm_object_content_unset(scroller);
+       evas_object_del(box);
+
+       _scroller_unregister(scroller);
+       evas_object_data_del(scroller, "win");
+       evas_object_data_del(scroller, "layout");
+       evas_object_data_del(scroller, "controlbar");
+       evas_object_data_del(scroller, "tab");
+       evas_object_data_del(scroller, "page_edje");
+       evas_object_data_del(scroller, "page_max_app");
+       evas_object_data_del(scroller, "item_edje");
+       evas_object_data_del(scroller, "item_width");
+       evas_object_data_del(scroller, "item_height");
+       evas_object_data_del(scroller, "item_enable_long_press");
+       evas_object_data_del(scroller, "item_text_dual_line");
+       evas_object_data_del(scroller, "enable_bg_image");
+       evas_object_data_del(scroller, "box");
+       evas_object_data_del(scroller, "drag_start");
+       evas_object_data_del(scroller, "previous_x");
+       evas_object_data_del(scroller, "index");
+       evas_object_data_del(scroller, "sort_type");
+       evas_object_data_del(scroller, "rotate");
+       evas_object_data_del(scroller, "is_edited");
+       evas_object_data_del(scroller, "install_list");
+
+       evas_object_del(scroller);
+       evas_object_event_callback_del(box, EVAS_CALLBACK_DEL, _evas_object_event_del_cb);
+
+       if (vconf_ignore_key_changed("memory/menuscreen/desktop", _desktop_cb) < 0) {
+               _E("Failed to ignore the desktop event");
+       }
+
+       if (vconf_ignore_key_changed("memory/menuscreen/mapbuf", _mapbuf_cb) < 0) {
+               _E("Failed to remove vconf %s", "memory/menuscreen/mapbuf");
+       }
+}
+
+
+
+void page_scroller_clean(Evas_Object *scroller)
+{
+       Evas_Object *page;
+       Evas_Object *item;
+
+       register unsigned int i;
+       unsigned int page_max_app;
+       unsigned int count;
+
+       count = page_scroller_count_page(scroller);
+       if (count == 0) return;
+
+       for (i = 1; i < MAX_PAGE_NO; i++) {
+               page = page_scroller_get_page_at(scroller, i);
+               if (NULL == page) break;
+
+               page_destroy(scroller, page);
+       }
+
+       page = page_scroller_get_page_at(scroller, 0);
+       ret_if(NULL == page);
+
+       page_max_app = (unsigned int) evas_object_data_get(scroller, "page_max_app");
+       for (i = 0; i < page_max_app; i++) {
+               item = page_get_item_at(page, i);
+               if (item) {
+                       item_destroy(item);
+               } else break;
+       }
+}
+
+
+
+Evas_Object *page_scroller_get_page_at(Evas_Object *scroller, unsigned int idx)
+{
+       const Eina_List *page_list;
+       Evas_Object *item;
+       Evas_Object *box;
+
+       retv_if(idx >= MAX_PAGE_NO, NULL);
+
+       box = evas_object_data_get(scroller, "box");
+       retv_if(NULL == box, NULL);
+
+       page_list = elm_box_children_get(box);
+       retv_if(NULL == page_list, NULL);
+
+       item = eina_list_nth(page_list, idx);
+       if (item) {
+               item = mapbuf_get_page(item);
+       }
+
+       return item;
+}
+
+
+
+unsigned int page_scroller_count_page(Evas_Object *scroller)
+{
+       const Eina_List *page_list;
+       Evas_Object *box;
+
+       box = evas_object_data_get(scroller, "box");
+       retv_if(NULL == box, 0);
+
+       page_list = elm_box_children_get(box);
+       retv_if(NULL == page_list, 0);
+
+       return eina_list_count(page_list);
+}
+
+
+
+int page_scroller_get_page_no(Evas_Object* scroller, Evas_Object *page)
+{
+       Evas_Object *item;
+       Evas_Object *box;
+       register int idx = 0;
+       const Eina_List *page_list;
+       const Eina_List *pos;
+
+       box = evas_object_data_get(scroller, "box");
+       retv_if(NULL == box, 0);
+
+       page_list = elm_box_children_get(box);
+       EINA_LIST_FOREACH(page_list, pos, item) {
+               if (!item) {
+                       _D("page list contains nil item");
+                       continue;
+               }
+
+               item = mapbuf_get_page(item);
+               if (item == page) {
+                       return idx;
+               }
+
+               idx ++;
+       }
+
+       return -1;
+}
+
+
+
+Evas_Object *page_scroller_find_item_by_package(Evas_Object *scroller, const char *package, int *page_no)
+{
+       register int i;
+       register int j;
+       Evas_Object *page;
+       Evas_Object *item;
+       const char *tmp;
+       int local_page_no;
+       int page_max_app;
+
+       if (!page_no) page_no = &local_page_no;
+
+       retv_if(NULL == package, NULL);
+
+       page_max_app = (int) evas_object_data_get(scroller, "page_max_app");
+       for (i = 0; i < page_scroller_count_page(scroller); i ++) {
+               page = page_scroller_get_page_at(scroller, i);
+               if (!page) continue;
+
+               for (j = 0; j < page_max_app; j ++) {
+                       item = page_get_item_at(page, j);
+                       if (!item) continue;
+
+                       tmp = item_get_package(item);
+                       if (!tmp) {
+                               _D("Something goes wrong, this package has no name?");
+                               continue;
+                       }
+
+                       if (!strcmp(tmp, package)) {
+                               *page_no = i;
+                               return item;
+                       }
+               }
+       }
+
+       return NULL;
+}
+
+
+
+void _show(Evas_Object *scroller, int page)
+{
+       Evas_Coord w;
+       Evas_Coord h;
+
+       evas_object_geometry_get(scroller, NULL, NULL, &w, &h);
+       elm_scroller_region_show(scroller, page * w, 0, w, h);
+}
+
+
+
+void page_scroller_trim_items(Evas_Object *scroller)
+{
+       register unsigned int i;
+       register unsigned int j;
+       int page_max_app;
+       int pos = 0;
+
+       Evas_Object *page;
+       Evas_Object *item;
+       Eina_List *list = NULL;
+
+       page_max_app = (int) evas_object_data_get(scroller, "page_max_app");
+       for (i = 0; i < MAX_PAGE_NO; i ++) {
+               page = page_scroller_get_page_at(scroller, i);
+               if (!page) break;
+
+               for (j = 0; j < page_max_app; j++) {
+                       item = page_unpack_item_at(page, j);
+                       if (item) {
+                               list = eina_list_append(list, item);
+                               _D("LIST APPEND : %s", item_get_package(item));
+                       }
+               }
+
+       }
+
+       for (i = 0; i < eina_list_count(list); i++) {
+               if (i % page_max_app == 0) {
+                       page = page_scroller_get_page_at(scroller, i / page_max_app);
+                       _D("PAGE GET : 0x%x", page);
+                       if (NULL == page) {
+                               _E("Cannot get page");
+                               break;
+                       }
+               }
+
+               item = eina_list_nth(list, i);
+               if (NULL == item) {
+                       _E("Cannot get item");
+                       break;
+               }
+               _D("LIST GET : [%d] %s", pos, item_get_package(item));
+
+               page_pack_item(page, pos % page_max_app, item);
+               pos++;
+       }
+
+       for (i = pos / page_max_app; i < MAX_PAGE_NO; i++) {
+               int count;
+
+               page = page_scroller_get_page_at(scroller, i);
+               if (NULL == page) {
+                       break;
+               }
+               count = page_count_item(page);
+               if (count == 0) {
+                       Evas_Coord w;
+                       Evas_Coord h;
+
+                       _D("PAGE IS EMPTY : 0x%x", page);
+
+                       page_destroy(scroller, page);
+                       evas_object_geometry_get(scroller, NULL, NULL, &w, &h);
+                       elm_scroller_region_show(scroller, 0, 0, w, h);
+               }
+       }
+       pos --;
+       eina_list_free(list);
+}
+
+
+
+Evas_Object *_unpack_updated_item(Evas_Object *scroller, unsigned int page_no, unsigned int position_no)
+{
+       Evas_Object *page;
+       Evas_Object *temp;
+
+       retv_if(NULL == scroller, NULL);
+       page = page_scroller_get_page_at(scroller, page_no);
+       temp = page_unpack_item_at(page, (int) position_no);
+
+       return temp;
+}
+
+
+
+// End of a file
diff --git a/src/pkgmgr.c b/src/pkgmgr.c
new file mode 100644 (file)
index 0000000..f39a7c1
--- /dev/null
@@ -0,0 +1,808 @@
+ /*
+  * 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>
+#include <package-manager.h>
+
+#include "conf.h"
+#include "index.h"
+#include "item.h"
+#include "list.h"
+#include "page.h"
+#include "page_scroller.h"
+#include "mapbuf.h"
+#include "pkgmgr.h"
+#include "util.h"
+
+
+
+struct pkgmgr_handler {
+       const char *key;
+       int (*func)(const char *package, const char *val, void *data);
+};
+
+
+
+static struct {
+       pkgmgr_client *listen_pc;
+} pkg_mgr_info = {
+       .listen_pc = NULL,
+};
+
+
+
+inline menu_screen_error_e pkgmgr_uninstall(Evas_Object *item)
+{
+       pkgmgr_client *req_pc = NULL;
+       int ret = MENU_SCREEN_ERROR_OK;
+
+       retv_if(NULL == item, MENU_SCREEN_ERROR_FAIL);
+
+       req_pc = pkgmgr_client_new(PC_REQUEST);
+       retv_if(NULL == req_pc, MENU_SCREEN_ERROR_FAIL);
+
+       if (pkgmgr_client_uninstall(req_pc, NULL, item_get_package(item), PM_DEFAULT, NULL, NULL) < 0) {
+               _E("cannot uninstall %s.", item_get_package(item));
+               ret = MENU_SCREEN_ERROR_FAIL;
+       }
+
+       if (pkgmgr_client_free(req_pc) != PKGMGR_R_OK) {
+               _E("cannot free pkgmgr_client for request.");
+       }
+
+       return ret;
+}
+
+
+
+static menu_screen_error_e _start_download(const char *package, void *scroller)
+{
+       struct package_info *pi;
+       Eina_List *install_list;
+
+       install_list = evas_object_data_get(scroller, "install_list");
+       pi = calloc(1, sizeof(struct package_info));
+       retv_if(NULL == pi, MENU_SCREEN_ERROR_FAIL);
+
+       pi->status = DOWNLOAD_BEGIN;
+       pi->ai.package = strdup(package);
+       pi->ai.name = strdup("Download");
+
+       install_list = eina_list_append(install_list, pi);
+       evas_object_data_set(scroller, "install_list", install_list);
+       _D("Package [%s] is jump into the downloading phase", package);
+
+       return MENU_SCREEN_ERROR_OK;
+}
+
+
+
+static menu_screen_error_e _start_uninstall(const char *package, void *scroller)
+{
+       Eina_List *l;
+       Eina_List *tmp;
+       int page_no = 0;
+       struct package_info *pi = NULL;
+       Eina_List *install_list;
+
+       install_list = evas_object_data_get(scroller, "install_list");
+       EINA_LIST_FOREACH_SAFE(install_list, l, tmp, pi) {
+               if (pi->ai.package && !strcmp(pi->ai.package, package)) {
+                       break;
+               }
+               pi = NULL;
+       }
+
+       retv_if(pi, MENU_SCREEN_ERROR_FAIL);
+
+       pi = calloc(1, sizeof(struct package_info));
+       retv_if(NULL == pi, MENU_SCREEN_ERROR_FAIL);
+
+       pi->status = UNINSTALL_BEGIN;
+       pi->ai.package = strdup(package);
+       pi->ai.nodisplay = false;
+       pi->item = page_scroller_find_item_by_package(scroller, package, &page_no);
+       pi->page = page_scroller_get_page_at(scroller, page_no);
+
+       install_list = eina_list_append(install_list, pi);
+       evas_object_data_set(scroller, "install_list", install_list);
+
+       return MENU_SCREEN_ERROR_OK;
+}
+
+
+
+static menu_screen_error_e _start_update(const char *package, void *scroller)
+{
+       Eina_List *l;
+       Eina_List *tmp;
+       struct package_info *pi = NULL;
+       Eina_List *install_list;
+
+       install_list = evas_object_data_get(scroller, "install_list");
+       EINA_LIST_FOREACH_SAFE(install_list, l, tmp, pi) {
+               if (pi->ai.package && !strcmp(pi->ai.package, package)) {
+                       break;
+               }
+               pi = NULL;
+       }
+
+       if (!pi) {
+               int page_no = 0;
+               _D("Package [%s] is starting update phase directly (without downloading phase)", package);
+
+               pi = calloc(1, sizeof(struct package_info));
+               retv_if(NULL == pi, MENU_SCREEN_ERROR_FAIL);
+
+               pi->ai.package = strdup(package);
+               pi->item = page_scroller_find_item_by_package(scroller, package, &page_no);
+               if (pi->item) {
+                       pi->page = page_scroller_get_page_at(scroller, page_no);
+               }
+
+               if (pi->item && pi->page) {
+                       pi->ai.nodisplay = false;
+               }
+
+               install_list = eina_list_append(install_list, pi);
+               evas_object_data_set(scroller, "install_list", install_list);
+       } else {
+               if (pi->status != DOWNLOAD_END) {
+                       _D("Package [%s] is in invalid state (%d), cancel this", package, pi->status);
+                       install_list = eina_list_remove(install_list, pi);
+                       evas_object_data_set(scroller, "install_list", install_list);
+                       if (pi->item) {
+                               page_unpack_item(pi->page, pi->item);
+                               page_trim_items(pi->page);
+                               item_destroy(pi->item);
+                       }
+
+                       list_free_values(&pi->ai);
+                       free(pi);
+                       return MENU_SCREEN_ERROR_FAIL;
+               }
+       }
+
+       pi->status = UPDATE_BEGIN;
+       pi->ai.name = strdup("Update");
+       if (pi->item) {
+               item_set_name(pi->item, pi->ai.name, 0);
+       }
+
+       _D("Package [%s] is jump into the updating phase", package);
+
+       return MENU_SCREEN_ERROR_OK;
+}
+
+
+
+static menu_screen_error_e _start_recover(const char *package, void *scroller)
+{
+       return MENU_SCREEN_ERROR_OK;
+}
+
+
+
+static menu_screen_error_e _start_install(const char *package, void *scroller)
+{
+       Eina_List *l;
+       Eina_List *tmp;
+       struct package_info *pi = NULL;
+       Eina_List *install_list;
+
+       install_list = evas_object_data_get(scroller, "install_list");
+       EINA_LIST_FOREACH_SAFE(install_list, l, tmp, pi) {
+               if (pi->ai.package && !strcmp(pi->ai.package, package)) {
+                       break;
+               }
+               pi = NULL;
+       }
+
+       if (!pi) {
+               int page_no = 0;
+               _D("Package [%s] is starting install phase directly (without downloading phase)", package);
+               pi = calloc(1, sizeof(struct package_info));
+               retv_if(NULL == pi, MENU_SCREEN_ERROR_FAIL);
+
+               pi->ai.package = strdup(package);
+               pi->item = page_scroller_find_item_by_package(scroller, package, &page_no);
+               if (pi->item) {
+                       pi->page = page_scroller_get_page_at(scroller, page_no);
+               }
+
+               if (pi->item && pi->page) {
+                       pi->ai.nodisplay = false;
+               }
+
+               install_list = eina_list_append(install_list, pi);
+               evas_object_data_set(scroller, "install_list", install_list);
+       } else {
+               if (pi->status != DOWNLOAD_END) {
+                       _D("Package [%s] is in invalid state (%d), cancel this", package, pi->status);
+                       install_list = eina_list_remove(install_list, pi);
+                       evas_object_data_set(scroller, "install_list", install_list);
+                       if (pi->item) {
+                               page_unpack_item(pi->page, pi->item);
+                               page_trim_items(pi->page);
+                               item_destroy(pi->item);
+                       }
+
+                       list_free_values(&pi->ai);
+                       free(pi);
+                       return MENU_SCREEN_ERROR_FAIL;
+               }
+       }
+
+       pi->status = INSTALL_BEGIN;
+       pi->ai.name = strdup("Install");
+       if (pi->item) {
+               // Update app name to install
+               item_set_name(pi->item, pi->ai.name, 0);
+       }
+       _D("Package [%s] is jump into the installing phase", package);
+
+       return MENU_SCREEN_ERROR_OK;
+}
+
+
+
+static menu_screen_error_e _start(const char *package, const char *val, void *scroller)
+{
+       struct start_cb_set {
+               const char *name;
+               int (*handler)(const char *package, void *scroller);
+       } start_cb[] = {
+               {
+                       .name = "download",
+                       .handler = _start_download,
+               },
+               {
+                       .name = "uninstall",
+                       .handler = _start_uninstall,
+               },
+               {
+                       .name = "install",
+                       .handler = _start_install,
+               },
+               {
+                       .name = "update",
+                       .handler = _start_update,
+               },
+               {
+                       .name = "recover",
+                       .handler = _start_recover,
+               },
+               {
+                       .name = NULL,
+                       .handler = NULL,
+               },
+       };
+
+       register unsigned int i;
+
+       _D("package [%s]", package);
+
+       for (i = 0; start_cb[i].name; i ++) {
+               if (!strcasecmp(val, start_cb[i].name) && start_cb[i].handler) {
+                       return start_cb[i].handler(package, scroller);
+               }
+       }
+
+       _D("Unknown status for starting phase signal'd from package manager");
+
+       return MENU_SCREEN_ERROR_OK;
+}
+
+
+
+static menu_screen_error_e _icon_path(const char *package, const char *val, void *scroller)
+{
+       Eina_List *l;
+       Eina_List *tmp;
+       struct package_info *pi = NULL;
+       Eina_List *install_list;
+
+       install_list = evas_object_data_get(scroller, "install_list");
+       retv_if(!package, MENU_SCREEN_ERROR_FAIL);
+       retv_if(!val, MENU_SCREEN_ERROR_FAIL);
+
+       _D("package [%s] with %s", package, val);
+
+       EINA_LIST_FOREACH_SAFE(install_list, l, tmp, pi) {
+               if (pi->ai.package && !strcmp(pi->ai.package, package)) {
+                       break;
+               }
+               pi = NULL;
+       }
+       retv_if(NULL == pi, MENU_SCREEN_ERROR_FAIL);
+
+       if (strlen(val)) {
+               pi->ai.icon = strdup(val);
+               retv_if (NULL == pi->ai.icon, MENU_SCREEN_ERROR_OUT_OF_MEMORY);
+
+               if (!pi->item) {
+                       pi->ai.nodisplay = false;
+
+                       if (MENU_SCREEN_ERROR_FAIL == page_scroller_push_item(scroller, &pi->ai)) {
+                               _E("Failed to create a new item, remove this package from the installing list");
+                               list_free_values(&pi->ai);
+                               install_list = eina_list_remove(install_list, pi);
+                               evas_object_data_set(scroller, "install_list", install_list);
+                               free(pi);
+                       }
+               } else {
+                       item_update(pi->item, &pi->ai);
+               }
+       }
+
+       return MENU_SCREEN_ERROR_OK;
+}
+
+
+
+static menu_screen_error_e _download_percent(const char *package, const char *val, void *scroller)
+{
+       Eina_List *l;
+       Eina_List *tmp;
+       struct package_info *pi = NULL;
+       Eina_List *install_list;
+
+       _D("package [%s] with %s", package, val);
+
+       install_list = evas_object_data_get(scroller, "install_list");
+       EINA_LIST_FOREACH_SAFE(install_list, l, tmp, pi) {
+               if (pi->ai.package && !strcmp(pi->ai.package, package)) {
+                       break;
+               }
+               pi = NULL;
+       }
+
+       retv_if(NULL == pi, MENU_SCREEN_ERROR_FAIL);
+
+       if (pi->status == DOWNLOAD_BEGIN) {
+               pi->status = DOWNLOADING;
+       } else if (pi->status == DOWNLOADING) {
+               // Do nothing, just we are in proper state
+       } else {
+               _D("Invalid state for %s, This is not started from the download_begin state(%s)", package, val);
+       }
+
+       if (!pi->ai.nodisplay && pi->item) {
+               if (!item_is_enabled_progress(pi->item)) {
+                       item_enable_progress(pi->item);
+               }
+
+               item_update_progress(pi->item, atoi(val));
+       }
+
+       return MENU_SCREEN_ERROR_OK;
+}
+
+
+
+static menu_screen_error_e _install_percent(const char *package, const char *val, void *scroller)
+{
+       Eina_List *l;
+       Eina_List *tmp;
+       struct package_info *pi;
+       int progress;
+       Eina_List *install_list;
+
+       _D("package [%s] with %s", package, val);
+
+       pi = NULL;
+       install_list = evas_object_data_get(scroller, "install_list");
+       EINA_LIST_FOREACH_SAFE(install_list, l, tmp, pi) {
+               if (pi->ai.package && !strcmp(pi->ai.package, package)) {
+                       break;
+               }
+
+               pi = NULL;
+       }
+
+       retv_if(NULL == pi, MENU_SCREEN_ERROR_FAIL);
+
+       progress = atoi(val);
+
+       if (pi->status == INSTALL_BEGIN) {
+               pi->status = INSTALLING;
+       } else if (pi->status == UNINSTALL_BEGIN) {
+               progress = 100 - progress;
+               pi->status = UNINSTALLING;
+       } else if (pi->status == UPDATE_BEGIN) {
+               pi->status = UPDATING;
+       } else if (pi->status == INSTALLING) {
+       } else if (pi->status == UNINSTALLING) {
+               progress = 100 - progress;
+       } else if (pi->status == UPDATING) {
+       } else {
+               _D("Invalid state for %s, This is not the uninstall or install_begin state(%s)", package, val);
+       }
+
+       if (!pi->ai.nodisplay && pi->item) {
+               if (!item_is_enabled_progress(pi->item)) {
+                       item_enable_progress(pi->item);
+               }
+
+               item_update_progress(pi->item, progress);
+       }
+
+       return MENU_SCREEN_ERROR_OK;
+}
+
+
+
+static menu_screen_error_e _error(const char *package, const char *val, void *scroller)
+{
+       struct package_info *pi = NULL;
+       Eina_List *l;
+       Eina_List *tmp;
+       Eina_List *install_list;
+
+       _D("package [%s] with %s", package, val);
+
+       install_list = evas_object_data_get(scroller, "install_list");
+       EINA_LIST_FOREACH_SAFE(install_list, l, tmp, pi) {
+               if (pi->ai.package && !strcmp(pi->ai.package, package)) {
+                       break;
+               }
+
+               pi = NULL;
+       }
+
+       retv_if(NULL == pi, MENU_SCREEN_ERROR_FAIL);
+
+       pi->error_count ++;
+       return MENU_SCREEN_ERROR_OK;
+}
+
+
+
+static menu_screen_error_e _end_downloading(const char *package, struct package_info *pi, void *scroller)
+{
+       pi->status = DOWNLOAD_END;
+       _D("Package downloading is complete, waiting install progress");
+       return MENU_SCREEN_ERROR_OK;
+}
+
+
+
+static menu_screen_error_e _end_installing(const char *package, struct package_info *pi, void *scroller)
+{
+       // This status will not be referenced from the others.
+       // because it will be freed right after set it. ;)
+       Eina_List *install_list;
+
+       pi->status = INSTALL_END;
+       _D("Package installing is complete");
+
+       install_list = evas_object_data_get(scroller, "install_list");
+       if (pi->desktop_file_found == 1) {
+               install_list = eina_list_remove(install_list, pi);
+               evas_object_data_set(scroller, "install_list", install_list);
+               list_free_values(&pi->ai);
+               free(pi);
+       }
+
+
+       // TODO: Need to register a timer callback
+       return MENU_SCREEN_ERROR_OK;
+}
+
+
+
+static menu_screen_error_e _end_updating(const char *package, struct package_info *pi, void *scroller)
+{
+       // This status will not be referenced from the others.
+       // because it will be freed right after set it. ;)
+       Eina_List *install_list;
+
+       pi->status = UPDATE_END;
+       _D("Package updating is complete");
+
+       install_list = evas_object_data_get(scroller, "install_list");
+       if (pi->desktop_file_found == 1) {
+               install_list = eina_list_remove(install_list, pi);
+               evas_object_data_set(scroller, "install_list", install_list);
+               list_free_values(&pi->ai);
+               free(pi);
+       }
+
+
+       // TODO: Need to register a timer callback
+       return MENU_SCREEN_ERROR_OK;
+}
+
+
+
+static menu_screen_error_e _end_uninstalling(const char *package, struct package_info *pi, void *scroller)
+{
+       Eina_List *install_list;
+
+       pi->status = UNINSTALL_END;
+       _D("Package uninstalling is complete");
+
+       install_list = evas_object_data_get(scroller, "install_list");
+       if (pi->desktop_file_found == 1) {
+               install_list = eina_list_remove(install_list, pi);
+               evas_object_data_set(scroller, "install_list", install_list);
+               list_free_values(&pi->ai);
+               free(pi);
+       }
+
+       return MENU_SCREEN_ERROR_OK;
+}
+
+
+
+static menu_screen_error_e _end_unknown(const char *package, struct package_info *pi, void *scroller)
+{
+       Eina_List *install_list;
+
+       install_list = evas_object_data_get(scroller, "install_list");
+       install_list = eina_list_remove(install_list, pi);
+       evas_object_data_set(scroller, "install_list", install_list);
+
+       if (pi->item) {
+               // Remove an item only if it is installing.
+               if (
+                       pi->status == INSTALL_BEGIN || pi->status == INSTALLING || pi->status == INSTALL_END ||
+                       pi->status == DOWNLOAD_BEGIN || pi->status == DOWNLOADING || pi->status == DOWNLOAD_END ||
+                       pi->status == UPDATE_BEGIN || pi->status == UPDATING || pi->status == UPDATE_END
+               )
+               {
+                       if (pi->page) {
+                               page_unpack_item(pi->page, pi->item);
+                               page_trim_items(pi->page);
+                       } else {
+                               _D("Page is not valid (%s)", package);
+                       }
+                       item_destroy(pi->item);
+                       page_scroller_trim_items(scroller);
+               }
+       }
+
+       list_free_values(&pi->ai);
+       free(pi);
+
+       return MENU_SCREEN_ERROR_OK;
+}
+
+
+
+static menu_screen_error_e _end(const char *package, const char *val, void *scroller)
+{
+       Eina_List *l;
+       Eina_List *tmp;
+       struct package_info *pi;
+       register int i;
+       struct end_cb_set {
+               int status;
+               int (*handler)(const char *package, struct package_info *pi, void *scroller);
+       } end_cb[] = {
+               {
+                       .status = DOWNLOADING,
+                       .handler = _end_downloading,
+               },
+               {
+                       .status = INSTALLING,
+                       .handler = _end_installing,
+               },
+               {
+                       .status = UNINSTALLING,
+                       .handler = _end_uninstalling,
+               },
+               {
+                       .status = UPDATING,
+                       .handler = _end_updating,
+               },
+               {
+                       .status = UNKNOWN,
+                       .handler = _end_unknown,
+               },
+               {
+                       .status = MAX_STATUS,
+                       .handler = NULL,
+               },
+       };
+       Eina_List *install_list;
+
+       _D("package [%s]", package);
+
+       pi = NULL;
+       install_list = evas_object_data_get(scroller, "install_list");
+       EINA_LIST_FOREACH_SAFE(install_list, l, tmp, pi) {
+               if (pi->ai.package && !strcmp(pi->ai.package, package)) {
+                       break;
+               }
+               pi = NULL;
+       }
+
+       retv_if(NULL == pi, MENU_SCREEN_ERROR_FAIL);
+
+       if (item_is_enabled_progress(pi->item)) {
+               item_disable_progress(pi->item);
+       }
+
+       // NOTE: Don't release the 'pi'
+       //       Release it from each handler
+       for (i = 0; end_cb[i].handler; i ++) {
+               if (end_cb[i].status == pi->status && end_cb[i].handler) {
+                       int ret;
+
+                       if (strcasecmp(val, "ok")) {
+                               ret = _end_unknown(package, pi, scroller);
+                       } else {
+                               ret = end_cb[i].handler(package, pi, scroller);
+                       }
+
+                       return ret;
+               }
+       }
+
+       return _end_unknown(package, pi, scroller);
+}
+
+
+
+static menu_screen_error_e _change_pkg_name(const char *package, const char *val, void *scroller)
+{
+       Eina_List *l;
+       Eina_List *tmp;
+       struct package_info *pi;
+       Eina_List *install_list;
+
+       _D("package [%s]", package);
+
+       install_list = evas_object_data_get(scroller, "install_list");
+       EINA_LIST_FOREACH_SAFE(install_list, l, tmp, pi) {
+               if (!pi) {
+                       continue;
+               }
+               if (pi->ai.package && !strcmp(pi->ai.package, package)) {
+                       _D("Replace package name %s to %s", pi->ai.package, val);
+                       free(pi->ai.package);
+                       pi->ai.package = strdup(val);
+                       if (!pi->ai.package) {
+                               _E("cannot strdup");
+                               return MENU_SCREEN_ERROR_FAIL;
+                       }
+                       if (pi->item) {
+                               item_set_package(pi->item, (char*) val, 0);
+                       }
+                       return MENU_SCREEN_ERROR_OK;
+               }
+       }
+
+       return MENU_SCREEN_ERROR_FAIL;
+}
+
+
+
+static struct pkgmgr_handler pkgmgr_cbs[] = {
+       { "start", _start },
+       { "icon_path", _icon_path },
+       { "download_percent", _download_percent },
+       { "command", NULL },
+       { "install_percent", _install_percent },
+       { "error", _error },
+       { "end", _end },
+       { "change_pkg_name", _change_pkg_name },
+};
+
+
+
+static menu_screen_error_e _pkgmgr_cb(int req_id, const char *pkg_type, const char *package, const char *key, const char *val, const void *pmsg, void *data)
+{
+       register unsigned int i;
+       Evas_Object *scroller = data;
+
+       _D("pkgmgr request [%s] for %s, val(%s)", key, package, val);
+
+       for (i = 0; i < sizeof(pkgmgr_cbs) / sizeof(struct pkgmgr_handler); i++) {
+               if (!strcasecmp(pkgmgr_cbs[i].key, key)) {
+                       if (pkgmgr_cbs[i].func) {
+                               if (MENU_SCREEN_ERROR_OK != pkgmgr_cbs[i].func(package, val, scroller)) {
+                                       _E("pkgmgr_cbs[%u].func has errors.", i);
+                               }
+                       } else {
+                               _E("Cannot find pkgmgr_cbs[%u].func.", i);
+                       }
+                       return MENU_SCREEN_ERROR_OK;
+               }
+       }
+
+       return MENU_SCREEN_ERROR_FAIL;
+}
+
+
+
+menu_screen_error_e pkgmgr_init(Evas_Object *scroller)
+{
+       if (NULL != pkg_mgr_info.listen_pc) {
+               return MENU_SCREEN_ERROR_OK;
+       }
+
+       pkg_mgr_info.listen_pc = pkgmgr_client_new(PC_LISTENING);
+       retv_if(NULL == pkg_mgr_info.listen_pc, MENU_SCREEN_ERROR_FAIL);
+       retv_if(pkgmgr_client_listen_status(pkg_mgr_info.listen_pc,
+                       _pkgmgr_cb, scroller) != PKGMGR_R_OK, MENU_SCREEN_ERROR_FAIL);
+
+       return MENU_SCREEN_ERROR_OK;
+}
+
+
+
+void pkgmgr_fini(void)
+{
+       ret_if(NULL == pkg_mgr_info.listen_pc);
+       if (pkgmgr_client_free(pkg_mgr_info.listen_pc) != PKGMGR_R_OK) {
+               _E("cannot free pkgmgr_client for listen.");
+       }
+       pkg_mgr_info.listen_pc = NULL;
+}
+
+
+
+Evas_Object *pkgmgr_find_pended_object(const char *package, int with_desktop_file, Evas_Object *scroller, Evas_Object **page)
+{
+       Eina_List *l;
+       Eina_List *tmp;
+       struct package_info *pi;
+       Eina_List *install_list;
+
+       _D("package [%s]", package);
+
+       retv_if(NULL == package, NULL);
+       install_list = evas_object_data_get(scroller, "install_list");
+       EINA_LIST_FOREACH_SAFE(install_list, l, tmp, pi) {
+               if (!pi) {
+                       continue;
+               }
+               if (pi->ai.package && !strcmp(pi->ai.package, package)) {
+                       Evas_Object *item;
+                       _D("Installing(Downloading) package is found (%p)", pi->item);
+
+                       item = pi->item;
+
+                       if (with_desktop_file) {
+                               pi->desktop_file_found = 1;
+
+                               if (pi->status == INSTALL_END || pi->status == UNINSTALL_END || pi->status == UPDATE_END) {
+                                       install_list = eina_list_remove(install_list, pi);
+                                       evas_object_data_set(scroller, "install_list", install_list);
+                                       list_free_values(&pi->ai);
+                                       free(pi);
+                                       pi = NULL;
+                               }
+                       }
+
+                       if (page) {
+                               *page = pi ? pi->page : NULL;
+                       }
+                       return item;
+               }
+       }
+
+       _D("Failed to find a installing/downloading package");
+       return NULL;
+}
+
+
+
+// End of a file
diff --git a/src/popup.c b/src/popup.c
new file mode 100644 (file)
index 0000000..3849383
--- /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>
+
+#include "conf.h"
+#include "menu_screen.h"
+#include "util.h"
+
+
+
+static void _response_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       Evas_Object *popup;
+
+       ret_if(NULL == data);
+       popup = data;
+       evas_object_del(evas_object_data_del(popup, "button"));
+       evas_object_del(popup);
+}
+
+
+
+Evas_Object *popup_create(Evas_Object *parent, const char *warning)
+{
+       Evas_Object *popup;
+       Evas_Object *btn;
+
+       retv_if(NULL == warning, NULL);
+
+       popup = elm_popup_add(parent);
+       retv_if(NULL == popup, NULL);
+
+       btn = elm_button_add(popup);
+       if (NULL == btn) {
+               evas_object_del(popup);
+               return NULL;
+       }
+
+       elm_object_text_set(btn, D_("IDS_COM_SK_OK"));
+       evas_object_data_set(popup, "button", btn);
+
+       elm_object_part_content_set(popup, "button1", btn);
+       evas_object_smart_callback_add(btn, "clicked", _response_cb, popup);
+
+       evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       elm_object_part_text_set(popup, "title,text", D_("IDS_COM_POP_WARNING"));
+       elm_object_text_set(popup, warning);
+       evas_object_show(popup);
+
+       return popup;
+}
+
+
+
+// End of a file
diff --git a/src/util.c b/src/util.c
new file mode 100644 (file)
index 0000000..7ec1f36
--- /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 <Evas.h>
+
+#include "util.h"
+
+
+
+void _evas_object_resize_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+       Evas_Coord x;
+       Evas_Coord y;
+       Evas_Coord w;
+       Evas_Coord h;
+
+       evas_object_geometry_get(obj, &x, &y, &w, &h);
+       _D("%s is resized to (%d, %d, %d, %d)", data, x, y, w, h);
+}
+
+
+
+void _evas_object_event_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+       _D("%s IS REMOVED!", (const char *) data);
+}
+
+
+
+void _evas_object_event_move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+       Evas_Coord x;
+       Evas_Coord y;
+       Evas_Coord w;
+       Evas_Coord h;
+
+       evas_object_geometry_get(obj, &x, &y, &w, &h);
+       _D("%s's GEOMETRY : [%d, %d, %d, %d]", (const char *) data, x, y, w, h);
+}
+
+
+
+void _evas_object_event_show_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+       Evas_Coord x;
+       Evas_Coord y;
+       Evas_Coord w;
+       Evas_Coord h;
+
+       evas_object_geometry_get(obj, &x, &y, &w, &h);
+       _D("%s's GEOMETRY : [%d, %d, %d, %d]", (const char *) data, x, y, w, h);
+}
+
+
+
+// End of a file