From: Sung-jae Park Date: Fri, 1 May 2015 07:06:54 +0000 (+0900) Subject: Clean up all to pull all again with its whole history X-Git-Tag: submit/tizen_mobile/20150511.123737~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=af5969f15f2cf0cc1928c764459100555b7f24d4;p=platform%2Fcore%2Fappfw%2Fdata-provider-slave.git Clean up all to pull all again with its whole history [model] Redwood,Kiran,B3(Wearable) [binary_type] AP [customer] Docomo/Orange/ATT/Open [issue#] N/A [problem] [cause] [solution] [team] HomeTF [request] [horizontal_expansion] --- diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index 56ac21f..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,130 +0,0 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -PROJECT(data-provider-slave C) - -INCLUDE(FindPkgConfig) -pkg_check_modules(pkg REQUIRED - capi-appfw-application - capi-appfw-app-manager - ail - dlog - aul - vconf - sqlite3 - db-util - glib-2.0 - gio-2.0 - bundle - ecore - widget_provider - widget_service - edje - evas - widget - elementary - capi-system-system-settings - com-core - shortcut - efl-assist - json-glib-1.0 -) - -IF (X11_SUPPORT) -pkg_check_modules(pkg_extra REQUIRED - ecore-x -) -ENDIF (X11_SUPPORT) - -IF (WAYLAND_SUPPORT) -pkg_check_modules(pkg_extra REQUIRED - ecore-wayland -) -ENDIF (WAYLAND_SUPPORT) - -SET(PACKAGE "${PROJECT_NAME}") -SET(LOCALEDIR "/usr/apps/org.tizen.${PROJECT_NAME}/res/locale") -SET(ICON_PROVIDER "icon-provider-slave") -SET(EXE_LOADER "${PROJECT_NAME}") -SET(THEME_DIR "/opt/usr/share/data-provider-slave/theme") - -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) - -#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden") - -ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") -ADD_DEFINITIONS("-DPATH_MAX=256") -ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE}\"") -ADD_DEFINITIONS("-DLOCALEDIR=\"${LOCALEDIR}\"") -ADD_DEFINITIONS("-DEXEC_NAME=\"${PROJECT_NAME}.loader\"") - -ADD_DEFINITIONS("-DMASTER_PKGNAME=\"data-provider-master\"") -ADD_DEFINITIONS("-DSLAVE_PKGNAME=\"org.tizen.data-provider-slave\"") -ADD_DEFINITIONS("-DSOCKET_FILE=\"/opt/usr/share/live_magazine/.live.socket\"") -ADD_DEFINITIONS("-DCONF_FILE=\"/usr/share/data-provider-master/conf.ini\"") - -ADD_DEFINITIONS("-DNDEBUG") -#ADD_DEFINITIONS("-D_ENABLE_MCHECK") -ADD_DEFINITIONS("-DLOG_TAG=\"DATA_PROVIDER_SLAVE\"") -ADD_DEFINITIONS("-D_USE_ECORE_TIME_GET") -ADD_DEFINITIONS("-DTHEME_DIR=\"${THEME_DIR}\"") -#ADD_DEFINITIONS("-D_ESTIMATE_PERF") - -ADD_DEFINITIONS(${pkg_CFLAGS}) -ADD_DEFINITIONS(${pkg_LDFLAGS}) -ADD_DEFINITIONS(${pkg_extra_CFLAGS}) -ADD_DEFINITIONS(${pkg_extra_LDFLAGS}) - -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Winline -Werror -g -fno-builtin-malloc -fpie") - -SET(BUILD_SOURCE - src/main.c - src/so_handler.c - src/fault.c - src/update_monitor.c - src/util.c - src/widget.c - src/client.c - src/critical_log.c - src/connection.c - src/theme_loader.c -) - -IF (WAYLAND_SUPPORT) - ADD_DEFINITIONS("-DHAVE_WAYLAND") - SET(BUILD_SOURCE - ${BUILD_SOURCE} - src/util_wayland.c - ) -ENDIF (WAYLAND_SUPPORT) - -IF (X11_SUPPORT) - ADD_DEFINITIONS("-DHAVE_X11") - SET(BUILD_SOURCE - ${BUILD_SOURCE} - src/util_x11.c - ) -ENDIF (X11_SUPPORT) - -ADD_EXECUTABLE("${PROJECT_NAME}" - ${BUILD_SOURCE} -) - -TARGET_LINK_LIBRARIES(${PROJECT_NAME} "-ldl -pie" ${pkg_extra_LDFLAGS} ${pkg_LDFLAGS}) - -ADD_EXECUTABLE(${ICON_PROVIDER} - icon_src/main.c - icon_src/script_handler.c - src/util.c -) -TARGET_LINK_LIBRARIES(${ICON_PROVIDER} "-ldl -pie" ${pkg_extra_LDFLAGS} ${pkg_LDFLAGS}) - -#INSTALL(FILES ${CMAKE_SOURCE_DIR}/org.tizen.data-provider-slave.desktop DESTINATION /usr/share/applications) -INSTALL(FILES ${CMAKE_SOURCE_DIR}/org.tizen.data-provider-slave.xml DESTINATION /usr/share/packages) -INSTALL(FILES ${CMAKE_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license RENAME "org.tizen.${PROJECT_NAME}") -INSTALL(FILES ${CMAKE_SOURCE_DIR}/org.tizen.data-provider-slave.efl DESTINATION /etc/smack/accesses.d) -INSTALL(TARGETS ${ICON_PROVIDER} DESTINATION /usr/apps/org.tizen.${PROJECT_NAME}/bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) -INSTALL(TARGETS ${EXE_LOADER} DESTINATION /usr/apps/org.tizen.${PROJECT_NAME}/bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) - -# INCLUDE FOR BUILD & INSTALL .PO FILES -ADD_SUBDIRECTORY(res) -ADD_SUBDIRECTORY(data) diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 571fe79..0000000 --- a/LICENSE +++ /dev/null @@ -1,206 +0,0 @@ -Flora License - -Version 1.1, April, 2013 - -http://floralicense.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 Tizen Compliance Specification -and passes the Tizen Compliance Tests 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 - and your own copyright statement or terms and conditions do not conflict - the conditions stated in the License including section 3. - -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.1 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://floralicense.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/data/.icon_font.edc.swp b/data/.icon_font.edc.swp deleted file mode 100644 index 9ded4f5..0000000 Binary files a/data/.icon_font.edc.swp and /dev/null differ diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt deleted file mode 100644 index 2ba9e89..0000000 --- a/data/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -ADD_CUSTOM_TARGET(icon.edj ALL - COMMAND edje_cc -sd ${CMAKE_CURRENT_SOURCE_DIR} -id ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/icon.edc icon.edj - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/icon.edc -) -ADD_DEPENDENCIES(${PROJECT_NAME} icon_font.edj) -ADD_CUSTOM_TARGET(icon_font.edj ALL - COMMAND edje_cc -sd ${CMAKE_CURRENT_SOURCE_DIR} -id ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/icon_font.edc icon_font.edj - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/icon_font.edc -) -ADD_DEPENDENCIES(${PROJECT_NAME} icon_font.edj) - -ADD_CUSTOM_TARGET(icon_effect.edj ALL - COMMAND edje_cc -sd ${CMAKE_CURRENT_SOURCE_DIR} -id ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/icon_effect.edc icon_effect.edj - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/icon_effect.edc -) -ADD_DEPENDENCIES(${PROJECT_NAME} icon_effect.edj) -ADD_CUSTOM_TARGET(icon_effect_font.edj ALL - COMMAND edje_cc -sd ${CMAKE_CURRENT_SOURCE_DIR} -id ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/icon_effect_font.edc icon_effect_font.edj - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/icon_effect_font.edc -) -ADD_DEPENDENCIES(${PROJECT_NAME} icon_effect_font.edj) - -INSTALL(FILES icon.edj DESTINATION /usr/apps/org.tizen.${PROJECT_NAME}/res/edje) -INSTALL(FILES icon_effect.edj DESTINATION /usr/apps/org.tizen.${PROJECT_NAME}/res/edje) -INSTALL(FILES icon_font.edj DESTINATION /usr/apps/org.tizen.${PROJECT_NAME}/res/edje) -INSTALL(FILES icon_effect_font.edj DESTINATION /usr/apps/org.tizen.${PROJECT_NAME}/res/edje) diff --git a/data/icon.edc b/data/icon.edc deleted file mode 100644 index cbf17ae..0000000 --- a/data/icon.edc +++ /dev/null @@ -1,600 +0,0 @@ -/* - * Copyright 2013 Samsung Electronics Co., Ltd - * - * Licensed under the Flora License, Version 1.1 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://floralicense.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. - */ - -images { - image: "icon_shadow.png" COMP; - image: "shortcut_bg_1x1.png" COMP; -} - -collections { - group { - name: "default,1x1"; - parts { - part { - name: "box,bg"; - type: IMAGE; - description { - state: "default" 0.0; - rel1 { relative: 0.0 0.0; } - rel2 { relative: 1.0 1.0; } - image { normal: "shortcut_bg_1x1.png"; } - } - } - - part { - name: "bg"; - type: IMAGE; - description { - state: "default" 0.0; - rel1 { relative: 23/175 11/175; } - rel2 { relative: 152/175 140/175; } - image { normal: "icon_shadow.png"; } - align: 0.5 0.5; - aspect: 1.0 1.0; - aspect_preference: BOTH; - } - } - - part { - name: "icon"; - type: SWALLOW; - description { - rel1 { relative: 6/129 3/129; to, "bg"; } - rel2 { relative: 123/129 120/129; to, "bg"; } - } - } - - part { - name: "name,shadow"; - type: TEXT; - // effect: FAR_SHADOW - description { - rel1 { relative: 11/175 135/175; } - rel2 { relative: 166/175 169/175; } - color: 0 0 0 102; - text { - font: "Tizen:style=Bold"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - - part { - name: "name"; - type: TEXT; - // effect: FAR_SHADOW; - description { - rel1 { relative: 10/175 133/175; } - rel2 { relative: 165/175 167/175; } - color: 255 255 255 255; - //color3: 255 255 255 153; - text { - font: "Tizen:style=Bold"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - } - } - - group { - name: "default,2x1"; /* +89.5, 0 */ - parts { - part { - name: "bg"; - type: IMAGE; - description { - state: "default" 0.0; - rel1 { relative: 112.5/354 11/175; } - rel2 { relative: 241.5/354 140/175; } - image { normal: "icon_shadow.png"; } - align: 0.5 0.5; - aspect: 1.0 1.0; - aspect_preference: BOTH; - } - } - - part { - name: "icon"; - type: SWALLOW; - description { - rel1 { relative: 6/129 3/129; to, "bg"; } - rel2 { relative: 123/129 120/129; to, "bg"; } - } - } - - part { - name: "name,shadow"; - type: TEXT; - // effect: FAR_SHADOW - description { - rel1 { relative: 100.5/354 135/175; } - rel2 { relative: 255.5/354 169/175; } - color: 0 0 0 102; - text { - font: "Tizen:style=Bold"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - - part { - name: "name"; - type: TEXT; - // effect: FAR_SHADOW; - description { - rel1 { relative: 99.5/354 133/175; } - rel2 { relative: 254.5/354 167/175; } - color: 255 255 255 255; - //color3: 255 255 255 153; - text { - font: "Tizen:style=Bold"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - } - } - - group { - name: "default,2x2"; /* +89.5, +89.5 */ - parts { - part { - name: "bg"; - type: IMAGE; - description { - state: "default" 0.0; - rel1 { relative: 112.5/354 100.5/354; } - rel2 { relative: 241.5/354 229.5/354; } - image { normal: "icon_shadow.png"; } - align: 0.5 0.5; - aspect: 1.0 1.0; - aspect_preference: BOTH; - } - } - - part { - name: "icon"; - type: SWALLOW; - description { - rel1 { relative: 6/129 3/129; to, "bg"; } - rel2 { relative: 123/129 120/129; to, "bg"; } - } - } - - part { - name: "name,shadow"; - type: TEXT; - // effect: FAR_SHADOW - description { - rel1 { relative: 100.5/354 224.5/354; } - rel2 { relative: 255.5/354 258.5/354; } - color: 0 0 0 102; - text { - font: "Tizen:style=Bold"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - - part { - name: "name"; - type: TEXT; - // effect: FAR_SHADOW; - description { - rel1 { relative: 99.5/354 222.5/354; } - rel2 { relative: 254.5/354 256.5/354; } - color: 255 255 255 255; - //color3: 255 255 255 153; - text { - font: "Tizen:style=Bold"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - } - } - - group { - name: "default,4x1"; /* +268.5, 0 */ - parts { - part { - name: "bg"; - type: IMAGE; - description { - state: "default" 0.0; - rel1 { relative: 291.5/712 11/175; } - rel2 { relative: 420.5/712 140/175; } - image { normal: "icon_shadow.png"; } - align: 0.5 0.5; - aspect: 1.0 1.0; - aspect_preference: BOTH; - } - } - - part { - name: "icon"; - type: SWALLOW; - description { - rel1 { relative: 6/129 3/129; to, "bg"; } - rel2 { relative: 123/129 120/129; to, "bg"; } - } - } - - part { - name: "name,shadow"; - type: TEXT; - // effect: FAR_SHADOW - description { - rel1 { relative: 279.5/712 135/175; } - rel2 { relative: 434.5/712 169/175; } - color: 0 0 0 102; - text { - font: "Tizen:style=Bold"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - - part { - name: "name"; - type: TEXT; - // effect: FAR_SHADOW; - description { - rel1 { relative: 278.5/712 133/175; } - rel2 { relative: 433.5/712 167/175; } - color: 255 255 255 255; - //color3: 255 255 255 153; - text { - font: "Tizen:style=Bold"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - } - } - - group { - name: "default,4x2"; /* +268.5, +89.5 */ - parts { - part { - name: "bg"; - type: IMAGE; - description { - state: "default" 0.0; - rel1 { relative: 291.5/712 100.5/354; } - rel2 { relative: 420.5/712 229.5/354; } - image { normal: "icon_shadow.png"; } - align: 0.5 0.5; - aspect: 1.0 1.0; - aspect_preference: BOTH; - } - } - - part { - name: "icon"; - type: SWALLOW; - description { - rel1 { relative: 6/129 3/129; to, "bg"; } - rel2 { relative: 123/129 120/129; to, "bg"; } - } - } - - part { - name: "name,shadow"; - type: TEXT; - // effect: FAR_SHADOW - description { - rel1 { relative: 279.5/712 224.5/354; } - rel2 { relative: 434.5/712 258.5/354; } - color: 0 0 0 102; - text { - font: "Tizen:style=Bold"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - - part { - name: "name"; - type: TEXT; - // effect: FAR_SHADOW; - description { - rel1 { relative: 278.5/712 222.5/354; } - rel2 { relative: 433.5/712 256.5/354; } - color: 255 255 255 255; - //color3: 255 255 255 153; - text { - font: "Tizen:style=Bold"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - } - } - - group { - name: "default,4x3"; /* +268.5, +179 */ - parts { - part { - name: "bg"; - type: IMAGE; - description { - state: "default" 0.0; - rel1 { relative: 291.5/712 190/533; } - rel2 { relative: 420.5/712 319/533; } - image { normal: "icon_shadow.png"; } - align: 0.5 0.5; - aspect: 1.0 1.0; - aspect_preference: BOTH; - } - } - - part { - name: "icon"; - type: SWALLOW; - description { - rel1 { relative: 6/129 3/129; to, "bg"; } - rel2 { relative: 123/129 120/129; to, "bg"; } - } - } - - part { - name: "name,shadow"; - type: TEXT; - // effect: FAR_SHADOW - description { - rel1 { relative: 279.5/712 314/533; } - rel2 { relative: 434.5/712 348/533; } - color: 0 0 0 102; - text { - font: "Tizen:style=Bold"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - - part { - name: "name"; - type: TEXT; - // effect: FAR_SHADOW; - description { - rel1 { relative: 278.5/712 312/533; } - rel2 { relative: 433.5/712 346/533; } - color: 255 255 255 255; - //color3: 255 255 255 153; - text { - font: "Tizen:style=Bold"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - } - } - - group { - name: "default,4x4"; /* +268.5, +268.5 */ - parts { - part { - name: "bg"; - type: IMAGE; - description { - state: "default" 0.0; - rel1 { relative: 291.5/712 279.5/712; } - rel2 { relative: 420.5/712 408.5/712; } - image { normal: "icon_shadow.png"; } - align: 0.5 0.5; - aspect: 1.0 1.0; - aspect_preference: BOTH; - } - } - - part { - name: "icon"; - type: SWALLOW; - description { - rel1 { relative: 6/129 3/129; to, "bg"; } - rel2 { relative: 123/129 120/129; to, "bg"; } - } - } - - part { - name: "name,shadow"; - type: TEXT; - // effect: FAR_SHADOW - description { - rel1 { relative: 279.5/712 403.5/712; } - rel2 { relative: 434.5/712 437.5/712; } - color: 0 0 0 102; - text { - font: "Tizen:style=Bold"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - - part { - name: "name"; - type: TEXT; - // effect: FAR_SHADOW; - description { - rel1 { relative: 278.5/712 401.5/712; } - rel2 { relative: 433.5/712 435.5/712; } - color: 255 255 255 255; - //color3: 255 255 255 153; - text { - font: "Tizen:style=Bold"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - } - } - - group { - name: "default,4x5"; /* +268.5, +358 , 891 */ - parts { - part { - name: "bg"; - type: IMAGE; - description { - state: "default" 0.0; - rel1 { relative: 291.5/712 369/891; } - rel2 { relative: 420.5/712 498/891; } - image { normal: "icon_shadow.png"; } - align: 0.5 0.5; - aspect: 1.0 1.0; - aspect_preference: BOTH; - } - } - - part { - name: "icon"; - type: SWALLOW; - description { - rel1 { relative: 6/129 3/129; to, "bg"; } - rel2 { relative: 123/129 120/129; to, "bg"; } - } - } - - part { - name: "name,shadow"; - type: TEXT; - // effect: FAR_SHADOW - description { - rel1 { relative: 279.5/712 493/891; } - rel2 { relative: 434.5/712 527/891; } - color: 0 0 0 102; - text { - font: "Tizen:style=Bold"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - - part { - name: "name"; - type: TEXT; - // effect: FAR_SHADOW; - description { - rel1 { relative: 278.5/712 491/891; } - rel2 { relative: 433.5/712 525/891; } - color: 255 255 255 255; - //color3: 255 255 255 153; - text { - font: "Tizen:style=Bold"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - } - } - - group { - name: "default,4x6"; /* +268.5, +447.5, 1070 */ - parts { - part { - name: "bg"; - type: IMAGE; - description { - state: "default" 0.0; - rel1 { relative: 291.5/712 458.5/1070; } - rel2 { relative: 420.5/712 587.5/1070; } - image { normal: "icon_shadow.png"; } - align: 0.5 0.5; - aspect: 1.0 1.0; - aspect_preference: BOTH; - } - } - - part { - name: "icon"; - type: SWALLOW; - description { - rel1 { relative: 6/129 3/129; to, "bg"; } - rel2 { relative: 123/129 120/129; to, "bg"; } - } - } - - part { - name: "name,shadow"; - type: TEXT; - // effect: FAR_SHADOW - description { - rel1 { relative: 279.5/712 582.5/1070; } - rel2 { relative: 434.5/712 616.5/1070; } - color: 0 0 0 102; - text { - font: "Tizen:style=Bold"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - - part { - name: "name"; - type: TEXT; - // effect: FAR_SHADOW; - description { - rel1 { relative: 278.5/712 580.5/1070; } - rel2 { relative: 433.5/712 614.5/1070; } - color: 255 255 255 255; - //color3: 255 255 255 153; - text { - font: "Tizen:style=Bold"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - } - } -} diff --git a/data/icon_effect.edc b/data/icon_effect.edc deleted file mode 100644 index f89cabf..0000000 --- a/data/icon_effect.edc +++ /dev/null @@ -1,599 +0,0 @@ -/* - * Copyright 2013 Samsung Electronics Co., Ltd - * - * Licensed under the Flora License, Version 1.1 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://floralicense.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. - */ - -images { - image: "shortcut_bg_1x1.png" COMP; -} - -collections { - group { - name: "default,1x1"; - parts { - part { - name: "box,bg"; - type: IMAGE; - description { - state: "default" 0.0; - rel1 { relative: 0.0 0.0; } - rel2 { relative: 1.0 1.0; } - image { normal: "shortcut_bg_1x1.png"; } - } - } - - part { - name: "bg"; - type: RECT; - description { - state: "default" 0.0; - rel1 { relative: 23/175 7/175; } - rel2 { relative: 160/175 146/175; } - color: 0 0 0 0; - align: 0.5 0.5; - aspect: 1.0 1.0; - aspect_preference: BOTH; - } - } - - part { - name: "icon"; - type: SWALLOW; - description { - rel1 { relative: 2/137 2/139; to, "bg"; } - rel2 { relative: 127/137 132/139; to, "bg"; } // 117x117 125x127 - } - } - - part { - name: "name,shadow"; - type: TEXT; - // effect: FAR_SHADOW - description { - rel1 { relative: 11/175 135/175; } - rel2 { relative: 166/175 169/175; } - color: 0 0 0 102; - text { - font: "Tizen:style=Bold"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - - part { - name: "name"; - type: TEXT; - // effect: FAR_SHADOW; - description { - rel1 { relative: 10/175 133/175; } - rel2 { relative: 165/175 167/175; } - color: 255 255 255 255; - //color3: 255 255 255 153; - text { - font: "Tizen:style=Bold"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - } - } - - group { - name: "default,2x1"; /* +89.5, 0 */ - parts { - part { - name: "bg"; - type: RECT; - description { - state: "default" 0.0; - rel1 { relative: 112.5/354 7/175; } - rel2 { relative: 249.5/354 146/175; } - align: 0.5 0.5; - aspect: 1.0 1.0; - color: 0 0 0 0; - aspect_preference: BOTH; - } - } - - part { - name: "icon"; - type: SWALLOW; - description { - rel1 { relative: 2/137 2/139; to, "bg"; } - rel2 { relative: 127/137 132/139; to, "bg"; } // 117x117 125x127 - } - } - - part { - name: "name,shadow"; - type: TEXT; - // effect: FAR_SHADOW - description { - rel1 { relative: 100.5/354 135/175; } - rel2 { relative: 255.5/354 169/175; } - color: 0 0 0 102; - text { - font: "Tizen:style=Bold"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - - part { - name: "name"; - type: TEXT; - // effect: FAR_SHADOW; - description { - rel1 { relative: 99.5/354 133/175; } - rel2 { relative: 254.5/354 167/175; } - color: 255 255 255 255; - //color3: 255 255 255 153; - text { - font: "Tizen:style=Bold"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - } - } - - group { - name: "default,2x2"; /* +89.5, +89.5 */ - parts { - part { - name: "bg"; - type: RECT; - description { - state: "default" 0.0; - rel1 { relative: 112.5/354 96.5/354; } - rel2 { relative: 249.5/354 235.5/354; } - color: 0 0 0 0; - align: 0.5 0.5; - aspect: 1.0 1.0; - aspect_preference: BOTH; - } - } - - part { - name: "icon"; - type: SWALLOW; - description { - rel1 { relative: 2/137 2/139; to, "bg"; } - rel2 { relative: 127/137 132/139; to, "bg"; } // 117x117 125x127 - } - } - - part { - name: "name,shadow"; - type: TEXT; - // effect: FAR_SHADOW - description { - rel1 { relative: 100.5/354 224.5/354; } - rel2 { relative: 255.5/354 258.5/354; } - color: 0 0 0 102; - text { - font: "Tizen:style=Bold"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - - part { - name: "name"; - type: TEXT; - // effect: FAR_SHADOW; - description { - rel1 { relative: 99.5/354 222.5/354; } - rel2 { relative: 254.5/354 256.5/354; } - color: 255 255 255 255; - //color3: 255 255 255 153; - text { - font: "Tizen:style=Bold"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - } - } - - group { - name: "default,4x1"; /* +268.5, 0 */ - parts { - part { - name: "bg"; - type: RECT; - description { - state: "default" 0.0; - rel1 { relative: 291.5/712 7/175; } - rel2 { relative: 428.5/712 146/175; } - color: 0 0 0 0; - align: 0.5 0.5; - aspect: 1.0 1.0; - aspect_preference: BOTH; - } - } - - part { - name: "icon"; - type: SWALLOW; - description { - rel1 { relative: 2/137 2/139; to, "bg"; } - rel2 { relative: 127/137 132/139; to, "bg"; } // 117x117 125x127 - } - } - - part { - name: "name,shadow"; - type: TEXT; - // effect: FAR_SHADOW - description { - rel1 { relative: 279.5/712 135/175; } - rel2 { relative: 434.5/712 169/175; } - color: 0 0 0 102; - text { - font: "Tizen:style=Bold"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - - part { - name: "name"; - type: TEXT; - // effect: FAR_SHADOW; - description { - rel1 { relative: 278.5/712 133/175; } - rel2 { relative: 433.5/712 167/175; } - color: 255 255 255 255; - //color3: 255 255 255 153; - text { - font: "Tizen:style=Bold"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - } - } - - group { - name: "default,4x2"; /* +268.5, +89.5 */ - parts { - part { - name: "bg"; - type: RECT; - description { - state: "default" 0.0; - rel1 { relative: 291.5/712 96.5/354; } - rel2 { relative: 428.5/712 235.5/354; } - color: 0 0 0 0; - align: 0.5 0.5; - aspect: 1.0 1.0; - aspect_preference: BOTH; - } - } - - part { - name: "icon"; - type: SWALLOW; - description { - rel1 { relative: 2/137 2/139; to, "bg"; } - rel2 { relative: 127/137 132/139; to, "bg"; } // 117x117 125x127 - } - } - - part { - name: "name,shadow"; - type: TEXT; - // effect: FAR_SHADOW - description { - rel1 { relative: 279.5/712 224.5/354; } - rel2 { relative: 434.5/712 258.5/354; } - color: 0 0 0 102; - text { - font: "Tizen:style=Bold"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - - part { - name: "name"; - type: TEXT; - // effect: FAR_SHADOW; - description { - rel1 { relative: 278.5/712 222.5/354; } - rel2 { relative: 433.5/712 256.5/354; } - color: 255 255 255 255; - //color3: 255 255 255 153; - text { - font: "Tizen:style=Bold"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - } - } - - group { - name: "default,4x3"; /* +268.5, +179 */ - parts { - part { - name: "bg"; - type: RECT; - description { - state: "default" 0.0; - rel1 { relative: 291.5/712 186/533; } - rel2 { relative: 428.5/712 325/533; } - color: 0 0 0 0; - align: 0.5 0.5; - aspect: 1.0 1.0; - aspect_preference: BOTH; - } - } - - part { - name: "icon"; - type: SWALLOW; - description { - rel1 { relative: 2/137 2/139; to, "bg"; } - rel2 { relative: 127/137 132/139; to, "bg"; } // 117x117 125x127 - } - } - - part { - name: "name,shadow"; - type: TEXT; - // effect: FAR_SHADOW - description { - rel1 { relative: 279.5/712 314/533; } - rel2 { relative: 434.5/712 348/533; } - color: 0 0 0 102; - text { - font: "Tizen:style=Bold"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - - part { - name: "name"; - type: TEXT; - // effect: FAR_SHADOW; - description { - rel1 { relative: 278.5/712 312/533; } - rel2 { relative: 433.5/712 346/533; } - color: 255 255 255 255; - //color3: 255 255 255 153; - text { - font: "Tizen:style=Bold"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - } - } - - group { - name: "default,4x4"; /* +268.5, +268.5 */ - parts { - part { - name: "bg"; - type: RECT; - description { - state: "default" 0.0; - rel1 { relative: 291.5/712 275.5/712; } - rel2 { relative: 428.5/712 414.5/712; } - color: 0 0 0 0; - align: 0.5 0.5; - aspect: 1.0 1.0; - aspect_preference: BOTH; - } - } - - part { - name: "icon"; - type: SWALLOW; - description { - rel1 { relative: 2/137 2/139; to, "bg"; } - rel2 { relative: 127/137 132/139; to, "bg"; } // 117x117 125x127 - } - } - - part { - name: "name,shadow"; - type: TEXT; - // effect: FAR_SHADOW - description { - rel1 { relative: 279.5/712 403.5/712; } - rel2 { relative: 434.5/712 437.5/712; } - color: 0 0 0 102; - text { - font: "Tizen:style=Bold"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - - part { - name: "name"; - type: TEXT; - // effect: FAR_SHADOW; - description { - rel1 { relative: 278.5/712 401.5/712; } - rel2 { relative: 433.5/712 435.5/712; } - color: 255 255 255 255; - //color3: 255 255 255 153; - text { - font: "Tizen:style=Bold"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - } - } - - group { - name: "default,4x5"; /* +268.5, +358 , 891 */ - parts { - part { - name: "bg"; - type: RECT; - description { - state: "default" 0.0; - rel1 { relative: 291.5/712 365/891; } - rel2 { relative: 428.5/712 504/891; } - color: 0 0 0 0; - align: 0.5 0.5; - aspect: 1.0 1.0; - aspect_preference: BOTH; - } - } - - part { - name: "icon"; - type: SWALLOW; - description { - rel1 { relative: 2/137 2/139; to, "bg"; } - rel2 { relative: 127/137 132/139; to, "bg"; } // 117x117 125x127 - } - } - - part { - name: "name,shadow"; - type: TEXT; - // effect: FAR_SHADOW - description { - rel1 { relative: 279.5/712 493/891; } - rel2 { relative: 434.5/712 527/891; } - color: 0 0 0 102; - text { - font: "Tizen:style=Bold"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - - part { - name: "name"; - type: TEXT; - // effect: FAR_SHADOW; - description { - rel1 { relative: 278.5/712 491/891; } - rel2 { relative: 433.5/712 525/891; } - color: 255 255 255 255; - //color3: 255 255 255 153; - text { - font: "Tizen:style=Bold"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - } - } - - group { - name: "default,4x6"; /* +268.5, +447.5, 1070 */ - parts { - part { - name: "bg"; - type: RECT; - description { - state: "default" 0.0; - rel1 { relative: 291.5/712 454.5/1070; } - rel2 { relative: 428.5/712 593.5/1070; } - color: 0 0 0 0; - align: 0.5 0.5; - aspect: 1.0 1.0; - aspect_preference: BOTH; - } - } - - part { - name: "icon"; - type: SWALLOW; - description { - rel1 { relative: 2/137 2/139; to, "bg"; } - rel2 { relative: 127/137 132/139; to, "bg"; } // 117x117 125x127 - } - } - - part { - name: "name,shadow"; - type: TEXT; - // effect: FAR_SHADOW - description { - rel1 { relative: 279.5/712 582.5/1070; } - rel2 { relative: 434.5/712 616.5/1070; } - color: 0 0 0 102; - text { - font: "Tizen:style=Bold"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - - part { - name: "name"; - type: TEXT; - // effect: FAR_SHADOW; - description { - rel1 { relative: 278.5/712 580.5/1070; } - rel2 { relative: 433.5/712 614.5/1070; } - color: 255 255 255 255; - //color3: 255 255 255 153; - text { - font: "Tizen:style=Bold"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - } - } -} diff --git a/data/icon_effect_font.edc b/data/icon_effect_font.edc deleted file mode 100644 index 15fa700..0000000 --- a/data/icon_effect_font.edc +++ /dev/null @@ -1,455 +0,0 @@ -/* - * Copyright 2013 Samsung Electronics Co., Ltd - * - * Licensed under the Flora License, Version 1.1 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://floralicense.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. - */ - -images { - image: "shortcut_bg_1x1.png" COMP; -} - -collections { - group { - name: "default,1x1"; - parts { - part { - name: "box,bg"; - type: IMAGE; - description { - state: "default" 0.0; - rel1 { relative: 0.0 0.0; } - rel2 { relative: 1.0 1.0; } - image { normal: "shortcut_bg_1x1.png"; } - } - } - - part { - name: "bg"; - type: RECT; - description { - state: "default" 0.0; - rel1 { relative: 23/175 7/175; } - rel2 { relative: 160/175 146/175; } - color: 0 0 0 0; - align: 0.5 0.5; - aspect: 1.0 1.0; - aspect_preference: BOTH; - } - } - - part { - name: "icon"; - type: SWALLOW; - description { - rel1 { relative: 2/137 2/139; to, "bg"; } - rel2 { relative: 127/137 132/139; to, "bg"; } // 117x117 125x127 - } - } - - part { - name: "name"; - type: TEXT; - effect: TIZEN_GLOW_SHADOW; // TIZEN_SOFT_GLOW_SHADOW, TIZEN_SHADOW - description { - rel1 { relative: 10/175 133/175; } - rel2 { relative: 165/175 167/175; } - color: 255 255 255 255; - color2: 0 0 0 255; // for glow - color3: 0 0 0 255; // for shadow - text { - font: "Tizen:style=Regular"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - } - } - - group { - name: "default,2x1"; /* +89.5, 0 */ - parts { - part { - name: "bg"; - type: RECT; - description { - state: "default" 0.0; - rel1 { relative: 112.5/354 7/175; } - rel2 { relative: 249.5/354 146/175; } - align: 0.5 0.5; - aspect: 1.0 1.0; - color: 0 0 0 0; - aspect_preference: BOTH; - } - } - - part { - name: "icon"; - type: SWALLOW; - description { - rel1 { relative: 2/137 2/139; to, "bg"; } - rel2 { relative: 127/137 132/139; to, "bg"; } // 117x117 125x127 - } - } - - part { - name: "name"; - type: TEXT; - effect: TIZEN_GLOW_SHADOW; - description { - rel1 { relative: 99.5/354 133/175; } - rel2 { relative: 254.5/354 167/175; } - color: 255 255 255 255; - color2: 0 0 0 255; - color3: 0 0 0 255; - text { - font: "Tizen:style=Regular"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - } - } - - group { - name: "default,2x2"; /* +89.5, +89.5 */ - parts { - part { - name: "bg"; - type: RECT; - description { - state: "default" 0.0; - rel1 { relative: 112.5/354 96.5/354; } - rel2 { relative: 249.5/354 235.5/354; } - color: 0 0 0 0; - align: 0.5 0.5; - aspect: 1.0 1.0; - aspect_preference: BOTH; - } - } - - part { - name: "icon"; - type: SWALLOW; - description { - rel1 { relative: 2/137 2/139; to, "bg"; } - rel2 { relative: 127/137 132/139; to, "bg"; } // 117x117 125x127 - } - } - - part { - name: "name"; - type: TEXT; - effect: TIZEN_GLOW_SHADOW; - description { - rel1 { relative: 99.5/354 222.5/354; } - rel2 { relative: 254.5/354 256.5/354; } - color: 255 255 255 255; - color2: 0 0 0 255; - color3: 0 0 0 255; - text { - font: "Tizen:style=Regular"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - } - } - - group { - name: "default,4x1"; /* +268.5, 0 */ - parts { - part { - name: "bg"; - type: RECT; - description { - state: "default" 0.0; - rel1 { relative: 291.5/712 7/175; } - rel2 { relative: 428.5/712 146/175; } - color: 0 0 0 0; - align: 0.5 0.5; - aspect: 1.0 1.0; - aspect_preference: BOTH; - } - } - - part { - name: "icon"; - type: SWALLOW; - description { - rel1 { relative: 2/137 2/139; to, "bg"; } - rel2 { relative: 127/137 132/139; to, "bg"; } // 117x117 125x127 - } - } - - part { - name: "name"; - type: TEXT; - effect: TIZEN_GLOW_SHADOW; - description { - rel1 { relative: 278.5/712 133/175; } - rel2 { relative: 433.5/712 167/175; } - color: 255 255 255 255; - color2: 0 0 0 255; - color3: 0 0 0 255; - text { - font: "Tizen:style=Regular"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - } - } - - group { - name: "default,4x2"; /* +268.5, +89.5 */ - parts { - part { - name: "bg"; - type: RECT; - description { - state: "default" 0.0; - rel1 { relative: 291.5/712 96.5/354; } - rel2 { relative: 428.5/712 235.5/354; } - color: 0 0 0 0; - align: 0.5 0.5; - aspect: 1.0 1.0; - aspect_preference: BOTH; - } - } - - part { - name: "icon"; - type: SWALLOW; - description { - rel1 { relative: 2/137 2/139; to, "bg"; } - rel2 { relative: 127/137 132/139; to, "bg"; } // 117x117 125x127 - } - } - - part { - name: "name"; - type: TEXT; - effect: TIZEN_GLOW_SHADOW; - description { - rel1 { relative: 278.5/712 222.5/354; } - rel2 { relative: 433.5/712 256.5/354; } - color: 255 255 255 255; - color2: 0 0 0 255; - color3: 0 0 0 255; - text { - font: "Tizen:style=Regular"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - } - } - - group { - name: "default,4x3"; /* +268.5, +179 */ - parts { - part { - name: "bg"; - type: RECT; - description { - state: "default" 0.0; - rel1 { relative: 291.5/712 186/533; } - rel2 { relative: 428.5/712 325/533; } - color: 0 0 0 0; - align: 0.5 0.5; - aspect: 1.0 1.0; - aspect_preference: BOTH; - } - } - - part { - name: "icon"; - type: SWALLOW; - description { - rel1 { relative: 2/137 2/139; to, "bg"; } - rel2 { relative: 127/137 132/139; to, "bg"; } // 117x117 125x127 - } - } - - part { - name: "name"; - type: TEXT; - effect: TIZEN_GLOW_SHADOW; - description { - rel1 { relative: 278.5/712 312/533; } - rel2 { relative: 433.5/712 346/533; } - color: 255 255 255 255; - color2: 0 0 0 255; - color3: 0 0 0 255; - text { - font: "Tizen:style=Regular"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - } - } - - group { - name: "default,4x4"; /* +268.5, +268.5 */ - parts { - part { - name: "bg"; - type: RECT; - description { - state: "default" 0.0; - rel1 { relative: 291.5/712 275.5/712; } - rel2 { relative: 428.5/712 414.5/712; } - color: 0 0 0 0; - align: 0.5 0.5; - aspect: 1.0 1.0; - aspect_preference: BOTH; - } - } - - part { - name: "icon"; - type: SWALLOW; - description { - rel1 { relative: 2/137 2/139; to, "bg"; } - rel2 { relative: 127/137 132/139; to, "bg"; } // 117x117 125x127 - } - } - - part { - name: "name"; - type: TEXT; - effect: TIZEN_GLOW_SHADOW; - description { - rel1 { relative: 278.5/712 401.5/712; } - rel2 { relative: 433.5/712 435.5/712; } - color: 255 255 255 255; - color2: 0 0 0 255; - color3: 0 0 0 255; - text { - font: "Tizen:style=Regular"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - } - } - - group { - name: "default,4x5"; /* +268.5, +358 , 891 */ - parts { - part { - name: "bg"; - type: RECT; - description { - state: "default" 0.0; - rel1 { relative: 291.5/712 365/891; } - rel2 { relative: 428.5/712 504/891; } - color: 0 0 0 0; - align: 0.5 0.5; - aspect: 1.0 1.0; - aspect_preference: BOTH; - } - } - - part { - name: "icon"; - type: SWALLOW; - description { - rel1 { relative: 2/137 2/139; to, "bg"; } - rel2 { relative: 127/137 132/139; to, "bg"; } // 117x117 125x127 - } - } - - part { - name: "name"; - type: TEXT; - effect: TIZEN_GLOW_SHADOW; - description { - rel1 { relative: 278.5/712 491/891; } - rel2 { relative: 433.5/712 525/891; } - color: 255 255 255 255; - color2: 0 0 0 255; - color3: 0 0 0 255; - text { - font: "Tizen:style=Regular"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - } - } - - group { - name: "default,4x6"; /* +268.5, +447.5, 1070 */ - parts { - part { - name: "bg"; - type: RECT; - description { - state: "default" 0.0; - rel1 { relative: 291.5/712 454.5/1070; } - rel2 { relative: 428.5/712 593.5/1070; } - color: 0 0 0 0; - align: 0.5 0.5; - aspect: 1.0 1.0; - aspect_preference: BOTH; - } - } - - part { - name: "icon"; - type: SWALLOW; - description { - rel1 { relative: 2/137 2/139; to, "bg"; } - rel2 { relative: 127/137 132/139; to, "bg"; } // 117x117 125x127 - } - } - - part { - name: "name"; - type: TEXT; - effect: TIZEN_GLOW_SHADOW; - description { - rel1 { relative: 278.5/712 580.5/1070; } - rel2 { relative: 433.5/712 614.5/1070; } - color: 255 255 255 255; - color2: 0 0 0 255; - color3: 0 0 0 255; - text { - font: "Tizen:style=Regular"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - } - } -} diff --git a/data/icon_font.edc b/data/icon_font.edc deleted file mode 100644 index 9933f04..0000000 --- a/data/icon_font.edc +++ /dev/null @@ -1,456 +0,0 @@ -/* - * Copyright 2013 Samsung Electronics Co., Ltd - * - * Licensed under the Flora License, Version 1.1 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://floralicense.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. - */ - -images { - image: "icon_shadow.png" COMP; - image: "shortcut_bg_1x1.png" COMP; -} - -collections { - group { - name: "default,1x1"; - parts { - part { - name: "box,bg"; - type: IMAGE; - description { - state: "default" 0.0; - rel1 { relative: 0.0 0.0; } - rel2 { relative: 1.0 1.0; } - image { normal: "shortcut_bg_1x1.png"; } - } - } - - part { - name: "bg"; - type: IMAGE; - description { - state: "default" 0.0; - rel1 { relative: 23/175 11/175; } - rel2 { relative: 152/175 140/175; } - image { normal: "icon_shadow.png"; } - align: 0.5 0.5; - aspect: 1.0 1.0; - aspect_preference: BOTH; - } - } - - part { - name: "icon"; - type: SWALLOW; - description { - rel1 { relative: 6/129 3/129; to, "bg"; } - rel2 { relative: 123/129 120/129; to, "bg"; } - } - } - - part { - name: "name"; - type: TEXT; - effect: TIZEN_GLOW_SHADOW; - description { - rel1 { relative: 10/175 133/175; } - rel2 { relative: 165/175 167/175; } - color: 255 255 255 255; - color2: 0 0 0 255; - color3: 0 0 0 255; - text { - font: "Tizen:style=Regular"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - } - } - - group { - name: "default,2x1"; /* +89.5, 0 */ - parts { - part { - name: "bg"; - type: IMAGE; - description { - state: "default" 0.0; - rel1 { relative: 112.5/354 11/175; } - rel2 { relative: 241.5/354 140/175; } - image { normal: "icon_shadow.png"; } - align: 0.5 0.5; - aspect: 1.0 1.0; - aspect_preference: BOTH; - } - } - - part { - name: "icon"; - type: SWALLOW; - description { - rel1 { relative: 6/129 3/129; to, "bg"; } - rel2 { relative: 123/129 120/129; to, "bg"; } - } - } - - part { - name: "name"; - type: TEXT; - effect: TIZEN_GLOW_SHADOW; - description { - rel1 { relative: 99.5/354 133/175; } - rel2 { relative: 254.5/354 167/175; } - color: 255 255 255 255; - color2: 0 0 0 255; - color3: 0 0 0 255; - text { - font: "Tizen:style=Regular"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - } - } - - group { - name: "default,2x2"; /* +89.5, +89.5 */ - parts { - part { - name: "bg"; - type: IMAGE; - description { - state: "default" 0.0; - rel1 { relative: 112.5/354 100.5/354; } - rel2 { relative: 241.5/354 229.5/354; } - image { normal: "icon_shadow.png"; } - align: 0.5 0.5; - aspect: 1.0 1.0; - aspect_preference: BOTH; - } - } - - part { - name: "icon"; - type: SWALLOW; - description { - rel1 { relative: 6/129 3/129; to, "bg"; } - rel2 { relative: 123/129 120/129; to, "bg"; } - } - } - - part { - name: "name"; - type: TEXT; - effect: TIZEN_GLOW_SHADOW; - description { - rel1 { relative: 99.5/354 222.5/354; } - rel2 { relative: 254.5/354 256.5/354; } - color: 255 255 255 255; - color2: 0 0 0 255; - color3: 0 0 0 255; - text { - font: "Tizen:style=Regular"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - } - } - - group { - name: "default,4x1"; /* +268.5, 0 */ - parts { - part { - name: "bg"; - type: IMAGE; - description { - state: "default" 0.0; - rel1 { relative: 291.5/712 11/175; } - rel2 { relative: 420.5/712 140/175; } - image { normal: "icon_shadow.png"; } - align: 0.5 0.5; - aspect: 1.0 1.0; - aspect_preference: BOTH; - } - } - - part { - name: "icon"; - type: SWALLOW; - description { - rel1 { relative: 6/129 3/129; to, "bg"; } - rel2 { relative: 123/129 120/129; to, "bg"; } - } - } - - part { - name: "name"; - type: TEXT; - effect: TIZEN_GLOW_SHADOW; - description { - rel1 { relative: 278.5/712 133/175; } - rel2 { relative: 433.5/712 167/175; } - color: 255 255 255 255; - color2: 0 0 0 255; - color3: 0 0 0 255; - text { - font: "Tizen:style=Regular"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - } - } - - group { - name: "default,4x2"; /* +268.5, +89.5 */ - parts { - part { - name: "bg"; - type: IMAGE; - description { - state: "default" 0.0; - rel1 { relative: 291.5/712 100.5/354; } - rel2 { relative: 420.5/712 229.5/354; } - image { normal: "icon_shadow.png"; } - align: 0.5 0.5; - aspect: 1.0 1.0; - aspect_preference: BOTH; - } - } - - part { - name: "icon"; - type: SWALLOW; - description { - rel1 { relative: 6/129 3/129; to, "bg"; } - rel2 { relative: 123/129 120/129; to, "bg"; } - } - } - - part { - name: "name"; - type: TEXT; - effect: TIZEN_GLOW_SHADOW; - description { - rel1 { relative: 278.5/712 222.5/354; } - rel2 { relative: 433.5/712 256.5/354; } - color: 255 255 255 255; - color2: 0 0 0 255; - color3: 0 0 0 255; - text { - font: "Tizen:style=Regular"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - } - } - - group { - name: "default,4x3"; /* +268.5, +179 */ - parts { - part { - name: "bg"; - type: IMAGE; - description { - state: "default" 0.0; - rel1 { relative: 291.5/712 190/533; } - rel2 { relative: 420.5/712 319/533; } - image { normal: "icon_shadow.png"; } - align: 0.5 0.5; - aspect: 1.0 1.0; - aspect_preference: BOTH; - } - } - - part { - name: "icon"; - type: SWALLOW; - description { - rel1 { relative: 6/129 3/129; to, "bg"; } - rel2 { relative: 123/129 120/129; to, "bg"; } - } - } - - part { - name: "name"; - type: TEXT; - effect: TIZEN_GLOW_SHADOW; - description { - rel1 { relative: 278.5/712 312/533; } - rel2 { relative: 433.5/712 346/533; } - color: 255 255 255 255; - color2: 0 0 0 255; - color3: 0 0 0 255; - text { - font: "Tizen:style=Regular"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - } - } - - group { - name: "default,4x4"; /* +268.5, +268.5 */ - parts { - part { - name: "bg"; - type: IMAGE; - description { - state: "default" 0.0; - rel1 { relative: 291.5/712 279.5/712; } - rel2 { relative: 420.5/712 408.5/712; } - image { normal: "icon_shadow.png"; } - align: 0.5 0.5; - aspect: 1.0 1.0; - aspect_preference: BOTH; - } - } - - part { - name: "icon"; - type: SWALLOW; - description { - rel1 { relative: 6/129 3/129; to, "bg"; } - rel2 { relative: 123/129 120/129; to, "bg"; } - } - } - - part { - name: "name"; - type: TEXT; - effect: TIZEN_GLOW_SHADOW; - description { - rel1 { relative: 278.5/712 401.5/712; } - rel2 { relative: 433.5/712 435.5/712; } - color: 255 255 255 255; - color2: 0 0 0 255; - color3: 0 0 0 255; - text { - font: "Tizen:style=Regular"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - } - } - - group { - name: "default,4x5"; /* +268.5, +358 , 891 */ - parts { - part { - name: "bg"; - type: IMAGE; - description { - state: "default" 0.0; - rel1 { relative: 291.5/712 369/891; } - rel2 { relative: 420.5/712 498/891; } - image { normal: "icon_shadow.png"; } - align: 0.5 0.5; - aspect: 1.0 1.0; - aspect_preference: BOTH; - } - } - - part { - name: "icon"; - type: SWALLOW; - description { - rel1 { relative: 6/129 3/129; to, "bg"; } - rel2 { relative: 123/129 120/129; to, "bg"; } - } - } - - part { - name: "name"; - type: TEXT; - effect: TIZEN_GLOW_SHADOW; - description { - rel1 { relative: 278.5/712 491/891; } - rel2 { relative: 433.5/712 525/891; } - color: 255 255 255 255; - color2: 0 0 0 255; - color3: 0 0 0 255; - text { - font: "Tizen:style=Regular"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - } - } - - group { - name: "default,4x6"; /* +268.5, +447.5, 1070 */ - parts { - part { - name: "bg"; - type: IMAGE; - description { - state: "default" 0.0; - rel1 { relative: 291.5/712 458.5/1070; } - rel2 { relative: 420.5/712 587.5/1070; } - image { normal: "icon_shadow.png"; } - align: 0.5 0.5; - aspect: 1.0 1.0; - aspect_preference: BOTH; - } - } - - part { - name: "icon"; - type: SWALLOW; - description { - rel1 { relative: 6/129 3/129; to, "bg"; } - rel2 { relative: 123/129 120/129; to, "bg"; } - } - } - - part { - name: "name"; - type: TEXT; - effect: TIZEN_GLOW_SHADOW; - description { - rel1 { relative: 278.5/712 580.5/1070; } - rel2 { relative: 433.5/712 614.5/1070; } - color: 255 255 255 255; - color2: 0 0 0 255; - color3: 0 0 0 255; - text { - font: "Tizen:style=Regular"; - text_class: "tizen"; - align: 0.5 0.5; - size: 26; - } - } - } - } - } -} diff --git a/data/icon_shadow.png b/data/icon_shadow.png deleted file mode 100644 index 65e836b..0000000 Binary files a/data/icon_shadow.png and /dev/null differ diff --git a/data/shortcut_bg_1x1.png b/data/shortcut_bg_1x1.png deleted file mode 100644 index 61f8058..0000000 Binary files a/data/shortcut_bg_1x1.png and /dev/null differ diff --git a/icon_src/main.c b/icon_src/main.c deleted file mode 100644 index 93ead81..0000000 --- a/icon_src/main.c +++ /dev/null @@ -1,545 +0,0 @@ -/* - * Copyright 2013 Samsung Electronics Co., Ltd - * - * Licensed under the Flora License, Version 1.1 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://floralicense.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. - */ - -#if defined(LOG_TAG) -#undef LOG_TAG -#define LOG_TAG "ICON_PROVIDER" -#endif - -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include -#include - -#include "util.h" -#include "debug.h" - -#define UTILITY_ADDR "/tmp/.utility.service" -#if !defined(DEFAULT_ICON_LAYOUT) -#define DEFAULT_ICON_LAYOUT "/usr/apps/org.tizen.data-provider-slave/res/edje/icon.edj" -#endif - -#if !defined(DEFAULT_ICON_GROUP) -#define DEFAULT_ICON_GROUP "default" -#endif - -#define TEXT_CLASS "tizen" -#define DEFAULT_FONT_SIZE -100 - -int script_handler_parse_desc(Evas_Object *edje, const char *descfile); - -static struct info { - int client_fd; - const char *socket_file; - char *font_name; -} s_info = { - .client_fd = -1, - .socket_file = UTILITY_ADDR, - .font_name = NULL, -}; - -#define TTL 30.0f /* Can alive only 30 seconds from the last event */ -#define QUALITY_N_COMPRESS "quality=100 compress=1" - -/*! - * Defined for libwidget - */ -const char *widget_find_pkgname(const char *filename) -{ - return NULL; -} - -int widget_request_update_by_id(const char *filename) -{ - return WIDGET_ERROR_NOT_EXIST; -} - -int widget_trigger_update_monitor(const char *id, int is_pd) -{ - return WIDGET_ERROR_INVALID_PARAMETER; -} - -static inline Evas *create_virtual_canvas(int w, int h) -{ - Ecore_Evas *internal_ee; - Evas *internal_e; - - // Create virtual canvas - internal_ee = ecore_evas_buffer_new(w, h); - if (!internal_ee) { - ErrPrint("Failed to create a new canvas buffer\n"); - return NULL; - } - - ecore_evas_alpha_set(internal_ee, EINA_TRUE); - ecore_evas_manual_render_set(internal_ee, EINA_TRUE); - - // Get the "Evas" object from a virtual canvas - internal_e = ecore_evas_get(internal_ee); - if (!internal_e) { - ecore_evas_free(internal_ee); - ErrPrint("Faield to get Evas object\n"); - return NULL; - } - - ecore_evas_resize(internal_ee, w, h); - ecore_evas_show(internal_ee); - - return internal_e; -} - -static inline int flush_data_to_file(Evas *e, char *data, const char *filename, int w, int h) -{ - Evas_Object *output; - - output = evas_object_image_add(e); - if (!output) { - ErrPrint("Failed to create an image object\n"); - return EXIT_FAILURE; - } - - evas_object_image_data_set(output, NULL); - evas_object_image_colorspace_set(output, EVAS_COLORSPACE_ARGB8888); - evas_object_image_alpha_set(output, EINA_TRUE); - evas_object_image_size_set(output, w, h); - evas_object_image_smooth_scale_set(output, EINA_TRUE); - evas_object_image_data_set(output, data); - evas_object_image_data_update_add(output, 0, 0, w, h); - - if (evas_object_image_save(output, filename, NULL, QUALITY_N_COMPRESS) == EINA_FALSE) { - evas_object_del(output); - ErrPrint("Faield to save a captured image (%s)\n", filename); - return EXIT_FAILURE; - } - - evas_object_del(output); - - if (access(filename, F_OK) != 0) { - ErrPrint("File %s is not found\n", filename); - return EXIT_FAILURE; - } - - return EXIT_SUCCESS; -} - -static inline int flush_to_file(Evas *e, const char *filename, int w, int h) -{ - void *data; - Ecore_Evas *internal_ee; - - internal_ee = ecore_evas_ecore_evas_get(e); - if (!internal_ee) { - ErrPrint("Failed to get ecore evas\n"); - return EXIT_FAILURE; - } - - ecore_evas_manual_render(internal_ee); - - // Get a pointer of a buffer of the virtual canvas - data = (void *)ecore_evas_buffer_pixels_get(internal_ee); - if (!data) { - ErrPrint("Failed to get pixel data\n"); - return EXIT_FAILURE; - } - - return flush_data_to_file(e, data, filename, w, h); -} - -static inline int destroy_virtual_canvas(Evas *e) -{ - Ecore_Evas *ee; - - ee = ecore_evas_ecore_evas_get(e); - if (!ee) { - ErrPrint("Failed to ecore evas object\n"); - return EXIT_FAILURE; - } - - ecore_evas_free(ee); - return EXIT_SUCCESS; -} - -static int disconnected_cb(int handle, void *data) -{ - s_info.client_fd = -1; - elm_exit(); - return 0; -} - -static inline int convert_shortcut_type_to_lb_type(int shortcut_type, char **str) -{ - char *_str; - - if (!str) { - str = &_str; - } - - switch (shortcut_type) { - case WIDGET_SIZE_TYPE_1x1: - *str = "1x1"; - return WIDGET_SIZE_TYPE_1x1; - case WIDGET_SIZE_TYPE_2x1: - *str = "2x1"; - return WIDGET_SIZE_TYPE_2x1; - case WIDGET_SIZE_TYPE_2x2: - *str = "2x2"; - return WIDGET_SIZE_TYPE_2x2; - case WIDGET_SIZE_TYPE_4x1: - *str = "4x1"; - return WIDGET_SIZE_TYPE_4x1; - case WIDGET_SIZE_TYPE_4x2: - *str = "4x2"; - return WIDGET_SIZE_TYPE_4x2; - case WIDGET_SIZE_TYPE_4x3: - *str = "4x3"; - return WIDGET_SIZE_TYPE_4x3; - case WIDGET_SIZE_TYPE_4x4: - *str = "4x4"; - return WIDGET_SIZE_TYPE_4x4; - case WIDGET_SIZE_TYPE_4x5: - *str = "4x5"; - return WIDGET_SIZE_TYPE_4x5; - case WIDGET_SIZE_TYPE_4x6: - *str = "4x6"; - return WIDGET_SIZE_TYPE_4x6; - case WIDGET_SIZE_TYPE_EASY_1x1: - *str = "easy,1x1"; - return WIDGET_SIZE_TYPE_EASY_1x1; - case WIDGET_SIZE_TYPE_EASY_3x1: - *str = "easy,3x1"; - return WIDGET_SIZE_TYPE_EASY_3x1; - case WIDGET_SIZE_TYPE_EASY_3x3: - *str = "easy,3x3"; - return WIDGET_SIZE_TYPE_EASY_3x3; - default: - *str = "?x?"; - return WIDGET_SIZE_TYPE_UNKNOWN; - } -} - -static struct packet *icon_create(pid_t pid, int handle, const struct packet *packet) -{ - Evas *e; - const char *edje_path; - const char *group; - const char *desc_file; - const char *output; - int size_type; - int ret; - int w; - int h; - Evas_Object *edje; - Evas_Object *parent; - char _group[16]; - char *size_str; - - ret = packet_get(packet, "sssis", &edje_path, &group, &desc_file, &size_type, &output); - if (ret != 5) { - ErrPrint("Invalid parameters"); - ret = -EINVAL; - goto out; - } - - if (!edje_path || !strlen(edje_path)) { - edje_path = DEFAULT_ICON_LAYOUT; - } - - size_type = convert_shortcut_type_to_lb_type(size_type, &size_str); - if (!group || !strlen(group)) { - snprintf(_group, sizeof(_group), DEFAULT_ICON_GROUP",%s", size_str); - group = _group; - } - DbgPrint("Selected layout: %s(%s)\n", edje_path, group); - - ret = widget_service_get_size(size_type, &w, &h); - if (ret != WIDGET_ERROR_NONE) { - ErrPrint("Unable to get size(%d): %d\n", size_type, ret); - goto out; - } - - e = create_virtual_canvas(w, h); - if (!e) { - ErrPrint("Unable to create a canvas: %dx%d\n", w, h); - ret = WIDGET_ERROR_FAULT; - goto out; - } - - parent = evas_object_rectangle_add(e); - if (!parent) { - ErrPrint("Unable to create a parent\n"); - destroy_virtual_canvas(e); - ret = WIDGET_ERROR_FAULT; - goto out; - } - - evas_object_resize(parent, w, h); - evas_object_color_set(parent, 0, 0, 0, 0); - evas_object_show(parent); - - edje = elm_layout_add(parent); - if (!edje) { - ErrPrint("Unable to add an edje object\n"); - evas_object_del(parent); - destroy_virtual_canvas(e); - goto out; - } - - if (elm_layout_file_set(edje, edje_path, group) == EINA_FALSE) { - Edje_Load_Error err; - err = edje_object_load_error_get(elm_layout_edje_get(edje)); - if (err != EDJE_LOAD_ERROR_NONE) { - ErrPrint("Uanble to load an edje %s(%s) - %s\n", edje_path, group, edje_load_error_str(err)); - } - evas_object_del(edje); - evas_object_del(parent); - destroy_virtual_canvas(e); - goto out; - } - - evas_object_resize(edje, w, h); - evas_object_show(edje); - - if (script_handler_parse_desc(edje, desc_file) != WIDGET_ERROR_NONE) { - ErrPrint("Unable to parse the %s\n", desc_file); - } - - flush_to_file(e, output, w, h); - evas_object_del(edje); - evas_object_del(parent); - destroy_virtual_canvas(e); - -out: - if (ret < 0) { - /* Desc file should be deleted if it fails to create an icon image */ - if (unlink(desc_file) < 0) { - ErrPrint("unlink(%s): %d\n", desc_file, errno); - } - } - - return packet_create_reply(packet, "i", ret); -} - -static inline int client_init(void) -{ - int ret; - struct packet *packet; - static struct method service_table[] = { - { - .cmd = "icon_create", - .handler = icon_create, - }, - { - .cmd = NULL, - .handler = NULL, - }, - }; - - com_core_add_event_callback(CONNECTOR_DISCONNECTED, disconnected_cb, NULL); - - s_info.client_fd = com_core_packet_client_init(s_info.socket_file, 0, service_table); - if (s_info.client_fd < 0) { - ErrPrint("Failed to make a connection to the master\n"); - return -EFAULT; - } - - packet = packet_create_noack("service_register", ""); - if (!packet) { - ErrPrint("Failed to build a packet\n"); - return -EFAULT; - } - - ret = com_core_packet_send_only(s_info.client_fd, packet); - DbgPrint("Service register sent: %d\n", ret); - packet_destroy(packet); - if (ret != 0) { - com_core_packet_client_fini(s_info.client_fd); - s_info.client_fd = -1; - ret = -EFAULT; - } else { - ret = 0; - } - - DbgPrint("Server FD: %d\n", s_info.client_fd); - return ret; -} - -static inline void client_fini(void) -{ - if (s_info.client_fd < 0) { - DbgPrint("Client is not initiated\n"); - return; - } - - com_core_packet_client_fini(s_info.client_fd); - s_info.client_fd = -1; -} - -static void update_font_cb(void *data) -{ - Eina_List *list; - char *text; - - list = edje_text_class_list(); - DbgPrint("List: %p\n", list); - if (list) { - EINA_LIST_FREE(list, text) { - if (!strncasecmp(text, TEXT_CLASS, strlen(TEXT_CLASS))) { - DbgPrint("Update text class %s (%s, %d)\n", text, s_info.font_name, DEFAULT_FONT_SIZE); - edje_text_class_del(text); - edje_text_class_set(text, s_info.font_name, DEFAULT_FONT_SIZE); - } else { - DbgPrint("Skip text class %s\n", text); - } - } - } else { - DbgPrint("New (%s, %d)\n", s_info.font_name, DEFAULT_FONT_SIZE); - edje_text_class_set(TEXT_CLASS, s_info.font_name, DEFAULT_FONT_SIZE); - } -} - -static void font_changed_cb(keynode_t *node, void *user_data) -{ - char *font_name; - - evas_font_reinit(); - - if (s_info.font_name) { - font_name = vconf_get_str("db/setting/accessibility/font_name"); - if (!font_name) { - ErrPrint("Invalid font name (NULL)\n"); - return; - } - - if (!strcmp(s_info.font_name, font_name)) { - DbgPrint("Font is not changed (Old: %s(%p) <> New: %s(%p))\n", s_info.font_name, s_info.font_name, font_name, font_name); - free(font_name); - return; - } - - DbgPrint("Release old font name: %s(%p)\n", s_info.font_name, s_info.font_name); - free(s_info.font_name); - } else { - int ret; - - font_name = NULL; - ret = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_FONT_TYPE, &font_name); - if (ret != SYSTEM_SETTINGS_ERROR_NONE || !font_name) { - ErrPrint("system settings: %d, font_name[%p]\n", ret, font_name); - return; - } - } - - s_info.font_name = font_name; - DbgPrint("Font name is changed to %s(%p)\n", s_info.font_name, s_info.font_name); - - update_font_cb(NULL); -} - -static bool app_create(void *data) -{ - int ret; - - if (client_init() < 0) { - ErrPrint("Unable to initiate the client\n"); - return FALSE; - } - - /*! - * Send a request to reigister as a service. - */ - ret = vconf_notify_key_changed("db/setting/accessibility/font_name", font_changed_cb, NULL); - if (ret < 0) { - DbgPrint("System font is changed: %d\n", ret); - } - - font_changed_cb(NULL, NULL); - return TRUE; -} - -static void app_terminate(void *data) -{ - int ret; - - ret = vconf_ignore_key_changed("db/setting/accessibility/font_name", font_changed_cb); - if (ret < 0) { - DbgPrint("Remove font change callback: %d\n", ret); - } - - client_fini(); - - free(s_info.font_name); - s_info.font_name = NULL; - return; -} - -static void app_pause(void *data) -{ - /* Will not be called */ - return; -} - -static void app_resume(void *data) -{ - /* Will not be called */ - return; -} - -static void app_control(app_control_h service, void *data) -{ -} - -int main(int argc, char *argv[]) -{ - int ret; - ui_app_lifecycle_callback_s event_callback; - - event_callback.create = app_create; - event_callback.terminate = app_terminate; - event_callback.pause = app_pause; - event_callback.resume = app_resume; - event_callback.app_control = app_control; - - ret = ui_app_main(argc, argv, &event_callback, NULL); - return ret; -} - -/* End of a file */ diff --git a/icon_src/script_handler.c b/icon_src/script_handler.c deleted file mode 100644 index b40c058..0000000 --- a/icon_src/script_handler.c +++ /dev/null @@ -1,1436 +0,0 @@ -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "debug.h" -#include "util.h" - -#if defined(LOG_TAG) -#undef LOG_TAG -#define LOG_TAG "ICON_PROVIDER" -#endif - -#define HAPI __attribute__((visibility("hidden"))) -#define TYPE_COLOR "color" -#define TYPE_TEXT "text" -#define TYPE_IMAGE "image" -#define TYPE_EDJE "script" -#define TYPE_SIGNAL "signal" -#define TYPE_INFO "info" -#define TYPE_DRAG "drag" -#define TYPE_ACCESS "access" - -#define INFO_SIZE "size" -#define INFO_CATEGORY "category" -#define ADDEND 256 - -struct block { - char *type; - int type_len; - - char *part; - int part_len; - - char *data; - int data_len; - - char *file; - int file_len; - - char *option; - int option_len; - - char *id; - int id_len; - - char *target_id; - int target_len; -}; - -struct image_option { - int orient; - int aspect; - enum { - FILL_DISABLE, - FILL_IN_SIZE, - FILL_OVER_SIZE, - } fill; - - struct shadow { - int enabled; - int angle; - int offset; - int softness; - int color; - } shadow; - - int width; - int height; -}; - -struct child { - Evas_Object *obj; - char *part; -}; - -struct obj_info { - char *id; - Eina_List *children; -}; - -static struct info { - Eina_List *obj_list; -} s_info = { - .obj_list = NULL, -}; - -static inline Evas_Object *find_edje(const char *id) -{ - Eina_List *l; - Evas_Object *child; - struct obj_info *obj_info; - - EINA_LIST_FOREACH(s_info.obj_list, l, child) { - obj_info = evas_object_data_get(child, "obj_info"); - if (!obj_info || strcmp(obj_info->id, id)) { - continue; - } - - return child; - } - - return NULL; -} - -static inline void delete_block(struct block *block) -{ - DbgFree(block->file); - DbgFree(block->type); - DbgFree(block->part); - DbgFree(block->data); - DbgFree(block->option); - DbgFree(block->id); - DbgFree(block->target_id); - DbgFree(block); -} - -static int update_script_color(Evas_Object *edje, struct block *block) -{ - int r[3], g[3], b[3], a[3]; - int ret; - - if (!block || !block->part || !block->data) { - ErrPrint("Block or part or data is not valid\n"); - return WIDGET_ERROR_INVALID_PARAMETER; - } - - if (block->id) { - edje = find_edje(block->id); - if (!edje) { - ErrPrint("Edje is not exists: %s\n", block->id); - return WIDGET_ERROR_NOT_EXIST; - } - DbgPrint("EDJE[%s] is selected (%p)\n", block->id, edje); - } - - ret = sscanf(block->data, "%d %d %d %d %d %d %d %d %d %d %d %d", - r, g, b, a, /* OBJECT */ - r + 1, g + 1, b + 1, a + 1, /* OUTLINE */ - r + 2, g + 2, b + 2, a + 2); /* SHADOW */ - if (ret != 12) { - DbgPrint("id[%s] part[%s] rgba[%s]\n", block->id, block->part, block->data); - return WIDGET_ERROR_INVALID_PARAMETER; - } - - ret = edje_object_color_class_set(elm_layout_edje_get(edje), block->part, - r[0], g[0], b[0], a[0], /* OBJECT */ - r[1], g[1], b[1], a[1], /* OUTLINE */ - r[2], g[2], b[2], a[2]); /* SHADOW */ - - DbgPrint("color class is %s changed", ret == EINA_TRUE ? "successfully" : "not"); - return WIDGET_ERROR_NONE; -} - -static int update_script_text(Evas_Object *edje, struct block *block) -{ - if (!block || !block->part || !block->data) { - ErrPrint("Block or part or data is not valid\n"); - return WIDGET_ERROR_INVALID_PARAMETER; - } - - if (block->id) { - edje = find_edje(block->id); - if (!edje) { - ErrPrint("Failed to find EDJE\n"); - return WIDGET_ERROR_NOT_EXIST; - } - } - - elm_object_part_text_set(edje, block->part, block->data ? block->data : ""); - - return WIDGET_ERROR_NONE; -} - -static void parse_aspect(struct image_option *img_opt, const char *value, int len) -{ - while (len > 0 && *value == ' ') { - value++; - len--; - } - - if (len < 4) { - return; - } - - img_opt->aspect = !strncasecmp(value, "true", 4); - DbgPrint("Parsed ASPECT: %d (%s)\n", img_opt->aspect, value); -} - -static void parse_orient(struct image_option *img_opt, const char *value, int len) -{ - while (len > 0 && *value == ' ') { - value++; - len--; - } - - if (len < 4) { - return; - } - - img_opt->orient = !strncasecmp(value, "true", 4); - DbgPrint("Parsed ORIENT: %d (%s)\n", img_opt->orient, value); -} - -static void parse_size(struct image_option *img_opt, const char *value, int len) -{ - int width; - int height; - char *buf; - - while (len > 0 && *value == ' ') { - value++; - len--; - } - - buf = strndup(value, len); - if (!buf) { - ErrPrint("strndup: %d\n", errno); - return; - } - - if (sscanf(buf, "%dx%d", &width, &height) == 2) { - img_opt->width = width; - img_opt->height = height; - DbgPrint("Parsed size : %dx%d (%s)\n", width, height, buf); - } else { - DbgPrint("Invalid size tag[%s]\n", buf); - } - - free(buf); -} - -static void parse_shadow(struct image_option *img_opt, const char *value, int len) -{ - int angle; - int offset; - int softness; - int color; - - if (sscanf(value, "%d,%d,%d,%x", &angle, &offset, &softness, &color) != 4) { - ErrPrint("Invalid shadow [%s]\n", value); - } else { - img_opt->shadow.enabled = 1; - img_opt->shadow.angle = angle; - img_opt->shadow.offset = offset; - img_opt->shadow.softness = softness; - img_opt->shadow.color = color; - } -} - -static void parse_fill(struct image_option *img_opt, const char *value, int len) -{ - while (len > 0 && *value == ' ') { - value++; - len--; - } - - if (!strncasecmp(value, "in-size", len)) { - img_opt->fill = FILL_IN_SIZE; - } else if (!strncasecmp(value, "over-size", len)) { - img_opt->fill = FILL_OVER_SIZE; - } else { - img_opt->fill = FILL_DISABLE; - } - - DbgPrint("Parsed FILL: %d (%s)\n", img_opt->fill, value); -} - -static inline void parse_image_option(const char *option, struct image_option *img_opt) -{ - const char *ptr; - const char *cmd; - const char *value; - struct { - const char *cmd; - void (*handler)(struct image_option *img_opt, const char *value, int len); - } cmd_list[] = { - { - .cmd = "aspect", /* Keep the aspect ratio */ - .handler = parse_aspect, - }, - { - .cmd = "orient", /* Keep the orientation value: for the rotated images */ - .handler = parse_orient, - }, - { - .cmd = "fill", /* Fill the image to its container */ - .handler = parse_fill, /* Value: in-size, over-size, disable(default) */ - }, - { - .cmd = "size", - .handler = parse_size, - }, - { - .cmd = "shadow", - .handler = parse_shadow, - }, - }; - enum { - STATE_START, - STATE_TOKEN, - STATE_DATA, - STATE_IGNORE, - STATE_ERROR, - STATE_END, - } state; - int idx; - int tag; - - if (!option || !*option) { - return; - } - - state = STATE_START; - /*! - * \note - * GCC 4.7 warnings uninitialized idx and tag value. - * But it will be initialized by the state machine. :( - * Anyway, I just reset idx and tag for reducing the GCC4.7 complains. - */ - idx = 0; - tag = 0; - cmd = NULL; - value = NULL; - - for (ptr = option; state != STATE_END; ptr++) { - switch (state) { - case STATE_START: - if (*ptr == '\0') { - state = STATE_END; - continue; - } - - if (isalpha(*ptr)) { - state = STATE_TOKEN; - ptr--; - } - tag = 0; - idx = 0; - - cmd = cmd_list[tag].cmd; - break; - case STATE_IGNORE: - if (*ptr == '=') { - state = STATE_DATA; - value = ptr; - } else if (*ptr == '\0') { - state = STATE_END; - } - break; - case STATE_TOKEN: - if (cmd[idx] == '\0' && (*ptr == ' ' || *ptr == '\t' || *ptr == '=')) { - if (*ptr == '=') { - value = ptr; - state = STATE_DATA; - } else { - state = STATE_IGNORE; - } - idx = 0; - } else if (*ptr == '\0') { - state = STATE_END; - } else if (cmd[idx] == *ptr) { - idx++; - } else { - ptr -= (idx + 1); - - tag++; - if (tag == sizeof(cmd_list) / sizeof(cmd_list[0])) { - tag = 0; - state = STATE_ERROR; - } else { - cmd = cmd_list[tag].cmd; - } - idx = 0; - } - break; - case STATE_DATA: - if (*ptr == ';' || *ptr == '\0') { - cmd_list[tag].handler(img_opt, value + 1, idx); - state = *ptr ? STATE_START : STATE_END; - } else { - idx++; - } - break; - case STATE_ERROR: - if (*ptr == ';') { - state = STATE_START; - } else if (*ptr == '\0') { - state = STATE_END; - } - break; - default: - break; - } - } -} - -static int update_script_image(Evas_Object *edje, struct block *block) -{ - Evas_Load_Error err; - Evas_Object *img; - Evas_Coord w, h; - struct obj_info *obj_info; - struct child *child; - struct image_option img_opt = { - .aspect = 0, - .orient = 0, - .fill = FILL_DISABLE, - .width = -1, - .height = -1, - .shadow = { - .enabled = 0, - }, - }; - - if (block->id) { - edje = find_edje(block->id); - if (!edje) { - ErrPrint("No such object: %s\n", block->id); - return WIDGET_ERROR_NOT_EXIST; - } - } - - obj_info = evas_object_data_get(edje, "obj_info"); - if (!obj_info) { - ErrPrint("Object info is not available\n"); - return WIDGET_ERROR_FAULT; - } - - img = elm_object_part_content_unset(edje, block->part); - if (img) { - Eina_List *l; - Eina_List *n; - - EINA_LIST_FOREACH_SAFE(obj_info->children, l, n, child) { - if (child->obj != img) { - continue; - } - - obj_info->children = eina_list_remove(obj_info->children, child); - free(child->part); - free(child); - break; - } - - DbgPrint("delete object %s %p\n", block->part, img); - evas_object_del(img); - } - - if (!block->data || !strlen(block->data) || access(block->data, R_OK) != 0) { - DbgPrint("SKIP - Path: [%s]\n", block->data); - return WIDGET_ERROR_NONE; - } - - child = malloc(sizeof(*child)); - if (!child) { - ErrPrint("malloc: %d\n", errno); - return WIDGET_ERROR_OUT_OF_MEMORY; - } - - child->part = strdup(block->part); - if (!child->part) { - ErrPrint("strdup: %d\n", errno); - free(child); - return WIDGET_ERROR_OUT_OF_MEMORY; - } - - img = evas_object_image_add(evas_object_evas_get(edje)); - if (!img) { - ErrPrint("Failed to add an image object\n"); - free(child->part); - free(child); - return WIDGET_ERROR_FAULT; - } - - evas_object_image_preload(img, EINA_FALSE); - parse_image_option(block->option, &img_opt); - evas_object_image_load_orientation_set(img, img_opt.orient); - - evas_object_image_file_set(img, block->data, NULL); - err = evas_object_image_load_error_get(img); - if (err != EVAS_LOAD_ERROR_NONE) { - ErrPrint("Load error: %s\n", evas_load_error_str(err)); - evas_object_del(img); - free(child->part); - free(child); - return WIDGET_ERROR_IO_ERROR; - } - - evas_object_image_size_get(img, &w, &h); - if (img_opt.aspect) { - if (img_opt.fill == FILL_OVER_SIZE) { - Evas_Coord part_w; - Evas_Coord part_h; - - if (img_opt.width >= 0 && img_opt.height >= 0) { - part_w = img_opt.width * elm_config_scale_get(); - part_h = img_opt.height * elm_config_scale_get(); - } else { - part_w = 0; - part_h = 0; - edje_object_part_geometry_get(elm_layout_edje_get(edje), block->part, NULL, NULL, &part_w, &part_h); - } - DbgPrint("Original %dx%d (part: %dx%d)\n", w, h, part_w, part_h); - - if (part_w > w || part_h > h) { - double fw; - double fh; - - fw = (double)part_w / (double)w; - fh = (double)part_h / (double)h; - - if (fw > fh) { - w = part_w; - h = (double)h * fw; - } else { - h = part_h; - w = (double)w * fh; - } - } - - if (!part_w || !part_h || !w || !h) { - evas_object_del(img); - free(child->part); - free(child); - return WIDGET_ERROR_INVALID_PARAMETER; - } - - if (evas_object_image_region_support_get(img)) { - evas_object_image_load_region_set(img, (w - part_w) / 2, (h - part_h) / 2, part_w, part_h); - evas_object_image_load_size_set(img, part_w, part_h); - evas_object_image_filled_set(img, EINA_TRUE); - DbgPrint("Size: %dx%d (region: %dx%d - %dx%d)\n", w, h, (w - part_w) / 2, (h - part_h) / 2, part_w, part_h); - } else { - Ecore_Evas *ee; - Evas *e; - Evas_Object *src_img; - Evas_Coord rw, rh; - const void *data; - - DbgPrint("Part loading is not supported\n"); - ee = ecore_evas_buffer_new(part_w, part_h); - if (!ee) { - ErrPrint("Failed to create a EE\n"); - evas_object_del(img); - free(child->part); - free(child); - return WIDGET_ERROR_FAULT; - } - - ecore_evas_alpha_set(ee, EINA_TRUE); - - e = ecore_evas_get(ee); - if (!e) { - ErrPrint("Unable to get Evas\n"); - ecore_evas_free(ee); - - evas_object_del(img); - free(child->part); - free(child); - return WIDGET_ERROR_FAULT; - } - - src_img = evas_object_image_filled_add(e); - if (!src_img) { - ErrPrint("Unable to add an image\n"); - ecore_evas_free(ee); - - evas_object_del(img); - free(child->part); - free(child); - return WIDGET_ERROR_FAULT; - } - - evas_object_image_alpha_set(src_img, EINA_TRUE); - evas_object_image_colorspace_set(src_img, EVAS_COLORSPACE_ARGB8888); - evas_object_image_smooth_scale_set(src_img, EINA_TRUE); - evas_object_image_load_orientation_set(src_img, img_opt.orient); - evas_object_image_file_set(src_img, block->data, NULL); - err = evas_object_image_load_error_get(src_img); - if (err != EVAS_LOAD_ERROR_NONE) { - ErrPrint("Load error: %s\n", evas_load_error_str(err)); - evas_object_del(src_img); - ecore_evas_free(ee); - - evas_object_del(img); - free(child->part); - free(child); - return WIDGET_ERROR_IO_ERROR; - } - evas_object_image_size_get(src_img, &rw, &rh); - evas_object_image_fill_set(src_img, 0, 0, rw, rh); - evas_object_resize(src_img, w, h); - evas_object_move(src_img, -(w - part_w) / 2, -(h - part_h) / 2); - evas_object_show(src_img); - - data = ecore_evas_buffer_pixels_get(ee); - if (!data) { - ErrPrint("Unable to get pixels\n"); - evas_object_del(src_img); - ecore_evas_free(ee); - - evas_object_del(img); - free(child->part); - free(child); - return WIDGET_ERROR_IO_ERROR; - } - - e = evas_object_evas_get(img); - evas_object_del(img); - img = evas_object_image_filled_add(e); - if (!img) { - evas_object_del(src_img); - ecore_evas_free(ee); - - free(child->part); - free(child); - return WIDGET_ERROR_OUT_OF_MEMORY; - } - - evas_object_image_colorspace_set(img, EVAS_COLORSPACE_ARGB8888); - evas_object_image_smooth_scale_set(img, EINA_TRUE); - evas_object_image_alpha_set(img, EINA_TRUE); - evas_object_image_data_set(img, NULL); - evas_object_image_size_set(img, part_w, part_h); - evas_object_resize(img, part_w, part_h); - evas_object_image_data_copy_set(img, (void *)data); - evas_object_image_fill_set(img, 0, 0, part_w, part_h); - evas_object_image_data_update_add(img, 0, 0, part_w, part_h); - - evas_object_del(src_img); - ecore_evas_free(ee); - } - } else if (img_opt.fill == FILL_IN_SIZE) { - Evas_Coord part_w; - Evas_Coord part_h; - - if (img_opt.width >= 0 && img_opt.height >= 0) { - part_w = img_opt.width * elm_config_scale_get(); - part_h = img_opt.height * elm_config_scale_get(); - } else { - part_w = 0; - part_h = 0; - edje_object_part_geometry_get(elm_layout_edje_get(edje), block->part, NULL, NULL, &part_w, &part_h); - } - DbgPrint("Original %dx%d (part: %dx%d)\n", w, h, part_w, part_h); - - if (part_w > w || part_h > h) { - double fw; - double fh; - - fw = (double)part_w / (double)w; - fh = (double)part_h / (double)h; - - if (fw > fh) { - w = part_w; - h = (double)h * fw; - } else { - h = part_h; - w = (double)w * fh; - } - } - DbgPrint("Size: %dx%d\n", w, h); - evas_object_image_fill_set(img, 0, 0, part_w, part_h); - evas_object_size_hint_fill_set(img, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_weight_set(img, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - } else { - evas_object_image_fill_set(img, 0, 0, w, h); - evas_object_size_hint_fill_set(img, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_aspect_set(img, EVAS_ASPECT_CONTROL_BOTH, w, h); - } - } else { - if (img_opt.width >= 0 && img_opt.height >= 0) { - w = img_opt.width; - h = img_opt.height; - DbgPrint("Using given image size: %dx%d\n", w, h); - } - - evas_object_image_fill_set(img, 0, 0, w, h); - evas_object_image_filled_set(img, EINA_TRUE); - evas_object_size_hint_fill_set(img, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_weight_set(img, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - } - -#if 0 - img_opt.shadow.enabled = 1; - img_opt.shadow.angle = -90; - img_opt.shadow.offset = 2; - img_opt.shadow.softness = 4; - img_opt.shadow.color = 0x99000000; -#endif - if (img_opt.shadow.enabled) { - ea_effect_h *ea_effect; - - ea_effect = ea_image_effect_create(); - if (ea_effect) { - // -90, 2, 4, 0x99000000 - ea_image_effect_add_outer_shadow(ea_effect, img_opt.shadow.angle, img_opt.shadow.offset, img_opt.shadow.softness, img_opt.shadow.color); - ea_object_image_effect_set(img, ea_effect); - - ea_image_effect_destroy(ea_effect); - } - } - - /*! - * \note - * object will be shown by below statement automatically - */ - DbgPrint("%s part swallow image %p (%dx%d)\n", block->part, img, w, h); - child->obj = img; - elm_object_part_content_set(edje, block->part, img); - obj_info->children = eina_list_append(obj_info->children, child); - - /*! - * \note - * This object is not registered as an access object. - * So the developer should add it to access list manually, using DESC_ACCESS block. - */ - return WIDGET_ERROR_NONE; -} - -static void edje_del_cb(void *_info, Evas *e, Evas_Object *obj, void *event_info) -{ - struct obj_info *obj_info; - struct child *child; - Evas_Object *parent = _info; - Eina_List *l; - Eina_List *n; - - if (parent) { - obj_info = evas_object_data_get(parent, "obj_info"); - if (!obj_info) { - ErrPrint("Invalid parent\n"); - return; - } - - EINA_LIST_FOREACH_SAFE(obj_info->children, l, n, child) { - if (child->obj != obj) { - continue; - } - - obj_info->children = eina_list_remove(obj_info->children, child); - free(child->part); - free(child); - break; - } - - s_info.obj_list = eina_list_remove(s_info.obj_list, obj); - } else { - DbgPrint("Parent object is destroying\n"); - } - - obj_info = evas_object_data_del(obj, "obj_info"); - if (!obj_info) { - ErrPrint("Object info is not valid\n"); - return; - } - - DbgPrint("delete object %s %p\n", obj_info->id, obj); - - EINA_LIST_FREE(obj_info->children, child) { - DbgPrint("delete object %s %p\n", child->part, child->obj); - if (child->obj) { - evas_object_del(child->obj); - } - - free(child->part); - free(child); - } - - free(obj_info->id); - free(obj_info); -} - -static int update_script_script(Evas_Object *edje, struct block *block) -{ - Evas_Object *obj; - struct obj_info *obj_info; - struct child *child; - struct obj_info *new_obj_info; - - DbgPrint("src_id[%s] target_id[%s] part[%s] path[%s] group[%s]\n", block->id, block->target_id, block->part, block->data, block->option); - - if (block->id) { - edje = find_edje(block->id); - if (!edje) { - ErrPrint("Edje is not exists\n"); - return WIDGET_ERROR_NOT_EXIST; - } - } - - obj_info = evas_object_data_get(edje, "obj_info"); - if (!obj_info) { - ErrPrint("Object info is not valid\n"); - return WIDGET_ERROR_INVALID_PARAMETER; - } - - obj = elm_object_part_content_unset(edje, block->part); - if (obj) { - Eina_List *l; - Eina_List *n; - - EINA_LIST_FOREACH_SAFE(obj_info->children, l, n, child) { - if (child->obj != obj) { - continue; - } - - obj_info->children = eina_list_remove(obj_info->children, child); - - free(child->part); - free(child); - break; - } - - DbgPrint("delete object %s %p\n", block->part, obj); - /*! - * \note - * This will call the edje_del_cb. - * It will delete all access objects - */ - evas_object_del(obj); - } - - if (!block->data || !strlen(block->data) || access(block->data, R_OK) != 0) { - DbgPrint("SKIP - Path: [%s]\n", block->data); - return WIDGET_ERROR_NONE; - } - - obj = elm_layout_add(edje); - if (!obj) { - ErrPrint("Failed to add a new edje object\n"); - return WIDGET_ERROR_FAULT; - } - - if (!elm_layout_file_set(obj, block->data, block->option)) { - int err; - - err = edje_object_load_error_get(elm_layout_edje_get(obj)); - if (err != EDJE_LOAD_ERROR_NONE) { - ErrPrint("Could not load %s from %s: %s\n", block->option, block->data, edje_load_error_str(err)); - } - evas_object_del(obj); - return WIDGET_ERROR_IO_ERROR; - } - - evas_object_show(obj); - - new_obj_info = calloc(1, sizeof(*obj_info)); - if (!new_obj_info) { - ErrPrint("Failed to add a obj_info\n"); - evas_object_del(obj); - return WIDGET_ERROR_OUT_OF_MEMORY; - } - - new_obj_info->id = strdup(block->target_id); - if (!new_obj_info->id) { - ErrPrint("Failed to add a obj_info\n"); - free(new_obj_info); - evas_object_del(obj); - return WIDGET_ERROR_OUT_OF_MEMORY; - } - - child = malloc(sizeof(*child)); - if (!child) { - ErrPrint("malloc: %d\n", errno); - free(new_obj_info->id); - free(new_obj_info); - evas_object_del(obj); - return WIDGET_ERROR_OUT_OF_MEMORY; - } - - child->part = strdup(block->part); - if (!child->part) { - ErrPrint("strdup: %d\n", errno); - free(child); - free(new_obj_info->id); - free(new_obj_info); - evas_object_del(obj); - return WIDGET_ERROR_OUT_OF_MEMORY; - } - - child->obj = obj; - - evas_object_data_set(obj, "obj_info", new_obj_info); - evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, edje_del_cb, edje); - s_info.obj_list = eina_list_append(s_info.obj_list, obj); - - DbgPrint("%s part swallow edje %p\n", block->part, obj); - elm_object_part_content_set(edje, block->part, obj); - obj_info->children = eina_list_append(obj_info->children, child); - return WIDGET_ERROR_NONE; -} - -static int update_script_signal(Evas_Object *edje, struct block *block) -{ - ErrPrint("Signal emit function is not supported\n"); - return WIDGET_ERROR_INVALID_PARAMETER; -} - -static int update_script_drag(Evas_Object *edje, struct block *block) -{ - ErrPrint("Signal emit function is not supported\n"); - return WIDGET_ERROR_INVALID_PARAMETER; -} - -static int update_info(Evas_Object *edje, struct block *block) -{ - ErrPrint("Signal emit function is not supported\n"); - return WIDGET_ERROR_INVALID_PARAMETER; -} - -static int update_access(Evas_Object *edje, struct block *block) -{ - ErrPrint("Accessibility is not able to be apply for making a shot\n"); - return WIDGET_ERROR_INVALID_PARAMETER; -} - -static inline void consuming_parsed_block(Evas_Object *edje, int lineno, struct block *block) -{ - /*! - * To speed up, use the static. - * But this will increase the memory slightly. - */ - static struct { - const char *type; - int (*handler)(Evas_Object *edje, struct block *block); - } handlers[] = { - { - .type = TYPE_COLOR, - .handler = update_script_color, - }, - { - .type = TYPE_TEXT, - .handler = update_script_text, - }, - { - .type = TYPE_IMAGE, - .handler = update_script_image, - }, - { - .type = TYPE_EDJE, - .handler = update_script_script, - }, - { - .type = TYPE_SIGNAL, - .handler = update_script_signal, - }, - { - .type = TYPE_DRAG, - .handler = update_script_drag, - }, - { - .type = TYPE_INFO, - .handler = update_info, - }, - { - .type = TYPE_ACCESS, - .handler = update_access, - }, - { - .type = NULL, - .handler = NULL, - }, - }; - - register int i; - - for (i = 0; handlers[i].type; i++) { - if (strcasecmp(handlers[i].type, block->type)) { - continue; - } - - handlers[i].handler(edje, block); - break; - } - - if (!handlers[i].type) { - ErrPrint("%d: Unknown block type: %s\n", lineno, block->type); - } - - delete_block(block); - - return; -} - -HAPI int script_handler_parse_desc(Evas_Object *edje, const char *descfile) -{ - FILE *fp; - int ch; - int lineno; - enum state { - UNKNOWN = 0x10, - BLOCK_OPEN = 0x11, - FIELD = 0x12, - VALUE = 0x13, - BLOCK_CLOSE = 0x14, - - VALUE_TYPE = 0x00, - VALUE_PART = 0x01, - VALUE_DATA = 0x02, - VALUE_FILE = 0x03, - VALUE_OPTION = 0x04, - VALUE_ID = 0x05, - VALUE_TARGET = 0x06, - }; - const char *field_name[] = { - "type", - "part", - "data", - "file", - "option", - "id", - "target", - NULL - }; - enum state state; - register int field_idx; - register int idx = 0; - struct block *block; - struct obj_info *info; - - block = NULL; - - fp = fopen(descfile, "rt"); - if (!fp) { - ErrPrint("fopen: %s [%d]\n", descfile, errno); - return WIDGET_ERROR_IO_ERROR; - } - - /*! - * \note - * After open a descfile, we can delete it. - */ - if (unlink(descfile) < 0) { - ErrPrint("Unable to delete file\n"); - } - - DbgPrint("Parsing %s\n", descfile); - DbgPrint("Building obj_info\n"); - info = malloc(sizeof(*info)); - if (!info) { - ErrPrint("malloc: %d\n", errno); - if (fclose(fp) != 0) { - ErrPrint("fclose: %d\n", errno); - } - return WIDGET_ERROR_OUT_OF_MEMORY; - } - info->id = NULL; - info->children = NULL; - - evas_object_data_set(edje, "obj_info", info); - evas_object_event_callback_add(edje, EVAS_CALLBACK_DEL, edje_del_cb, NULL); - - state = UNKNOWN; - field_idx = 0; - lineno = 1; - - block = NULL; - while (!feof(fp)) { - ch = getc(fp); - if (ch == '\n') { - lineno++; - } - - switch (state) { - case UNKNOWN: - if (ch == '{') { - state = BLOCK_OPEN; - break; - } - - if (!isspace(ch) && ch != EOF) { - ErrPrint("%d: Syntax error: Desc is not started with '{' or space - (%c = 0x%x)\n", lineno, ch, ch); - if (fclose(fp) != 0) { - ErrPrint("fclose: %d\n", errno); - } - return WIDGET_ERROR_INVALID_PARAMETER; - } - break; - - case BLOCK_OPEN: - if (isblank(ch)) { - break; - } - - if (ch != '\n') { - ErrPrint("%d: Syntax error: New line must has to be started right after '{'\n", lineno); - goto errout; - } - - block = calloc(1, sizeof(*block)); - if (!block) { - ErrPrint("calloc: %d\n", errno); - if (fclose(fp) != 0) { - ErrPrint("fclose: %d\n", errno); - } - return WIDGET_ERROR_OUT_OF_MEMORY; - } - - state = FIELD; - idx = 0; - field_idx = 0; - break; - - case FIELD: - if (isspace(ch)) { - break; - } - - if (ch == '}') { - state = BLOCK_CLOSE; - break; - } - - if (ch == '=') { - if (field_name[field_idx][idx] != '\0') { - ErrPrint("%d: Syntax error: Unrecognized field\n", lineno); - goto errout; - } - - switch (field_idx) { - case 0: - state = VALUE_TYPE; - if (block->type) { - DbgFree(block->type); - block->type = NULL; - block->type_len = 0; - } - idx = 0; - break; - case 1: - state = VALUE_PART; - if (block->part) { - DbgFree(block->part); - block->part = NULL; - block->part_len = 0; - } - idx = 0; - break; - case 2: - state = VALUE_DATA; - if (block->data) { - DbgFree(block->data); - block->data = NULL; - block->data_len = 0; - } - idx = 0; - break; - case 3: - state = VALUE_FILE; - if (block->file) { - DbgFree(block->file); - block->file = NULL; - block->file_len = 0; - } - idx = 0; - break; - case 4: - state = VALUE_OPTION; - if (block->option) { - DbgFree(block->option); - block->option = NULL; - block->option_len = 0; - } - idx = 0; - break; - case 5: - state = VALUE_ID; - if (block->id) { - DbgFree(block->id); - block->id = NULL; - block->id_len = 0; - } - idx = 0; - break; - case 6: - state = VALUE_TARGET; - if (block->target_id) { - DbgFree(block->target_id); - block->target_id = NULL; - block->target_len = 0; - } - idx = 0; - break; - default: - ErrPrint("%d: Syntax error: Unrecognized field\n", lineno); - goto errout; - } - - break; - } - - if (ch == '\n') { - goto errout; - } - - if (field_name[field_idx][idx] != ch) { - ungetc(ch, fp); - if (ch == '\n') { - lineno--; - } - - while (--idx >= 0) { - ungetc(field_name[field_idx][idx], fp); - } - - field_idx++; - if (field_name[field_idx] == NULL) { - ErrPrint("%d: Syntax error: Unrecognized field\n", lineno); - goto errout; - } - - idx = 0; - break; - } - - idx++; - break; - - case VALUE_TYPE: - if (idx == block->type_len) { - char *tmp; - block->type_len += ADDEND; - tmp = realloc(block->type, block->type_len); - if (!tmp) { - ErrPrint("realloc: %d\n", errno); - goto errout; - } - block->type = tmp; - } - - if (ch == '\n') { - block->type[idx] = '\0'; - state = FIELD; - idx = 0; - field_idx = 0; - break; - } - - block->type[idx] = ch; - idx++; - break; - - case VALUE_PART: - if (idx == block->part_len) { - char *tmp; - block->part_len += ADDEND; - tmp = realloc(block->part, block->part_len); - if (!tmp) { - ErrPrint("realloc: %d\n", errno); - goto errout; - } - block->part = tmp; - } - - if (ch == '\n') { - block->part[idx] = '\0'; - state = FIELD; - idx = 0; - field_idx = 0; - break; - } - - block->part[idx] = ch; - idx++; - break; - - case VALUE_DATA: - if (idx == block->data_len) { - char *tmp; - block->data_len += ADDEND; - tmp = realloc(block->data, block->data_len); - if (!tmp) { - ErrPrint("realloc: %d\n", errno); - goto errout; - } - block->data = tmp; - } - - if (ch == '\n') { - block->data[idx] = '\0'; - state = FIELD; - idx = 0; - field_idx = 0; - break; - } - - block->data[idx] = ch; - idx++; - break; - - case VALUE_FILE: - if (idx == block->file_len) { - char *tmp; - block->file_len += ADDEND; - tmp = realloc(block->file, block->file_len); - if (!tmp) { - ErrPrint("realloc: %d\n", errno); - goto errout; - } - block->file = tmp; - } - - if (ch == '\n') { - block->file[idx] = '\0'; - state = FIELD; - idx = 0; - field_idx = 0; - break; - } - - block->file[idx] = ch; - idx++; - break; - - case VALUE_OPTION: - if (idx == block->option_len) { - char *tmp; - block->option_len += ADDEND; - tmp = realloc(block->option, block->option_len); - if (!tmp) { - ErrPrint("realloc: %d\n", errno); - goto errout; - } - block->option = tmp; - } - - if (ch == '\n') { - block->option[idx] = '\0'; - state = FIELD; - idx = 0; - field_idx = 0; - break; - } - - block->option[idx] = ch; - idx++; - break; - case VALUE_ID: - if (idx == block->id_len) { - char *tmp; - block->id_len += ADDEND; - tmp = realloc(block->id, block->id_len); - if (!tmp) { - ErrPrint("realloc: %d\n", errno); - goto errout; - } - block->id = tmp; - } - - if (ch == '\n') { - block->id[idx] = '\0'; - state = FIELD; - idx = 0; - field_idx = 0; - break; - } - - block->id[idx] = ch; - idx++; - break; - case VALUE_TARGET: - if (idx == block->target_len) { - char *tmp; - block->target_len += ADDEND; - tmp = realloc(block->target_id, block->target_len); - if (!tmp) { - ErrPrint("realloc: %d\n", errno); - goto errout; - } - block->target_id = tmp; - } - - if (ch == '\n') { - block->target_id[idx] = '\0'; - state = FIELD; - idx = 0; - field_idx = 0; - break; - } - - block->target_id[idx] = ch; - idx++; - break; - case BLOCK_CLOSE: - if (!block->file) { - block->file = strdup(descfile); - if (!block->file) { - ErrPrint("strdup: %d\n", errno); - goto errout; - } - } - - consuming_parsed_block(edje, lineno, block); - block = NULL; - state = UNKNOWN; - break; - - default: - break; - } /* switch */ - } /* while */ - - if (state != UNKNOWN) { - ErrPrint("%d: Unknown state\n", lineno); - goto errout; - } - - if (fclose(fp) != 0) { - ErrPrint("fclose: %d\n", errno); - } - return WIDGET_ERROR_NONE; - -errout: - ErrPrint("Parse error at %d file %s\n", lineno, util_basename(descfile)); - if (block) { - delete_block(block); - } - if (fclose(fp) != 0) { - ErrPrint("fclose: %d\n", errno); - } - return WIDGET_ERROR_INVALID_PARAMETER; -} - -/* End of a file */ diff --git a/include/client.h b/include/client.h deleted file mode 100644 index 5325ef2..0000000 --- a/include/client.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2013 Samsung Electronics Co., Ltd - * - * Licensed under the Flora License, Version 1.1 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://floralicense.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. - */ - -extern int client_init(const char *name, const char *abi, const char *accel, int secured); -extern int client_fini(void); - -/* End of a file */ - - diff --git a/include/conf.h b/include/conf.h deleted file mode 100644 index b5187af..0000000 --- a/include/conf.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2013 Samsung Electronics Co., Ltd - * - * Licensed under the Flora License, Version 1.1 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://floralicense.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 DEFAULT_LIFE_TIMER 20 -#define DEFAULT_LOAD_TIMER 20 -#define MINIMUM_UPDATE_INTERVAL 0.1f - -/** - * @note - * NO_ALARM is used for disabling the alarm code - * This will turn off the alarm for checking the return of widget functions - */ -#define NO_ALARM 1 - -/** - * @note - * This is default action. - * This will enable the alarm for checking the return time of widget functions - * If the function doesn't return before alarm rining, it will be deal as a faulted one - */ -#define USE_ALARM 0 - -#if !defined(LOCALEDIR) -#define LOCALEDIR "/usr/share/locale" -#endif - -#define HAPI __attribute__((visibility("hidden"))) - -/* End of a file */ diff --git a/include/connection.h b/include/connection.h deleted file mode 100644 index 8694b31..0000000 --- a/include/connection.h +++ /dev/null @@ -1,29 +0,0 @@ - -enum connection_event_type { - CONNECTION_EVENT_TYPE_CONNECTED = 0x00, - CONNECTION_EVENT_TYPE_DISCONNECTED = 0x01, - CONNECTION_EVENT_TYPE_UNKNOWN = 0xFF, -}; - -struct connection; - -extern int connection_init(void); -extern int connection_fini(void); - -extern struct connection *connection_create(const char *addr, void *table); - -extern struct connection *connection_find_by_addr(const char *addr); -extern struct connection *connection_find_by_fd(int fd); - -extern int connection_add_event_handler(enum connection_event_type type, int (*event_cb)(int handle, void *data), void *data); -extern void *connection_del_event_handler(enum connection_event_type type, int (*event_cb)(int handle, void *data)); - -extern struct connection *connection_unref(struct connection *handle); -extern struct connection *connection_ref(struct connection *handle); - -extern int connection_handle(struct connection *connection); -extern const char *connection_addr(struct connection *connection); - -#define connection_destroy(handle) connection_unref(handle); - -/* End of a file */ diff --git a/include/critical_log.h b/include/critical_log.h deleted file mode 100644 index dbfe540..0000000 --- a/include/critical_log.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2013 Samsung Electronics Co., Ltd - * - * Licensed under the Flora License, Version 1.1 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://floralicense.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. - */ - -extern int critical_log(const char *func, int line, const char *fmt, ...); -extern int critical_log_init(const char *tag); -extern int critical_log_fini(void); - -#define CRITICAL_LOG(format, args...) critical_log(__func__, __LINE__, format, args) - -/* End of a file */ diff --git a/include/debug.h b/include/debug.h deleted file mode 100644 index 03c08d6..0000000 --- a/include/debug.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2013 Samsung Electronics Co., Ltd - * - * Licensed under the Flora License, Version 1.1 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://floralicense.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 DbgPrint(format, arg...) SECURE_LOGD(format, ##arg) - -#define ErrPrint(format, arg...) SECURE_LOGE(format, ##arg) - -#define WarnPrint(format, arg...) SECURE_LOGW(format, ##arg) - -#define DbgFree(a) do { \ - free(a); \ -} while (0) - -/* End of a file */ diff --git a/include/fault.h b/include/fault.h deleted file mode 100644 index e0398c2..0000000 --- a/include/fault.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2013 Samsung Electronics Co., Ltd - * - * Licensed under the Flora License, Version 1.1 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://floralicense.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. - */ - -extern int fault_init(char **argv); -extern int fault_fini(void); -extern int fault_mark_call(const char *pkgname, const char *filename, const char *funcname, int noalarm, int life_time); -extern int fault_unmark_call(const char *pkgname, const char *filename, const char *funcname, int noalarm); -extern void fault_disable_call_option(void); - -/* End of a file */ diff --git a/include/main.h b/include/main.h deleted file mode 100644 index c2ba761..0000000 --- a/include/main.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2013 Samsung Electronics Co., Ltd - * - * Licensed under the Flora License, Version 1.1 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://floralicense.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. - */ - -extern int main_heap_monitor_is_enabled(void); -extern size_t main_heap_monitor_target_usage(const char *name); -extern int main_heap_monitor_add_target(const char *name); -extern int main_heap_monitor_del_target(const char *name); - -/* End of a file */ diff --git a/include/so_handler.h b/include/so_handler.h deleted file mode 100644 index d546832..0000000 --- a/include/so_handler.h +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright 2013 Samsung Electronics Co., Ltd - * - * Licensed under the Flora License, Version 1.1 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://floralicense.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. - */ - -typedef int (*create_t)(const char *filename, const char *content, const char *cluster, const char *category); -typedef int (*destroy_t)(const char *filename); -typedef int (*is_updated_t)(const char *filename); -typedef int (*need_to_destroy_t)(const char *filename); -typedef int (*update_content_t)(const char *filename); -typedef int (*clicked_t)(const char *filename, const char *event, double timestamp, double x, double y); -typedef int (*text_signal_t)(const char *filename, const char *signal_name, const char *source, widget_event_info_s event_info); -typedef int (*resize_t)(const char *filename, int type); -typedef int (*create_needed_t)(const char *cluster, const char *category); -typedef int (*change_group_t)(const char *filename, const char *cluster, const char *category); -typedef int (*get_output_info_t)(const char *filename, int *w, int *h, double *priority, char **content, char **title); -typedef int (*initialize_t)(const char *pkgname); -typedef int (*finalize_t)(void); -typedef char *(*pinup_t)(const char *filename, int pinup); -typedef int (*is_pinned_up_t)(const char *filename); -typedef int (*system_event_t)(const char *filename, int type); -typedef int (*get_alt_info_t)(const char *filename, char **icon, char **name); -typedef int (*set_content_info_t)(const char *filename, const char *content_info); - -typedef int (*adaptor_create_t)(const char *pkgname, const char *filename, const char *content, const char *cluster, const char *category); -typedef int (*adaptor_destroy_t)(const char *pkgname, const char *filename); -typedef int (*adaptor_is_updated_t)(const char *pkgname, const char *filename); -typedef int (*adaptor_need_to_destroy_t)(const char *pkgname, const char *filename); -typedef int (*adaptor_update_content_t)(const char *pkgname, const char *filename); -typedef int (*adaptor_clicked_t)(const char *pkgname, const char *filename, const char *event, double timestamp, double x, double y); -typedef int (*adaptor_text_signal_t)(const char *pkgname, const char *filename, const char *signal_name, const char *source, widget_event_info_s event_info); -typedef int (*adaptor_resize_t)(const char *pkgname, const char *filename, int type); -typedef int (*adaptor_create_needed_t)(const char *pkgname, const char *cluster, const char *category); -typedef int (*adaptor_change_group_t)(const char *pkgname, const char *filename, const char *cluster, const char *category); -typedef int (*adaptor_get_output_info_t)(const char *pkgname, const char *filename, int *w, int *h, double *priority, char **content, char **title); -typedef int (*adaptor_initialize_t)(const char *pkgname); -typedef int (*adaptor_finalize_t)(const char *pkgname); -typedef char *(*adaptor_pinup_t)(const char *pkgname, const char *filename, int pinup); -typedef int (*adaptor_is_pinned_up_t)(const char *pkgname, const char *filename); -typedef int (*adaptor_system_event_t)(const char *pkgname, const char *filename, int type); -typedef int (*adaptor_get_alt_info_t)(const char *pkgname, const char *filename, char **icon, char **name); -typedef int (*adaptor_set_content_info_t)(const char *pkgname, const char *filename, const char *content_info); - -struct instance { - struct so_item *item; - char *id; - char *content; - char *title; - char *icon; // alternative icon - char *name; // alternative name - int w; - int h; - double priority; - char *cluster; - char *category; - int orientation; -}; - -struct so_item { - char *so_fname; - char *pkgname; - void *handle; - int timeout; - int has_widget_script; - - Eina_List *inst_list; - - struct { - initialize_t initialize; - finalize_t finalize; - create_t create; - destroy_t destroy; - is_updated_t is_updated; - update_content_t update_content; - clicked_t clicked; - text_signal_t text_signal; - resize_t resize; - create_needed_t create_needed; - change_group_t change_group; - get_output_info_t get_output_info; - need_to_destroy_t need_to_destroy; - pinup_t pinup; - is_pinned_up_t is_pinned_up; - system_event_t sys_event; - get_alt_info_t get_alt_info; - set_content_info_t set_content_info; - } widget; - - struct { - adaptor_initialize_t initialize; - adaptor_finalize_t finalize; - adaptor_create_t create; - adaptor_destroy_t destroy; - adaptor_is_updated_t is_updated; - adaptor_update_content_t update_content; - adaptor_clicked_t clicked; - adaptor_text_signal_t text_signal; - adaptor_resize_t resize; - adaptor_create_needed_t create_needed; - adaptor_change_group_t change_group; - adaptor_get_output_info_t get_output_info; - adaptor_need_to_destroy_t need_to_destroy; - adaptor_pinup_t pinup; - adaptor_is_pinned_up_t is_pinned_up; - adaptor_system_event_t sys_event; - adaptor_get_alt_info_t get_alt_info; - adaptor_set_content_info_t set_content_info; - } adaptor; -}; - -enum current_operations { - WIDGET_OP_UNKNOWN, - WIDGET_OP_CREATE, - WIDGET_OP_RESIZE, - WIDGET_OP_CONTENT_EVENT, - WIDGET_OP_NEED_TO_UPDATE, - WIDGET_OP_NEED_TO_DESTROY, - WIDGET_OP_NEED_TO_CREATE, - WIDGET_OP_CHANGE_GROUP, - WIDGET_OP_GET_INFO, - WIDGET_OP_UPDATE_CONTENT, - WIDGET_OP_CLICKED, - WIDGET_OP_SYSTEM_EVENT, - WIDGET_OP_PINUP, - WIDGET_OP_IS_PINNED_UP, - WIDGET_OP_DESTROY, - WIDGET_OP_GET_ALT_INFO, - WIDGET_OP_SET_CONTENT_INFO -}; - -extern struct instance *so_find_instance(const char *pkgname, const char *filename); -extern int so_create(const char *pkgname, const char *filename, const char *content_info, int timeout, int has_widget_script, const char *cluster, const char *category, const char *abi, struct instance **inst); -extern int so_is_updated(struct instance *inst); -extern int so_need_to_destroy(struct instance *inst); -extern int so_update(struct instance *inst); -extern int so_destroy(struct instance *inst, int unload); -extern int so_clicked(struct instance *inst, const char *event, double timestamp, double x, double y); -extern int so_script_event(struct instance *inst, const char *signal_name, const char *source, widget_event_info_s event_info); -extern int so_resize(struct instance *inst, int w, int h); -extern int so_create_needed(const char *pkgname, const char *cluster, const char *category, const char *abi); -extern int so_change_group(struct instance *inst, const char *cluster, const char *category); -extern int so_get_output_info(struct instance *inst, int *w, int *h, double *priority, char **content, char **title); -extern char *so_pinup(struct instance *inst, int pinup); -extern int so_is_pinned_up(struct instance *inst); -extern int so_sys_event(struct instance *inst, int event); -extern int so_get_alt_info(struct instance *inst, char **icon, char **name); -extern int so_set_content_info(struct instance *inst, const char *content_info); - -extern enum current_operations so_current_op(void); - -/* End of a file */ diff --git a/include/theme_loader.h b/include/theme_loader.h deleted file mode 100644 index c701b05..0000000 --- a/include/theme_loader.h +++ /dev/null @@ -1,2 +0,0 @@ -extern int theme_loader_load(const char *path); -extern void theme_loader_unload(void); diff --git a/include/update_monitor.h b/include/update_monitor.h deleted file mode 100644 index bd2b55c..0000000 --- a/include/update_monitor.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2013 Samsung Electronics Co., Ltd - * - * Licensed under the Flora License, Version 1.1 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://floralicense.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. - */ - -extern int update_monitor_init(void); -extern int update_monitor_fini(void); - -extern int update_monitor_add_update_cb(const char *filename, int (*cb)(const char *filename, void *data, int over), void *data); -extern int update_monitor_add_delete_cb(const char *filename, int (*cb)(const char *filename, void *data, int over), void *data); -extern void *update_monitor_del_update_cb(const char *filename, int (*cb)(const char *filename, void *data, int over)); -extern void *update_monitor_del_delete_cb(const char *filename, int (*cb)(const char *filename, void *data, int over)); -extern int update_monitor_trigger_update_cb(const char *filename, int over); -extern int update_monitor_trigger_delete_cb(const char *filename, int over); - -// End of a file diff --git a/include/util.h b/include/util.h deleted file mode 100644 index 0efaeb1..0000000 --- a/include/util.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2013 Samsung Electronics Co., Ltd - * - * Licensed under the Flora License, Version 1.1 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://floralicense.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. - */ - -extern int util_check_ext(const char *icon, const char *ext); -extern double util_timestamp(void); -extern const char *util_basename(const char *name); -extern char *util_get_current_module(char **symbol); -extern const char *util_uri_to_path(const char *uri); -extern void *util_timer_add(double interval, Eina_Bool (*cb)(void *data), void *data); -extern void util_timer_interval_set(void *timer, double interval); -extern int util_get_filesize(const char *filename); -extern double util_time_delay_for_compensation(double period); -extern void util_dump_current_so_info(const char *path); - -extern void *util_screen_get(void); -extern int util_screen_size_get(int *width, int *height); -extern int util_screen_init(void); -extern int util_screen_fini(void); - -#define SCHEMA_FILE "file://" -#define SCHEMA_PIXMAP "pixmap://" -#define SCHEMA_SHM "shm://" - -/* End of a file */ diff --git a/include/widget.h b/include/widget.h deleted file mode 100644 index e275bf3..0000000 --- a/include/widget.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2013 Samsung Electronics Co., Ltd - * - * Licensed under the Flora License, Version 1.1 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://floralicense.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. - */ - -extern void widget_viewer_init(void); -extern void widget_viewer_fini(void); - -struct widget_create_arg { - double period; - int timeout; - int has_widget_script; - int skip_need_to_create; - const char *content; - const char *cluster; - const char *category; - const char *abi; - const char *direct_addr; -}; - -extern int widget_create(const char *pkgname, const char *id, struct widget_create_arg *arg, int *w, int *h, double *priority, char **content, char **title); -extern int widget_destroy(const char *pkgname, const char *id, int type); - -extern int widget_viewer_resize_widget(const char *pkgname, const char *id, int w, int h); -extern int widget_clicked(const char *pkgname, const char *id, const char *event, double timestamp, double x, double y); -extern int widget_set_content_info(const char *pkgname, const char *id, const char *content_info); -extern int widget_set_content_info_all(const char *pkgname, const char *content); - -extern int widget_script_event(const char *pkgname, const char *id, const char *signal_name, const char *source, widget_event_info_s event_info); -extern int widget_change_group(const char *pkgname, const char *id, const char *cluster, const char *category); - -extern int widget_update(const char *pkgname, const char *id, int force); -extern int widget_update_all(const char *pkgname, const char *cluster, const char *category, int force); -extern void widget_pause_all(void); -extern void widget_resume_all(void); -extern int widget_viewer_set_period(const char *pkgname, const char *id, double period); -extern char *widget_pinup(const char *pkgname, const char *id, int pinup); -extern int widget_system_event(const char *pkgname, const char *id, int event); -extern int widget_system_event_all(int event); - -extern int widget_open_gbar(const char *pkgname, const char *id); -extern int widget_close_gbar(const char *pkgname, const char *id); - -extern int widget_pause(const char *pkgname, const char *id); -extern int widget_resume(const char *pkgname, const char *id); - -extern int widget_viewer_is_pinned_up(const char *pkgname, const char *id); - -extern void widget_turn_secured_on(void); -extern int widget_is_secured(void); - -extern int widget_is_all_paused(void); -extern int widget_delete_all_deleteme(void); -extern int widget_delete_all(void); - -extern int widget_viewer_connected(const char *pkgname, const char *id, const char *direct_addr); -extern int widget_viewer_disconnected(const char *pkgname, const char *id, const char *direct_addr); - -extern int widget_set_orientation(const char *pkgname, const char *id, int orientation); - -/** - * @brief - * Exported API for each widgets - */ -extern const char *widget_find_pkgname(const char *filename); -extern int widget_request_update_by_id(const char *filename); -extern int widget_trigger_update_monitor(const char *id, int is_gbar); -extern int widget_update_extra_info(const char *id, const char *content, const char *title, const char *icon, const char *name); -extern int widget_send_updated(const char *pkgname, const char *id, int idx, int x, int y, int w, int h, int gbar, const char *descfile); -extern int widget_send_buffer_updated(const char *pkgname, const char *id, widget_buffer_h handle, int idx, int x, int y, int w, int h, int gbar, const char *descfile); -extern int widget_orientation(const char *filename); - -/* End of a file */ diff --git a/org.tizen.data-provider-slave.efl b/org.tizen.data-provider-slave.efl deleted file mode 100644 index 11612f1..0000000 --- a/org.tizen.data-provider-slave.efl +++ /dev/null @@ -1,44 +0,0 @@ -org.tizen.data-provider-slave system::homedir rwxat- ------ -org.tizen.data-provider-slave system::vconf rwxat- ------ -org.tizen.data-provider-slave system::media rwxat- ------ -org.tizen.data-provider-slave system::share rwxat- ------ -org.tizen.data-provider-slave pulseaudio rwxat- ------ -e17 org.tizen.data-provider-slave -w---- ------ -org.tizen.data-provider-slave device::app_logging -w---- ------ -org.tizen.data-provider-slave sys-assert::core rwxat- ------ -stest-service org.tizen.data-provider-slave r-x--- ------ -org.tizen.data-provider-slave stest-service -w---- ------ -org.tizen.data-provider-slave privacy-manager::db r----l ------ -org.tizen.data-provider-slave pkgmgr::db r----l ------ -org.tizen.data-provider-slave system::vconf_inhouse rw---- ------ -org.tizen.data-provider-slave system::vconf_setting rw---- ------ -org.tizen.data-provider-slave system::vconf_privacy rw---- ------ -org.tizen.data-provider-slave system::vconf_system rw---- ------ -org.tizen.data-provider-slave system::vconf_multimedia rw---- ------ -org.tizen.data-provider-slave system::vconf_network rw---- ------ -org.tizen.data-provider-slave system::vconf_misc rw---- ------ -org.tizen.data-provider-slave ecore::lock rwxat- ------ -org.tizen.data-provider-slave system::use_internet rw---- ------ -org.tizen.data-provider-slave ail::db rw---- ------ -org.tizen.data-provider-slave app-svc::db rw---- ------ -org.tizen.data-provider-slave xorg rw---- ------ -org.tizen.data-provider-slave isf rwx--- ------ -org.tizen.data-provider-slave dbus -wx--- ------ -org.tizen.data-provider-slave data-provider-master::data r-x--- ------ -org.tizen.data-provider-slave data-provider-master::share rwxat- ------ -org.tizen.data-provider-slave data-provider-master::db r----l ------ -org.tizen.data-provider-slave data-provider-master::provider rw---- ------ -org.tizen.data-provider-slave data-provider-master::utility rw---- ------ -org.tizen.data-provider-slave e17 r-x--- ------ -org.tizen.data-provider-slave dali --x--- ------ -org.tizen.app-tray org.tizen.data-provider-slave r-x--- ------ -dbus org.tizen.data-provider-slave rwx--- ------ -org.tizen.data-provider-slave sound_server rw---- ------ -org.tizen.data-provider-slave tts-server rwx--- ------ -org.tizen.data-provider-slave aul::launch --x--- ------ -org.tizen.data-provider-slave security-server::api-cookie-check -w---- ------ -org.tizen.data-provider-slave ug-setting-call-efl::vconf r----- ------ -org.tizen.data-provider-slave deviced::haptic rw---- ------ -org.tizen.data-provider-slave device::input r----- ------ -org.tizen.data-provider-slave privacy-manager::read r----- ------ -system::use_internet org.tizen.data-provider-slave rw---- ------ diff --git a/org.tizen.data-provider-slave.xml b/org.tizen.data-provider-slave.xml deleted file mode 100644 index abce9e4..0000000 --- a/org.tizen.data-provider-slave.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - Sung-jae Park - Youngjoo Park - widget Provider (slave) - - - org.tizen.data-provider-slave.png - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - http://tizen.org/privilege/location - http://developer.samsung.com/tizen/privilege/privacymanager.read - - - - org.tizen.icon-provider-slave.png - - - - diff --git a/packaging/org.tizen.data-provider-slave.manifest b/packaging/org.tizen.data-provider-slave.manifest deleted file mode 100644 index f00a47c..0000000 --- a/packaging/org.tizen.data-provider-slave.manifest +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packaging/org.tizen.data-provider-slave.spec b/packaging/org.tizen.data-provider-slave.spec deleted file mode 100755 index 05a20a3..0000000 --- a/packaging/org.tizen.data-provider-slave.spec +++ /dev/null @@ -1,109 +0,0 @@ -%bcond_with wayland -%define app_data /opt/usr/apps/org.tizen.data-provider-slave/data - -Name: org.tizen.data-provider-slave -Summary: Plugin type widget service provider -Version: 1.0.0 -Release: 1 -Group: HomeTF/Livebox -License: Flora -Source0: %{name}-%{version}.tar.gz -Source1001: %{name}.manifest -BuildRequires: cmake, gettext-tools, coreutils, edje-bin -BuildRequires: pkgconfig(appcore-efl) -BuildRequires: pkgconfig(ail) -BuildRequires: pkgconfig(dlog) -BuildRequires: pkgconfig(aul) -BuildRequires: pkgconfig(vconf) -BuildRequires: pkgconfig(sqlite3) -BuildRequires: pkgconfig(db-util) -BuildRequires: pkgconfig(glib-2.0) -BuildRequires: pkgconfig(gio-2.0) -BuildRequires: pkgconfig(bundle) -BuildRequires: pkgconfig(widget_provider) -BuildRequires: pkgconfig(widget_service) -BuildRequires: pkgconfig(capi-appfw-application) -BuildRequires: pkgconfig(capi-appfw-app-manager) -BuildRequires: pkgconfig(ecore) -BuildRequires: pkgconfig(edje) -BuildRequires: pkgconfig(evas) -BuildRequires: pkgconfig(widget) -BuildRequires: pkgconfig(elementary) -BuildRequires: pkgconfig(com-core) -BuildRequires: pkgconfig(shortcut) -BuildRequires: pkgconfig(efl-assist) -BuildRequires: pkgconfig(json-glib-1.0) -%if %{with wayland} -BuildRequires: pkgconfig(ecore-wayland) -%else -BuildRequires: pkgconfig(ecore-x) -%endif -#BuildRequires: hash-signer -BuildRequires: pkgconfig(capi-system-system-settings) -BuildRequires: model-build-features -#Requires(post): signing-client - -%if "%{model_build_feature_widget}" == "0" -ExclusiveArch: -%endif - -%description -Plugin type widgetes are managed by this. -Supporting the EFL. -Supporting the In-house widget only. - -%prep -%setup -q -cp %{SOURCE1001} . - -%build -%if 0%{?sec_build_binary_debug_enable} -export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE" -export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE" -export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE" -%endif - -%if 0%{?tizen_build_binary_release_type_eng} -export CFLAGS="${CFLAGS} -DTIZEN_ENGINEER_MODE" -export CXXFLAGS="${CXXFLAGS} -DTIZEN_ENGINEER_MODE" -export FFLAGS="${FFLAGS} -DTIZEN_ENGINEER_MODE" -%endif - -%if %{with wayland} -export WAYLAND_SUPPORT=On -export X11_SUPPORT=Off -%else -export WAYLAND_SUPPORT=Off -export X11_SUPPORT=On -%endif - -%cmake . -DWAYLAND_SUPPORT=${WAYLAND_SUPPORT} -DX11_SUPPORT=${X11_SUPPORT} -make %{?jobs:-j%jobs} - -%install -rm -rf %{buildroot} -%make_install -%define tizen_sign 1 -%define tizen_sign_base %{_prefix}/apps/%{name} -%define tizen_sign_level platform -%define tizen_author_sign 1 -%define tizen_dist_sign 1 -mkdir -p %{buildroot}/%{_datarootdir}/license -mkdir -p %{buildroot}%{app_data} - -%post -#/usr/bin/signing-client/hash-signer-client.sh -a -d -p platform %{_prefix}/apps/%{name} -chown 5000:5000 %{app_data} -chmod 755 %{app_data} - -%files -n org.tizen.data-provider-slave -%manifest %{name}.manifest -%defattr(-,root,root,-) -%{_prefix}/apps/%{name} -%{_datarootdir}/packages/%{name}.xml -%{_datarootdir}/license/* -%{_sysconfdir}/smack/accesses.d/%{name}.efl -/opt/usr/share/data-provider-slave/* -%dir %{app_data} - -# End of a file diff --git a/res/CMakeLists.txt b/res/CMakeLists.txt deleted file mode 100644 index 232d495..0000000 --- a/res/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/org.tizen.data-provider-slave_ChangeableColorInfo.xml DESTINATION ${THEME_DIR}/color) diff --git a/res/org.tizen.data-provider-slave_ChangeableColorInfo.xml b/res/org.tizen.data-provider-slave_ChangeableColorInfo.xml deleted file mode 100644 index 02c41e4..0000000 --- a/res/org.tizen.data-provider-slave_ChangeableColorInfo.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/client.c b/src/client.c deleted file mode 100644 index e36c9dd..0000000 --- a/src/client.c +++ /dev/null @@ -1,555 +0,0 @@ -/* - * Copyright 2013 Samsung Electronics Co., Ltd - * - * Licensed under the Flora License, Version 1.1 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://floralicense.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 -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include - -#include /* widget_provider */ -#include /* widget_service */ -#include /* widget_service - widget_event_info */ -#include -#include /* widget - WIDGET_SYS_EVENT_XXX */ -#include /* widget - WIDGET_SYS_EVENT_XXX */ - -#include "critical_log.h" -#include "debug.h" -#include "client.h" -#include "so_handler.h" -#include "widget.h" -#include "util.h" -#include "conf.h" - -struct pre_callback_item { - widget_pre_callback_t cb; - void *data; -}; - -static struct info { - Ecore_Timer *ping_timer; - Eina_List *widget_pre_callback_list[WIDGET_PRE_CALLBACK_COUNT]; -} s_info = { - .ping_timer = NULL, - .widget_pre_callback_list = { NULL, }, -}; - -static void invoke_pre_callback(widget_pre_callback_e type, const char *id) -{ - Eina_List *l; - Eina_List *n; - struct pre_callback_item *item; - - EINA_LIST_FOREACH_SAFE(s_info.widget_pre_callback_list[type], l, n, item) { - item->cb(id, item->data); - } -} - -int widget_provider_app_add_pre_callback(widget_pre_callback_e type, widget_pre_callback_t cb, void *data) -{ - struct pre_callback_item *item; - Eina_List *l; - - if (!cb || type == WIDGET_PRE_CALLBACK_COUNT) { - return WIDGET_ERROR_INVALID_PARAMETER; - } - - EINA_LIST_FOREACH(s_info.widget_pre_callback_list[type], l, item) { - if (item->cb == cb && item->data == data) { - return WIDGET_ERROR_ALREADY_EXIST; - } - } - - item = malloc(sizeof(*item)); - if (!item) { - ErrPrint("malloc: %d\n", errno); - return WIDGET_ERROR_OUT_OF_MEMORY; - } - - item->cb = cb; - item->data = data; - - s_info.widget_pre_callback_list[type] = eina_list_append(s_info.widget_pre_callback_list[type], item); - return 0; -} - -int widget_provider_app_del_pre_callback(widget_pre_callback_e type, widget_pre_callback_t cb, void *data) -{ - Eina_List *l; - Eina_List *n; - struct pre_callback_item *item; - - if (!cb || type == WIDGET_PRE_CALLBACK_COUNT) { - ErrPrint("Invalid parameter\n"); - return WIDGET_ERROR_INVALID_PARAMETER; - } - - EINA_LIST_FOREACH_SAFE(s_info.widget_pre_callback_list[type], l, n, item) { - if (item->cb == cb && item->data == data) { - s_info.widget_pre_callback_list[type] = eina_list_remove_list(s_info.widget_pre_callback_list[type], l); - free(item); - return WIDGET_ERROR_NONE; - } - } - - return WIDGET_ERROR_NOT_EXIST; -} - -static int method_new(struct widget_event_arg *arg, int *width, int *height, double *priority, void *data) -{ - int ret; - struct widget_create_arg _arg; - DbgPrint("Create: pkgname[%s], id[%s], content[%s], timeout[%d], has_script[%d], period[%lf], cluster[%s], category[%s], skip[%d], abi[%s], size: %dx%d\n", - arg->pkgname, - arg->id, - arg->info.widget_create.content, - arg->info.widget_create.timeout, - arg->info.widget_create.has_script, - arg->info.widget_create.period, - arg->info.widget_create.cluster, arg->info.widget_create.category, - arg->info.widget_create.skip_need_to_create, - arg->info.widget_create.abi, - arg->info.widget_create.width, - arg->info.widget_create.height); - - if (!arg->info.widget_create.content || !strlen(arg->info.widget_create.content)) { - DbgPrint("Use default content: \"%s\"\n", WIDGET_CONF_DEFAULT_CONTENT); - arg->info.widget_create.content = WIDGET_CONF_DEFAULT_CONTENT; - } - - _arg.content = arg->info.widget_create.content; - _arg.timeout = arg->info.widget_create.timeout; - _arg.has_widget_script = arg->info.widget_create.has_script; - _arg.period = arg->info.widget_create.period; - _arg.cluster = arg->info.widget_create.cluster; - _arg.category = arg->info.widget_create.category; - _arg.abi = arg->info.widget_create.abi; - _arg.skip_need_to_create = arg->info.widget_create.skip_need_to_create; - _arg.direct_addr = arg->info.widget_create.direct_addr; - - invoke_pre_callback(WIDGET_PRE_CREATE_CALLBACK, arg->id); - - ret = widget_create(arg->pkgname, arg->id, - &_arg, - width, height, priority, - &arg->info.widget_create.out_content, - &arg->info.widget_create.out_title); - - if (ret == 0) { - if (arg->info.widget_create.width > 0 && arg->info.widget_create.height > 0) { - DbgPrint("Create size: %dx%d (created: %dx%d)\n", arg->info.widget_create.width, arg->info.widget_create.height, *width, *height); - if (*width != arg->info.widget_create.width || *height != arg->info.widget_create.height) { - int tmp; - tmp = widget_viewer_resize_widget(arg->pkgname, arg->id, arg->info.widget_create.width, arg->info.widget_create.height); - DbgPrint("widget_resize returns: %d\n", tmp); - if (tmp == (int)WIDGET_ERROR_NONE) { - /*! - * \note - * Just returns resized canvas size. - * Even if it is not ready to render contents. - * Provider will allocate render buffer using this size. - */ - *width = arg->info.widget_create.width; - *height = arg->info.widget_create.height; - } - } - } - - arg->info.widget_create.out_is_pinned_up = (widget_viewer_is_pinned_up(arg->pkgname, arg->id) == 1); - } else { - ErrPrint("widget_create returns %d\n", ret); - } - - if (widget_is_all_paused()) { - DbgPrint("Box is paused\n"); - (void)widget_system_event(arg->pkgname, arg->id, WIDGET_SYS_EVENT_PAUSED); - } - - return ret; -} - -static int method_renew(struct widget_event_arg *arg, void *data) -{ - int ret; - int w; - int h; - double priority; - struct widget_create_arg _arg; - - DbgPrint("Re-create: pkgname[%s], id[%s], content[%s], timeout[%d], has_script[%d], period[%lf], cluster[%s], category[%s], abi[%s]\n", - arg->pkgname, arg->id, - arg->info.widget_recreate.content, - arg->info.widget_recreate.timeout, - arg->info.widget_recreate.has_script, - arg->info.widget_recreate.period, - arg->info.widget_recreate.cluster, - arg->info.widget_recreate.category, - arg->info.widget_recreate.abi); - - if (!arg->info.widget_recreate.content || !strlen(arg->info.widget_recreate.content)) { - DbgPrint("Use default content: \"%s\"\n", WIDGET_CONF_DEFAULT_CONTENT); - arg->info.widget_recreate.content = WIDGET_CONF_DEFAULT_CONTENT; - } - - _arg.content = arg->info.widget_recreate.content; - _arg.timeout = arg->info.widget_recreate.timeout; - _arg.has_widget_script = arg->info.widget_recreate.has_script; - _arg.period = arg->info.widget_recreate.period; - _arg.cluster = arg->info.widget_recreate.cluster; - _arg.category = arg->info.widget_recreate.category; - _arg.abi = arg->info.widget_recreate.abi; - _arg.skip_need_to_create = 1; - _arg.direct_addr = arg->info.widget_recreate.direct_addr; - - invoke_pre_callback(WIDGET_PRE_CREATE_CALLBACK, arg->id); - - ret = widget_create(arg->pkgname, arg->id, - &_arg, - &w, &h, &priority, - &arg->info.widget_recreate.out_content, - &arg->info.widget_recreate.out_title); - if (ret == 0) { - if (w != arg->info.widget_recreate.width || h != arg->info.widget_recreate.height) { - int tmp; - tmp = widget_viewer_resize_widget(arg->pkgname, arg->id, arg->info.widget_recreate.width, arg->info.widget_recreate.height); - if (tmp < 0) { - DbgPrint("Resize[%dx%d] returns: %d\n", arg->info.widget_recreate.width, arg->info.widget_recreate.height, tmp); - } - } else { - DbgPrint("No need to change the size: %dx%d\n", w, h); - } - - arg->info.widget_recreate.out_is_pinned_up = (widget_viewer_is_pinned_up(arg->pkgname, arg->id) == 1); - } else { - ErrPrint("widget_create returns %d\n", ret); - } - - if (widget_is_all_paused()) { - DbgPrint("Box is paused\n"); - (void)widget_system_event(arg->pkgname, arg->id, WIDGET_SYS_EVENT_PAUSED); - } - - return ret; -} - -static int method_delete(struct widget_event_arg *arg, void *data) -{ - int ret; - - DbgPrint("pkgname[%s] id[%s]\n", arg->pkgname, arg->id); - - if (arg->info.widget_destroy.type == WIDGET_DESTROY_TYPE_DEFAULT || arg->info.widget_destroy.type == WIDGET_DESTROY_TYPE_UNINSTALL) { - DbgPrint("Box is deleted from the viewer\n"); - (void)widget_system_event(arg->pkgname, arg->id, WIDGET_SYS_EVENT_DELETED); - } - - invoke_pre_callback(WIDGET_PRE_DESTROY_CALLBACK, arg->id); - ret = widget_destroy(arg->pkgname, arg->id, 0); - return ret; -} - -static int method_content_event(struct widget_event_arg *arg, void *data) -{ - int ret; - struct widget_event_info info; - - info = arg->info.content_event.info; - - ret = widget_script_event(arg->pkgname, arg->id, - arg->info.content_event.signal_name, arg->info.content_event.source, - &info); - return ret; -} - -static int method_clicked(struct widget_event_arg *arg, void *data) -{ - int ret; - - DbgPrint("pkgname[%s] id[%s] event[%s] timestamp[%lf] x[%lf] y[%lf]\n", - arg->pkgname, arg->id, - arg->info.clicked.event, arg->info.clicked.timestamp, - arg->info.clicked.x, arg->info.clicked.y); - ret = widget_clicked(arg->pkgname, arg->id, - arg->info.clicked.event, - arg->info.clicked.timestamp, arg->info.clicked.x, arg->info.clicked.y); - - return ret; -} - -static int method_text_signal(struct widget_event_arg *arg, void *data) -{ - int ret; - struct widget_event_info info; - - info = arg->info.text_signal.info; - - DbgPrint("pkgname[%s] id[%s] signal_name[%s] source[%s]\n", arg->pkgname, arg->id, arg->info.text_signal.signal_name, arg->info.text_signal.source); - ret = widget_script_event(arg->pkgname, arg->id, - arg->info.text_signal.signal_name, arg->info.text_signal.source, - &info); - - return ret; -} - -static int method_resize(struct widget_event_arg *arg, void *data) -{ - int ret; - - invoke_pre_callback(WIDGET_PRE_RESIZE_CALLBACK, arg->id); - - DbgPrint("pkgname[%s] id[%s] w[%d] h[%d]\n", arg->pkgname, arg->id, arg->info.resize.w, arg->info.resize.h); - ret = widget_viewer_resize_widget(arg->pkgname, arg->id, arg->info.resize.w, arg->info.resize.h); - - return ret; -} - -static int method_set_period(struct widget_event_arg *arg, void *data) -{ - int ret; - DbgPrint("pkgname[%s] id[%s] period[%lf]\n", arg->pkgname, arg->id, arg->info.set_period.period); - ret = widget_viewer_set_period(arg->pkgname, arg->id, arg->info.set_period.period); - return ret; -} - -static int method_change_group(struct widget_event_arg *arg, void *data) -{ - int ret; - DbgPrint("pkgname[%s] id[%s] cluster[%s] category[%s]\n", arg->pkgname, arg->id, arg->info.change_group.cluster, arg->info.change_group.category); - ret = widget_change_group(arg->pkgname, arg->id, arg->info.change_group.cluster, arg->info.change_group.category); - return ret; -} - -static int method_pinup(struct widget_event_arg *arg, void *data) -{ - DbgPrint("pkgname[%s] id[%s] state[%d]\n", arg->pkgname, arg->id, arg->info.pinup.state); - arg->info.pinup.content_info = widget_pinup(arg->pkgname, arg->id, arg->info.pinup.state); - return arg->info.pinup.content_info ? WIDGET_ERROR_NONE : WIDGET_ERROR_NOT_SUPPORTED; -} - -static int method_update_content(struct widget_event_arg *arg, void *data) -{ - int ret; - - if (!arg->id || !strlen(arg->id)) { - if (arg->info.update_content.content && strlen(arg->info.update_content.content)) { - DbgPrint("pkgname[%s] content[%s]\n", arg->pkgname, arg->info.update_content.content); - ret = widget_set_content_info_all(arg->pkgname, arg->info.update_content.content); - } else { - DbgPrint("pkgname[%s] cluster[%s] category[%s]\n", arg->pkgname, arg->info.update_content.cluster, arg->info.update_content.category); - ret = widget_update_all(arg->pkgname, arg->info.update_content.cluster, arg->info.update_content.category, arg->info.update_content.force); - } - } else { - if (arg->info.update_content.content && strlen(arg->info.update_content.content)) { - DbgPrint("id[%s] content[%s]\n", arg->id, arg->info.update_content.content); - ret = widget_set_content_info(arg->pkgname, arg->id, arg->info.update_content.content); - } else { - DbgPrint("Update [%s]\n", arg->id); - ret = widget_update(arg->pkgname, arg->id, arg->info.update_content.force); - } - } - - return ret; -} - -static int method_pause(struct widget_event_arg *arg, void *data) -{ - widget_pause_all(); - - if (s_info.ping_timer) { - ecore_timer_freeze(s_info.ping_timer); - } - - if (WIDGET_CONF_SLAVE_AUTO_CACHE_FLUSH) { - elm_cache_all_flush(); - sqlite3_release_memory(WIDGET_CONF_SQLITE_FLUSH_MAX); - malloc_trim(0); - } - - return WIDGET_ERROR_NONE; -} - -static int method_resume(struct widget_event_arg *arg, void *data) -{ - widget_resume_all(); - - if (s_info.ping_timer) { - ecore_timer_thaw(s_info.ping_timer); - } - - return WIDGET_ERROR_NONE; -} - -static Eina_Bool send_ping_cb(void *data) -{ - widget_provider_send_ping(); - return ECORE_CALLBACK_RENEW; -} - -static int method_disconnected(struct widget_event_arg *arg, void *data) -{ - if (s_info.ping_timer) { - ecore_timer_del(s_info.ping_timer); - s_info.ping_timer = NULL; - } - - ui_app_exit(); - return WIDGET_ERROR_NONE; -} - -static int method_connected(struct widget_event_arg *arg, void *data) -{ - int ret; - ret = widget_provider_send_hello(); - if (ret == 0) { - double ping_interval; - - ping_interval = WIDGET_CONF_DEFAULT_PING_TIME / 2.0f; - DbgPrint("Ping Timer: %lf\n", ping_interval); - - s_info.ping_timer = ecore_timer_add(ping_interval, send_ping_cb, NULL); - if (!s_info.ping_timer) { - ErrPrint("Failed to add a ping timer\n"); - } - } - - return WIDGET_ERROR_NONE; -} - -static int method_gbar_created(struct widget_event_arg *arg, void *data) -{ - int ret; - - ret = widget_open_gbar(arg->pkgname, arg->id); - if (ret < 0) { - DbgPrint("%s Open PD: %d\n", arg->id, ret); - } - - return WIDGET_ERROR_NONE; -} - -static int method_gbar_destroyed(struct widget_event_arg *arg, void *data) -{ - int ret; - - ret = widget_close_gbar(arg->pkgname, arg->id); - if (ret < 0) { - DbgPrint("%s Close PD: %d\n", arg->id, ret); - } - - return WIDGET_ERROR_NONE; -} - -static int method_gbar_moved(struct widget_event_arg *arg, void *data) -{ - int ret; - struct widget_event_info info; - - memset(&info, 0, sizeof(info)); - info.pointer.x = arg->info.gbar_move.x; - info.pointer.y = arg->info.gbar_move.y; - info.pointer.down = 0; - - ret = widget_script_event(arg->pkgname, arg->id, - "gbar,move", util_uri_to_path(arg->id), &info); - return ret; -} - -static int method_widget_pause(struct widget_event_arg *arg, void *data) -{ - int ret; - - ret = widget_pause(arg->pkgname, arg->id); - - if (WIDGET_CONF_SLAVE_AUTO_CACHE_FLUSH) { - elm_cache_all_flush(); - sqlite3_release_memory(WIDGET_CONF_SQLITE_FLUSH_MAX); - malloc_trim(0); - } - - return ret; -} - -static int method_widget_resume(struct widget_event_arg *arg, void *data) -{ - return widget_resume(arg->pkgname, arg->id); -} - -static int method_viewer_connected(struct widget_event_arg *arg, void *data) -{ - return widget_viewer_connected(arg->pkgname, arg->id, arg->info.viewer_connected.direct_addr); -} - -static int method_viewer_disconnected(struct widget_event_arg *arg, void *data) -{ - return widget_viewer_disconnected(arg->pkgname, arg->id, arg->info.viewer_disconnected.direct_addr); -} - -static int method_orientation(struct widget_event_arg *arg, void *data) -{ - invoke_pre_callback(WIDGET_PRE_ORIENTATION_CALLBACK, arg->id); - return widget_set_orientation(arg->pkgname, arg->id, arg->info.orientation.degree); -} - -HAPI int client_init(const char *name, const char *abi, const char *accel, int secured) -{ - struct widget_event_table table = { - .widget_create = method_new, - .widget_recreate = method_renew, - .widget_destroy = method_delete, - .content_event = method_content_event, - .clicked = method_clicked, - .text_signal = method_text_signal, - .resize = method_resize, - .set_period = method_set_period, - .change_group = method_change_group, - .pinup = method_pinup, - .update_content = method_update_content, - .pause = method_pause, - .resume = method_resume, - .disconnected = method_disconnected, - .connected = method_connected, - .gbar_create = method_gbar_created, - .gbar_destroy = method_gbar_destroyed, - .gbar_move = method_gbar_moved, - .widget_pause = method_widget_pause, - .widget_resume = method_widget_resume, - .viewer_connected = method_viewer_connected, - .viewer_disconnected = method_viewer_disconnected, - .orientation = method_orientation, - }; - - widget_provider_prepare_init(abi, accel, secured); - return widget_provider_init(util_screen_get(), name, &table, NULL, 1, 1); -} - -HAPI int client_fini(void) -{ - (void)widget_provider_fini(); - return WIDGET_ERROR_NONE; -} - -/* End of a file */ - diff --git a/src/connection.c b/src/connection.c deleted file mode 100644 index 162b95b..0000000 --- a/src/connection.c +++ /dev/null @@ -1,296 +0,0 @@ -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include - -#include - -#include "debug.h" -#include "connection.h" - -static struct info { - Eina_List *connection_list; - Eina_List *connected_list; - Eina_List *disconnected_list; - - enum { - IDLE = 0x00, - DISCONNECTION = 0x01, - CONNECTION = 0x02, - } process; -} s_info = { - .connection_list = NULL, - .connected_list = NULL, - .disconnected_list = NULL, - .process = IDLE, -}; - -int errno; - -struct event_item { - int (*event_cb)(int handle, void *data); - void *data; - int deleted; -}; - -struct connection { - char *addr; - int fd; - int refcnt; -}; - -/** - * When we get this connected callback, - * The connection handle is not prepared yet. - * So it is not possible to find a connection handle using socket fd. - * In this case, just propagate this event to upper layer. - * Make them handles this. - */ -static int connected_cb(int handle, void *data) -{ - Eina_List *l; - Eina_List *n; - struct event_item *item; - - EINA_LIST_FOREACH_SAFE(s_info.connected_list, l, n, item) { - s_info.process = CONNECTION; - if (item->deleted || item->event_cb(handle, item->data) < 0 || item->deleted) { - s_info.connected_list = eina_list_remove(s_info.connected_list, item); - free(item); - } - s_info.process = IDLE; - } - - return 0; -} - -static int disconnected_cb(int handle, void *data) -{ - Eina_List *l; - Eina_List *n; - struct event_item *item; - - EINA_LIST_FOREACH_SAFE(s_info.disconnected_list, l, n, item) { - s_info.process = DISCONNECTION; - if (item->deleted || item->event_cb(handle, item->data) < 0 || item->deleted) { - s_info.disconnected_list = eina_list_remove(s_info.disconnected_list, item); - free(item); - } - s_info.process = IDLE; - } - - return 0; -} - -int connection_init(void) -{ - if (com_core_add_event_callback(CONNECTOR_DISCONNECTED, disconnected_cb, NULL) < 0) { - ErrPrint("Unable to register the disconnected callback\n"); - } - - if (com_core_add_event_callback(CONNECTOR_CONNECTED, connected_cb, NULL) < 0) { - ErrPrint("Unable to register the disconnected callback\n"); - } - - return WIDGET_ERROR_NONE; -} - -int connection_fini(void) -{ - (void)com_core_del_event_callback(CONNECTOR_DISCONNECTED, disconnected_cb, NULL); - (void)com_core_del_event_callback(CONNECTOR_CONNECTED, connected_cb, NULL); - - return WIDGET_ERROR_NONE; -} - -struct connection *connection_create(const char *addr, void *table) -{ - struct connection *handle; - - handle = calloc(1, sizeof(*handle)); - if (!handle) { - ErrPrint("calloc: %d\n", errno); - return NULL; - } - - handle->addr = strdup(addr); - if (!handle->addr) { - ErrPrint("strdup: %d (%s)\n", errno, addr); - free(handle); - return NULL; - } - - handle->fd = com_core_packet_client_init(handle->addr, 0, table); - if (handle->fd < 0) { - ErrPrint("Unable to make a connection %s\n", handle->addr); - free(handle->addr); - free(handle); - return NULL; - } - - handle->refcnt = 1; - - s_info.connection_list = eina_list_append(s_info.connection_list, handle); - return handle; -} - -struct connection *connection_ref(struct connection *handle) -{ - if (!handle) { - return NULL; - } - - handle->refcnt++; - return handle; -} - -struct connection *connection_unref(struct connection *handle) -{ - if (!handle) { - return NULL; - } - - handle->refcnt--; - if (handle->refcnt > 0) { - return handle; - } - - s_info.connection_list = eina_list_remove(s_info.connection_list, handle); - - if (handle->fd >= 0) { - com_core_packet_client_fini(handle->fd); - } - - free(handle->addr); - free(handle); - return NULL; -} - -struct connection *connection_find_by_addr(const char *addr) -{ - Eina_List *l; - struct connection *handle; - - if (!addr) { - return NULL; - } - - EINA_LIST_FOREACH(s_info.connection_list, l, handle) { - if (handle->addr && !strcmp(handle->addr, addr)) { - return handle; - } - } - - return NULL; -} - -struct connection *connection_find_by_fd(int fd) -{ - Eina_List *l; - struct connection *handle; - - if (fd < 0) { - return NULL; - } - - EINA_LIST_FOREACH(s_info.connection_list, l, handle) { - if (handle->fd == fd) { - return handle; - } - } - - return NULL; -} - -int connection_add_event_handler(enum connection_event_type type, int (*event_cb)(int handle, void *data), void *data) -{ - struct event_item *item; - - item = malloc(sizeof(*item)); - if (!item) { - ErrPrint("malloc: %d\n", errno); - return WIDGET_ERROR_OUT_OF_MEMORY; - } - - item->event_cb = event_cb; - item->data = data; - - switch (type) { - case CONNECTION_EVENT_TYPE_CONNECTED: - s_info.connected_list = eina_list_append(s_info.connected_list, item); - break; - case CONNECTION_EVENT_TYPE_DISCONNECTED: - s_info.disconnected_list = eina_list_append(s_info.disconnected_list, item); - break; - default: - free(item); - return WIDGET_ERROR_INVALID_PARAMETER; - } - - return WIDGET_ERROR_NONE; -} - -void *connection_del_event_handler(enum connection_event_type type, int (*event_cb)(int handle, void *data)) -{ - Eina_List *l; - Eina_List *n; - struct event_item *item; - void *ret = NULL; - - switch (type) { - case CONNECTION_EVENT_TYPE_CONNECTED: - EINA_LIST_FOREACH_SAFE(s_info.connected_list, l, n, item) { - if (item->event_cb == event_cb) { - if (s_info.process == CONNECTION) { - item->deleted = 1; - ret = item->data; - } else { - s_info.connected_list = eina_list_remove(s_info.connected_list, item); - ret = item->data; - free(item); - } - break; - } - } - break; - case CONNECTION_EVENT_TYPE_DISCONNECTED: - EINA_LIST_FOREACH_SAFE(s_info.disconnected_list, l, n, item) { - if (item->event_cb == event_cb) { - if (s_info.process == DISCONNECTION) { - item->deleted = 1; - ret = item->data; - } else { - s_info.disconnected_list = eina_list_remove(s_info.disconnected_list, item); - ret = item->data; - free(item); - } - break; - } - } - break; - default: - break; - } - - return ret; -} - -int connection_handle(struct connection *connection) -{ - return connection->fd; -} - -const char *connection_addr(struct connection *connection) -{ - return connection->addr; -} - -/* End of a file */ diff --git a/src/critical_log.c b/src/critical_log.c deleted file mode 100644 index ed54dc2..0000000 --- a/src/critical_log.c +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright 2013 Samsung Electronics Co., Ltd - * - * Licensed under the Flora License, Version 1.1 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://floralicense.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 -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "util.h" -#include "critical_log.h" -#include "debug.h" -#include "conf.h" - -static struct { - FILE *fp; - int file_id; - int nr_of_lines; - char *filename; -} s_info = { - .fp = NULL, - .file_id = 0, - .nr_of_lines = 0, - .filename = NULL, -}; - - - -static inline void rotate_log(void) -{ - char *filename; - int namelen; - - if (s_info.nr_of_lines < WIDGET_CONF_MAX_LOG_LINE) { - return; - } - - s_info.file_id = (s_info.file_id + 1) % WIDGET_CONF_MAX_LOG_FILE; - - namelen = strlen(s_info.filename) + strlen(WIDGET_CONF_LOG_PATH) + 30; - filename = malloc(namelen); - if (filename) { - snprintf(filename, namelen, "%s/%d_%s.%d", WIDGET_CONF_LOG_PATH, s_info.file_id, s_info.filename, getpid()); - - if (s_info.fp) { - if (fclose(s_info.fp) != 0) { - ErrPrint("fclose: %d\n", errno); - } - } - - s_info.fp = fopen(filename, "w+"); - if (!s_info.fp) { - ErrPrint("Failed to open a file: %s\n", filename); - } - - DbgFree(filename); - } - - s_info.nr_of_lines = 0; -} - - - -HAPI int critical_log(const char *func, int line, const char *fmt, ...) -{ - va_list ap; - int ret; - - if (!s_info.fp) { - return WIDGET_ERROR_IO_ERROR; - } - - fprintf(s_info.fp, "%lf [%s:%d] ", util_timestamp(), util_basename((char *)func), line); - - va_start(ap, fmt); - ret = vfprintf(s_info.fp, fmt, ap); - va_end(ap); - - if (fflush(s_info.fp) != 0) { - ErrPrint("fflush: %d\n", errno); - } - - s_info.nr_of_lines++; - rotate_log(); - return ret; -} - - - -HAPI int critical_log_init(const char *name) -{ - int namelen; - char *filename; - - if (s_info.fp) { - return WIDGET_ERROR_NONE; - } - - s_info.filename = strdup(name); - if (!s_info.filename) { - ErrPrint("Failed to create a log file\n"); - return WIDGET_ERROR_OUT_OF_MEMORY; - } - - namelen = strlen(name) + strlen(WIDGET_CONF_LOG_PATH) + 30; - - filename = malloc(namelen); - if (!filename) { - ErrPrint("Failed to create a log file\n"); - free(s_info.filename); - s_info.filename = NULL; - return WIDGET_ERROR_OUT_OF_MEMORY; - } - - snprintf(filename, namelen, "%s/%d_%s.%d", WIDGET_CONF_LOG_PATH, s_info.file_id, name, getpid()); - - s_info.fp = fopen(filename, "w+"); - if (!s_info.fp) { - ErrPrint("fopen: %d\n", errno); - free(s_info.filename); - s_info.filename = NULL; - free(filename); - return WIDGET_ERROR_IO_ERROR; - } - - free(filename); - return WIDGET_ERROR_NONE; -} - - - -HAPI int critical_log_fini(void) -{ - if (s_info.filename) { - free(s_info.filename); - s_info.filename = NULL; - } - - if (s_info.fp) { - if (fclose(s_info.fp) != 0) { - ErrPrint("fclose: %d\n", errno); - } - s_info.fp = NULL; - } - - return WIDGET_ERROR_NONE; -} - - - -/* End of a file */ diff --git a/src/fault.c b/src/fault.c deleted file mode 100644 index dcfbe1e..0000000 --- a/src/fault.c +++ /dev/null @@ -1,286 +0,0 @@ -/* - * Copyright 2013 Samsung Electronics Co., Ltd - * - * Licensed under the Flora License, Version 1.1 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://floralicense.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 _GNU_SOURCE -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include "critical_log.h" -#include "main.h" -#include "debug.h" -#include "fault.h" -#include "client.h" -#include "util.h" -#include "conf.h" - -static struct info { -#if defined(_USE_ECORE_TIME_GET) - double alarm_tv; -#else - struct timeval alarm_tv; -#endif - int marked; - int disable_checker; - struct sigaction SEGV_act; - struct sigaction ILL_act; - struct sigaction ALRM_act; - struct sigaction USR1_act; - struct sigaction ABRT_act; - char **argv; -} s_info = { - .marked = 0, - .disable_checker = 0, - .argv = NULL, -}; - -static void signal_handler(int signum, siginfo_t *info, void *unused) -{ - char *so_fname; - char *symbol = NULL; - - so_fname = util_get_current_module(&symbol); - - if (info->si_signo == SIGALRM) { - if (!s_info.marked) { - DbgPrint("Ignore false alarm signal [false]\n"); - return; - } - -#if defined(_USE_ECORE_TIME_GET) - double tv; - tv = ecore_time_get(); - if (tv - s_info.alarm_tv < DEFAULT_LIFE_TIMER) { - DbgPrint("Ignore false alarm signal [%lf]\n", tv - s_info.alarm_tv); - return; - } - - CRITICAL_LOG("ALARM: %lf (%d, %d)\n", tv - s_info.alarm_tv, DEFAULT_LIFE_TIMER, DEFAULT_LOAD_TIMER); -#else - struct timeval tv; - struct timeval res_tv; - - if (gettimeofday(&tv, NULL) < 0) { - ErrPrint("gettimeofday: %d\n", errno); - tv.tv_sec = 0; - tv.tv_usec = 0; - } - - timersub(&tv, &s_info.alarm_tv, &res_tv); - - /*! - * \note - * GAP: 1 sec - */ - if (res_tv.tv_sec < DEFAULT_LIFE_TIMER) { - DbgPrint("Ignore false alarm signal [%d]\n", res_tv.tv_sec); - return; - } - - CRITICAL_LOG("ALARM: %d.%d (%d, %d)\n", - res_tv.tv_sec, res_tv.tv_usec, DEFAULT_LIFE_TIMER, DEFAULT_LOAD_TIMER); -#endif - } else if (so_fname) { - int fd; - char log_fname[256]; - - snprintf(log_fname, sizeof(log_fname), "%s/slave.%d", WIDGET_CONF_LOG_PATH, getpid()); - fd = open(log_fname, O_WRONLY|O_CREAT|O_SYNC, 0644); - if (fd >= 0) { - if (write(fd, so_fname, strlen(so_fname)) != strlen(so_fname)) { - ErrPrint("Failed to recording the fault SO filename (%s)\n", so_fname); - } - if (close(fd) < 0) { - ErrPrint("close: %d\n", errno); - } - } - } - - CRITICAL_LOG("SIGNAL> Received from PID[%d]\n", info->si_pid); - CRITICAL_LOG("SIGNAL> Signal: %d (%d)\n", signum, info->si_signo); - CRITICAL_LOG("SIGNAL> Error code: %d\n", info->si_code); - CRITICAL_LOG("SIGNAL> Address: %p\n", info->si_addr); - CRITICAL_LOG("Package: [%s] Symbol[%s]\n", so_fname, symbol); - - if (so_fname) { - int len = strlen(s_info.argv[0]); - memset(s_info.argv[0], 0, len); - strncpy(s_info.argv[0], util_basename(so_fname), len - 1); - free(so_fname); - } else { - CRITICAL_LOG("Unable to find a so_fname (%s)\n", symbol); - } - - free(symbol); - - switch (signum) { - case SIGSEGV: - s_info.SEGV_act.sa_sigaction(signum, info, unused); - break; - case SIGALRM: - s_info.ALRM_act.sa_sigaction(signum, info, unused); - break; - case SIGABRT: - s_info.ABRT_act.sa_sigaction(signum, info, unused); - break; - case SIGILL: - s_info.ILL_act.sa_sigaction(signum, info, unused); - break; - case SIGUSR1: - s_info.USR1_act.sa_sigaction(signum, info, unused); - break; - default: - ErrPrint("Unhandled signal\n"); - break; - } -} - -HAPI int fault_init(char **argv) -{ - struct sigaction act; - char *ecore_abort; - - s_info.argv = argv; - - act.sa_sigaction = signal_handler; - act.sa_flags = SA_SIGINFO; - - if (sigemptyset(&act.sa_mask) != 0) { - ErrPrint("Failed to init signal: %d\n", errno); - } - - if (sigaddset(&act.sa_mask, SIGUSR1) != 0) { - ErrPrint("Failed to add set: %d\n", errno); - } - - if (sigaddset(&act.sa_mask, SIGALRM) != 0) { - ErrPrint("Failed to add set: %d\n", errno); - } - - ecore_abort = getenv("ECORE_ERROR_ABORT"); - if (!ecore_abort || ecore_abort[0] != '1') { - if (sigaddset(&act.sa_mask, SIGSEGV) != 0) { - ErrPrint("Failed to add set: %d\n", errno); - } - if (sigaddset(&act.sa_mask, SIGABRT) != 0) { - ErrPrint("Failed to add set: %d\n", errno); - } - if (sigaddset(&act.sa_mask, SIGILL) != 0) { - ErrPrint("Failed to add set: %d\n", errno); - } - - if (sigaction(SIGSEGV, &act, &s_info.SEGV_act) < 0) { - ErrPrint("Failed to install the SEGV handler\n"); - } - - if (sigaction(SIGABRT, &act, &s_info.ABRT_act) < 0) { - ErrPrint("Faield to install the ABRT handler\n"); - } - - if (sigaction(SIGILL, &act, &s_info.ILL_act) < 0) { - ErrPrint("Faield to install the ILL handler\n"); - } - } - - if (sigaction(SIGUSR1, &act, &s_info.USR1_act) < 0) { - ErrPrint("Failed to install the USR1 handler\n"); - } - - if (sigaction(SIGALRM, &act, &s_info.ALRM_act) < 0) { - ErrPrint("Failed to install the ALRM handler\n"); - } - - return 0; -} - -HAPI int fault_fini(void) -{ - /*! - * \todo - * remove all signal handlers - */ - return 0; -} - -HAPI int fault_mark_call(const char *pkgname, const char *filename, const char *funcname, int noalarm, int life_time) -{ - if (!s_info.disable_checker) { - widget_provider_send_call(pkgname, filename, funcname); - } - /*! - * \NOTE - * To use this "alarm", the widget have to do not use the 'sleep' series functions. - * because those functions will generate alarm signal. - * then the module will be deactivated - * - * Enable alarm for detecting infinite loop - */ - if (!noalarm) { -#if defined(_USE_ECORE_TIME_GET) - s_info.alarm_tv = ecore_time_get(); -#else - if (gettimeofday(&s_info.alarm_tv, NULL) < 0) { - ErrPrint("gettimeofday: %d\n", errno); - s_info.alarm_tv.tv_sec = 0; - s_info.alarm_tv.tv_usec = 0; - } -#endif - s_info.marked = 1; - alarm(life_time); - } - - return 0; -} - -HAPI int fault_unmark_call(const char *pkgname, const char *filename, const char *funcname, int noalarm) -{ - if (!noalarm) { - /*! - * \NOTE - * Disable alarm - */ - alarm(0); - s_info.marked = 0; - } - - if (!s_info.disable_checker) { - widget_provider_send_ret(pkgname, filename, funcname); - } - return 0; -} - -HAPI void fault_disable_call_option(void) -{ - s_info.disable_checker = 1; -} - -/* End of a file */ diff --git a/src/main.c b/src/main.c deleted file mode 100644 index b41e220..0000000 --- a/src/main.c +++ /dev/null @@ -1,646 +0,0 @@ -/* - * Copyright 2013 Samsung Electronics Co., Ltd - * - * Licensed under the Flora License, Version 1.1 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://floralicense.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 -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "critical_log.h" -#include "debug.h" -#include "fault.h" -#include "update_monitor.h" -#include "client.h" -#include "util.h" -#include "so_handler.h" -#include "widget.h" -#include "conf.h" -#include "theme_loader.h" - -#define WVGA_DEFAULT_SCALE 1.8f - -static struct info { - int (*heap_monitor_initialized)(void); - size_t (*heap_monitor_target_usage)(const char *name); - int (*heap_monitor_add_target)(const char *name); - int (*heap_monitor_del_target)(const char *name); - void *heap_monitor; - Ea_Theme_Font_Table *table; - - app_event_handler_h lang_changed_handler; - app_event_handler_h region_changed_handler; -} s_info = { - .heap_monitor_initialized = NULL, - .heap_monitor_target_usage = NULL, - .heap_monitor_add_target = NULL, - .heap_monitor_del_target = NULL, - .heap_monitor = NULL, - .table = NULL, - .lang_changed_handler = NULL, - .region_changed_handler = NULL, -}; - -static void font_changed_cb(void *user_data) -{ - DbgPrint("Font change event\n"); - widget_system_event_all(WIDGET_SYS_EVENT_FONT_CHANGED); -} - -static void tts_changed_cb(keynode_t *node, void *user_data) -{ - DbgPrint("TTS status is changed\n"); - widget_system_event_all(WIDGET_SYS_EVENT_TTS_CHANGED); -} - -static void mmc_changed_cb(keynode_t *node, void *user_data) -{ - DbgPrint("MMC status is changed\n"); - widget_system_event_all(WIDGET_SYS_EVENT_MMC_STATUS_CHANGED); -} - -static void time_changed_cb(keynode_t *node, void *user_data) -{ - DbgPrint("Time is changed\n"); - widget_system_event_all(WIDGET_SYS_EVENT_TIME_CHANGED); -} - -static void initialize_glib_type_system(void) -{ - GType type; - - type = G_TYPE_DBUS_ACTION_GROUP; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = G_TYPE_DBUS_ANNOTATION_INFO; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = G_TYPE_DBUS_ARG_INFO; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = G_TYPE_DBUS_AUTH_OBSERVER; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = G_TYPE_DBUS_CALL_FLAGS; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = G_TYPE_DBUS_CAPABILITY_FLAGS; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = G_TYPE_DBUS_CONNECTION; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = G_TYPE_DBUS_CONNECTION_FLAGS; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = G_TYPE_DBUS_ERROR; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = G_TYPE_DBUS_INTERFACE; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = G_TYPE_DBUS_INTERFACE_INFO; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = G_TYPE_DBUS_INTERFACE_SKELETON; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = G_TYPE_DBUS_INTERFACE_SKELETON_FLAGS; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = G_TYPE_DBUS_MENU_MODEL; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = G_TYPE_DBUS_MESSAGE; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = G_TYPE_DBUS_MESSAGE_BYTE_ORDER; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = G_TYPE_DBUS_MESSAGE_FLAGS; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = G_TYPE_DBUS_MESSAGE_HEADER_FIELD; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = G_TYPE_DBUS_MESSAGE_TYPE; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = G_TYPE_DBUS_METHOD_INFO; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = G_TYPE_DBUS_METHOD_INVOCATION; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = G_TYPE_DBUS_NODE_INFO; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = G_TYPE_DBUS_OBJECT; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = G_TYPE_DBUS_OBJECT_MANAGER; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = G_TYPE_DBUS_OBJECT_MANAGER_CLIENT; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = G_TYPE_DBUS_OBJECT_MANAGER_CLIENT_FLAGS; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = G_TYPE_DBUS_OBJECT_MANAGER_SERVER; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = G_TYPE_DBUS_OBJECT_PROXY; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = G_TYPE_DBUS_OBJECT_SKELETON; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = G_TYPE_DBUS_PROPERTY_INFO; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = G_TYPE_DBUS_PROPERTY_INFO_FLAGS; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = G_TYPE_DBUS_PROXY; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = G_TYPE_DBUS_PROXY_FLAGS; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = G_TYPE_DBUS_SEND_MESSAGE_FLAGS; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = G_TYPE_DBUS_SERVER; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = G_TYPE_DBUS_SERVER_FLAGS; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = G_TYPE_DBUS_SIGNAL_FLAGS; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = G_TYPE_DBUS_SIGNAL_INFO; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = G_TYPE_DBUS_SUBTREE_FLAGS; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = JSON_TYPE_NODE; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = JSON_TYPE_OBJECT; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = JSON_TYPE_ARRAY; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = JSON_TYPE_ARRAY; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = JSON_TYPE_SERIALIZABLE; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = JSON_TYPE_PARSER; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } - type = JSON_TYPE_GENERATOR; - if (type != G_TYPE_OBJECT) { - DbgPrint("initialized\n"); - } -} - -static bool app_create(void *argv) -{ - int ret; - - elm_app_base_scale_set(WVGA_DEFAULT_SCALE); - - widget_conf_init(); - if (!widget_conf_is_loaded()) { - ret = widget_conf_load(); - if (ret < 0) { - DbgPrint("Configureation manager is initiated: %d\n", ret); - } - } - - critical_log_init(util_basename(((char **)argv)[0])); - - /*! - * Touch the glib type system - */ - initialize_glib_type_system(); - - DbgPrint("Scale factor: %lf\n", elm_config_scale_get()); - - if (WIDGET_CONF_COM_CORE_THREAD) { - if (setenv("PROVIDER_COM_CORE_THREAD", "true", 0) < 0) { - ErrPrint("setenv: %d\n", errno); - } - } else { - if (setenv("PROVIDER_COM_CORE_THREAD", "false", 0) < 0){ - ErrPrint("setenv: %d\n", errno); - } - } - - ret = widget_service_init(); - if (ret < 0) { - DbgPrint("Livebox service init: %d\n", ret); - } - - /** - * @note - * Slave is not able to initiate system, before - * receive its name from the master - * - * So create callback doesn't do anything. - */ - ret = fault_init(argv); - if (ret < 0) { - DbgPrint("Crash recover is initiated: %d\n", ret); - } - - ret = update_monitor_init(); - if (ret < 0) { - DbgPrint("Content update monitor is initiated: %d\n", ret); - } - - s_info.table = ea_theme_font_table_new("/usr/share/themes/FontInfoTable.xml"); - if (s_info.table) { - DbgPrint("FONT TABLE Prepared"); - ea_theme_fonts_set(s_info.table); - } - ea_theme_event_callback_add(EA_THEME_CALLBACK_TYPE_FONT, font_changed_cb, NULL); - - ret = vconf_notify_key_changed(VCONFKEY_SYSTEM_TIME_CHANGED, time_changed_cb, NULL); - if (ret < 0) { - DbgPrint("System time changed event callback added: %d\n", ret); - } - - ret = vconf_notify_key_changed(VCONFKEY_SYSMAN_MMC_STATUS, mmc_changed_cb, NULL); - if (ret < 0) { - DbgPrint("MMC status changed event callback added: %d\n", ret); - } - - ret = vconf_notify_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, tts_changed_cb, NULL); - if (ret < 0) { - DbgPrint("TTS changed callback is added: %s\n", ret); - } - - font_changed_cb(NULL); - theme_loader_load(THEME_DIR); - - widget_viewer_init(); - - return TRUE; -} - -static void app_terminate(void *data) -{ - int ret; - - DbgPrint("Terminating provider\n"); - - widget_viewer_fini(); - - theme_loader_unload(); - - if (s_info.table) { - DbgPrint("FONT TABLE Destroyed"); - ea_theme_font_table_free(s_info.table); - s_info.table = NULL; - } - - ret = vconf_ignore_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, tts_changed_cb); - if (ret < 0) { - DbgPrint("TTS changed callback is added: %s\n", ret); - } - - ea_theme_event_callback_del(EA_THEME_CALLBACK_TYPE_FONT, font_changed_cb); - - ret = vconf_ignore_key_changed(VCONFKEY_SYSTEM_TIME_CHANGED, time_changed_cb); - if (ret < 0) { - DbgPrint("Remove time changed callback: %d\n", ret); - } - - ret = vconf_ignore_key_changed(VCONFKEY_SYSMAN_MMC_STATUS, mmc_changed_cb); - if (ret < 0) { - DbgPrint("Remove MMC status changed callback: %d\n", ret); - } - - ret = update_monitor_fini(); - if (ret < 0) { - DbgPrint("Content update monitor is finalized: %d\n", ret); - } - - ret = fault_fini(); - if (ret < 0) { - DbgPrint("Crash recover is finalized: %d\n", ret); - } - - ret = client_fini(); - if (ret < 0) { - DbgPrint("client finalized: %d\n", ret); - } - - ret = widget_service_fini(); - if (ret < 0) { - DbgPrint("widget service fini: %d\n", ret); - } - - critical_log_fini(); - - exit(0); - return; -} - -static void app_pause(void *data) -{ - /* Will not be invoked */ - return; -} - -static void app_resume(void *data) -{ - /* Will not be invoked */ - return; -} - -static void app_region_changed(app_event_info_h event_info, void *data) -{ - // char *region; - // app_event_get_region_format(event_info, ®ion); - widget_system_event_all(WIDGET_SYS_EVENT_REGION_CHANGED); -} - -static void app_language_changed(app_event_info_h event_info, void *data) -{ - // char *lang; - // app_event_get_language(event_info, &lang); - widget_system_event_all(WIDGET_SYS_EVENT_LANG_CHANGED); -} - -static void app_control(app_control_h service, void *data) -{ - int ret; - char *name; - char *secured; - char *hw_acceleration = NULL; - char *abi; - static int initialized = 0; - - if (initialized) { - ErrPrint("Already initialized\n"); - return; - } - - ret = app_control_get_extra_data(service, WIDGET_CONF_BUNDLE_SLAVE_NAME, &name); - if (ret != APP_CONTROL_ERROR_NONE) { - ErrPrint("Name is not valid\n"); - return; - } - - ret = app_control_get_extra_data(service, WIDGET_CONF_BUNDLE_SLAVE_SECURED, &secured); - if (ret != APP_CONTROL_ERROR_NONE) { - free(name); - ErrPrint("Secured is not valid\n"); - return; - } - - ret = app_control_get_extra_data(service, WIDGET_CONF_BUNDLE_SLAVE_HW_ACCELERATION, &hw_acceleration); - if (ret != APP_CONTROL_ERROR_NONE) { - DbgPrint("Unable to get option for hw-acceleration\n"); - hw_acceleration = strdup("use-x11"); - /* Go ahead */ - } - - ret = app_control_get_extra_data(service, WIDGET_CONF_BUNDLE_SLAVE_ABI, &abi); - if (ret != APP_CONTROL_ERROR_NONE) { - DbgPrint("Unable to get option for hw-acceleration\n"); - abi = strdup(WIDGET_CONF_DEFAULT_ABI); - /* Go ahead */ - } - - if (!strcasecmp(secured, "true")) { - /* Don't use the update timer */ - widget_turn_secured_on(); - } - - DbgPrint("Name assigned: %s\n", name); - DbgPrint("Secured: %s\n", secured); - DbgPrint("hw-acceleration: %s\n", hw_acceleration); - DbgPrint("abi: %s\n", abi); - ret = client_init(name, abi, hw_acceleration, widget_is_secured()); - - if (hw_acceleration && !strcasecmp(hw_acceleration, "use-gl")) { - DbgPrint("Turn on: opengl_x11\n"); - elm_config_preferred_engine_set("opengl_x11"); - } - - free(name); - free(secured); - free(hw_acceleration); - free(abi); - - initialized = 1; - return; -} - -#if defined(_ENABLE_MCHECK) -static inline void mcheck_cb(enum mcheck_status status) -{ - char *ptr; - - ptr = util_get_current_module(NULL); - - switch (status) { - case MCHECK_DISABLED: - ErrPrint("[DISABLED] Heap incosistency detected: %s\n", ptr); - break; - case MCHECK_OK: - ErrPrint("[OK] Heap incosistency detected: %s\n", ptr); - break; - case MCHECK_HEAD: - ErrPrint("[HEAD] Heap incosistency detected: %s\n", ptr); - break; - case MCHECK_TAIL: - ErrPrint("[TAIL] Heap incosistency detected: %s\n", ptr); - break; - case MCHECK_FREE: - ErrPrint("[FREE] Heap incosistency detected: %s\n", ptr); - break; - default: - break; - } -} -#endif - -#define HEAP_MONITOR_PATH "/usr/lib/libheap-monitor.so" -#define BIN_PATH "/usr/apps/org.tizen.data-provider-slave/bin/" -int main(int argc, char *argv[]) -{ - int ret; - ui_app_lifecycle_callback_s event_callback; - - const char *option; - - memset(argv[0], 0, strlen(argv[0])); - strcpy(argv[0], BIN_PATH "data-provider-slave"); - DbgPrint("Replace argv[0] with %s\n", argv[0]); - -#if defined(_ENABLE_MCHECK) - mcheck(mcheck_cb); -#endif - option = getenv("PROVIDER_DISABLE_CALL_OPTION"); - if (option && !strcasecmp(option, "true")) { - fault_disable_call_option(); - } - - option = getenv("PROVIDER_HEAP_MONITOR_START"); - if (option && !strcasecmp(option, "true")) { - s_info.heap_monitor = dlopen(HEAP_MONITOR_PATH, RTLD_NOW); - if (s_info.heap_monitor) { - s_info.heap_monitor_initialized = dlsym(s_info.heap_monitor, "heap_monitor_initialized"); - s_info.heap_monitor_target_usage = dlsym(s_info.heap_monitor, "heap_monitor_target_usage"); - s_info.heap_monitor_add_target = dlsym(s_info.heap_monitor, "heap_monitor_add_target"); - s_info.heap_monitor_del_target = dlsym(s_info.heap_monitor, "heap_monitor_del_target"); - } - } - - if (setenv("BUFMGR_LOCK_TYPE", "once", 0) < 0) { - ErrPrint("setenv: %d\n", errno); - } - - if (setenv("BUFMGR_MAP_CACHE", "true", 0) < 0) { - ErrPrint("setenv: %d\n", errno); - } - - event_callback.create = app_create; - event_callback.terminate = app_terminate; - event_callback.pause = app_pause; - event_callback.resume = app_resume; - event_callback.app_control = app_control; - - ui_app_add_event_handler(&s_info.lang_changed_handler, APP_EVENT_LANGUAGE_CHANGED, app_language_changed, argv); - ui_app_add_event_handler(&s_info.region_changed_handler, APP_EVENT_REGION_FORMAT_CHANGED, app_region_changed, argv); - // APP_EVENT_DEVICE_ORIENTATION_CHANGED - // APP_EVENT_LOW_MEMORY - // APP_EVENT_LOW_BATTERY - - ret = ui_app_main(argc, argv, &event_callback, (void *)argv); - ErrPrint("ui_app_main: %d\n", ret); - - if (s_info.heap_monitor) { - if (dlclose(s_info.heap_monitor) < 0) { - ErrPrint("dlclose: %d\n", errno); - } - } - - return ret; -} - -HAPI int main_heap_monitor_is_enabled(void) -{ - return s_info.heap_monitor_initialized ? s_info.heap_monitor_initialized() : 0; -} - -HAPI size_t main_heap_monitor_target_usage(const char *name) -{ - return s_info.heap_monitor_target_usage ? s_info.heap_monitor_target_usage(name) : 0; -} - -HAPI int main_heap_monitor_add_target(const char *name) -{ - return s_info.heap_monitor_add_target ? s_info.heap_monitor_add_target(name) : 0; -} - -HAPI int main_heap_monitor_del_target(const char *name) -{ - return s_info.heap_monitor_del_target ? s_info.heap_monitor_del_target(name) : 0; -} - -/* End of a file */ diff --git a/src/so_handler.c b/src/so_handler.c deleted file mode 100644 index e7f39e8..0000000 --- a/src/so_handler.c +++ /dev/null @@ -1,1113 +0,0 @@ -/* - * Copyright 2013 Samsung Electronics Co., Ltd - * - * Licensed under the Flora License, Version 1.1 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://floralicense.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 -#include -#include /* dlopen */ -#include /* malloc, free */ -#include /* strcmp */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "main.h" -#include "critical_log.h" -#include "debug.h" -#include "so_handler.h" -#include "fault.h" -#include "util.h" -#include "conf.h" - -int errno; - -static struct info { - Eina_List *widget_list; - enum current_operations current_op; -} s_info = { - .widget_list = NULL, - .current_op = WIDGET_OP_UNKNOWN, -}; - -static inline struct so_item *find_widget(const char *pkgname) -{ - Eina_List *l; - struct so_item *item; - - EINA_LIST_FOREACH(s_info.widget_list, l, item) { - if (!strcmp(item->pkgname, pkgname)) { - return item; - } - } - - return NULL; -} - -static inline char *so_adaptor_alloc(const char *abi) -{ - /* TODO: Implement me */ - DbgPrint("ABI[%s] loads %s\n", abi, "/usr/lib/libwidget-cpp.so"); - return strdup("/usr/lib/libwidget-cpp.so"); -} - -static inline char *so_path_alloc(const char *pkgname) -{ - char *widget_id; - char *path; - - widget_id = widget_service_get_widget_id(pkgname); - if (!widget_id) { - ErrPrint("Failed to get package name\n"); - return NULL; - } else { - path = widget_service_get_libexec(widget_id); - free(widget_id); - } - - DbgPrint("so path: %s\n", path); - return path; -} - -static void delete_widget(struct so_item *item) -{ - int ret; - - fault_mark_call(item->pkgname, "finalize", __func__, USE_ALARM, DEFAULT_LIFE_TIMER); - - if (item->adaptor.finalize) { - ret = item->adaptor.finalize(item->pkgname); - } else if (item->widget.finalize) { - ret = item->widget.finalize(); - } else { - ErrPrint("%s has no finalize\n", item->pkgname); - ret = WIDGET_ERROR_NOT_SUPPORTED; - } - - fault_unmark_call(item->pkgname, "finalize", __func__, USE_ALARM); - - if (ret == WIDGET_ERROR_RESOURCE_BUSY) { - DbgPrint("Keep SO in a process space (%s)\n", item->so_fname); - } else { - if (ret < 0) { - ErrPrint("Package %s, finalize returns %d\n", item->pkgname, ret); - } - DbgPrint("Unload SO from process space (%s)\n", item->so_fname); - s_info.widget_list = eina_list_remove(s_info.widget_list, item); - main_heap_monitor_del_target(item->so_fname); - util_dump_current_so_info(item->so_fname); - if (dlclose(item->handle) != 0) { - ErrPrint("dlclose: %s\n", dlerror()); - } - free(item->so_fname); - free(item->pkgname); - free(item); - } -} - -static struct so_item *new_adaptor(const char *pkgname, const char *abi) -{ - struct so_item *item; - char *errmsg; - - item = calloc(1, sizeof(*item)); - if (!item) { - ErrPrint("calloc: %d\n", errno); - return NULL; - } - - item->pkgname = strdup(pkgname); - if (!item->pkgname) { - ErrPrint("strdup: %d\n", errno); - free(item); - return NULL; - } - - /*! \TODO: - * item->timeout - */ - - /*! \TODO - * item->has_widget_script - */ - - item->inst_list = NULL; - - item->so_fname = so_adaptor_alloc(abi); - if (!item->so_fname) { - free(item->pkgname); - free(item); - return NULL; - } - - fault_mark_call(pkgname, __func__, __func__, USE_ALARM, DEFAULT_LOAD_TIMER); - item->handle = dlopen(item->so_fname, RTLD_LOCAL | RTLD_NOW | RTLD_DEEPBIND); - if (!item->handle) { - fault_unmark_call(pkgname, __func__, __func__, USE_ALARM); - ErrPrint("dlopen: %s - %s\n", dlerror(), item->so_fname); - free(item->so_fname); - free(item->pkgname); - free(item); - return NULL; - } - fault_unmark_call(pkgname, __func__, __func__, USE_ALARM); - - errmsg = dlerror(); - if (errmsg) { - DbgPrint("dlerror(can be ignored): %s\n", errmsg); - } - - item->adaptor.create = (adaptor_create_t)dlsym(item->handle, "widget_create"); - if (!item->adaptor.create) { - ErrPrint("symbol: widget_create - %s\n", dlerror()); - delete_widget(item); - return NULL; - } - - item->adaptor.destroy = (adaptor_destroy_t)dlsym(item->handle, "widget_destroy"); - if (!item->adaptor.destroy) { - ErrPrint("symbol: widget_destroy - %s\n", dlerror()); - delete_widget(item); - return NULL; - } - - item->adaptor.pinup = (adaptor_pinup_t)dlsym(item->handle, "widget_pinup"); - if (!item->adaptor.pinup) { - ErrPrint("symbol: widget_pinup - %s\n", dlerror()); - } - - item->adaptor.is_updated = (adaptor_is_updated_t)dlsym(item->handle, "widget_need_to_update"); - if (!item->adaptor.is_updated) { - ErrPrint("symbol: widget_need_to_update - %s\n", dlerror()); - } - - item->adaptor.update_content = (adaptor_update_content_t)dlsym(item->handle, "widget_update_content"); - if (!item->adaptor.update_content) { - ErrPrint("symbol: widget_update_content - %s\n", dlerror()); - } - - item->adaptor.clicked = (adaptor_clicked_t)dlsym(item->handle, "widget_clicked"); - if (!item->adaptor.clicked) { - ErrPrint("symbol: widget_clicked - %s\n", dlerror()); - } - - item->adaptor.text_signal = (adaptor_text_signal_t)dlsym(item->handle, "widget_content_event"); - if (!item->adaptor.text_signal) { - ErrPrint("symbol: widget_content_event - %s\n", dlerror()); - } - - item->adaptor.resize = (adaptor_resize_t)dlsym(item->handle, "widget_resize"); - if (!item->adaptor.resize) { - ErrPrint("symbol: widget_resize - %s\n", dlerror()); - } - - item->adaptor.create_needed = (adaptor_create_needed_t)dlsym(item->handle, "widget_need_to_create"); - if (!item->adaptor.create_needed) { - ErrPrint("symbol: widget_need_to_create - %s\n", dlerror()); - } - - item->adaptor.change_group = (adaptor_change_group_t)dlsym(item->handle, "widget_change_group"); - if (!item->adaptor.change_group) { - ErrPrint("symbol: widget_change_group - %s\n", dlerror()); - } - - item->adaptor.get_output_info = (adaptor_get_output_info_t)dlsym(item->handle, "widget_get_info"); - if (!item->adaptor.get_output_info) { - ErrPrint("symbol: widget_get_info - %s\n", dlerror()); - } - - item->adaptor.initialize = (adaptor_initialize_t)dlsym(item->handle, "widget_initialize"); - if (!item->adaptor.initialize) { - ErrPrint("symbol: widget_initialize - %s\n", dlerror()); - } - - item->adaptor.finalize = (adaptor_finalize_t)dlsym(item->handle, "widget_finalize"); - if (!item->adaptor.finalize) { - ErrPrint("symbol: widget_finalize - %s\n", dlerror()); - } - - item->adaptor.need_to_destroy = (adaptor_need_to_destroy_t)dlsym(item->handle, "widget_need_to_destroy"); - if (!item->adaptor.need_to_destroy) { - ErrPrint("symbol: widget_need_to_destroy - %s\n", dlerror()); - } - - item->adaptor.sys_event = (adaptor_system_event_t)dlsym(item->handle, "widget_system_event"); - if (!item->adaptor.sys_event) { - ErrPrint("symbol: lievbox_system_event - %s\n", dlerror()); - } - - item->adaptor.is_pinned_up = (adaptor_is_pinned_up_t)dlsym(item->handle, "widget_is_pinned_up"); - if (!item->adaptor.is_pinned_up) { - ErrPrint("symbol: widget_is_pinned_up - %s\n", dlerror()); - } - - item->adaptor.get_alt_info = (adaptor_get_alt_info_t)dlsym(item->handle, "widget_get_alt_info"); - if (!item->adaptor.get_alt_info) { - ErrPrint("symbol: widget_get_alt_info - %s\n", dlerror()); - } - - item->adaptor.set_content_info = (adaptor_set_content_info_t)dlsym(item->handle, "widget_set_content_info"); - if (!item->adaptor.set_content_info) { - ErrPrint("symbol: widget_set_content_info - %s\n", dlerror()); - } - - if (item->adaptor.initialize) { - int ret; - fault_mark_call(pkgname, "initialize", __func__, USE_ALARM, DEFAULT_LIFE_TIMER); - - ret = item->adaptor.initialize(pkgname); - - fault_unmark_call(pkgname, "initialize", __func__, USE_ALARM); - if (ret < 0) { - ErrPrint("Failed to initialize package %s\n", pkgname); - delete_widget(item); - return NULL; - } - } - - s_info.widget_list = eina_list_append(s_info.widget_list, item); - return item; -} - -static struct so_item *new_widget(const char *pkgname) -{ - struct so_item *item; - char *errmsg; - - item = calloc(1, sizeof(*item)); - if (!item) { - ErrPrint("calloc: %d\n", errno); - return NULL; - } - - item->pkgname = strdup(pkgname); - if (!item->pkgname) { - ErrPrint("strdup: %d\n", errno); - free(item); - return NULL; - } - - /*! \TODO: - * item->timeout - */ - - /*! \TODO - * item->has_widget_script - */ - - item->inst_list = NULL; - - item->so_fname = so_path_alloc(pkgname); - if (!item->so_fname) { - free(item->pkgname); - free(item); - return NULL; - } - - fault_mark_call(pkgname, __func__, __func__, USE_ALARM, DEFAULT_LOAD_TIMER); - item->handle = dlopen(item->so_fname, RTLD_LOCAL | RTLD_NOW | RTLD_DEEPBIND); - if (!item->handle) { - fault_unmark_call(pkgname, __func__, __func__, USE_ALARM); - ErrPrint("dlopen: %s - %s\n", dlerror(), item->so_fname); - free(item->so_fname); - free(item->pkgname); - free(item); - return NULL; - } - fault_unmark_call(pkgname, __func__, __func__, USE_ALARM); - - errmsg = dlerror(); - if (errmsg) { - DbgPrint("dlerror(can be ignored): %s\n", errmsg); - } - - item->widget.create = (create_t)dlsym(item->handle, "widget_create"); - if (!item->widget.create) { - ErrPrint("symbol: widget_create - %s\n", dlerror()); - delete_widget(item); - return NULL; - } - - item->widget.destroy = (destroy_t)dlsym(item->handle, "widget_destroy"); - if (!item->widget.destroy) { - ErrPrint("symbol: widget_destroy - %s\n", dlerror()); - delete_widget(item); - return NULL; - } - - item->widget.pinup = (pinup_t)dlsym(item->handle, "widget_pinup"); - if (!item->widget.pinup) { - ErrPrint("symbol: widget_pinup - %s\n", dlerror()); - } - - item->widget.is_updated = (is_updated_t)dlsym(item->handle, "widget_need_to_update"); - if (!item->widget.is_updated) { - ErrPrint("symbol: widget_need_to_update - %s\n", dlerror()); - } - - item->widget.update_content = (update_content_t)dlsym(item->handle, "widget_update_content"); - if (!item->widget.update_content) { - ErrPrint("symbol: widget_update_content - %s\n", dlerror()); - } - - item->widget.clicked = (clicked_t)dlsym(item->handle, "widget_clicked"); - if (!item->widget.clicked) { - ErrPrint("symbol: widget_clicked - %s\n", dlerror()); - } - - item->widget.text_signal = (text_signal_t)dlsym(item->handle, "widget_content_event"); - if (!item->widget.text_signal) { - ErrPrint("symbol: widget_content_event - %s\n", dlerror()); - } - - item->widget.resize = (resize_t)dlsym(item->handle, "widget_resize"); - if (!item->widget.resize) { - ErrPrint("symbol: widget_resize - %s\n", dlerror()); - } - - item->widget.create_needed = (create_needed_t)dlsym(item->handle, "widget_need_to_create"); - if (!item->widget.create_needed) { - ErrPrint("symbol: widget_need_to_create - %s\n", dlerror()); - } - - item->widget.change_group = (change_group_t)dlsym(item->handle, "widget_change_group"); - if (!item->widget.change_group) { - ErrPrint("symbol: widget_change_group - %s\n", dlerror()); - } - - item->widget.get_output_info = (get_output_info_t)dlsym(item->handle, "widget_get_info"); - if (!item->widget.get_output_info) { - ErrPrint("symbol: widget_get_info - %s\n", dlerror()); - } - - item->widget.initialize = (initialize_t)dlsym(item->handle, "widget_initialize"); - if (!item->widget.initialize) { - ErrPrint("symbol: widget_initialize - %s\n", dlerror()); - } - - item->widget.finalize = (finalize_t)dlsym(item->handle, "widget_finalize"); - if (!item->widget.finalize) { - ErrPrint("symbol: widget_finalize - %s\n", dlerror()); - } - - item->widget.need_to_destroy = (need_to_destroy_t)dlsym(item->handle, "widget_need_to_destroy"); - if (!item->widget.need_to_destroy) { - ErrPrint("symbol: widget_need_to_destroy - %s\n", dlerror()); - } - - item->widget.sys_event = (system_event_t)dlsym(item->handle, "widget_system_event"); - if (!item->widget.sys_event) { - ErrPrint("symbol: widget_system_event - %s\n", dlerror()); - } - - item->widget.is_pinned_up = (is_pinned_up_t)dlsym(item->handle, "widget_is_pinned_up"); - if (!item->widget.is_pinned_up) { - ErrPrint("symbol: widget_is_pinned_up - %s\n", dlerror()); - } - - item->widget.get_alt_info = (get_alt_info_t)dlsym(item->handle, "widget_get_alt_info"); - if (!item->widget.get_alt_info) { - ErrPrint("symbol: widget_get_alt_info - %s\n", dlerror()); - } - - item->widget.set_content_info = (set_content_info_t)dlsym(item->handle, "widget_set_content_info"); - if (!item->widget.set_content_info) { - ErrPrint("symbol: widget_set_content_info - %s\n", dlerror()); - } - - main_heap_monitor_add_target(item->so_fname); - - if (item->widget.initialize) { - int ret; - fault_mark_call(pkgname, "initialize", __func__, USE_ALARM, DEFAULT_LIFE_TIMER); - - ret = item->widget.initialize(pkgname); - - fault_unmark_call(pkgname, "initialize", __func__, USE_ALARM); - if (ret < 0) { - ErrPrint("Failed to initialize package %s\n", pkgname); - delete_widget(item); - return NULL; - } - } - - s_info.widget_list = eina_list_append(s_info.widget_list, item); - return item; -} - -static inline struct instance *new_instance(const char *id, const char *content, const char *cluster, const char *category) -{ - struct instance *inst; - - inst = calloc(1, sizeof(*inst)); - if (!inst) { - ErrPrint("calloc: %d\n", errno); - return NULL; - } - - inst->id = strdup(id); - if (!inst->id) { - ErrPrint("strdup: %d\n", errno); - free(inst); - return NULL; - } - - DbgPrint("Default content: [%s]\n", content); - if (content) { - inst->content = strdup(content); - if (!inst->content) { - ErrPrint("strdup: %d\n", errno); - free(inst->id); - free(inst); - return NULL; - } - } - - if (cluster) { - inst->cluster = strdup(cluster); - if (!inst->cluster) { - ErrPrint("strdup: %d\n", errno); - free(inst->id); - free(inst->content); - free(inst); - return NULL; - } - } - - if (category) { - inst->category = strdup(category); - if (!inst->category) { - ErrPrint("strdup: %d\n", errno); - free(inst->cluster); - free(inst->id); - free(inst->content); - free(inst); - return NULL; - } - } - - return inst; -} - -static inline int delete_instance(struct instance *inst) -{ - free(inst->icon); - free(inst->name); - free(inst->cluster); - free(inst->category); - free(inst->id); - free(inst->content); - free(inst->title); - free(inst); - return WIDGET_ERROR_NONE; -} - -static inline struct instance *find_instance(struct so_item *item, const char *id) -{ - struct instance *inst; - Eina_List *l; - - EINA_LIST_FOREACH(item->inst_list, l, inst) { - if (!strcmp(inst->id, id)) { - return inst; - } - } - - return NULL; -} - -HAPI struct instance *so_find_instance(const char *pkgname, const char *id) -{ - struct so_item *item; - - item = find_widget(pkgname); - if (!item) { - return NULL; - } - - return find_instance(item, id); -} - -HAPI int so_create(const char *pkgname, const char *id, const char *content_info, int timeout, int has_widget_script, const char *cluster, const char *category, const char *abi, struct instance **out) -{ - struct so_item *item; - struct instance *inst; - int ret; - - item = find_widget(pkgname); - if (item) { - inst = find_instance(item, id); - if (inst) { - ErrPrint("Instance: %s - %s is already exists\n", pkgname, id); - return WIDGET_ERROR_ALREADY_EXIST; - } - } else { - if (!strcasecmp(abi, "c")) { - item = new_widget(pkgname); - } else { - item = new_adaptor(pkgname, abi); - } - - if (!item) { - return WIDGET_ERROR_FAULT; - } - } - - inst = new_instance(id, content_info, cluster, category); - if (!inst) { - if (!item->inst_list) { - delete_widget(item); - } - - return WIDGET_ERROR_FAULT; - } - - item->inst_list = eina_list_append(item->inst_list, inst); - item->has_widget_script = has_widget_script; - item->timeout = timeout; - - fault_mark_call(pkgname, id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER); - - s_info.current_op = WIDGET_OP_CREATE; - if (item->adaptor.create) { - ret = item->adaptor.create(pkgname, util_uri_to_path(id), content_info, cluster, category); - } else if (item->widget.create) { - ret = item->widget.create(util_uri_to_path(id), content_info, cluster, category); - } else { /*! \NOTE: This is not possible, but for the exceptional handling */ - ret = WIDGET_ERROR_NOT_SUPPORTED; - } - s_info.current_op = WIDGET_OP_UNKNOWN; - - fault_unmark_call(pkgname, id, __func__, USE_ALARM); - - if (ret < 0) { - item->inst_list = eina_list_remove(item->inst_list, inst); - delete_instance(inst); - - if (!item->inst_list) { - /* There is no instances, unload this widget */ - delete_widget(item); - } - return ret; - } - - inst->item = item; - *out = inst; - return ret; -} - -HAPI int so_destroy(struct instance *inst, int unload) -{ - struct so_item *item; - int ret; - - item = inst->item; - if (!item) { - return WIDGET_ERROR_INVALID_PARAMETER; - } - - fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER); - - s_info.current_op = WIDGET_OP_DESTROY; - if (item->adaptor.destroy) { - ret = item->adaptor.destroy(item->pkgname, util_uri_to_path(inst->id)); - } else if (item->widget.destroy) { - ret = item->widget.destroy(util_uri_to_path(inst->id)); - } else { - ret = WIDGET_ERROR_NOT_SUPPORTED; - } - s_info.current_op = WIDGET_OP_UNKNOWN; - - fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM); - - item->inst_list = eina_list_remove(item->inst_list, inst); - delete_instance(inst); - - if (unload && !item->inst_list) { - delete_widget(item); - } - - return ret; -} - -HAPI char *so_pinup(struct instance *inst, int pinup) -{ - struct so_item *item; - char *ret; - - item = inst->item; - if (!item) { - return NULL; - } - - fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER); - - s_info.current_op = WIDGET_OP_PINUP; - if (item->adaptor.pinup) { - ret = item->adaptor.pinup(item->pkgname, util_uri_to_path(inst->id), pinup); - } else if (item->widget.pinup) { - ret = item->widget.pinup(util_uri_to_path(inst->id), pinup); - } else { - ret = NULL; - } - s_info.current_op = WIDGET_OP_UNKNOWN; - - fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM); - return ret; -} - -HAPI int so_is_pinned_up(struct instance *inst) -{ - struct so_item *item; - int ret; - - item = inst->item; - if (!item) { - return WIDGET_ERROR_INVALID_PARAMETER; - } - - fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER); - - s_info.current_op = WIDGET_OP_IS_PINNED_UP; - if (item->adaptor.is_pinned_up) { - ret = item->adaptor.is_pinned_up(item->pkgname, util_uri_to_path(inst->id)); - } else if (item->widget.is_pinned_up) { - ret = item->widget.is_pinned_up(util_uri_to_path(inst->id)); - } else { - ret = WIDGET_ERROR_NOT_SUPPORTED; - } - s_info.current_op = WIDGET_OP_UNKNOWN; - - fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM); - return ret; -} - -HAPI int so_is_updated(struct instance *inst) -{ - struct so_item *item; - int ret; - - item = inst->item; - if (!item) { - return WIDGET_ERROR_INVALID_PARAMETER; - } - - fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER); - - s_info.current_op = WIDGET_OP_NEED_TO_UPDATE; - if (item->adaptor.is_updated) { - ret = item->adaptor.is_updated(item->pkgname, util_uri_to_path(inst->id)); - } else if (item->widget.is_updated) { - ret = item->widget.is_updated(util_uri_to_path(inst->id)); - } else { - ret = WIDGET_ERROR_NOT_SUPPORTED; - } - s_info.current_op = WIDGET_OP_UNKNOWN; - - fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM); - - return ret; -} - -HAPI int so_need_to_destroy(struct instance *inst) -{ - struct so_item *item; - int ret; - - item = inst->item; - if (!item) { - return WIDGET_ERROR_INVALID_PARAMETER; - } - - fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER); - - s_info.current_op = WIDGET_OP_NEED_TO_DESTROY; - if (item->adaptor.need_to_destroy) { - ret = item->adaptor.need_to_destroy(item->pkgname, util_uri_to_path(inst->id)); - } else if (item->widget.need_to_destroy) { - ret = item->widget.need_to_destroy(util_uri_to_path(inst->id)); - } else { - ret = WIDGET_ERROR_NOT_SUPPORTED; - } - s_info.current_op = WIDGET_OP_UNKNOWN; - - fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM); - - return ret; -} - -HAPI int so_update(struct instance *inst) -{ - struct so_item *item; - int ret; - - item = inst->item; - if (!item) { - return WIDGET_ERROR_INVALID_PARAMETER; - } - - fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER); - - s_info.current_op = WIDGET_OP_UPDATE_CONTENT; - if (item->adaptor.update_content) { - ret = item->adaptor.update_content(item->pkgname, util_uri_to_path(inst->id)); - } else if (item->widget.update_content) { - ret = item->widget.update_content(util_uri_to_path(inst->id)); - } else { - ret = WIDGET_ERROR_NOT_SUPPORTED; - } - s_info.current_op = WIDGET_OP_UNKNOWN; - - fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM); - return ret; -} - -HAPI int so_clicked(struct instance *inst, const char *event, double timestamp, double x, double y) -{ - struct so_item *item; - int ret; - - item = inst->item; - if (!item) { - return WIDGET_ERROR_INVALID_PARAMETER; - } - - fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER); - - DbgPrint("PERF_WIDGET\n"); - - s_info.current_op = WIDGET_OP_CLICKED; - if (item->adaptor.clicked) { - ret = item->adaptor.clicked(item->pkgname, util_uri_to_path(inst->id), event, timestamp, x, y); - } else if (item->widget.clicked) { - ret = item->widget.clicked(util_uri_to_path(inst->id), event, timestamp, x, y); - } else { - ret = WIDGET_ERROR_NOT_SUPPORTED; - } - s_info.current_op = WIDGET_OP_UNKNOWN; - - fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM); - - return ret; -} - -HAPI int so_script_event(struct instance *inst, const char *signal_name, const char *source, widget_event_info_s event_info) -{ - struct so_item *item; - int ret; - - item = inst->item; - if (!item) { - return WIDGET_ERROR_INVALID_PARAMETER; - } - - fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER); - - s_info.current_op = WIDGET_OP_CONTENT_EVENT; - if (item->adaptor.text_signal) { - ret = item->adaptor.text_signal(item->pkgname, util_uri_to_path(inst->id), signal_name, source, event_info); - } else if (item->widget.text_signal) { - ret = item->widget.text_signal(util_uri_to_path(inst->id), signal_name, source, event_info); - } else { - ret = WIDGET_ERROR_NOT_SUPPORTED; - } - s_info.current_op = WIDGET_OP_UNKNOWN; - - fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM); - - return ret; -} - -HAPI int so_resize(struct instance *inst, int w, int h) -{ - struct so_item *item; - int ret; - widget_size_type_e type = WIDGET_SIZE_TYPE_UNKNOWN; - - item = inst->item; - if (!item) { - return WIDGET_ERROR_INVALID_PARAMETER; - } - - widget_service_get_size_type(w, h, &type); - if (type == WIDGET_SIZE_TYPE_UNKNOWN) { - return WIDGET_ERROR_INVALID_PARAMETER; - } - - fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER); - - s_info.current_op = WIDGET_OP_RESIZE; - if (item->adaptor.resize) { - ret = item->adaptor.resize(item->pkgname, util_uri_to_path(inst->id), type); - } else if (item->widget.resize) { - ret = item->widget.resize(util_uri_to_path(inst->id), type); - } else { - ret = WIDGET_ERROR_NOT_SUPPORTED; - } - s_info.current_op = WIDGET_OP_UNKNOWN; - - fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM); - - return ret; -} - -HAPI int so_set_content_info(struct instance *inst, const char *content_info) -{ - struct so_item *item; - int ret; - - item = inst->item; - if (!item) { - return WIDGET_ERROR_INVALID_PARAMETER; - } - - fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER); - s_info.current_op = WIDGET_OP_SET_CONTENT_INFO; - if (item->adaptor.set_content_info) { - ret = item->adaptor.set_content_info(item->pkgname, util_uri_to_path(inst->id), content_info); - } else if (item->widget.set_content_info) { - ret = item->widget.set_content_info(util_uri_to_path(inst->id), content_info); - } else { - ret = WIDGET_ERROR_NOT_SUPPORTED; - } - s_info.current_op = WIDGET_OP_UNKNOWN; - fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM); - - return ret; -} - -HAPI int so_create_needed(const char *pkgname, const char *cluster, const char *category, const char *abi) -{ - struct so_item *item; - int ret; - - item = find_widget(pkgname); - if (!item) { - if (!strcasecmp(abi, "c")) { - item = new_widget(pkgname); - } else { - item = new_adaptor(pkgname, abi); - } - - if (!item) { - return WIDGET_ERROR_FAULT; - } - } - - fault_mark_call(item->pkgname, __func__, __func__, USE_ALARM, DEFAULT_LIFE_TIMER); - - s_info.current_op = WIDGET_OP_NEED_TO_CREATE; - if (item->adaptor.create_needed) { - ret = item->adaptor.create_needed(pkgname, cluster, category); - } else if (item->widget.create_needed) { - ret = item->widget.create_needed(cluster, category); - } else { - ret = WIDGET_ERROR_NOT_SUPPORTED; - } - s_info.current_op = WIDGET_OP_UNKNOWN; - - fault_unmark_call(item->pkgname, __func__, __func__, USE_ALARM); - - DbgPrint("[%s] returns %d\n", pkgname, ret); - return ret; -} - -HAPI int so_change_group(struct instance *inst, const char *cluster, const char *category) -{ - struct so_item *item; - int ret; - char *tmp_cluster; - char *tmp_category; - - item = inst->item; - if (!item) { - return WIDGET_ERROR_INVALID_PARAMETER; - } - - tmp_cluster = strdup(cluster); - if (!tmp_cluster) { - return WIDGET_ERROR_OUT_OF_MEMORY; - } - - tmp_category = strdup(category); - if (!tmp_category) { - free(tmp_cluster); - return WIDGET_ERROR_OUT_OF_MEMORY; - } - - fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER); - - s_info.current_op = WIDGET_OP_CHANGE_GROUP; - if (item->adaptor.change_group) { - ret = item->adaptor.change_group(item->pkgname, util_uri_to_path(inst->id), cluster, category); - } else if (item->widget.change_group) { - ret = item->widget.change_group(util_uri_to_path(inst->id), cluster, category); - } else { - ret = WIDGET_ERROR_NOT_SUPPORTED; - } - s_info.current_op = WIDGET_OP_UNKNOWN; - - fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM); - if (ret >= 0) { - free(inst->cluster); - free(inst->category); - - inst->cluster = tmp_cluster; - inst->category = tmp_category; - } else { - free(tmp_cluster); - free(tmp_category); - } - - return ret; -} - -HAPI int so_get_alt_info(struct instance *inst, char **icon, char **name) -{ - struct so_item *item; - int ret; - - item = inst->item; - if (!item) { - return WIDGET_ERROR_INVALID_PARAMETER; - } - - *icon = NULL; - *name = NULL; - - fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER); - - s_info.current_op = WIDGET_OP_GET_ALT_INFO; - if (item->adaptor.get_alt_info) { - ret = item->adaptor.get_alt_info(item->pkgname, util_uri_to_path(inst->id), icon, name); - } else if (item->widget.get_alt_info) { - ret = item->widget.get_alt_info(util_uri_to_path(inst->id), icon, name); - } else { - ret = WIDGET_ERROR_NOT_SUPPORTED; - } - s_info.current_op = WIDGET_OP_UNKNOWN; - - fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM); - if (ret >= 0) { - if (*icon) { - free(inst->icon); - inst->icon = *icon; - } - - if (*name) { - free(inst->name); - inst->name = *name; - } - } - - if (main_heap_monitor_is_enabled()) { - DbgPrint("%s allocates %d bytes\n", item->pkgname, main_heap_monitor_target_usage(item->so_fname)); - } - - return ret; -} - -HAPI int so_get_output_info(struct instance *inst, int *w, int *h, double *priority, char **content, char **title) -{ - struct so_item *item; - int ret; - - item = inst->item; - if (!item) { - return WIDGET_ERROR_INVALID_PARAMETER; - } - - *content = NULL; - *title = NULL; - - fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER); - - s_info.current_op = WIDGET_OP_GET_INFO; - if (item->adaptor.get_output_info) { - ret = item->adaptor.get_output_info(item->pkgname, util_uri_to_path(inst->id), w, h, priority, content, title); - } else if (item->widget.get_output_info) { - ret = item->widget.get_output_info(util_uri_to_path(inst->id), w, h, priority, content, title); - } else { - ret = WIDGET_ERROR_NOT_SUPPORTED; - } - s_info.current_op = WIDGET_OP_UNKNOWN; - - fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM); - if (ret >= 0) { - inst->w = *w; - inst->h = *h; - inst->priority = *priority; - - /*! - * \todo - * Add "*content" "*title" address validation code. - * using mcheck? - */ - - if (*content) { - free(inst->content); - inst->content = *content; - } - - if (*title) { - free(inst->title); - inst->title = *title; - } - } - - if (main_heap_monitor_is_enabled()) { - DbgPrint("%s allocates %d bytes\n", item->pkgname, main_heap_monitor_target_usage(item->so_fname)); - } - - return ret; -} - -HAPI int so_sys_event(struct instance *inst, int event) -{ - struct so_item *item; - int ret; - - item = inst->item; - if (!item) { - return WIDGET_ERROR_INVALID_PARAMETER; - } - - fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER); - - s_info.current_op = WIDGET_OP_SYSTEM_EVENT; - if (item->adaptor.sys_event) { - ret = item->adaptor.sys_event(item->pkgname, util_uri_to_path(inst->id), event); - } else if (item->widget.sys_event) { - ret = item->widget.sys_event(util_uri_to_path(inst->id), event); - } else { - ret = WIDGET_ERROR_NOT_SUPPORTED; - } - s_info.current_op = WIDGET_OP_UNKNOWN; - - fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM); - return ret; -} - -HAPI enum current_operations so_current_op(void) -{ - return s_info.current_op; -} - -/* End of a file */ diff --git a/src/theme_loader.c b/src/theme_loader.c deleted file mode 100644 index 51e180f..0000000 --- a/src/theme_loader.c +++ /dev/null @@ -1,146 +0,0 @@ -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include "conf.h" -#include "debug.h" - -static struct info { - Eina_List *color_list; - Eina_List *font_list; -} s_info = { - .color_list = NULL, - .font_list = NULL, -}; - -static int load_files(const char *path, int (*cb)(const char *fname, void *data), void *data) -{ - DIR *handle; - struct dirent *ent; - char *fname; - int plen; - int len; - int ret; - - handle = opendir(path); - if (!handle) { - ErrPrint("opendir: %d (%s)\n", errno, path); - return WIDGET_ERROR_IO_ERROR; - } - - plen = strlen(path); - - while ((ent = readdir(handle))) { - if (ent->d_name[0] == '.') { - continue; - } - - len = strlen(ent->d_name); - DbgPrint("File: %s\n", ent->d_name); - if (len <= 4 || strcasecmp(ent->d_name + len - 4, ".xml")) { - DbgPrint("Skip: %s\n", ent->d_name); - continue; - } - - len = plen + len + 2; - - fname = malloc(len); - if (!fname) { - if (closedir(handle) < 0) { - ErrPrint("closedir: %d\n", errno); - } - return WIDGET_ERROR_OUT_OF_MEMORY; - } - - snprintf(fname, len, "%s/%s", path, ent->d_name); - ret = cb(fname, data); - free(fname); - if (ret < 0) { - break; - } - } - - if (closedir(handle) < 0) { - ErrPrint("closedir: %d\n", errno); - } - - return WIDGET_ERROR_NONE; -} - -static int color_loader_cb(const char *fname, void *data) -{ - Ea_Theme_Color_Table *color; - - DbgPrint("Load color theme: %s\n", fname); - color = ea_theme_color_table_new(fname); - if (!color) { - ErrPrint("Failed to load theme table: %s\n", fname); - return WIDGET_ERROR_NONE; - } - - ea_theme_colors_set(color, EA_THEME_STYLE_DEFAULT); - - s_info.color_list = eina_list_append(s_info.color_list, color); - return WIDGET_ERROR_NONE; -} - -static int font_loader_cb(const char *fname, void *data) -{ - Eina_List *list; - - DbgPrint("Load font theme: %s\n", fname); - list = ea_theme_font_table_new(fname); - if (!list) { - ErrPrint("Failed to load font table: %s\n", fname); - return WIDGET_ERROR_NONE; - } - - ea_theme_fonts_set(list); - s_info.font_list = eina_list_append(s_info.font_list, list); - return WIDGET_ERROR_NONE; -} - -HAPI int theme_loader_load(const char *path) -{ - char *folder; - int len; - - len = strlen(path) + strlen("color") + 2; - folder = malloc(len); - if (!folder) { - ErrPrint("malloc: %d\n", errno); - return WIDGET_ERROR_OUT_OF_MEMORY; - } - - snprintf(folder, len, "%s/color", path); - (void)load_files(folder, color_loader_cb, NULL); - - snprintf(folder, len, "%s/font", path); - (void)load_files(folder, font_loader_cb, NULL); - - free(folder); - return WIDGET_ERROR_NONE; -} - -HAPI void theme_loader_unload(void) -{ - Ea_Theme_Color_Table *color_item; - Eina_List *font_item; - - EINA_LIST_FREE(s_info.color_list, color_item) { - ea_theme_color_table_free(color_item); - } - - EINA_LIST_FREE(s_info.font_list, font_item) { - ea_theme_font_table_free(font_item); - } -} - -/* End of a file */ diff --git a/src/update_monitor.c b/src/update_monitor.c deleted file mode 100644 index 4e622c8..0000000 --- a/src/update_monitor.c +++ /dev/null @@ -1,382 +0,0 @@ -/* - * Copyright 2013 Samsung Electronics Co., Ltd - * - * Licensed under the Flora License, Version 1.1 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://floralicense.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 -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -#include "critical_log.h" -#include "update_monitor.h" -#include "util.h" -#include "debug.h" -#include "conf.h" - -int errno; - -struct cb_item { - char *filename; - int (*cb)(const char *filename, void *data, int over); - void *data; - int deleted; -}; - -static struct info { - int ifd; - int iwd; - Ecore_Fd_Handler *handler; - Eina_List *update_list; - Eina_List *delete_list; - unsigned int update_list_in_use; - unsigned int delete_list_in_use; -} s_info = { - .ifd = -EINVAL, - .iwd = -EINVAL, - .handler = NULL, - .update_list = NULL, - .delete_list = NULL, - .update_list_in_use = 0, - .delete_list_in_use = 0, -}; - -static void *update_item_destroy(struct cb_item *item, Eina_List *l) -{ - void *data; - - if (s_info.update_list_in_use) { - item->deleted = 1; - data = item->data; - } else { - s_info.update_list = eina_list_remove_list(s_info.update_list, l); - data = item->data; - free(item->filename); - free(item); - } - - return data; -} - -static void *delete_item_destroy(struct cb_item *item, Eina_List *l) -{ - void *data; - - if (s_info.delete_list_in_use == 1) { - item->deleted = 1; - data = item->data; - } else { - s_info.delete_list = eina_list_remove_list(s_info.delete_list, l); - data = item->data; - free(item->filename); - free(item); - } - - return data; -} - -static Eina_Bool monitor_cb(void *data, Ecore_Fd_Handler *handler) -{ - int fd; - int read_size; - char *buffer; - register int i; - struct inotify_event *evt; - char *filename; - int len; - int ret; - - fd = ecore_main_fd_handler_fd_get(handler); - if (fd < 0) { - ErrPrint("Failed to get file handler\n"); - return ECORE_CALLBACK_CANCEL; - } - - if (ioctl(fd, FIONREAD, &read_size) < 0) { - ErrPrint("Failed to get q size (%d)\n", errno); - return ECORE_CALLBACK_CANCEL; - } - - if (read_size <= 0) { - ErrPrint("Buffer is not ready!!!\n"); - return ECORE_CALLBACK_RENEW; - } - - buffer = calloc(read_size+1, sizeof(char)); - if (!buffer) { - ErrPrint("calloc: %d\n", errno); - return ECORE_CALLBACK_CANCEL; - } - - if (read(fd, buffer, read_size) != read_size) { - ErrPrint("Could not get entire events (%d)\n", errno); - free(buffer); - return ECORE_CALLBACK_CANCEL; - } - - i = 0; - while (i < read_size) { - evt = (struct inotify_event *)(buffer + i); - i += sizeof(*evt) + evt->len; - - if (util_check_ext(evt->name, "gnp.") == 0 - && util_check_ext(evt->name, "csed.") == 0) - { - continue; - } - - len = strlen(evt->name) + strlen(WIDGET_CONF_IMAGE_PATH) + 1; - filename = malloc(len); - if (!filename) { - ErrPrint("malloc: %d\n", errno); - /* We met error, but keep going, - * and care the remained buffer. - */ - continue; - } - - ret = snprintf(filename, len, "%s%s", WIDGET_CONF_IMAGE_PATH, evt->name); - if (ret < 0) { - ErrPrint("snprintf: %d\n", errno); - /* We met error, but keep goging. - * and care the remained buffer. - */ - free(filename); - continue; - } - - if (evt->mask & (IN_DELETE | IN_MOVED_FROM)) { - update_monitor_trigger_delete_cb(filename, !!(evt->mask & IN_Q_OVERFLOW)); - } else if (evt->mask & (IN_CLOSE_WRITE | IN_MOVED_TO)) { - update_monitor_trigger_update_cb(filename, !!(evt->mask & IN_Q_OVERFLOW)); - } - - free(filename); - } - - free(buffer); - return ECORE_CALLBACK_RENEW; -} - -HAPI int update_monitor_init(void) -{ - DbgPrint("Shared folder: %s\n", WIDGET_CONF_IMAGE_PATH); - - s_info.ifd = inotify_init(); - if (s_info.ifd < 0) { - ErrPrint("inotify_init: %d\n", errno); - return WIDGET_ERROR_IO_ERROR; - } - - if (access(WIDGET_CONF_IMAGE_PATH, R_OK | X_OK) != 0) { - ErrPrint("Image folder is not exists\n"); - return WIDGET_ERROR_IO_ERROR; - } - - s_info.iwd = inotify_add_watch(s_info.ifd, WIDGET_CONF_IMAGE_PATH, - IN_DELETE | IN_CLOSE_WRITE | IN_MOVED_TO | IN_MOVED_FROM); - - if (s_info.iwd < 0) { - ErrPrint("inotify_add_watch: %d\n", errno); - if (close(s_info.ifd) < 0) { - ErrPrint("close: %d\n", errno); - } - s_info.ifd = WIDGET_ERROR_INVALID_PARAMETER; - return WIDGET_ERROR_IO_ERROR; - } - - s_info.handler = ecore_main_fd_handler_add(s_info.ifd, - ECORE_FD_READ, monitor_cb, NULL, NULL, NULL); - if (!s_info.handler) { - ErrPrint("Failed to add a FD handler\n"); - if (inotify_rm_watch(s_info.ifd, s_info.iwd) < 0) { - ErrPrint("inotify_rm_watch: %d", errno); - } - s_info.iwd = -EINVAL; - - if (close(s_info.ifd) < 0) { - ErrPrint("close: %d\n", errno); - } - s_info.ifd = WIDGET_ERROR_INVALID_PARAMETER; - return WIDGET_ERROR_FAULT; - } - - DbgPrint("Update monitor is successfully initialized\n"); - return WIDGET_ERROR_NONE; -} - -HAPI int update_monitor_fini(void) -{ - if (!s_info.handler) { - ErrPrint("Invalid fd handler\n"); - } else { - ecore_main_fd_handler_del(s_info.handler); - s_info.handler = NULL; - } - - if (s_info.ifd >= 0) { - if (inotify_rm_watch(s_info.ifd, s_info.iwd) < 0) { - ErrPrint("inotify_rm_watch:%d", errno); - } - - s_info.iwd = WIDGET_ERROR_INVALID_PARAMETER; - - if (close(s_info.ifd) < 0) { - ErrPrint("close: %d\n", errno); - } - s_info.ifd = WIDGET_ERROR_INVALID_PARAMETER; - } - - return WIDGET_ERROR_NONE; -} - -HAPI int update_monitor_trigger_update_cb(const char *filename, int over) -{ - Eina_List *l; - Eina_List *n; - struct cb_item *item; - int cnt = 0; - - s_info.update_list_in_use = 1; - EINA_LIST_FOREACH_SAFE(s_info.update_list, l, n, item) { - if (!strcmp(filename, item->filename)) { - if (item->deleted || item->cb(filename, item->data, over) == EXIT_FAILURE || item->deleted) { - /* Item can be deleted from the callback, so need to check existence */ - s_info.update_list = eina_list_remove_list(s_info.update_list, l); - free(item->filename); - free(item); - } - cnt++; - } - } - s_info.update_list_in_use = 0; - - return cnt == 0 ? WIDGET_ERROR_INVALID_PARAMETER : WIDGET_ERROR_NONE; -} - -HAPI int update_monitor_trigger_delete_cb(const char *filename, int over) -{ - Eina_List *l; - Eina_List *n; - struct cb_item *item; - int cnt = 0; - - s_info.delete_list_in_use = 1; - EINA_LIST_FOREACH_SAFE(s_info.delete_list, l, n, item) { - if (!strcmp(filename, item->filename)) { - /* delete should be checked before call the callback & after call the callback */ - if (item->deleted || item->cb(filename, item->data, over) == EXIT_FAILURE || item->deleted) { - s_info.delete_list = eina_list_remove_list(s_info.delete_list, l); - free(item->filename); - free(item); - } - - cnt++; - } - } - s_info.delete_list_in_use = 0; - - return cnt == 0 ? WIDGET_ERROR_INVALID_PARAMETER : WIDGET_ERROR_NONE; -} - -HAPI int update_monitor_add_update_cb(const char *filename, - int (*cb)(const char *filename, void *data, int over), void *data) -{ - struct cb_item *item; - - item = calloc(1, sizeof(*item)); - if (!item) { - ErrPrint("calloc:%d\n", errno); - return WIDGET_ERROR_OUT_OF_MEMORY; - } - - item->filename = strdup(filename); - if (!item->filename) { - ErrPrint("strdup: %d\n", errno); - free(item); - return WIDGET_ERROR_OUT_OF_MEMORY; - } - item->cb = cb; - item->data = data; - - s_info.update_list = eina_list_append(s_info.update_list, item); - return WIDGET_ERROR_NONE; -} - -HAPI int update_monitor_add_delete_cb(const char *filename, - int (*cb)(const char *filename, void *data, int over), void *data) -{ - struct cb_item *item; - - item = calloc(1, sizeof(*item)); - if (!item) { - ErrPrint("calloc:%d", errno); - return WIDGET_ERROR_OUT_OF_MEMORY; - } - - item->filename = strdup(filename); - if (!item->filename) { - ErrPrint("strdup: %d\n", errno); - free(item); - return WIDGET_ERROR_OUT_OF_MEMORY; - } - - item->cb = cb; - item->data = data; - - s_info.delete_list = eina_list_append(s_info.delete_list, item); - return WIDGET_ERROR_NONE; -} - -HAPI void *update_monitor_del_update_cb(const char *filename, - int (*cb)(const char *filename, void *data, int over)) -{ - Eina_List *l; - struct cb_item *item; - - EINA_LIST_FOREACH(s_info.update_list, l, item) { - if (item->cb == cb && !strcmp(item->filename, filename)) { - return update_item_destroy(item, l); - } - } - - return NULL; -} - -HAPI void *update_monitor_del_delete_cb(const char *filename, - int (*cb)(const char *filename, void *data, int over)) -{ - Eina_List *l; - struct cb_item *item; - - EINA_LIST_FOREACH(s_info.delete_list, l, item) { - if (item->cb == cb && !strcmp(item->filename, filename)) { - return delete_item_destroy(item, l); - } - } - - return NULL; -} - -/* End of a file */ diff --git a/src/util.c b/src/util.c deleted file mode 100644 index 88694a0..0000000 --- a/src/util.c +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Copyright 2013 Samsung Electronics Co., Ltd - * - * Licensed under the Flora License, Version 1.1 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://floralicense.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 _GNU_SOURCE -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "critical_log.h" -#include "util.h" -#include "debug.h" -#include "conf.h" - -HAPI int util_check_ext(const char *icon, const char *ext) -{ - int len; - - len = strlen(icon) - 1; - while (len >= 0 && *ext && icon[len] == *ext) { - len--; - ext++; - } - - return *ext ? 0 : 1; -} - -HAPI int util_get_filesize(const char *filename) -{ - struct stat buf; - - if (stat(filename, &buf) < 0) { - ErrPrint("stat: %d\n", errno); - return WIDGET_ERROR_IO_ERROR; - } - - if (!S_ISREG(buf.st_mode)) { - ErrPrint("%s is not a file\n", filename); - return WIDGET_ERROR_INVALID_PARAMETER; - } - - return buf.st_size; -} - -HAPI double util_timestamp(void) -{ -#if defined(_USE_ECORE_TIME_GET) - return ecore_time_get(); -#else - struct timeval tv; - - if (gettimeofday(&tv, NULL) < 0) { - static unsigned long internal_count = 0; - - ErrPrint("gettimeofday: %d\n", errno); - tv.tv_sec = internal_count++; - tv.tv_usec = 0; - } - - return (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0f; -#endif -} - -HAPI const char *util_basename(const char *name) -{ - int length; - - length = name ? strlen(name) : 0; - if (!length) { - return "."; - } - - while (--length > 0 && name[length] != '/'); - - return length <= 0 ? name : name + length + (name[length] == '/'); -} - -/*! - * \note - * Just trying to find the nearest module. - * It could be wrong. - */ -HAPI char *util_get_current_module(char **symbol) -{ - int *stack; - Dl_info dinfo; - char *ret; - pthread_attr_t attr; - unsigned int stack_boundary = 0; - unsigned int stack_size = 0; - register int i; - - if (!pthread_getattr_np(pthread_self(), &attr)) { - if (!pthread_attr_getstack(&attr, (void *)&stack_boundary, &stack_size)) { - stack_boundary += stack_size; - } - pthread_attr_destroy(&attr); - } - - ret = NULL; - for (i = 0, stack = (int *)&stack; (unsigned int)stack < stack_boundary ; stack++, i++) { - if (!dladdr((void *)*stack, &dinfo)) { - continue; - } - - - ret = widget_service_get_widget_id_by_libexec(dinfo.dli_fname); - if (!ret) { - DbgPrint("[%d] fname[%s] symbol[%s]\n", i, dinfo.dli_fname, dinfo.dli_sname); - continue; - } - - free(ret); - ret = strdup(dinfo.dli_fname); - - if (symbol) { - if (dinfo.dli_sname) { - *symbol = strdup(dinfo.dli_sname); - } else { - *symbol = NULL; - } - } - break; - } - - return ret; -} - -HAPI const char *util_uri_to_path(const char *uri) -{ - int len; - - len = strlen(SCHEMA_FILE); - if (strncasecmp(uri, SCHEMA_FILE, len)) { - return NULL; - } - - return uri + len; -} - -HAPI double util_time_delay_for_compensation(double period) -{ - unsigned long long curtime; - unsigned long long _period; - unsigned long long remain; - struct timeval tv; - double ret; - - if (period == 0.0f) { - DbgPrint("Period is ZERO\n"); - return 0.0f; - } - - if (gettimeofday(&tv, NULL) < 0) { - ErrPrint("gettimeofday: %d\n", errno); - return period; - } - - curtime = (unsigned long long)tv.tv_sec * 1000000llu + (unsigned long long)tv.tv_usec; - - _period = (unsigned long long)(period * (double)1000000); - if (_period == 0llu) { - ErrPrint("%lf <> %llu\n", period, _period); - return period; - } - - remain = curtime % _period; - - ret = (double)remain / (double)1000000; - return period - ret; -} - -HAPI void *util_timer_add(double interval, Eina_Bool (*cb)(void *data), void *data) -{ - Ecore_Timer *timer; - double delay; - - timer = ecore_timer_add(interval, cb, data); - if (!timer) { - return NULL; - } - - delay = util_time_delay_for_compensation(interval) - interval; - ecore_timer_delay(timer, delay); - - return timer; -} - -HAPI void util_timer_interval_set(void *timer, double interval) -{ - double delay; - ecore_timer_interval_set(timer, interval); - ecore_timer_reset(timer); - - delay = util_time_delay_for_compensation(interval) - interval; - ecore_timer_delay(timer, delay); -} - -static int dump_so_info_cb(struct dl_phdr_info *info, size_t size, void *data) -{ - if (data && info->dlpi_name && !strcmp(data, info->dlpi_name)) { - register int i; - ErrPrint("Base Address of %s [%p]\n", util_basename(info->dlpi_name), info->dlpi_addr); - for (i = 0; i < info->dlpi_phnum; i++) { - ErrPrint("type[%x] off[%x] vaddr[%lx] paddr[%lx] fsz[%x] msz[%x] f[%x] align[%x]\n", - info->dlpi_phdr[i].p_type, - info->dlpi_phdr[i].p_offset, - info->dlpi_phdr[i].p_vaddr, - info->dlpi_phdr[i].p_paddr, - info->dlpi_phdr[i].p_filesz, - info->dlpi_phdr[i].p_memsz, - info->dlpi_phdr[i].p_flags, - info->dlpi_phdr[i].p_align); - } - } - - return 0; -} - -HAPI void util_dump_current_so_info(const char *path) -{ - (void)dl_iterate_phdr(dump_so_info_cb, (void *)path); -} - -/* End of a file */ diff --git a/src/util_wayland.c b/src/util_wayland.c deleted file mode 100644 index 7ed8c75..0000000 --- a/src/util_wayland.c +++ /dev/null @@ -1,27 +0,0 @@ -#include "util.h" - -#include - -void *util_screen_get(void) -{ - return NULL; -} - -int util_screen_size_get(int *width, int *height) -{ - *width = 0; - *height = 0; - return WIDGET_ERROR_NOT_SUPPORTED; -} - -int util_screen_init(void) -{ - return WIDGET_ERROR_NONE; -} - -int util_screen_fini(void) -{ - return WIDGET_ERROR_NONE; -} - -/* End of a file */ diff --git a/src/util_x11.c b/src/util_x11.c deleted file mode 100644 index 0014a2b..0000000 --- a/src/util_x11.c +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include - -#include -#include "util.h" -#include "debug.h" - -void *util_screen_get(void) -{ - return ecore_x_display_get(); -} - -int util_screen_size_get(int *width, int *height) -{ - ecore_x_window_size_get(0, width, height); - return WIDGET_ERROR_NONE; -} - -int util_screen_init(void) -{ - return ecore_x_init(NULL); -} - -int util_screen_fini(void) -{ - return ecore_x_shutdown(); -} - -/* End of a file */ - diff --git a/src/widget.c b/src/widget.c deleted file mode 100644 index 671f8ec..0000000 --- a/src/widget.c +++ /dev/null @@ -1,2701 +0,0 @@ -/* - * Copyright 2013 Samsung Electronics Co., Ltd - * - * Licensed under the Flora License, Version 1.1 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://floralicense.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 -#include /* exit */ -#include -#include /* access */ - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "critical_log.h" -#include "debug.h" -#include "so_handler.h" -#include "widget.h" -#include "update_monitor.h" -#include "fault.h" -#include "util.h" -#include "connection.h" -#include "conf.h" - -#if defined(_ESTIMATE_PERF) -#define ESTIMATE_START(id) DbgPrint("%s START\n", id); -#define ESTIMATE_END(id) DbgPrint("%s END\n", id); -#else -#define ESTIMATE_START(id) -#define ESTIMATE_END(id) -#endif - -#define IS_WIDGET_SHOWN(itm) (!(itm)->inst->item->has_widget_script || ((itm)->inst->item->has_widget_script && (itm)->is_widget_show)) - -int errno; - -#define UPDATE_ITEM_DELETED (-1) -#define UPDATE_INVOKED (-2) -#define UPDATE_NOT_INVOKED (0) - -enum gbar_open_state { - GBAR_IS_OPENED_BUT_NOT_MINE = -1, - GBAR_IS_NOT_OPENED = 0, - GBAR_IS_OPENED = 1, -}; - -enum state { - STATE_UNKNOWN = 0, - STATE_RESUMED = 1, - STATE_PAUSED = 2 -}; - -struct item { - Ecore_Timer *timer; - struct instance *inst; - int monitor_cnt; - Ecore_Timer *monitor; - int deleteme; - double update_interval; - int heavy_updating; /* Only for debugging message */ - enum state state; /* 1 is paused, 0 is resumed */ - double sleep_at; - - unsigned int updated_in_pause; - - int is_widget_show; - int is_gbar_show; - int is_widget_updated; - int unload_so; - Eina_List *direct_path_list; -}; - -static struct info { - Eina_List *item_list; - Eina_List *force_update_list; - Eina_List *update_list; - Eina_List *pending_list; - Eina_List *hidden_list; - Ecore_Timer *force_update_timer; - Ecore_Timer *pending_timer; - Eina_List *gbar_open_pending_list; - Ecore_Timer *gbar_open_pending_timer; - enum state state; - Eina_List *gbar_list; - int secured; - int pending_timer_freezed; - int force_timer_freezed; -} s_info = { - .item_list = NULL, - .force_update_list = NULL, - .update_list = NULL, - .pending_list = NULL, - .hidden_list = NULL, - .force_update_timer = NULL, - .pending_timer = NULL, - .gbar_open_pending_list = NULL, - .gbar_open_pending_timer = NULL, - .state = STATE_UNKNOWN, - .gbar_list = NULL, - .secured = 0, - .pending_timer_freezed = 0, - .force_timer_freezed = 0, -}; - -static Eina_Bool updator_cb(void *data); -static inline void update_monitor_del(const char *id, struct item *item); -static int append_force_update_list(struct item *item); -static void reset_widget_updated_flag(struct item *item); -static int append_pending_list(struct item *item); - -static void pending_timer_freeze(void) -{ - DbgPrint("Freezed Count: %d\n", s_info.pending_timer_freezed); - if (!s_info.pending_timer) { - return; - } - - if (!s_info.pending_timer_freezed) { - DbgPrint("Freeze the pending timer\n"); - ecore_timer_freeze(s_info.pending_timer); - } - - s_info.pending_timer_freezed++; -} - -static void pending_timer_thaw(void) -{ - DbgPrint("Freezed Count: %d\n", s_info.pending_timer_freezed); - if (!s_info.pending_timer_freezed) { - return; - } - - if (!s_info.pending_timer) { - s_info.pending_timer_freezed = 0; - return; - } - - s_info.pending_timer_freezed--; - if (!s_info.pending_timer_freezed) { - DbgPrint("Thaw the pending timer\n"); - ecore_timer_thaw(s_info.pending_timer); - } -} - -static void force_timer_freeze(void) -{ - DbgPrint("Freeze force timer: %d\n", s_info.force_timer_freezed); - if (!s_info.force_update_timer) { - return; - } - - if (!s_info.force_timer_freezed) { - DbgPrint("Force timer freezed\n"); - ecore_timer_freeze(s_info.force_update_timer); - } - - s_info.force_timer_freezed++; -} - -static void force_timer_thaw(void) -{ - DbgPrint("Freezed force count: %d\n", s_info.force_timer_freezed); - if (!s_info.force_timer_freezed) { - return; - } - - if (!s_info.force_update_timer) { - s_info.force_timer_freezed = 0; - return; - } - - s_info.force_timer_freezed--; - if (!s_info.force_timer_freezed) { - DbgPrint("Thaw the force timer\n"); - ecore_timer_thaw(s_info.force_update_timer); - } -} - -/* - * -1 : GBAR is opened, but not mine - * 0 : GBAR is not opened - * 1 : my GBAR is opened - */ -static inline enum gbar_open_state gbar_is_opened(const char *pkgname) -{ - int i; - Eina_List *l; - struct instance *inst; - - i = 0; - EINA_LIST_FOREACH(s_info.gbar_list, l, inst) { - if (pkgname && !strcmp(pkgname, inst->item->pkgname)) { - return GBAR_IS_OPENED; - } - - i++; - } - - return i > 0 ? GBAR_IS_OPENED_BUT_NOT_MINE : GBAR_IS_NOT_OPENED; -} - -static Eina_Bool gbar_open_pended_cmd_consumer_cb(void *data) -{ - struct item *item; - - item = eina_list_nth(s_info.gbar_open_pending_list, 0); - if (!item) { - goto cleanout; - } - - if (eina_list_data_find(s_info.update_list, item)) { - return ECORE_CALLBACK_RENEW; - } - - s_info.gbar_open_pending_list = eina_list_remove(s_info.gbar_open_pending_list, item); - /*! - * \note - * To prevent from checking the is_updated function - */ - if (updator_cb(item) == ECORE_CALLBACK_CANCEL) { - /* Item is destroyed */ - } - - if (s_info.gbar_open_pending_list) { - return ECORE_CALLBACK_RENEW; - } - -cleanout: - s_info.gbar_open_pending_timer = NULL; - return ECORE_CALLBACK_CANCEL; -} - -static Eina_Bool update_timeout_cb(void *data) -{ - struct item *item; - - item = data; - - ErrPrint("UPDATE TIMEOUT ========> %s - %s\n", item->inst->item->pkgname, item->inst->id); - - if (!eina_list_data_find(s_info.update_list, item)) { - ErrPrint("Updating item is not matched\n"); - } - - fault_unmark_call(item->inst->item->pkgname, item->inst->id, "update,crashed", NO_ALARM); - fault_mark_call(item->inst->item->pkgname, item->inst->id, "update,timeout", NO_ALARM, DEFAULT_LIFE_TIMER); - s_info.update_list = eina_list_remove(s_info.update_list, item); - - exit(ETIME); - return ECORE_CALLBACK_CANCEL; -} - -static inline void update_monitor_cnt(struct item *item) -{ - double now; - double interval; - - now = util_timestamp(); - interval = now - item->update_interval; - - /*! - * \note - * If the content update is processed in too short time, - * don't increase the monitor counter, instead of it - * set the heavy updating flag. - * And handling this heavy updating from the - * file update callback. - */ - if (interval >= MINIMUM_UPDATE_INTERVAL) { - if (eina_list_data_find(s_info.update_list, item)) { - /*! - * \note - * If already in updating mode, - * reset the monitor_cnt to 1, - * all updated event will be merged into A inotify event - */ - DbgPrint("While waiting updated event, content is updated [%s]\n", item->inst->id); - item->monitor_cnt = 1; - } else { - item->monitor_cnt++; - } - } else { - item->heavy_updating = 1; - } - - item->update_interval = now; -} - -static inline void do_force_update(struct item *item) -{ - int ret; - - if (item->monitor) { /*!< If this item is already in update process */ - return; - } - - if (!IS_WIDGET_SHOWN(item)) { - DbgPrint("%s is not shown yet. it will be added to normal pending list\n", item->inst->item->pkgname); - (void)append_force_update_list(item); - return; - } - - if (item->state != STATE_RESUMED) { - DbgPrint("Item is paused. but it will be updated forcely(%s)\n", item->inst->item->pkgname); - } - - item->updated_in_pause = 0; - - ret = so_is_updated(item->inst); - if (ret <= 0) { - if (so_need_to_destroy(item->inst) == WIDGET_NEED_TO_DESTROY) { - widget_provider_send_deleted(item->inst->item->pkgname, item->inst->id); - widget_destroy(item->inst->item->pkgname, item->inst->id, WIDGET_DESTROY_TYPE_DEFAULT); - /*! - * \CRITICAL - * Every caller of this, must not access the item from now. - */ - return; - } - - reset_widget_updated_flag(item); - return; - } - - /*! - * \note - * Check the update_list, if you want make serialized update - */ - if (/*s_info.update_list || */gbar_is_opened(item->inst->item->pkgname) == GBAR_IS_OPENED_BUT_NOT_MINE) { - DbgPrint("%s is busy, migrate to normal pending list\n", item->inst->id); - (void)append_pending_list(item); - return; - } - - item->monitor = ecore_timer_add(item->inst->item->timeout, update_timeout_cb, item); - if (!item->monitor) { - ErrPrint("Failed to add update monitor %s(%s):%d\n", - item->inst->item->pkgname, item->inst->id, item->inst->item->timeout); - return; - } - - ret = so_update(item->inst); - if (ret < 0) { - ecore_timer_del(item->monitor); - item->monitor = NULL; - reset_widget_updated_flag(item); - return; - } - - /*! - * \note - * Counter of the event monitor is only used for asynchronous content updating, - * So reset it to 1 from here because the async updating is started now, - * even if it is accumulated by other event function before this. - */ - item->monitor_cnt = 1; - - /*! - * \note - * While waiting the Callback function call, - * Add this for finding the crash - */ - fault_mark_call(item->inst->item->pkgname, item->inst->id, "update,crashed", NO_ALARM, DEFAULT_LIFE_TIMER); - - if (ret & WIDGET_NEED_TO_SCHEDULE) { - (void)append_pending_list(item); - } - - if (ret & WIDGET_FORCE_TO_SCHEDULE) { - DbgPrint("%s Return WIDGET_NEED_TO_FORCE_SCHEDULE\n", item->inst->item->pkgname); - (void)append_force_update_list(item); - } - - if (ret & WIDGET_OUTPUT_UPDATED) { - /*! - * \NOTE - * In this case, there is potential issue - * 1. User added update CALLBACK -> Inotify event (Only once) - * > We have to detect this case. Is it possible to be a user callback called faster than inotify event handler? - * 2. Inotify event -> User added update CALLBACK -> Inotify event - * > Okay. What we want is this. - */ - update_monitor_cnt(item); - } - - /* - * \NOTE - * This should be updated after "update_monitor_cnt" function call, - * because the update_monitor_cnt function will see the s_info.update variable, - */ - s_info.update_list = eina_list_append(s_info.update_list, item); - - return; -} - -static Eina_Bool force_update_cb(void *data) -{ - struct item *item; - - item = eina_list_nth(s_info.force_update_list, 0); - if (!item) { - goto cleanout; - } - - s_info.force_update_list = eina_list_remove(s_info.force_update_list, item); - - do_force_update(item); - - if (s_info.force_update_list) { - return ECORE_CALLBACK_RENEW; - } - -cleanout: - s_info.force_update_timer = NULL; - return ECORE_CALLBACK_CANCEL; -} - -static inline __attribute__((always_inline)) int activate_force_update_consumer(void) -{ - if (s_info.force_update_timer) { - return WIDGET_ERROR_NONE; - } - - s_info.force_update_timer = ecore_timer_add(0.000001f, force_update_cb, NULL); - if (!s_info.force_update_timer) { - ErrPrint("Failed to add a new force update timer\n"); - return WIDGET_ERROR_FAULT; - } - - DbgPrint("Force update timer is registered\n"); - - return WIDGET_ERROR_NONE; -} - -static inline void deactivate_force_update_consumer(void) -{ - if (!s_info.force_update_timer) { - return; - } - - ecore_timer_del(s_info.force_update_timer); - s_info.force_update_timer = NULL; - - DbgPrint("Force update timer is deleted\n"); -} - -static Eina_Bool pended_cmd_consumer_cb(void *data) -{ - struct item *item; - - item = eina_list_nth(s_info.pending_list, 0); - if (!item) { - goto cleanout; - } - - if (eina_list_data_find(s_info.update_list, item) || gbar_is_opened(item->inst->item->pkgname) == GBAR_IS_OPENED_BUT_NOT_MINE) { - return ECORE_CALLBACK_RENEW; - } - - s_info.pending_list = eina_list_remove(s_info.pending_list, item); - /*! - * \note - * To prevent from checking the is_updated function - */ - if (updator_cb(item) == ECORE_CALLBACK_CANCEL) { - /* item is destroyed */ - } - - if (s_info.pending_list) { - return ECORE_CALLBACK_RENEW; - } - -cleanout: - s_info.pending_timer = NULL; - s_info.pending_timer_freezed = 0; - return ECORE_CALLBACK_CANCEL; -} - -static inline __attribute__((always_inline)) int activate_pending_consumer(void) -{ - if (s_info.pending_timer) { - return WIDGET_ERROR_NONE; - } - - s_info.pending_timer = ecore_timer_add(0.000001f, pended_cmd_consumer_cb, NULL); - if (!s_info.pending_timer) { - ErrPrint("Failed to add a new pended command consumer\n"); - return WIDGET_ERROR_FAULT; - } - - /*! - * Do not increase the freezed counter. - * Just freeze the timer. - */ - if (s_info.pending_timer_freezed) { - ecore_timer_freeze(s_info.pending_timer); - } - - return WIDGET_ERROR_NONE; -} - -static inline void deactivate_pending_consumer(void) -{ - if (!s_info.pending_timer) { - return; - } - - ecore_timer_del(s_info.pending_timer); - s_info.pending_timer = NULL; - s_info.pending_timer_freezed = 0; -} - -static inline void deactivate_gbar_open_pending_consumer(void) -{ - if (!s_info.gbar_open_pending_timer) { - return; - } - - ecore_timer_del(s_info.gbar_open_pending_timer); - s_info.gbar_open_pending_timer = NULL; -} - -static inline int __attribute__((always_inline)) activate_gbar_open_pending_consumer(void) -{ - if (s_info.gbar_open_pending_timer) { - return 0; - } - - s_info.gbar_open_pending_timer = ecore_timer_add(0.000001f, gbar_open_pended_cmd_consumer_cb, NULL); - if (!s_info.gbar_open_pending_timer) { - ErrPrint("Failed to add a new pended command consumer\n"); - return WIDGET_ERROR_FAULT; - } - - return 0; -} - -static inline void migrate_to_gbar_open_pending_list(const char *pkgname) -{ - Eina_List *l; - Eina_List *n; - struct item *item; - int cnt = 0; - - EINA_LIST_FOREACH_SAFE(s_info.pending_list, l, n, item) { - if (strcmp(pkgname, item->inst->item->pkgname)) { - continue; - } - - s_info.pending_list = eina_list_remove(s_info.pending_list, item); - s_info.gbar_open_pending_list = eina_list_append(s_info.gbar_open_pending_list, item); - cnt++; - } - - /*! - * These items will be moved to the pending list after the GBAR is closed. - * Force list -> pd open list -> pending list. - * So there is no way to go back to the foce update list again. - * - * \warning - * the ITEM must only exists in one list, pending list or force_update_list - * It is not accepted to exists in two list at same time. - */ - EINA_LIST_FOREACH_SAFE(s_info.force_update_list, l, n, item) { - if (strcmp(pkgname, item->inst->item->pkgname)) { - continue; - } - - s_info.force_update_list = eina_list_remove(s_info.force_update_list, item); - s_info.gbar_open_pending_list = eina_list_append(s_info.gbar_open_pending_list, item); - cnt++; - } - - if (s_info.gbar_open_pending_list) { - activate_gbar_open_pending_consumer(); - } - - if (!s_info.pending_list) { - deactivate_pending_consumer(); - } - - if (!s_info.force_update_list) { - deactivate_force_update_consumer(); - } -} - -static inline void migrate_to_pending_list(const char *pkgname) -{ - Eina_List *l; - Eina_List *n; - struct item *item; - int cnt = 0; - - EINA_LIST_FOREACH_SAFE(s_info.gbar_open_pending_list, l, n, item) { - if (strcmp(pkgname, item->inst->item->pkgname)) { - continue; - } - - s_info.gbar_open_pending_list = eina_list_remove(s_info.gbar_open_pending_list, item); - s_info.pending_list = eina_list_append(s_info.pending_list, item); - cnt++; - } - - if (s_info.pending_list) { - activate_pending_consumer(); - } - - if (!s_info.gbar_open_pending_list) { - deactivate_gbar_open_pending_consumer(); - } -} - -static inline int is_pended_item(struct item *item) -{ - struct item *in_item; - if (gbar_is_opened(item->inst->item->pkgname) == GBAR_IS_OPENED) { - in_item = eina_list_data_find(s_info.gbar_open_pending_list, item); - } else { - in_item = eina_list_data_find(s_info.pending_list, item); - } - - return (in_item == item); -} - -static int append_pending_list(struct item *item) -{ - if (item->deleteme) { - DbgPrint("Item will be deleted, ignore update request: %s\n", item->inst->id); - return WIDGET_ERROR_RESOURCE_BUSY; - } - - if (eina_list_data_find(s_info.force_update_list, item)) { - DbgPrint("Already exists in force list\n"); - return WIDGET_ERROR_NONE; - } - - if (gbar_is_opened(item->inst->item->pkgname) == GBAR_IS_OPENED) { - if (eina_list_data_find(s_info.gbar_open_pending_list, item) == item) { - DbgPrint("Already pended - %s\n", item->inst->item->pkgname); - return WIDGET_ERROR_ALREADY_EXIST; - } - - if (activate_gbar_open_pending_consumer() < 0) { - ErrPrint("Failed to activate GBAR open pending consumer\n"); - return WIDGET_ERROR_FAULT; - } - - s_info.gbar_open_pending_list = eina_list_append(s_info.gbar_open_pending_list, item); - } else { - if (eina_list_data_find(s_info.pending_list, item) == item) { - DbgPrint("Already pended - %s\n", item->inst->item->pkgname); - return WIDGET_ERROR_ALREADY_EXIST; - } - - if (IS_WIDGET_SHOWN(item)) { - if (activate_pending_consumer() < 0) { - return WIDGET_ERROR_FAULT; - } - - s_info.pending_list = eina_list_append(s_info.pending_list, item); - } else { - if (eina_list_data_find(s_info.hidden_list, item) == item) { - DbgPrint("Already in hidden list - %s\n", item->inst->item->pkgname); - return WIDGET_ERROR_ALREADY_EXIST; - } - - s_info.hidden_list = eina_list_append(s_info.hidden_list, item); - } - } - - return WIDGET_ERROR_NONE; -} - -static inline int clear_from_pending_list(struct item *item) -{ - Eina_List *l; - struct item *tmp; - - EINA_LIST_FOREACH(s_info.pending_list, l, tmp) { - if (tmp != item) { - continue; - } - - s_info.pending_list = eina_list_remove_list(s_info.pending_list, l); - if (!s_info.pending_list) { - deactivate_pending_consumer(); - } - return WIDGET_ERROR_NONE; - } - - return WIDGET_ERROR_NOT_EXIST; -} - -static int append_force_update_list(struct item *item) -{ - if (item->deleteme) { - DbgPrint("Item will be deleted, ignore force update request: %s\n", item->inst->id); - return WIDGET_ERROR_RESOURCE_BUSY; - } - - /*! - * If the item is already in pending list, remove it. - */ - clear_from_pending_list(item); - - if (gbar_is_opened(item->inst->item->pkgname) == GBAR_IS_OPENED) { - if (eina_list_data_find(s_info.gbar_open_pending_list, item) == item) { - DbgPrint("Already pended - %s\n", item->inst->item->pkgname); - return WIDGET_ERROR_ALREADY_EXIST; - } - - if (activate_gbar_open_pending_consumer() < 0) { - ErrPrint("Failed to activate GBAR open pending consumer\n"); - return WIDGET_ERROR_FAULT; - } - - s_info.gbar_open_pending_list = eina_list_append(s_info.gbar_open_pending_list, item); - } else { - if (eina_list_data_find(s_info.force_update_list, item)) { - DbgPrint("Already in force update list\n"); - return WIDGET_ERROR_NONE; - } - - if (IS_WIDGET_SHOWN(item)) { - if (activate_force_update_consumer() < 0) { - return WIDGET_ERROR_FAULT; - } - - s_info.force_update_list = eina_list_append(s_info.force_update_list, item); - } else { - if (eina_list_data_find(s_info.hidden_list, item) == item) { - DbgPrint("Already in hidden list - %s\n", item->inst->id); - return WIDGET_ERROR_ALREADY_EXIST; - } - - s_info.hidden_list = eina_list_append(s_info.hidden_list, item); - - DbgPrint("forced item is moved to hidden_list - %s\n", item->inst->id); - } - } - - return WIDGET_ERROR_NONE; -} - -static inline int clear_from_force_update_list(struct item *item) -{ - Eina_List *l; - struct item *tmp; - - EINA_LIST_FOREACH(s_info.force_update_list, l, tmp) { - if (tmp != item) { - continue; - } - - s_info.force_update_list = eina_list_remove_list(s_info.force_update_list, l); - if (!s_info.force_update_list) { - deactivate_force_update_consumer(); - } - - return WIDGET_ERROR_NONE; - } - - return WIDGET_ERROR_NOT_EXIST; -} - -static inline void migrate_to_pending_list_from_hidden_list(struct item *item) -{ - if (!eina_list_data_find(s_info.hidden_list, item)) { - return; - } - - s_info.hidden_list = eina_list_remove(s_info.hidden_list, item); - append_pending_list(item); -} - -/*! - * \brief - * This function can call the update callback - * return 0 if there is no changes - * return -1 the item is deleted - */ -static inline int timer_thaw(struct item *item) -{ - double pending; - double period; - double delay; - double sleep_time; - - if (!item->timer) { - return 0; - } - - ecore_timer_thaw(item->timer); - period = ecore_timer_interval_get(item->timer); - pending = ecore_timer_pending_get(item->timer); - delay = util_time_delay_for_compensation(period) - pending; - ecore_timer_delay(item->timer, delay); - - if (item->sleep_at == 0.0f) { - return 0; - } - - sleep_time = util_timestamp() - item->sleep_at; - item->sleep_at = 0.0f; - - if (sleep_time > pending) { - - /*! - * Before do updating forcely, clear it from the pending list. - * We will consume it from here now. - */ - (void)clear_from_pending_list(item); - - if (updator_cb(item) == ECORE_CALLBACK_CANCEL) { - /* item is destroyed */ - return UPDATE_ITEM_DELETED; - } else { - return UPDATE_INVOKED; - } - } - - return UPDATE_NOT_INVOKED; -} - -static void timer_freeze(struct item *item) -{ - if (!item->timer) { - return; - } - - ecore_timer_freeze(item->timer); - - if (ecore_timer_interval_get(item->timer) <= 1.0f) { - return; - } - -#if defined(_USE_ECORE_TIME_GET) - item->sleep_at = ecore_time_get(); -#else - struct timeval tv; - if (gettimeofday(&tv, NULL) < 0) { - ErrPrint("gettimeofday: %d\n", errno); - tv.tv_sec = 0; - tv.tv_usec = 0; - } - - item->sleep_at = (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0f; -#endif -} - -static inline Eina_List *find_item(struct instance *inst) -{ - Eina_List *l; - struct item *item; - - EINA_LIST_FOREACH(s_info.item_list, l, item) { - if (item->inst == inst) { - return l; - } - } - - return NULL; -} - -static int desc_updated_cb(const char *filename, void *data, int over) -{ - struct item *item; - - if (over) { - WarnPrint("Event Q overflow\n"); - } - - item = data; - - DbgPrint("DESC %s is updated\n", filename); - if (item->is_gbar_show) { - widget_damage_region_s region = { - .x = 0, - .y = 0, - .w = item->inst->w, - .h = item->inst->h, - }; - - widget_provider_send_updated(item->inst->item->pkgname, item->inst->id, WIDGET_PRIMARY_BUFFER, ®ion, 1, filename); - } else { - ErrPrint("But GBAR is not opened, Ignore this update (%s)\n", item->inst->id); - } - return EXIT_SUCCESS; -} - -static inline int output_handler(struct item *item) -{ - int invalid = 0; - - item->monitor_cnt--; - if (item->monitor_cnt < 0 || item->heavy_updating) { - if (!item->heavy_updating) { - WarnPrint("%s has invalid monitor_cnt\n", item->inst->id); - invalid = 1; - } else { - item->heavy_updating = 0; /* Reset flag */ - } - - item->monitor_cnt = 0; - } - - if (item->monitor_cnt == 0) { - if (!invalid) { - fault_unmark_call(item->inst->item->pkgname, item->inst->id, "update,crashed", NO_ALARM); - } - - if (item->monitor) { - ecore_timer_del(item->monitor); - item->monitor = NULL; - } - - s_info.update_list = eina_list_remove(s_info.update_list, item); - - if (item->deleteme) { - update_monitor_del(item->inst->id, item); - widget_provider_send_deleted(item->inst->item->pkgname, item->inst->id); - (void)so_destroy(item->inst, item->unload_so); - free(item); - return EXIT_FAILURE; - } - } - - return EXIT_SUCCESS; -} - -static int file_updated_cb(const char *filename, void *data, int over) -{ - struct item *item; - int w; - int h; - double priority; - char *content = NULL; - char *title = NULL; - int ret; - char *icon = NULL; - char *name = NULL; - - if (over) { - WarnPrint("Event Q overflow\n"); - } - - item = data; - - if (item->deleteme) { - DbgPrint("Item is in deleting process. (%s)\n", filename); - goto out; - } - - ESTIMATE_START(item->inst->id); - - ret = util_get_filesize(filename); - if (ret <= 0) { - ErrPrint("Content is updated. but invalid. ret = %d (Update is ignored)\n", ret); - ESTIMATE_END(item->inst->id); - return EXIT_SUCCESS; /*!< To keep the callback */ - } - - ret = so_get_output_info(item->inst, &w, &h, &priority, &content, &title); - if (ret < 0) { - ErrPrint("widget_get_info returns %d\n", ret); - ESTIMATE_END(item->inst->id); - return EXIT_SUCCESS; /*!< To keep the callback */ - } - - /** - * Alternative information can be NOT_IMPLEMENTED - * And we can ignore its error. - */ - ret = so_get_alt_info(item->inst, &icon, &name); - if (ret < 0) { - ErrPrint("widget_get_alt_info returns %d (ignored)\n", ret); - } - - if (IS_WIDGET_SHOWN(item)) { - widget_damage_region_s region = { - .x = 0, - .y = 0, - .w = item->inst->w, - .h = item->inst->h, - }; - /** - * If the content is not written on shared buffer (pixmap, shm, raw file, ...) - * We cannot use the direct path for sending updated event. - */ - widget_provider_send_extra_info(item->inst->item->pkgname, item->inst->id, item->inst->priority, - content, title, item->inst->icon, item->inst->name); - widget_provider_send_updated(item->inst->item->pkgname, item->inst->id, WIDGET_PRIMARY_BUFFER, ®ion, 0, NULL); - } else { - item->is_widget_updated++; - } - - ESTIMATE_END(item->inst->id); -out: - return output_handler(item); -} - -static void reset_widget_updated_flag(struct item *item) -{ - widget_damage_region_s region = { - .x = 0, - .y = 0, - .w = item->inst->w, - .h = item->inst->h, - }; - - if (!item->is_widget_updated) { - return; - } - - DbgPrint("[%s] Updated %d times, (content: %s), (title: %s)\n", - item->inst->id, item->is_widget_updated, - item->inst->content, item->inst->title); - - /** - * If the content is not written on shared buffer (pixmap, shm, raw file, ...) - * We cannot use the direct path for sending updated event. - */ - widget_provider_send_extra_info(item->inst->item->pkgname, item->inst->id, item->inst->priority, - item->inst->content, item->inst->title, item->inst->icon, item->inst->name); - widget_provider_send_updated(item->inst->item->pkgname, item->inst->id, WIDGET_PRIMARY_BUFFER, ®ion, 0, NULL); - - item->is_widget_updated = 0; -} - -static inline int clear_from_gbar_open_pending_list(struct item *item) -{ - Eina_List *l; - struct item *tmp; - - EINA_LIST_FOREACH(s_info.gbar_open_pending_list, l, tmp) { - if (tmp != item) { - continue; - } - - s_info.gbar_open_pending_list = eina_list_remove_list(s_info.gbar_open_pending_list, l); - if (!s_info.gbar_open_pending_list) { - deactivate_gbar_open_pending_consumer(); - } - return WIDGET_ERROR_NONE; - } - - return WIDGET_ERROR_NOT_EXIST; -} - -/*! - * \note - * This must has to return ECORE_CALLBACK_CANCEL, only if the item is deleted. - * So every caller, should manage the deleted item correctly. - */ -static Eina_Bool updator_cb(void *data) -{ - struct item *item; - int ret; - - item = data; - - if (item->monitor) { /*!< If this item is already in update process */ - return ECORE_CALLBACK_RENEW; - } - - if (!IS_WIDGET_SHOWN(item)) { - DbgPrint("%s is not shown yet. make delay for updates\n", item->inst->item->pkgname); - (void)append_pending_list(item); - return ECORE_CALLBACK_RENEW; - } - - if (item->state != STATE_RESUMED) { - item->updated_in_pause++; - DbgPrint("%s is paused[%d]. make delay for updating\n", item->inst->item->pkgname, item->updated_in_pause); - return ECORE_CALLBACK_RENEW; - } - - item->updated_in_pause = 0; - - ret = so_is_updated(item->inst); - if (ret <= 0) { - if (so_need_to_destroy(item->inst) == WIDGET_NEED_TO_DESTROY) { - widget_provider_send_deleted(item->inst->item->pkgname, item->inst->id); - widget_destroy(item->inst->item->pkgname, item->inst->id, WIDGET_DESTROY_TYPE_DEFAULT); - /*! - * \CRITICAL - * Every caller of this, must not access the item from now. - */ - return ECORE_CALLBACK_CANCEL; - } - - reset_widget_updated_flag(item); - return ECORE_CALLBACK_RENEW; - } - - /*! - * \note - * Check the update_list, if you want make serialized update - */ - if (/*s_info.update_list || */gbar_is_opened(item->inst->item->pkgname) == GBAR_IS_OPENED_BUT_NOT_MINE) { - DbgPrint("%s is busy\n", item->inst->id); - (void)append_pending_list(item); - return ECORE_CALLBACK_RENEW; - } - - item->monitor = ecore_timer_add(item->inst->item->timeout, update_timeout_cb, item); - if (!item->monitor) { - ErrPrint("Failed to add update monitor %s(%s):%d\n", - item->inst->item->pkgname, item->inst->id, item->inst->item->timeout); - return ECORE_CALLBACK_RENEW; - } - - ret = so_update(item->inst); - if (ret < 0) { - ecore_timer_del(item->monitor); - item->monitor = NULL; - reset_widget_updated_flag(item); - return ECORE_CALLBACK_RENEW; - } - - /*! - * \note - * Counter of the event monitor is only used for asynchronous content updating, - * So reset it to 1 from here because the async updating is started now, - * even if it is accumulated by other event function before this. - */ - item->monitor_cnt = 1; - - /*! - * \note - * While waiting the Callback function call, - * Add this for finding the crash - */ - fault_mark_call(item->inst->item->pkgname, item->inst->id, "update,crashed", NO_ALARM, DEFAULT_LIFE_TIMER); - - if (ret & WIDGET_NEED_TO_SCHEDULE) { - (void)append_pending_list(item); - } - - if (ret & WIDGET_FORCE_TO_SCHEDULE) { - DbgPrint("%s Return WIDGET_NEED_TO_FORCE_SCHEDULE\n", item->inst->item->pkgname); - (void)append_force_update_list(item); - } - - if (ret & WIDGET_OUTPUT_UPDATED) { - /*! - * \NOTE - * In this case, there is potential issue - * 1. User added update CALLBACK -> Inotify event (Only once) - * > We have to detect this case. Is it possible to be a user callback called faster than inotify event handler? - * 2. Inotify event -> User added update CALLBACK -> Inotify event - * > Okay. What we want is this. - */ - update_monitor_cnt(item); - } - - /* - * \NOTE - * This should be updated after "update_monitor_cnt" function call, - * because the update_monitor_cnt function will see the s_info.update variable, - */ - s_info.update_list = eina_list_append(s_info.update_list, item); - - return ECORE_CALLBACK_RENEW; -} - -static inline void update_monitor_del(const char *id, struct item *item) -{ - char *tmp; - int len; - - tmp = (char *)util_uri_to_path(id); - if (!tmp) { - ErrPrint("Invalid parameter\n"); - return; - } - - update_monitor_del_update_cb(tmp, file_updated_cb); - - len = strlen(tmp) + strlen(".desc") + 1; - tmp = malloc(len); - if (!tmp) { - ErrPrint("malloc: %d (%s.desc)\n", errno, util_uri_to_path(id)); - return; - } - - snprintf(tmp, len, "%s.desc", util_uri_to_path(id)); - update_monitor_del_update_cb(tmp, desc_updated_cb); - free(tmp); -} - -static inline int add_desc_update_monitor(const char *id, struct item *item) -{ - char *filename; - int len; - int ret; - - len = strlen(util_uri_to_path(id)) + strlen(".desc") + 1; - filename = malloc(len); - if (!filename) { - ErrPrint("malloc: %d (%s.desc)\n", errno, util_uri_to_path(id)); - return WIDGET_ERROR_OUT_OF_MEMORY; - } - - snprintf(filename, len, "%s.desc", util_uri_to_path(id)); - ret = update_monitor_add_update_cb(filename, desc_updated_cb, item); - free(filename); - return ret; -} - -static inline int add_file_update_monitor(const char *id, struct item *item) -{ - return update_monitor_add_update_cb(util_uri_to_path(id), file_updated_cb, item); -} - -static inline int update_monitor_add(const char *id, struct item *item) -{ - /*! - * \NOTE - * item->inst is not available yet. - */ - add_file_update_monitor(id, item); - add_desc_update_monitor(id, item); - return WIDGET_ERROR_NONE; -} - -static int disconnected_cb(int handle, void *data) -{ - Eina_List *l; - Eina_List *k; - Eina_List *n; - struct item *item; - struct connection *connection; - struct connection *conn_handle; - - connection = connection_find_by_fd(handle); - if (!connection) { - return 0; - } - - EINA_LIST_FOREACH(s_info.item_list, l, item) { - EINA_LIST_FOREACH_SAFE(item->direct_path_list, k, n, conn_handle) { - if (conn_handle == connection) { - item->direct_path_list = eina_list_remove(item->direct_path_list, conn_handle); - (void)connection_unref(conn_handle); - } - } - } - - return 0; -} - -HAPI void widget_viewer_init(void) -{ - int ret; - ret = connection_add_event_handler(CONNECTION_EVENT_TYPE_DISCONNECTED, disconnected_cb, NULL); - if (ret < 0) { - ErrPrint("Unable to add an event handler\n"); - } - return; -} - -HAPI void widget_viewer_fini(void) -{ - int ret; - - ret = widget_delete_all_deleteme(); - if (ret < 0) { - DbgPrint("Delete all deleteme: %d\n", ret); - } - - ret = widget_delete_all(); - if (ret < 0) { - DbgPrint("Delete all: %d\n", ret); - } - - /* Just for in case of ... */ - deactivate_pending_consumer(); - deactivate_gbar_open_pending_consumer(); - - eina_list_free(s_info.gbar_open_pending_list); - s_info.gbar_open_pending_list = NULL; - eina_list_free(s_info.pending_list); - s_info.pending_list = NULL; - - (void)connection_del_event_handler(CONNECTION_EVENT_TYPE_DISCONNECTED, disconnected_cb); - return; -} - -/*! - * \note - * Exported API for each widgetes. - */ -int widget_send_updated(const char *pkgname, const char *id, int idx, int x, int y, int w, int h, int gbar, const char *descfile) -{ - Eina_List *l; - struct item *item; - int ret = WIDGET_ERROR_NOT_EXIST; - widget_damage_region_s region = { - .x = x, - .y = y, - .w = w, - .h = h, - }; - - EINA_LIST_FOREACH(s_info.item_list, l, item) { - if (strcmp(item->inst->item->pkgname, pkgname) || strcmp(item->inst->id, id)) { - continue; - } - - if (item->direct_path_list) { - Eina_List *l; - struct connection *conn_handle; - EINA_LIST_FOREACH(item->direct_path_list, l, conn_handle) { - ret = widget_provider_send_direct_updated(connection_handle(conn_handle), pkgname, id, idx, ®ion, gbar, descfile); - } - } else { - ret = widget_provider_send_updated(pkgname, id, idx, ®ion, gbar, descfile); - } - - break; - } - - return ret; -} - -int widget_send_buffer_updated(const char *pkgname, const char *id, widget_buffer_h handle, int idx, int x, int y, int w, int h, int gbar, const char *descfile) -{ - Eina_List *l; - struct item *item; - int ret = WIDGET_ERROR_NOT_EXIST; - widget_damage_region_s region = { - .x = x, - .y = y, - .w = w, - .h = h, - }; - - EINA_LIST_FOREACH(s_info.item_list, l, item) { - if (strcmp(item->inst->item->pkgname, pkgname) || strcmp(item->inst->id, id)) { - continue; - } - - if (item->direct_path_list) { - Eina_List *l; - struct connection *conn_handle; - EINA_LIST_FOREACH(item->direct_path_list, l, conn_handle) { - ret = widget_provider_send_direct_buffer_updated(connection_handle(conn_handle), handle, idx, ®ion, gbar, descfile); - } - } else { - ret = widget_provider_send_buffer_updated(handle, idx, ®ion, gbar, descfile); - } - - break; - } - - return ret; -} - -const char *widget_find_pkgname(const char *filename) -{ - Eina_List *l; - struct item *item; - - EINA_LIST_FOREACH(s_info.item_list, l, item) { - if (!strcmp(item->inst->id, filename)) { - return item->inst->item->pkgname; - } - } - - return NULL; -} - -int widget_update_extra_info(const char *id, const char *content, const char *title, const char *icon, const char *name) -{ - Eina_List *l; - struct item *item; - - EINA_LIST_FOREACH(s_info.item_list, l, item) { - if (!strcmp(item->inst->id, id)) { - if (content && strlen(content)) { - char *_content; - - _content = strdup(content); - if (_content) { - if (item->inst->content) { - free(item->inst->content); - item->inst->content = NULL; - } - - item->inst->content = _content; - } else { - ErrPrint("strdup: %d\n", errno); - } - } - - if (title && strlen(title)) { - char *_title; - - _title = strdup(title); - if (_title) { - if (item->inst->title) { - free(item->inst->title); - item->inst->title = NULL; - } - - item->inst->title = _title; - } else { - ErrPrint("strdup: %d\n", errno); - } - } - - if (icon && strlen(icon)) { - char *_icon; - - _icon = strdup(icon); - if (_icon) { - if (item->inst->icon) { - free(item->inst->icon); - item->inst->icon = NULL; - } - - item->inst->icon = _icon; - } else { - ErrPrint("strdup: %d\n", errno); - } - } - - if (name && strlen(name)) { - char *_name; - - _name = strdup(name); - if (_name) { - if (item->inst->name) { - free(item->inst->name); - item->inst->name = NULL; - } - - item->inst->name = _name; - } else { - ErrPrint("strdup: %d\n", errno); - } - } - - return WIDGET_ERROR_NONE; - } - } - - return WIDGET_ERROR_NOT_EXIST; -} - -int widget_request_update_by_id(const char *filename) -{ - Eina_List *l; - struct item *item; - - if (so_current_op() != WIDGET_OP_UNKNOWN) { - ErrPrint("Current operation: %d\n", so_current_op()); - /*! - * \note - * Some case requires to update the content of other widget from widget_XXX ABI. - * In that case this function can be used so we have not to filter it from here. - * ex) Setting accessibility. - * Press the assistive light, turned on, need to update other instances too. - * Then the widget will use this function from widget_clicked function. - */ - } - - EINA_LIST_FOREACH(s_info.item_list, l, item) { - if (!strcmp(item->inst->id, filename)) { - return append_pending_list(item); - } - } - - return WIDGET_ERROR_NOT_EXIST; -} - -int widget_trigger_update_monitor(const char *filename, int is_gbar) -{ - char *fname; - int ret; - - if (so_current_op() != WIDGET_OP_UNKNOWN) { - ErrPrint("Current operation: %d\n", so_current_op()); - return WIDGET_ERROR_INVALID_PARAMETER; - } - - if (is_gbar) { - int len; - len = strlen(filename) + strlen(".desc"); - - fname = malloc(len + 1); - if (!fname) { - ErrPrint("malloc: %d\n", errno); - return WIDGET_ERROR_OUT_OF_MEMORY; - } - - snprintf(fname, len, "%s.desc", filename); - } else { - fname = strdup(filename); - if (!fname) { - ErrPrint("strdup: %d\n", errno); - return WIDGET_ERROR_OUT_OF_MEMORY; - } - } - - if (access(fname, R_OK | W_OK) != 0) { - ErrPrint("access: %s (%d)\n", fname, errno); - ret = WIDGET_ERROR_IO_ERROR; - } else { - ret = update_monitor_trigger_update_cb(fname, 0); - } - - free(fname); - return ret; -} - -HAPI int widget_open_gbar(const char *pkgname, const char *id) -{ - struct instance *inst; - struct instance *tmp; - Eina_List *l; - - inst = so_find_instance(pkgname, id); - if (!inst) { - ErrPrint("Instance is not found\n"); - return WIDGET_ERROR_NOT_EXIST; - } - - EINA_LIST_FOREACH(s_info.gbar_list, l, tmp) { - if (tmp == inst) { - return 0; - } - } - - if (!s_info.gbar_list) { - pending_timer_freeze(); - - /*! - * \note - * Freeze the force timer only in this case. - */ - force_timer_freeze(); - } - - s_info.gbar_list = eina_list_append(s_info.gbar_list, inst); - - /*! - * Find all instances from the pending list. - * Move them to gbar_open_pending_timer - */ - migrate_to_gbar_open_pending_list(pkgname); - return WIDGET_ERROR_NONE; -} - -HAPI int widget_close_gbar(const char *pkgname, const char *id) -{ - Eina_List *l; - Eina_List *n; - struct instance *tmp; - struct instance *inst; - - inst = so_find_instance(pkgname, id); - if (!inst) { - ErrPrint("Insatnce is not found\n"); - return WIDGET_ERROR_NOT_EXIST; - } - - EINA_LIST_FOREACH_SAFE(s_info.gbar_list, l, n, tmp) { - if (tmp != inst) { - continue; - } - - s_info.gbar_list = eina_list_remove(s_info.gbar_list, tmp); - if (!s_info.gbar_list) { - pending_timer_thaw(); - force_timer_thaw(); - } - - /*! - * Move all items in gbar_open_pending_list - * to pending_list. - */ - migrate_to_pending_list(pkgname); - return WIDGET_ERROR_NONE; - } - - return WIDGET_ERROR_NOT_EXIST; -} - -static struct method s_table[] = { - { - .cmd = NULL, - .handler = NULL, - }, -}; - -HAPI int widget_create(const char *pkgname, const char *id, struct widget_create_arg *arg, int *w, int *h, double *priority, char **content, char **title) -{ - struct instance *inst; - struct item *item; - int ret; - int create_ret; - int need_to_create; - - need_to_create = 0; - *content = NULL; - *title = NULL; - - inst = so_find_instance(pkgname, id); - if (inst) { - DbgPrint("Instance is already exists [%s - %s] content[%s], cluster[%s], category[%s], abi[%s]\n", pkgname, id, arg->content, arg->cluster, arg->category, arg->abi); - return WIDGET_ERROR_NONE; - } - - if (!arg->skip_need_to_create) { - ret = so_create_needed(pkgname, arg->cluster, arg->category, arg->abi); - if (ret != WIDGET_NEED_TO_CREATE) { - return WIDGET_ERROR_PERMISSION_DENIED; - } - - need_to_create = 1; - } - - item = calloc(1, sizeof(*item)); - if (!item) { - ErrPrint("calloc: %d (%s - %s, content[%s], cluster[%s], category[%s], abi[%s])\n", errno, pkgname, id, arg->content, arg->cluster, arg->category, arg->abi); - return WIDGET_ERROR_OUT_OF_MEMORY; - } - - ret = update_monitor_add(id, item); - if (ret < 0) { - free(item); - return ret; - } - - if (arg->direct_addr) { - struct connection *conn_handle; - - conn_handle = connection_find_by_addr(arg->direct_addr); - if (!conn_handle) { - conn_handle = connection_create(arg->direct_addr, (void *)s_table); - if (!conn_handle) { - ErrPrint("Direct update-path is not supported\n"); - } else { - DbgPrint("Direct update-path is created: %s\n", id); - item->direct_path_list = eina_list_append(item->direct_path_list, conn_handle); - } - } else { - item->direct_path_list = eina_list_append(item->direct_path_list, connection_ref(conn_handle)); - DbgPrint("Direct update-path is referred: %s\n", id); - } - } - - create_ret = so_create(pkgname, id, arg->content, arg->timeout, arg->has_widget_script, arg->cluster, arg->category, arg->abi, &inst); - if (create_ret < 0) { - struct connection *conn_handle; - - update_monitor_del(id, item); - EINA_LIST_FREE(item->direct_path_list, conn_handle) { - (void)connection_unref(conn_handle); - } - free(item); - - *w = 0; - *h = 0; - *priority = 0.0f; - return create_ret; - } - - item->inst = inst; - item->state = STATE_UNKNOWN; - - if (arg->period > 0.0f && !s_info.secured) { - item->timer = util_timer_add(arg->period, updator_cb, item); - if (!item->timer) { - struct connection *conn_handle; - ErrPrint("Failed to add timer (%s - %s, content[%s], cluster[%s], category[%s], abi[%s]\n", pkgname, id, arg->content, arg->cluster, arg->category, arg->abi); - update_monitor_del(id, item); - EINA_LIST_FREE(item->direct_path_list, conn_handle) { - (void)connection_unref(conn_handle); - } - (void)so_destroy(inst, item->unload_so); - free(item); - return WIDGET_ERROR_FAULT; - } - - if (s_info.state == STATE_PAUSED) { - timer_freeze(item); - } - } else { - DbgPrint("Local update timer is disabled: %lf (%d)\n", arg->period, s_info.secured); - item->timer = NULL; - } - - s_info.item_list = eina_list_append(s_info.item_list, item); - - if (create_ret & WIDGET_NEED_TO_SCHEDULE) { - DbgPrint("%s Returns WIDGET_NEED_TO_SCHEDULE\n", pkgname); - (void)append_pending_list(item); - } - - if (create_ret & WIDGET_FORCE_TO_SCHEDULE) { - DbgPrint("%s Returns WIDGET_NEED_TO_FORCE_UPDATE\n", pkgname); - (void)append_force_update_list(item); - } - - if (create_ret & WIDGET_OUTPUT_UPDATED) { - update_monitor_cnt(item); - /*! - * \note - * To send a output info, get the info forcely. - * but the output file monitor will do this again - * - * This function will set the tmp_content and tmp_title - * even if it has no updates on the content, title, - * it will set them to NULL. - */ - if (so_get_output_info(inst, w, h, priority, content, title) == (int)WIDGET_ERROR_NONE) { - if (*content) { - char *tmp; - - tmp = strdup(*content); - if (!tmp) { - ErrPrint("strdup: %d\n", errno); - } - - *content = tmp; - } - - if (*title) { - char *tmp; - - tmp = strdup(*title); - if (!tmp) { - ErrPrint("strdup: %d\n", errno); - } - - *title = tmp; - } - } - } - - *w = inst->w; - *h = inst->h; - *priority = inst->priority; - return need_to_create; -} - -HAPI int widget_destroy(const char *pkgname, const char *id, int type) -{ - Eina_List *l; - Eina_List *n; - struct instance *inst; - struct instance *tmp; - struct item *item; - struct connection *conn_handle; - - inst = so_find_instance(pkgname, id); - if (!inst) { - ErrPrint("Instance %s - %s is not created\n", pkgname, id); - return WIDGET_ERROR_INVALID_PARAMETER; - } - - EINA_LIST_FOREACH_SAFE(s_info.gbar_list, l, n, tmp) { - if (tmp != inst) { - continue; - } - - s_info.gbar_list = eina_list_remove(s_info.gbar_list, tmp); - if (!s_info.gbar_list) { - pending_timer_thaw(); - force_timer_thaw(); - } - - /*! - * Move all items in gbar_open_pending_list - * to pending_list. - */ - migrate_to_pending_list(pkgname); - break; - } - - l = find_item(inst); - if (!l) { - ErrPrint("Instance is not found (%s - %s)\n", pkgname, id); - return WIDGET_ERROR_NOT_EXIST; - } - - item = eina_list_data_get(l); - s_info.item_list = eina_list_remove_list(s_info.item_list, l); - - s_info.update_list = eina_list_remove(s_info.update_list, item); - s_info.hidden_list = eina_list_remove(s_info.hidden_list, item); - clear_from_gbar_open_pending_list(item); - clear_from_pending_list(item); - clear_from_force_update_list(item); - EINA_LIST_FREE(item->direct_path_list, conn_handle) { - (void)connection_unref(conn_handle); - } - - if (item->timer) { - ecore_timer_del(item->timer); - item->timer = NULL; - } - - /* - * To keep the previous status, we should or'ing the value. - */ - item->unload_so = (item->unload_so || (type == WIDGET_DESTROY_TYPE_UNINSTALL) || (type == WIDGET_DESTROY_TYPE_UPGRADE)); - - if (item->monitor) { - item->deleteme = 1; - } else { - update_monitor_del(id, item); - (void)so_destroy(inst, item->unload_so); - free(item); - } - - return WIDGET_ERROR_NONE; -} - -HAPI int widget_viewer_resize_widget(const char *pkgname, const char *id, int w, int h) -{ - Eina_List *l; - struct instance *inst; - struct item *item; - int ret; - - inst = so_find_instance(pkgname, id); - if (!inst) { - ErrPrint("Instance %s - %s is not created (%dx%d)\n", pkgname, id, w, h); - return WIDGET_ERROR_INVALID_PARAMETER; - } - - l = find_item(inst); - if (!l) { - ErrPrint("Instance is not found (%s - %s, %dx%d)\n", pkgname, id, w, h); - return WIDGET_ERROR_NOT_EXIST; - } - - item = eina_list_data_get(l); - - ESTIMATE_START(id); - ret = so_resize(inst, w, h); - ESTIMATE_END(id); - if (ret < 0) { - return ret; - } - - if (ret & WIDGET_NEED_TO_SCHEDULE) { - DbgPrint("%s Returns WIDGET_NEED_TO_SCHEDULE\n", pkgname); - (void)append_pending_list(item); - } - - if (ret & WIDGET_FORCE_TO_SCHEDULE) { - DbgPrint("%s Return WIDGET_NEED_TO_FORCE_SCHEDULE\n", pkgname); - (void)append_force_update_list(item); - } - - if (ret & WIDGET_OUTPUT_UPDATED) { - update_monitor_cnt(item); - } - - return WIDGET_ERROR_NONE; -} - -HAPI char *widget_pinup(const char *pkgname, const char *id, int pinup) -{ - struct instance *inst; - char *ret; - - inst = so_find_instance(pkgname, id); - if (!inst) { - ErrPrint("Instance %s - %s is not found (pinup[%d])\n", pkgname, id, pinup); - return NULL; - } - - ret = so_pinup(inst, pinup); - return ret; -} - -HAPI int widget_viewer_set_period(const char *pkgname, const char *id, double period) -{ - Eina_List *l; - struct instance *inst; - struct item *item; - - inst = so_find_instance(pkgname, id); - if (!inst) { - ErrPrint("Instance %s - %s is not found (period[%lf])\n", pkgname, id, period); - return WIDGET_ERROR_INVALID_PARAMETER; - } - - l = find_item(inst); - if (!l) { - ErrPrint("Instance is not found (%s - %s, period[%lf])\n", pkgname, id, period); - return WIDGET_ERROR_NOT_EXIST; - } - - item = eina_list_data_get(l); - - if (period <= 0.0f) { - if (item->timer) { - ecore_timer_del(item->timer); - item->timer = NULL; - } - } else { - if (item->timer) { - util_timer_interval_set(item->timer, period); - } else if (!s_info.secured) { - item->timer = util_timer_add(period, updator_cb, item); - if (!item->timer) { - ErrPrint("Failed to add timer (%s - %s)\n", pkgname, id); - return WIDGET_ERROR_FAULT; - } - - if (s_info.state == STATE_PAUSED) { - timer_freeze(item); - } - } - } - - return WIDGET_ERROR_NONE; -} - -HAPI int widget_clicked(const char *pkgname, const char *id, const char *event, double timestamp, double x, double y) -{ - Eina_List *l; - struct instance *inst; - struct item *item; - int ret; - - inst = so_find_instance(pkgname, id); - if (!inst) { - ErrPrint("Instance %s - %s is not exists (event[%s])\n", pkgname, id, event); - return WIDGET_ERROR_INVALID_PARAMETER; - } - - l = find_item(inst); - if (!l) { - ErrPrint("Instance is not found (%s - %s, event[%s])\n", pkgname, id, event); - return WIDGET_ERROR_NOT_EXIST; - } - - item = eina_list_data_get(l); - - ESTIMATE_START(id); - ret = so_clicked(inst, event, timestamp, x, y); - ESTIMATE_END(id); - if (ret < 0) { - return ret; - } - - if (ret & WIDGET_NEED_TO_SCHEDULE) { - DbgPrint("%s Returns WIDGET_NEED_TO_SCHEDULE\n", pkgname); - (void)append_pending_list(item); - } - - if (ret & WIDGET_FORCE_TO_SCHEDULE) { - DbgPrint("%s Return WIDGET_NEED_TO_FORCE_SCHEDULE\n", pkgname); - (void)append_force_update_list(item); - } - - if (ret & WIDGET_OUTPUT_UPDATED) { - update_monitor_cnt(item); - } - - return WIDGET_ERROR_NONE; -} - -HAPI int widget_script_event(const char *pkgname, const char *id, const char *signal_name, const char *source, widget_event_info_s event_info) -{ - Eina_List *l; - struct instance *inst; - struct item *item; - int ret; - - inst = so_find_instance(pkgname, id); - if (!inst) { - ErrPrint("Instance %s - %s is not exists (signal_name[%s], source[%s])\n", pkgname, id, signal_name, source); - return WIDGET_ERROR_INVALID_PARAMETER; - } - - l = find_item(inst); - if (!l) { - ErrPrint("Instance is not found (%s - %s, emissino[%s], source[%s])\n", pkgname, id, signal_name, source); - return WIDGET_ERROR_NOT_EXIST; - } - - item = eina_list_data_get(l); - - if (signal_name && source && !strcmp(source, id)) { - if (item->inst->item->has_widget_script) { - if (!strcmp(signal_name, "widget,show")) { - item->is_widget_show = 1; - - migrate_to_pending_list_from_hidden_list(item); - - if (item->is_widget_updated && !is_pended_item(item)) { - reset_widget_updated_flag(item); - } - - source = util_uri_to_path(source); - } else if (!strcmp(signal_name, "widget,hide")) { - DbgPrint("Livebox(%s) script is hide now\n", id); - item->is_widget_show = 0; - - source = util_uri_to_path(source); - } - } - - if (!strcmp(signal_name, "gbar,show")) { - item->is_gbar_show = 1; - source = util_uri_to_path(source); - } else if (!strcmp(signal_name, "gbar,hide")) { - item->is_gbar_show = 0; - source = util_uri_to_path(source); - } - } - - ESTIMATE_START(id); - ret = so_script_event(inst, signal_name, source, event_info); - ESTIMATE_END(id); - if (ret < 0) { - return ret; - } - - if (ret & WIDGET_NEED_TO_SCHEDULE) { - DbgPrint("%s Returns WIDGET_NEED_TO_SCHEDULE\n", pkgname); - (void)append_pending_list(item); - } - - if (ret & WIDGET_FORCE_TO_SCHEDULE) { - DbgPrint("%s Return WIDGET_NEED_TO_FORCE_SCHEDULE\n", pkgname); - (void)append_force_update_list(item); - } - - if (ret & WIDGET_OUTPUT_UPDATED) { - update_monitor_cnt(item); - } - - return WIDGET_ERROR_NONE; -} - -HAPI int widget_viewer_is_pinned_up(const char *pkgname, const char *id) -{ - Eina_List *l; - struct instance *inst; - struct item *item; - - inst = so_find_instance(pkgname, id); - if (!inst) { - ErrPrint("Instance %s - %s is not created\n", pkgname, id); - return WIDGET_ERROR_INVALID_PARAMETER; - } - - l = find_item(inst); - if (!l) { - ErrPrint("Instance is not found(%s - %s)\n", pkgname, id); - return WIDGET_ERROR_NOT_EXIST; - } - - item = eina_list_data_get(l); - if (!item) { - ErrPrint("Invalid item(%s - %s)\n", pkgname, id); - return WIDGET_ERROR_FAULT; - } - /*! - * NOTE: - * item is not used. - * Maybe this is not neccessary for this operation - */ - return so_is_pinned_up(inst); -} - -HAPI int widget_change_group(const char *pkgname, const char *id, const char *cluster, const char *category) -{ - Eina_List *l; - struct instance *inst; - struct item *item; - int ret; - - inst = so_find_instance(pkgname, id); - if (!inst) { - ErrPrint("Instance %s - %s is not created (cluster[%s], category[%s])\n", pkgname, id, cluster, category); - return WIDGET_ERROR_INVALID_PARAMETER; - } - - l = find_item(inst); - if (!l) { - ErrPrint("Instance is not found(%s - %s, cluster[%s], category[%s])\n", pkgname, id, cluster, category); - return WIDGET_ERROR_NOT_EXIST; - } - - item = eina_list_data_get(l); - - ret = so_change_group(inst, cluster, category); - if (ret < 0) { - return ret; - } - - if (ret & WIDGET_NEED_TO_SCHEDULE) { - DbgPrint("%s Returns WIDGET_NEED_TO_SCHEDULE\n", pkgname); - (void)append_pending_list(item); - } - - if (ret & WIDGET_FORCE_TO_SCHEDULE) { - DbgPrint("%s Return WIDGET_NEED_TO_FORCE_SCHEDULE\n", pkgname); - (void)append_force_update_list(item); - } - - if (ret & WIDGET_OUTPUT_UPDATED) { - update_monitor_cnt(item); - } - - return WIDGET_ERROR_NONE; -} - -static int widget_sys_event(struct instance *inst, struct item *item, int event) -{ - int ret; - - ret = so_sys_event(inst, event); - if (ret < 0) { - return ret; - } - - if (ret & WIDGET_NEED_TO_SCHEDULE) { - (void)append_pending_list(item); - } - - if (ret & WIDGET_FORCE_TO_SCHEDULE) { - DbgPrint("%s Return WIDGET_NEED_TO_FORCE_SCHEDULE\n", item->inst->item->pkgname); - (void)append_force_update_list(item); - } - - if (ret & WIDGET_OUTPUT_UPDATED) { - update_monitor_cnt(item); - } - - return WIDGET_ERROR_NONE; -} - -HAPI int widget_system_event(const char *pkgname, const char *id, int event) -{ - Eina_List *l; - struct instance *inst; - struct item *item; - - inst = so_find_instance(pkgname, id); - if (!inst) { - ErrPrint("instance %s - %s is not created\n", pkgname, id); - return WIDGET_ERROR_INVALID_PARAMETER; - } - - l = find_item(inst); - if (!l) { - ErrPrint("Instance is not found(%s - %s)\n", pkgname, id); - return WIDGET_ERROR_NOT_EXIST; - } - - item = eina_list_data_get(l); - return widget_sys_event(inst, item, event); -} - -HAPI int widget_update(const char *pkgname, const char *id, int force) -{ - Eina_List *l; - struct instance *inst; - struct item *item; - - inst = so_find_instance(pkgname, id); - if (!inst) { - ErrPrint("Instance %s - %s is not created\n", pkgname, id); - return WIDGET_ERROR_INVALID_PARAMETER; - } - - l = find_item(inst); - if (!l) { - ErrPrint("Instance is not found(%s - %s)\n", pkgname, id); - return WIDGET_ERROR_NOT_EXIST; - } - - item = eina_list_data_get(l); - if (force && gbar_is_opened(pkgname) != GBAR_IS_OPENED) { - (void)append_force_update_list(item); - } else { - (void)append_pending_list(item); - } - - return WIDGET_ERROR_NONE; -} - -HAPI int widget_set_content_info(const char *pkgname, const char *id, const char *content_info) -{ - Eina_List *l; - struct instance *inst; - struct item *item; - int ret; - - inst = so_find_instance(pkgname, id); - if (!inst) { - ErrPrint("Instance %s - %s is not created (%s)\n", pkgname, id, content_info); - return WIDGET_ERROR_INVALID_PARAMETER; - } - - l = find_item(inst); - if (!l) { - ErrPrint("Instance is not found (%s - %s, %s)\n", pkgname, id, content_info); - return WIDGET_ERROR_NOT_EXIST; - } - - item = eina_list_data_get(l); - ESTIMATE_START(id); - ret = so_set_content_info(inst, content_info); - ESTIMATE_END(id); - if (ret < 0) { - return ret; - } - - if (ret & WIDGET_NEED_TO_SCHEDULE) { - DbgPrint("%s Returns WIDGET_NEED_TO_SCHEDULE\n", pkgname); - (void)append_pending_list(item); - } - - if (ret & WIDGET_FORCE_TO_SCHEDULE) { - DbgPrint("%s Return WIDGET_NEED_TO_FORCE_SCHEDULE\n", pkgname); - (void)append_force_update_list(item); - } - - if (ret & WIDGET_OUTPUT_UPDATED) { - update_monitor_cnt(item); - } - - return WIDGET_ERROR_NONE; -} - -HAPI int widget_update_all(const char *pkgname, const char *cluster, const char *category, int force) -{ - Eina_List *l; - Eina_List *n; - struct item *item; - - DbgPrint("Update content for %s\n", pkgname ? pkgname : "(all)"); - EINA_LIST_FOREACH_SAFE(s_info.item_list, l, n, item) { - if (item->deleteme) { - continue; - } - - if (cluster && strcasecmp(item->inst->cluster, cluster)) { - continue; - } - - if (category && strcasecmp(item->inst->category, category)) { - continue; - } - - if (pkgname && strlen(pkgname)) { - if (!strcmp(item->inst->item->pkgname, pkgname)) { - if (force && gbar_is_opened(pkgname) != GBAR_IS_OPENED) { - (void)append_force_update_list(item); - } else { - (void)append_pending_list(item); - } - } - } else { - if (force) { - DbgPrint("Update All function doesn't support force update to all widgetes\n"); - } else { - (void)append_pending_list(item); - } - } - } - - return WIDGET_ERROR_NONE; -} - -HAPI int widget_set_content_info_all(const char *pkgname, const char *content) -{ - Eina_List *l; - Eina_List *n; - struct item *item; - register int cnt = 0; - - EINA_LIST_FOREACH_SAFE(s_info.item_list, l, n, item) { - if (item->deleteme) { - continue; - } - - if (pkgname && strlen(pkgname)) { - if (!strcmp(item->inst->item->pkgname, pkgname)) { - widget_set_content_info(item->inst->item->pkgname, item->inst->id, content); - cnt++; - } - } else { - widget_set_content_info(item->inst->item->pkgname, item->inst->id, content); - cnt++; - } - } - DbgPrint("Update content for %s - %d\n", pkgname ? pkgname : "(all)", cnt); - - return WIDGET_ERROR_NONE; -} - -HAPI int widget_delete_all_deleteme(void) -{ - Eina_List *l; - Eina_List *n; - struct item *item; - int cnt = 0; - - EINA_LIST_FOREACH_SAFE(s_info.item_list, l, n, item) { - if (!item->deleteme) { - continue; - } - - update_monitor_del(item->inst->id, item); - (void)so_destroy(item->inst, item->unload_so); - free(item); - cnt++; - } - - DbgPrint("Delete all deleteme: %d\n", cnt); - return WIDGET_ERROR_NONE; -} - -HAPI int widget_delete_all(void) -{ - Eina_List *l; - Eina_List *n; - struct item *item; - int cnt = 0; - - EINA_LIST_FOREACH_SAFE(s_info.item_list, l, n, item) { - update_monitor_del(item->inst->id, item); - (void)so_destroy(item->inst, item->unload_so); - free(item); - cnt++; - } - - DbgPrint("Delete all deleteme: %d\n", cnt); - return WIDGET_ERROR_NONE; -} - -HAPI int widget_system_event_all(int event) -{ - Eina_List *l; - Eina_List *n; - struct item *item; - - EINA_LIST_FOREACH_SAFE(s_info.item_list, l, n, item) { - if (item->deleteme) { - continue; - } - - DbgPrint("System event for %s (%d)\n", item->inst->id, event); - widget_sys_event(item->inst, item, event); - } - - return WIDGET_ERROR_NONE; -} - -HAPI void widget_pause_all(void) -{ - Eina_List *l; - struct item *item; - - if (s_info.state == STATE_PAUSED) { - return; - } - - s_info.state = STATE_PAUSED; - - pending_timer_freeze(); - /*! - * \note - * force timer will not be freezed - */ - - EINA_LIST_FOREACH(s_info.item_list, l, item) { - if (item->deleteme) { - DbgPrint("Instance %s skip timer pause (deleteme)\n", item->inst->item->pkgname); - continue; - } - - if (item->state != STATE_RESUMED) { - continue; - } - - timer_freeze(item); - - widget_sys_event(item->inst, item, WIDGET_SYS_EVENT_PAUSED); - } -} - -HAPI void widget_resume_all(void) -{ - Eina_List *l; - Eina_List *n; - struct item *item; - - if (s_info.state == STATE_RESUMED) { - return; - } - - s_info.state = STATE_RESUMED; - - pending_timer_thaw(); - - /*! - * \note - * force timer will not affected by this - */ - - EINA_LIST_FOREACH_SAFE(s_info.item_list, l, n, item) { - if (item->deleteme) { - DbgPrint("Instance %s skip timer resume (deleteme)\n", item->inst->item->pkgname); - continue; - } - - if (item->state != STATE_RESUMED) { - continue; - } - - widget_sys_event(item->inst, item, WIDGET_SYS_EVENT_RESUMED); - - if (item->updated_in_pause) { - (void)append_pending_list(item); - item->updated_in_pause = 0; - } - - /*! - * \note - * After send the resume callback, call this function. - * Because the timer_thaw can call the update function. - * Before resumed event is notified to the widget, - * Do not call update function - */ - if (timer_thaw(item) == UPDATE_ITEM_DELETED) { - /* item is deleted */ - } - } -} - -HAPI int widget_pause(const char *pkgname, const char *id) -{ - struct instance *inst; - Eina_List *l; - struct item *item; - - inst = so_find_instance(pkgname, id); - if (!inst) { - return WIDGET_ERROR_INVALID_PARAMETER; - } - - l = find_item(inst); - if (!l) { - ErrPrint("Instance is not found (%s - %s)\n", pkgname, id); - return WIDGET_ERROR_NOT_EXIST; - } - - item = eina_list_data_get(l); - if (!item) { - return WIDGET_ERROR_FAULT; - } - - if (item->deleteme) { - DbgPrint("Instance %s will be deleted (%s)\n", item->inst->item->pkgname, item->inst->id); - return WIDGET_ERROR_RESOURCE_BUSY; - } - - if (item->state == STATE_PAUSED) { - return WIDGET_ERROR_NONE; - } - - item->state = STATE_PAUSED; - - if (s_info.state != STATE_RESUMED) { - return WIDGET_ERROR_NONE; - } - - timer_freeze(item); - - widget_sys_event(inst, item, WIDGET_SYS_EVENT_PAUSED); - - return WIDGET_ERROR_NONE; -} - -HAPI int widget_viewer_connected(const char *pkgname, const char *id, const char *direct_addr) -{ - struct instance *inst; - Eina_List *l; - struct connection *conn_handle; - struct item *item; - - inst = so_find_instance(pkgname, id); - if (!inst) { - return WIDGET_ERROR_INVALID_PARAMETER; - } - - l = find_item(inst); - if (!l) { - ErrPrint("Instance is not found (%s - %s)\n", pkgname, id); - return WIDGET_ERROR_NOT_EXIST; - } - - item = eina_list_data_get(l); - if (!item) { - return WIDGET_ERROR_FAULT; - } - - conn_handle = connection_find_by_addr(direct_addr); - if (!conn_handle) { - conn_handle = connection_create(direct_addr, (void *)s_table); - if (!conn_handle) { - ErrPrint("Direct update-path is not supported\n"); - } else { - DbgPrint("Direct update-path is created: %s\n", id); - item->direct_path_list = eina_list_append(item->direct_path_list, conn_handle); - } - } else { - item->direct_path_list = eina_list_append(item->direct_path_list, conn_handle); - (void)connection_ref(conn_handle); - } - - return WIDGET_ERROR_NONE; -} - -HAPI int widget_viewer_disconnected(const char *pkgname, const char *id, const char *direct_addr) -{ - struct instance *inst; - Eina_List *l; - struct item *item; - struct connection *conn_handle; - - inst = so_find_instance(pkgname, id); - if (!inst) { - return WIDGET_ERROR_INVALID_PARAMETER; - } - - l = find_item(inst); - if (!l) { - ErrPrint("Instance is not found (%s - %s)\n", pkgname, id); - return WIDGET_ERROR_NOT_EXIST; - } - - item = eina_list_data_get(l); - if (!item) { - return WIDGET_ERROR_FAULT; - } - - conn_handle = connection_find_by_addr(direct_addr); - if (conn_handle) { - if (eina_list_data_find(item->direct_path_list, conn_handle)) { - item->direct_path_list = eina_list_remove(item->direct_path_list, conn_handle); - connection_unref(conn_handle); - } - } - - return WIDGET_ERROR_NONE; -} - -HAPI int widget_resume(const char *pkgname, const char *id) -{ - struct instance *inst; - Eina_List *l; - struct item *item; - int ret; - - inst = so_find_instance(pkgname, id); - if (!inst) { - return WIDGET_ERROR_INVALID_PARAMETER; - } - - l = find_item(inst); - if (!l) { - ErrPrint("Instance is not found (%s - %s)\n", pkgname, id); - return WIDGET_ERROR_NOT_EXIST; - } - - item = eina_list_data_get(l); - if (!item) { - return WIDGET_ERROR_FAULT; - } - - if (item->deleteme) { - DbgPrint("Instance %s will be deleted (%s)\n", item->inst->item->pkgname, item->inst->id); - return WIDGET_ERROR_RESOURCE_BUSY; - } - - if (item->state == STATE_RESUMED) { - return WIDGET_ERROR_NONE; - } - - item->state = STATE_RESUMED; - - if (s_info.state != STATE_RESUMED) { - return WIDGET_ERROR_NONE; - } - - widget_sys_event(inst, item, WIDGET_SYS_EVENT_RESUMED); - - ret = timer_thaw(item); - if (ret == UPDATE_ITEM_DELETED) { - /*! - * \note - * ITEM is deleted - */ - return WIDGET_ERROR_NONE; - } else if (ret == UPDATE_INVOKED) { - /*! - * \note - * if the update is successfully done, the updated_in_pause will be reset'd. - * or append it to the pending list - */ - } - - if (item->updated_in_pause) { - (void)append_pending_list(item); - item->updated_in_pause = 0; - } - - return WIDGET_ERROR_NONE; -} - -HAPI void widget_turn_secured_on(void) -{ - s_info.secured = 1; -} - -HAPI int widget_is_secured(void) -{ - return s_info.secured; -} - -HAPI int widget_is_all_paused(void) -{ - return s_info.state != STATE_RESUMED; -} - -HAPI int widget_set_orientation(const char *pkgname, const char *id, int orientation) -{ - Eina_List *l; - struct instance *inst; - struct item *item; - - inst = so_find_instance(pkgname, id); - if (!inst) { - ErrPrint("instance %s - %s is not created\n", pkgname, id); - return WIDGET_ERROR_INVALID_PARAMETER; - } - - l = find_item(inst); - if (!l) { - ErrPrint("Instance is not found(%s - %s)\n", pkgname, id); - return WIDGET_ERROR_NOT_EXIST; - } - - inst->orientation = orientation; - - item = eina_list_data_get(l); - return widget_sys_event(inst, item, WIDGET_SYS_EVENT_ORIENTATION_CHANGED); -} - -int widget_provider_app_get_orientation(const char *filename) -{ - Eina_List *l; - struct item *item; - - EINA_LIST_FOREACH(s_info.item_list, l, item) { - if (!strcmp(widget_util_uri_to_path(item->inst->id), filename)) { - return item->inst->orientation; - } - } - - return WIDGET_ERROR_NOT_EXIST; -} - -/* End of a file */ diff --git a/stub/main.c b/stub/main.c deleted file mode 100644 index 775cc1c..0000000 --- a/stub/main.c +++ /dev/null @@ -1,69 +0,0 @@ -#include -#include -#include -#include - -#include - -#include "debug.h" -#if defined(LOG_TAG) -#undef LOG_TAG -#define LOG_TAG "DATA_PROVIDER_SLAVE_LOADER" -#endif - -int errno; - -const char *widget_find_pkgname(const char *filename) -{ - return NULL; -} - -int widget_request_update_by_id(const char *filename) -{ - return 0; -} - -int widget_trigger_update_monitor(const char *filename, int is_pd) -{ - return 0; -} - -int main(int argc, char *argv[]) -{ - int i; - char **_argv; - const char *option; - - if (argc < 4) { - return -EINVAL; - } - - _argv = malloc(sizeof(char *) * (argc+2)); - if (!_argv) { - ErrPrint("%d\n", errno); - return -ENOMEM; - } - - for (i = 1; i < argc; i++) { - _argv[i] = strdup(argv[i]); - } - _argv[i] = NULL; - - _argv[0] = strdup("/usr/apps/org.tizen.data-provider-slave/bin/data-provider-slave.loader"); - DbgPrint("Replace argv[0] with %s\n", _argv[0]); - for (i = 0; i < argc; i++) { - DbgPrint("argv[%d]: %s\n", i, _argv[i]); - } - - option = getenv("PROVIDER_HEAP_MONITOR_START"); - if (option && !strcasecmp(option, "true")) { - DbgPrint("Heap monitor is enabled\n"); - setenv("LD_PRELOAD", "/usr/lib/libheap-monitor.so", 1); - } - - execvp(_argv[0], _argv); - ErrPrint("%d\n", errno); - return 0; -} - -/* End of a file */