From: Jinkun Jang Date: Sat, 16 Mar 2013 07:53:31 +0000 (+0900) Subject: sync with tizen 2.0 X-Git-Tag: accepted/tizen/20130530.164626~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cf6d9168b8953488b7403526cf94a358983de007;p=apps%2Fcore%2Fpreloaded%2Ftickernoti.git sync with tizen 2.0 --- diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..6c79206 --- /dev/null +++ b/AUTHORS @@ -0,0 +1 @@ +Shinwoo Kim diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100755 index 0000000..2122b6c --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,7 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) + +ADD_SUBDIRECTORY(src) +add_subdirectory(data/) + +# install manifest file +INSTALL(FILES org.tizen.tickernoti-syspopup.xml DESTINATION /opt/share/packages/) diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + 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. + + 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, + 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 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 in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) 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 + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache 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 Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/NOTICE b/NOTICE new file mode 100644 index 0000000..ccdad52 --- /dev/null +++ b/NOTICE @@ -0,0 +1,3 @@ +Copyright (c) Samsung Electronics Co., Ltd. All rights reserved. +Except as noted, this software is licensed under Apache License, Version 2. +Please, see the LICENSE file for Apache License terms and conditions. diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt new file mode 100644 index 0000000..55d7519 --- /dev/null +++ b/data/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 2.6) + +SET(PREFIX ${CMAKE_INSTALL_PREFIX}) +SET(RESDIR "${PREFIX}/res") + +add_custom_target(tickernoti.edj ALL + COMMAND edje_cc -id ${CMAKE_CURRENT_SOURCE_DIR}/images -fd ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/tickernoti.edc + ${CMAKE_CURRENT_BINARY_DIR}/tickernoti.edj + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tickernoti.edc + ) + +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tickernoti.edj + DESTINATION ${RESDIR}/edje/ + ) diff --git a/data/images/00_winset_notification_bg.png b/data/images/00_winset_notification_bg.png new file mode 100644 index 0000000..f4aad1e Binary files /dev/null and b/data/images/00_winset_notification_bg.png differ diff --git a/data/images/00_winset_notification_bg_black.png b/data/images/00_winset_notification_bg_black.png new file mode 100644 index 0000000..6ff17c0 Binary files /dev/null and b/data/images/00_winset_notification_bg_black.png differ diff --git a/data/tickernoti.edc b/data/tickernoti.edc new file mode 100644 index 0000000..f2e683d --- /dev/null +++ b/data/tickernoti.edc @@ -0,0 +1,611 @@ +/* + * tickernoti + * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + +collections { +//blue +#define TICKER_NOTI_DEFAULT_TEXT_COLOR_INC "#f4f4f4" +#define TICKERNOTI_DEFAULT_BG_MIN_HEIGHT_INC 100 +#define TICKERNOTI_DEFAULT_BG_BOTTOM_MIN_HEIGHT_INC 0 +#define TICKERNOTI_DEFAULT_BG_BORDER_INC 0 0 0 0 +#define TICKERNOTI_DEFAULT_BG_PADDING_LEFT_TOP_INC 16 18 +#define TICKERNOTI_DEFAULT_BG_PADDING_RIGHT_BOTTOM_INC 16 18 +#define TICKERNOTI_DEFAULT_PADDING_AFTER_ICON_INC 16 0 +#define TICKERNOTI_DEFAULT_TEXT_MIN_INC 0 60 +#define TICKERNOTI_DEFAULT_BUTTON_MIN_INC 90 54 +#define TICKERNOTI_DEFAULT_BUTTON_MAX_INC 90 54 +#define TICKERNOTI_DEFAULT_ICON_MIN_INC 64 64 +#define TICKERNOTI_DEFAULT_PADDING_BEFORE_BUTTON_INC 16 0 +#define TICKERNOTI_DEFAULT_TEXT_FONT_SIZE_INC 30 +#define TICKERNOTI_INFO_BG_MIN_HEIGHT_INC 50 +#define TICKERNOTI_INFO_BG_PADDING_LEFT_TOP_INC 8 5 +#define TICKERNOTI_INFO_BG_PADDING_RIGHT_BOTTOM_INC 8 5 +#define TICKERNOTI_BG_PADDING_AFTER_ICON_INC 15 0 +#define TICKERNOTI_INFO_TEXT_FONT_SIZE_INC 28 +#define SELECTION_INFO_TEXT_COLOR_INC 249 249 249 255 +/* +//black +#define TICKER_NOTI_DEFAULT_TEXT_COLOR_INC "#f4f4f4" +#define TICKERNOTI_DEFAULT_TEXT_FONT_SIZE_INC 30 +#define TICKERNOTI_DEFAULT_BG_MIN_HEIGHT_INC 98 +#define TICKERNOTI_DEFAULT_BG_BOTTOM_MIN_HEIGHT_INC 8 +#define TICKERNOTI_DEFAULT_BG_BORDER_INC 0 0 0 8 +#define TICKERNOTI_DEFAULT_BG_PADDING_LEFT_TOP_INC 16 13 +#define TICKERNOTI_DEFAULT_BG_PADDING_RIGHT_BOTTOM_INC 16 13 +#define TICKERNOTI_DEFAULT_PADDING_AFTER_ICON_INC 16 0 +#define TICKERNOTI_DEFAULT_TEXT_MIN_INC 0 60 +#define TICKERNOTI_DEFAULT_BUTTON_MIN_INC 90 54 +#define TICKERNOTI_DEFAULT_BUTTON_MAX_INC 90 54 +#define TICKERNOTI_DEFAULT_ICON_MIN_INC 64 64 +#define TICKERNOTI_DEFAULT_PADDING_BEFORE_BUTTON_INC 16 0 +#define TICKERNOTI_DEFAULT_TEXT_FONT_SIZE_INC 30 +#define TICKERNOTI_INFO_BG_MIN_HEIGHT_INC 50 +#define TICKERNOTI_INFO_BG_PADDING_LEFT_TOP_INC 8 5 +#define TICKERNOTI_INFO_BG_PADDING_RIGHT_BOTTOM_INC 8 5 +#define TICKERNOTI_BG_PADDING_AFTER_ICON_INC 15 0 +#define TICKERNOTI_INFO_TEXT_FONT_SIZE_INC 28 +#define SELECTION_INFO_TEXT_COLOR_INC 249 249 249 255 +*/ + + group { + name: "info"; + images { + image: "00_winset_notification_bg.png" COMP; + } + parts { + part { name: "base"; + type: RECT; + scale: 1; + description { state: "default" 0.0; + align: 0.5 0.0; + min: 0 TICKERNOTI_INFO_BG_MIN_HEIGHT_INC; + rel1 { + relative: 0.0 0.0; + } + rel2 { + relative: 1.0 1.0; + } + } + } + part { name: "bg"; + mouse_events: 1; + type: RECT; + scale: 1; + clip_to: "base"; + description { state: "default" 0.0; + rel1 { + relative: 0.0 0.0; + to: "base"; + } + rel2 { + relative: 1.0 1.0; + to: "base"; + } + } + } + part { + name: "bg_img"; + mouse_events: 0; + type: IMAGE; + scale: 1; + description { state: "default" 0.0; + visible: 1; + rel1 { + relative: 0.0 0.0; + to: "bg"; + } + rel2 { + relative: 1.0 1.0; + to: "bg"; + } + image { + normal: "00_winset_notification_bg.png"; + border: TICKERNOTI_DEFAULT_BG_BORDER_INC; + border_scale: 1; + } + } + } + part { + name: "padding_left_top"; + type: RECT; + scale: 1; + mouse_events: 0; + description { + state: "default" 0.0; + visible: 0; + min: TICKERNOTI_INFO_BG_PADDING_LEFT_TOP_INC; + fixed: 1 1; + align: 0.0 0.0; + rel1 { + relative: 0.0 0.0; + to: "bg"; + } + rel2 { + relative: 0.0 0.0; + to: "bg"; + } + } + } + part { + name: "padding_right_bottom"; + type: RECT; + scale: 1; + mouse_events: 0; + description { + state: "default" 0.0; + visible: 0; + min: TICKERNOTI_INFO_BG_PADDING_RIGHT_BOTTOM_INC; + fixed: 1 1; + align: 1.0 1.0; + rel1 { + relative: 1.0 1.0; + to: "bg"; + } + rel2 { + relative: 1.0 1.0; + to: "bg"; + } + } + } + part { + name: "icon"; + type: SWALLOW; + scale: 1; + mouse_events: 1; + description { + state: "default" 0.0; + fixed: 1 0; + align: 0.0 0.0; + rel1 { + relative: 1.0 1.0; + to: "padding_left_top"; + } + rel2 { + relative: 1.0 0.0; + to_x: "padding_left_top"; + to_y: "padding_right_bottom"; + } + aspect: 1.0 1.0; + aspect_preference: VERTICAL; + } + } + part { + name: "padding_icon_right"; + type: RECT; + scale: 1; + mouse_events: 0; + description { + state: "default" 0.0; + visible: 0; + min: TICKERNOTI_BG_PADDING_AFTER_ICON_INC; + fixed: 1 0; + align: 0.0 0.0; + rel1 { + relative: 1.0 1.0; + to_x: "icon"; + to_y: "padding_left_top"; + } + rel2 { + relative: 1.0 0.0; + to_x: "icon"; + to_y: "padding_right_bottom"; + } + } + } + part { + name: "elm.text"; + type: TEXT; + scale: 1; + mouse_events: 0; + description { + state: "default" 0.0; + rel1 { + relative: 1.0 1.0; + to: "padding_left_top"; + } + rel2 { + relative: 1.0 1.0; + to: "bg"; + } + color: SELECTION_INFO_TEXT_COLOR_INC; + text { + font: "Tizen:style=Roman"; + size: TICKERNOTI_INFO_TEXT_FONT_SIZE_INC; + align: 0.5 0.5; + } + } + } + part { + name: "event"; + mouse_events: 1; + repeat_events: 1; + description {state: "default" 0.0; + color: 0 0 0 0; + rel1 { + to: "bg"; + } + rel2 { + to: "bg"; + } + } + } + } + programs { + program { + name: "effect_show"; + signal: "effect,show"; + source: "elm"; + action: STATE_SET "show" "0.0"; + in: 0.1 0.0; + transition: ACCEL 0.4; + target: "bg"; + } + program { + name: "other_click"; + signal: "mouse,clicked,1"; + source: "bg"; + action: SIGNAL_EMIT "clicked" ""; + after: "effect_hide"; + } + program { + name: "effect_hide"; + action: STATE_SET "default" "0.0"; + transition: DECEL 0.4; + target: "bg"; + after: "hide"; + } + program { + name: "hide"; + action: SIGNAL_EMIT "request,hide" ""; + } + } + } + + group { + name: "default"; + images { + image: "00_winset_notification_bg.png" COMP; + } + styles { + style { + name: "style_text"; + base: "font=Tizen:style=Roman font_size="TICKERNOTI_DEFAULT_TEXT_FONT_SIZE_INC" color="TICKER_NOTI_DEFAULT_TEXT_COLOR_INC" wrap=char ellipsis=1.0"; + tag: "br" "\n"; + tag: "ps" "ps"; + tag: "b" "+ font=Tizen:style=Bold"; + } + } + parts { + part { + name: "base"; + type: RECT; + scale: 1; + description { state: "default" 0.0; + align: 0.5 0.0; + min: 0 TICKERNOTI_DEFAULT_BG_MIN_HEIGHT_INC; + rel1 { + relative: 0.0 0.0; + } + rel2 { + relative: 1.0 1.0; + } + } + } + part { + name: "bg"; + mouse_events: 1; + type: RECT; + clip_to: "base"; + scale: 1; +/* description { state: "default" 0.0; + visible: 1; + align: 0.5 0.0; + rel1 { + relative: 0.0 -1.0; + to: "base"; + } + rel2 { + relative: 1.0 0.0; + to: "base"; + } + color: 0 0 0 0; + } + description { state: "show" 0.0; + inherit: "default" 0.0;*/ + description { state: "default" 0.0; + rel1 { + relative: 0.0 0.0; + to: "base"; + } + rel2 { + relative: 1.0 1.0; + to: "base"; + } + } + } + part { + name: "bg_img"; + mouse_events: 0; + type: IMAGE; + scale: 1; + description { state: "default" 0.0; + visible: 1; + rel1 { + relative: 0.0 0.0; + to: "bg"; + } + rel2 { + relative: 1.0 1.0; + to: "bg"; + } + image { + normal: "00_winset_notification_bg.png"; + border: TICKERNOTI_DEFAULT_BG_BORDER_INC; + border_scale: 1; + } + } + } + part { + name: "bg_bottom"; + type: RECT; + scale: 1; + description { state: "default" 0.0; + align: 0.0 1.0; + visible: 0; + fixed: 0 1; + min: 0 TICKERNOTI_DEFAULT_BG_BOTTOM_MIN_HEIGHT_INC; + rel1 { + relative: 0.0 1.0; + to: "bg"; + } + rel2 { + relative: 1.0 1.0; + to: "bg"; + } + } + } + part { + name: "padding_left_top"; + type: RECT; + scale: 1; + mouse_events: 0; + description { + state: "default" 0.0; + visible: 0; + min: TICKERNOTI_DEFAULT_BG_PADDING_LEFT_TOP_INC; + fixed: 1 1; + align: 0.0 0.0; + rel1 { + relative: 0.0 0.0; + to: "bg"; + } + rel2 { + relative: 0.0 0.0; + to: "bg"; + } + } + } + part { + name: "padding_right_bottom"; + type: RECT; + scale: 1; + mouse_events: 0; + description { + state: "default" 0.0; + visible: 0; + min: TICKERNOTI_DEFAULT_BG_PADDING_RIGHT_BOTTOM_INC; + fixed: 1 1; + align: 1.0 1.0; + rel1 { + relative: 1.0 0.0; + to: "bg_bottom"; + } + rel2 { + relative: 1.0 0.0; + to: "bg_bottom"; + } + } + } + // Icon + part { + name: "icon"; + type: SWALLOW; + scale: 1; + mouse_events: 1; + clip_to: "base"; + description { + state: "default" 0.0; + fixed: 1 1; + min: TICKERNOTI_DEFAULT_ICON_MIN_INC; + max: TICKERNOTI_DEFAULT_ICON_MIN_INC; + align: 0.0 0.5; + rel1 { + relative: 1.0 1.0; + to: "padding_left_top"; + } + rel2 { + relative: 1.0 0.0; + to_x: "padding_left_top"; + to_y: "bg_bottom"; + } + aspect: 1.0 1.0; + aspect_preference: VERTICAL; + } + } + part { + name: "padding_icon_right"; + type: RECT; + scale: 1; + mouse_events: 0; + description { + state: "default" 0.0; + visible: 0; + min: TICKERNOTI_DEFAULT_PADDING_AFTER_ICON_INC; + fixed: 1 0; + align: 0.0 0.0; + rel1 { + relative: 1.0 0.0; + to_x: "icon"; + to_y: "bg"; + } + rel2 { + relative: 1.0 0.0; + to_x: "icon"; + to_y: "bg_bottom"; + } + } + } + /* Text */ + part { + name: "text_rect"; + type: RECT; + scale: 1; + mouse_events: 0; + description { + state: "default" 0.0; + visible: 0; + min: TICKERNOTI_DEFAULT_TEXT_MIN_INC; + align: 0.0 0.5; + rel1 { + relative: 1.0 0.0; + to_x: "padding_icon_right"; + to_y: "bg"; + } + rel2 { + relative: 0.0 0.0; + to_x: "padding_button_left"; + to_y: "bg_bottom"; + } + } + } + part { + name: "elm.text"; + type: TEXT; + scale: 1; + mouse_events: 0; + description { + state: "default" 0.0; + rel1 { + relative: 1.0 1.0; + to: "padding_left_top"; + } + rel2 { + relative: 1.0 1.0; + to: "bg"; + } + color: SELECTION_INFO_TEXT_COLOR_INC; + text { + font: "Tizen:style=Roman"; + size: TICKERNOTI_DEFAULT_TEXT_FONT_SIZE_INC; + align: 0.5 0.5; + } + } + } + part { + name: "event"; + mouse_events: 1; + repeat_events: 1; + description { + state: "default" 0.0; + color: 0 0 0 0; + rel1 { + to: "bg"; + } + rel2 { + to: "bg"; + } + } + } + // Button + part { + name: "button"; + type: SWALLOW; + scale: 1; + mouse_events: 1; + description { state: "default" 0.0; + min: TICKERNOTI_DEFAULT_BUTTON_MIN_INC; + max: TICKERNOTI_DEFAULT_BUTTON_MAX_INC; + fixed: 1 1; + align: 1.0 0.5; + rel1 { + relative: 0.0 0.0; + to_x: "padding_right_bottom"; + to_y: "bg"; + } + rel2 { + relative: 0.0 0.0; + to_x: "padding_right_bottom"; + to_y: "bg_bottom"; + } + } + } + part { + name: "padding_button_left"; + type: RECT; + scale: 1; + mouse_events: 0; + description { + state: "default" 0.0; + visible: 0; + min: TICKERNOTI_DEFAULT_PADDING_BEFORE_BUTTON_INC; + fixed: 1 0; + align: 0.0 0.0; + rel1 { + relative: 0.0 0.0; + to: "button"; + } + rel2 { + relative: 0.0 1.0; + to: "button"; + } + } + } + } + programs { + program { + name: "effect_show"; + signal: "effect,show"; + source: "elm"; + in: 0.1 0.0; + action: STATE_SET "show" "0.0"; + transition: ACCEL 0.4; + target: "bg"; + } + program { + name: "clicked"; + signal: "mouse,clicked,1"; + source: "event"; + action: SIGNAL_EMIT "clicked" ""; + after: "effect_hide"; + } + program { + name: "effect_hide"; + signal: "effect,hide"; + source: "elm"; + action: STATE_SET "default" "0.0"; + transition: DECEL 0.4; + target: "bg"; + after: "hide"; + } + program { + name: "hide"; + action: SIGNAL_EMIT "request,hide" ""; + } + } + } +} diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..75f391c --- /dev/null +++ b/debian/changelog @@ -0,0 +1,39 @@ +tickernoti (0.1.4) unstable; urgency=low + + * package update + * Git: slp/pkgs/t/tickernoti + * Tag: tickernoti_0.1.4 + + -- Shinwoo Kim Thu, 10 May 2012 17:22:02 +0900 + +tickernoti (0.1.3) unstable; urgency=low + + * Package Upload + * Git: slp/pkgs/t/tickernoti + * Tag: tickernoti_0.1.3 + + -- Jeonghyun Yun Fri, 27 Apr 2012 14:14:07 +0900 + +tickernoti (0.1.2) unstable; urgency=low + + * Package Upload + * Git: slp/pkgs/t/tickernoti + * Tag: tickernoti_0.1.2 + + -- Jaehwan Kim Thu, 29 Mar 2012 19:21:23 +0900 + +tickernoti (0.1.1) unstable; urgency=low + + * Package Upload + * Git: slp/pkgs/t/tickernoti + * Tag: tickernoti_0.1.1 + + -- Shinwoo Kim Sun, 18 Mar 2012 17:23:02 +0900 + +tickernoti (0.1.0) unstable; urgency=low + + * Initial Upload + * Git: slp/pkgs/t/tickernoti + * Tag: tickernoti_0.1.0 + + -- Shinwoo Kim Tue, 13 Mar 2012 20:34:04 +0900 diff --git a/debian/com.samsung.tickernoti-syspopup.install.in b/debian/com.samsung.tickernoti-syspopup.install.in new file mode 100755 index 0000000..8eb2309 --- /dev/null +++ b/debian/com.samsung.tickernoti-syspopup.install.in @@ -0,0 +1,3 @@ +@PREFIX@/bin/tickernoti-syspopup +@PREFIX@/res/* +/opt/share/* diff --git a/debian/com.samsung.tickernoti-syspopup.postinst b/debian/com.samsung.tickernoti-syspopup.postinst new file mode 100755 index 0000000..9a69138 --- /dev/null +++ b/debian/com.samsung.tickernoti-syspopup.postinst @@ -0,0 +1,9 @@ +#!/bin/sh +#This is tickernoti-syspopup postinst file + + +vconftool set -t int db/setting/select_popup_btn "0" -u 5000 + + +sync + diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +5 diff --git a/debian/control b/debian/control new file mode 100755 index 0000000..d58461d --- /dev/null +++ b/debian/control @@ -0,0 +1,20 @@ +Source: tickernoti +Section: devel +Priority: extra +Maintainer: Shinwoo Kim +Uploaders: Shinwoo Kim +Build-Depends: debhelper (>= 5), libelm-dev, libappcore-efl-dev, libslp-utilx-dev, libdevman-dev, libheynoti-dev, libslp-setting-dev, syspopup-dev, syspopup-caller-dev, libevas-dev, iniparser-dev, libslp-sysman-dev, libmdm-dev +Standards-Version: 0.1.0 +Homepage: N/A + +Package: com.samsung.tickernoti-syspopup +Section: devel +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: tickernoti system popup application + +Package: com.samsung.tickernoti-syspopup-dbg +Section: debug +Architecture: any +Depends: ${misc:Depends}, com.samsung.tickernoti-syspopup(=${binary:Version}) +Description: tickernoti system popup application debug package diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..93c01c4 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,15 @@ + +Copyright 2012 Samsung Electronics Co., Ltd + +Licensed under the Flora License, Version 1.0 (the License); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.tizenopensource.org/license + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an AS IS BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000..6415e19 --- /dev/null +++ b/debian/docs @@ -0,0 +1,2 @@ +CMakeLists.txt +readme diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..91e4174 --- /dev/null +++ b/debian/rules @@ -0,0 +1,136 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +CFLAGS ?= -Wall -g +CXXFLAGS ?= -Wall -g +LDFLAGS ?= +PREFIX ?= /opt/apps/com.samsung.tickernoti-syspopup +DATADIR ?= /opt + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 + CXXFLAGS += -O0 +else + CFLAGS += -O2 + CXXFLAGS += -O2 +endif + +LDFLAGS += -Wl,--rpath=$(PREFIX)/lib -Wl,--as-needed + +configure: configure-stamp +configure-stamp: + dh_testdir + # Add here commands to configure the package. + CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" cmake . -DCMAKE_INSTALL_PREFIX=$(PREFIX) + + touch configure-stamp + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + + # Add here commands to compile the package. + $(MAKE) + #docbook-to-man debian/wavplayer.sgml > wavplayer.1 + + for f in `find $(CURDIR)/debian/ -name "*.in"`; do \ + cat $$f > $${f%.in}; \ + sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \ + sed -i -e "s#@DATADIR@#$(DATADIR)#g" $${f%.in}; \ + done + + + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + # Add here commands to clean up after the build process. + -$(MAKE) clean + rm -rf CMakeCache.txt + rm -rf CMakeFiles + rm -rf cmake_install.cmake + rm -rf Makefile + rm -rf install_manifest.txt + rm -rf *.so + rm -rf po/CMakeFiles + rm -rf po/Makefile + rm -rf po/cmake_install.cmake + rm -rf po/*.mo + rm -rf tickernoti-*/CMakeCache.txt + rm -rf tickernoti-*/CMakeFiles + rm -rf tickernoti-*/cmake_install.cmake + rm -rf tickernoti-*/Makefile + rm -rf tickernoti-*/install_manifest.txt + rm -rf tickernoti-*/*.so + rm -rf tickernoti-*/po/CMakeFiles + rm -rf tickernoti-*/po/Makefile + rm -rf tickernoti-*/po/cmake_install.cmake + rm -rf tickernoti-*/po/*.mo + rm -rf tickernoti-*/*.desktop + + for f in `find $(CURDIR)/debian/ -name "*.in"`; do \ + rm -f $${f%.in}; \ + done + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/wavplayer. + $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install + + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot +# dh_installchangelogs +# dh_installdocs + dh_installexamples + dh_install --sourcedir=debian/tmp +# dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_python +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman + dh_link +# dh_strip + dh_strip --dbg-package=com.samsung.tickernoti-syspopup-dbg + dh_compress + dh_fixperms +# dh_perl + dh_makeshlibs + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/org.tizen.tickernoti-syspopup.manifest b/org.tizen.tickernoti-syspopup.manifest new file mode 100644 index 0000000..f7911ff --- /dev/null +++ b/org.tizen.tickernoti-syspopup.manifest @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/org.tizen.tickernoti-syspopup.xml b/org.tizen.tickernoti-syspopup.xml new file mode 100644 index 0000000..c187408 --- /dev/null +++ b/org.tizen.tickernoti-syspopup.xml @@ -0,0 +1,10 @@ + + + + Shinwoo Kim + tickernoti system popup application + + null + + + diff --git a/packaging/org.tizen.tickernoti-syspopup.spec b/packaging/org.tizen.tickernoti-syspopup.spec new file mode 100644 index 0000000..e0a6d75 --- /dev/null +++ b/packaging/org.tizen.tickernoti-syspopup.spec @@ -0,0 +1,41 @@ +Name: org.tizen.tickernoti-syspopup +Summary: tickernoti system popup application +Version: 0.1.7r02 +Release: 1 +Group: TO_BE/FILLED_IN +License: APLv2 +Source0: %{name}-%{version}.tar.gz + +BuildRequires: pkgconfig(elementary) +BuildRequires: pkgconfig(appcore-efl) +BuildRequires: pkgconfig(utilX) +BuildRequires: pkgconfig(evas) +BuildRequires: pkgconfig(syspopup) +BuildRequires: gettext-devel +BuildRequires: cmake +BuildRequires: edje-tools + +%description +tickernoti system popup application + +%prep +%setup -q + +%build +cmake . -DCMAKE_INSTALL_PREFIX=/opt/apps/org.tizen.tickernoti-syspopup + +make %{?jobs:-j%jobs} + +%install +rm -rf %{buildroot} +%make_install +mkdir -p %{buildroot}/usr/share/license +cp %{_builddir}/%{buildsubdir}/LICENSE %{buildroot}/usr/share/license/%{name} + +%files +%defattr(-,root,root,-) +/opt/share/packages/org.tizen.tickernoti-syspopup.xml +/opt/apps/org.tizen.tickernoti-syspopup/res/edje/tickernoti.edj +/opt/apps/org.tizen.tickernoti-syspopup/bin/tickernoti-syspopup +/usr/share/license/%{name} +%manifest %{name}.manifest diff --git a/readme b/readme new file mode 100644 index 0000000..e69de29 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..e7d8a28 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,49 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(tickernoti-syspopup C) + +SET(SRCS tickernoti-syspopup.c) + +SET(VENDOR "samsung") +SET(PACKAGE ${PROJECT_NAME}) +SET(PKGNAME "com.${VENDOR}.${PROJECT_NAME}") +SET(PREFIX ${CMAKE_INSTALL_PREFIX}) +SET(BINDIR "${PREFIX}/bin") + +IF("${CMAKE_BUILD_TYPE}" STREQUAL "") + SET(CMAKE_BUILD_TYPE "Release") +ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "") +MESSAGE("Build type: ${CMAKE_BUILD_TYPE}") + +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}) +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/tickernoti-syspopup) + +INCLUDE(FindPkgConfig) +pkg_check_modules(pkgs REQUIRED appcore-efl bundle dlog ecore elementary evas syspopup vconf) + +FOREACH(flag ${pkgs_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") +ENDFOREACH(flag) + +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") +SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") +SET(CMAKE_C_FLAGS_RELEASE "-O2") + +FIND_PROGRAM(UNAME NAMES uname) +EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH") +IF("${ARCH}" STREQUAL "arm") + ADD_DEFINITIONS("-DTARGET") + MESSAGE("add -DTARGET") +ENDIF("${ARCH}" STREQUAL "arm") + +ADD_DEFINITIONS("-DVENDOR=\"${VENDOR}\"") +ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE}\"") +ADD_DEFINITIONS("-DPACKAGE_NAME=\"${PKGNAME}\"") +ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"") +ADD_DEFINITIONS("-DLOCALEDIR=\"${LOCALEDIR}\"") + +SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed") + +ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS}) +TARGET_LINK_LIBRARIES(${PROJECT_NAME} syspopup ${pkgs_LDFLAGS}) + +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR}) diff --git a/src/tickernoti-syspopup.c b/src/tickernoti-syspopup.c new file mode 100644 index 0000000..5b5a7fb --- /dev/null +++ b/src/tickernoti-syspopup.c @@ -0,0 +1,520 @@ +/* + * tickernoti + * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + +#include +#include +#include +#include + +#include +#include "tickernoti-syspopup.h" + +#define HAVE_ELEMENTARY_X 1 +#define SYSPOPUP_PARAM_LEN 3 +syspopup_handler handler = { + .def_term_fn = NULL, + .def_timeout_fn = NULL +}; + +static void __win_del(void *data, Evas_Object * obj, void *event) +{ + elm_exit(); +} + +static Evas_Object *__create_win(const char *name) +{ + if(!name) return NULL; + Evas_Object *eo; + int w; + int h; + + eo = elm_win_add(NULL, name, ELM_WIN_DIALOG_BASIC); + if (eo) { + elm_win_title_set(eo, name); + elm_win_borderless_set(eo, EINA_TRUE); + elm_win_alpha_set(eo, EINA_TRUE); + elm_win_raise(eo); + evas_object_smart_callback_add(eo, "delete,request", + __win_del, NULL); + ecore_x_window_size_get(ecore_x_window_root_first_get(), + &w, &h); + evas_object_resize(eo, w, h); + } + + + return eo; +} + +static int __app_create(void *data) +{ + if(!data) return -1; + struct appdata *ad = data; + + int r; + int ret = -1; + + /* init internationalization */ + r = appcore_set_i18n(PACKAGE, LOCALEDIR); + if (r != 0) + { + return -1; + } + + return 0; +} + +static void unload_popup(void *data) +{ + if(!data) return ; + struct appdata *ad = data; + + if (ad->rotation_event_handler) + { + ecore_event_handler_del(ad->rotation_event_handler); + } + + if (ad->layout) + { + evas_object_del(ad->layout); + ad->layout = NULL; + } +} + +static int __app_terminate(void *data) +{ + + if(!data) return -1; + struct appdata *ad = data; + int ret = -1; + + unload_popup(ad); + + if (ad->win) + { + evas_object_del(ad->win); + ad->win = NULL; + } + if (ad->b) + { + ret = bundle_free(ad->b); + if (ret != 0 ) + { + } + ad->b = NULL; + } + + return 0; +} + +static int __app_pause(void *data) +{ + return 0; +} + +static int __app_resume(void *data) +{ + return 0; +} + +static void __prt_recvd_bundle(const char *key, const char *value, void *d) +{ +} + +static Eina_Bool timeout_cb(void *data) +{ + + elm_exit(); + + return ECORE_CALLBACK_CANCEL; +} + +#ifdef HAVE_ELEMENTARY_X +static void +_update_window_hints(Evas_Object *obj) +{ + Ecore_X_Window xwin; + Ecore_X_Atom _notification_level_atom; + int level; + // elm_win_xwindow_get() must call after elm_win_alpha_set() + xwin = elm_win_xwindow_get(obj); + + ecore_x_icccm_hints_set(xwin, 0, ECORE_X_WINDOW_STATE_HINT_NONE, 0, 0, 0, 0, 0); + ecore_x_netwm_window_type_set(xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION); + ecore_x_netwm_opacity_set(xwin, 0); + // Create atom for notification level + _notification_level_atom = ecore_x_atom_get("_E_ILLUME_NOTIFICATION_LEVEL"); + + // HIGH:150, NORMAL:100, LOW:50 + level = 100; + + // Set notification level of the window + ecore_x_window_prop_property_set(xwin, _notification_level_atom, ECORE_X_ATOM_CARDINAL, 32, &level, 1); +} + +#endif +static Evas_Object +*_create_window(Evas_Object *parent, const char *name) +{ + Evas_Object *win; + + win = elm_win_add(parent, name, ELM_WIN_BASIC); + elm_win_title_set(win, name); + elm_win_borderless_set(win, EINA_TRUE); + elm_win_autodel_set(win, EINA_TRUE); + elm_win_alpha_set(win, EINA_TRUE); + evas_object_size_hint_weight_set(win, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(win, EVAS_HINT_FILL, EVAS_HINT_FILL); + +#ifdef HAVE_ELEMENTARY_X + // set top window + _update_window_hints(win); +#endif + return win; +} + +static void +_update_geometry_on_rotation(void *data, int *x, int *y, int *w) +{ + int angle; + + if(!data) return ; + struct appdata *ad = data; + + angle = ad->angle; +#ifdef HAVE_ELEMENTARY_X + Evas_Coord root_w, root_h; + + /* + * manually calculate win_tickernoti_indi window position & size + * - win_indi is not full size window + */ + ecore_x_window_size_get(ecore_x_window_root_first_get(), &root_w, &root_h); + // rotate win + switch(angle) + { + case 90: + *w = root_h; + if (ad->orient == _ELM_TICKERNOTI_ORIENT_BOTTOM) + *x = root_w - ad->noti_height; + break; + case 270: + *w = root_h; + if (!(ad->orient == _ELM_TICKERNOTI_ORIENT_BOTTOM)) + *x = root_w - ad->noti_height; + break; + case 180: + *w = root_w; + if (!ad->orient == _ELM_TICKERNOTI_ORIENT_BOTTOM) + *y = root_h - ad->noti_height; + break; + case 0: + default: + *w = root_w; + if (ad->orient == _ELM_TICKERNOTI_ORIENT_BOTTOM) + *y = root_h - ad->noti_height; + break; + } +#endif +} + +static void +_win_rotated(void *data) +{ + struct appdata *ad = data; + int x = 0, y = 0, w = 0, angle = 0; + + if (!ad) return; + angle = elm_win_rotation_get(ad->win); + if (angle % 90) return; + angle %= 360; + if (angle < 0) angle += 360; + ad->angle = angle; + _update_geometry_on_rotation(ad, &x, &y, &w); + evas_object_move(ad->win, x, y); + evas_object_resize(ad->win, w, ad->noti_height); +#ifdef HAVE_ELEMENTARY_X + _update_window_hints(ad->win); +#endif +} + +static Eina_Bool +_prop_change(void *data, int type, void *event) +{ +#ifdef HAVE_ELEMENTARY_X + Ecore_X_Event_Window_Property *ev; + struct appdata *ad = data; + + if (!ad) return ECORE_CALLBACK_PASS_ON; + ev = event; + if (ev->atom == ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE) + { + if (ev->win == elm_win_xwindow_get(ad->win)) + { + _win_rotated(data); + } + } + return ECORE_CALLBACK_PASS_ON; +#endif +} +static void _hide_cb(void *data, Evas_Object *obj, const char *emission, const char *source) +{ + struct appdata *ad = data; + + if (!ad) return; + evas_object_hide(ad->win); +} + +static void +_create_tickernoti(void *data) +{ + Evas_Coord w; + char *data_win_height = NULL; + + if(!data) return ; + struct appdata *ad = data; + + evas_object_move(ad->win, 0, 0); + + ad->layout = elm_layout_add(ad->win); + elm_layout_file_set(ad->layout, TICKERNOTI_EDJ, ad->style); + + elm_win_resize_object_add(ad->win, ad->layout); + evas_object_size_hint_weight_set(ad->layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + + // tickernoti height setting + if ((ad->style) && (!strcmp(ad->style, "info"))) + data_win_height = TICKERNOTI_INFO_BG_MIN_HEIGHT; + else + data_win_height = TICKERNOTI_DEFAULT_BG_MIN_HEIGHT; + + if (data_win_height != NULL && elm_config_scale_get() > 0.0) + ad->noti_height = (int)(elm_config_scale_get() * atoi(data_win_height)); + + ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, NULL); + evas_object_size_hint_min_set(ad->layout, w, ad->noti_height); + evas_object_resize(ad->win, w, ad->noti_height); + + ad->rotation_event_handler = ecore_event_handler_add( + ECORE_X_EVENT_WINDOW_PROPERTY, _prop_change, ad); + + edje_object_signal_callback_add(elm_layout_edje_get(ad->layout), "request,hide", "", _hide_cb, ad); + evas_object_show(ad->layout); +} + +static void +_show_tickernoti(void *data) +{ + if(!data) return ; + struct appdata *ad = data; + + _update_window_hints(ad->win); + evas_object_show(ad->win); + edje_object_signal_emit(elm_layout_edje_get(ad->layout), "effect,show", "elm"); + edje_object_message_signal_process(elm_layout_edje_get(ad->layout)); +} + +static void +_hide(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + if(!data) return ; + struct appdata *ad = data; + evas_object_hide(ad->win); +} + +EAPI Evas_Object * +_elm_tickernoti_add(void *data) +{ + Evas_Object *obj; + + if(!data) return NULL; + struct appdata *ad = data; + + ad->win = _create_window(NULL, "noti-window"); + + _create_tickernoti(ad); + + evas_object_event_callback_add(ad->layout, EVAS_CALLBACK_HIDE, _hide, ad); + return ad->layout; +} + +static void +_sizing_eval(void *data) +{ + if(!data) return ; + struct appdata *ad = data; + Evas_Coord minw = -1, minh = -1; + + elm_coords_finger_size_adjust(1, &minw, 1, &minh); + edje_object_size_min_restricted_calc(elm_layout_edje_get(ad->layout), &minw, &minh, minw, minh); +} + +static void +_elm_tickernoti_label_set(void *data) +{ + if(!data) return ; + struct appdata *ad = data; + edje_object_part_text_set(elm_layout_edje_get(ad->layout), "elm.text", ad->text); + _sizing_eval(ad); +} + +EAPI void +_elm_tickernoti_orient_set(void *data, _Elm_Tickernoti_Orient orient) +{ + Evas_Coord root_w, root_h; + if(!data) return ; + struct appdata *ad = data; + + if (orient >= _ELM_TICKERNOTI_ORIENT_LAST) return; + + ecore_x_window_size_get(ecore_x_window_root_first_get(), &root_w, &root_h); + + switch(orient) { + case _ELM_TICKERNOTI_ORIENT_BOTTOM: + evas_object_move(ad->win, 0, root_h - ad->noti_height); + ad->orient = _ELM_TICKERNOTI_ORIENT_BOTTOM; + break; + case _ELM_TICKERNOTI_ORIENT_TOP: + default: + evas_object_move(ad->win, 0, 0); + ad->orient = _ELM_TICKERNOTI_ORIENT_TOP; + break; + } + _update_window_hints(ad->win); +} + +static void load_small_popup(void *data) +{ + if(!data) return ; + struct appdata *ad = data; + int ret = -1; + + if (ad->win) + { + evas_object_del(ad->win); + ad->win = NULL; + } + + _elm_tickernoti_add(ad); + + ret = syspopup_create(ad->b, &handler, ad->win, ad); + if(ret != 0) return; + + _elm_tickernoti_label_set(ad); + _elm_tickernoti_orient_set(ad, ad->orient); + evas_object_show(ad->layout); + _show_tickernoti(ad); + + if (ad->timeout <= 0) return; + ad->e_timer = ecore_timer_add(ad->timeout, timeout_cb, NULL); +} + +static int __app_reset(bundle *b, void *data) +{ + + if(!data) return -1; + struct appdata *ad = data; + char key[SYSPOPUP_PARAM_LEN]; + int ret = 0; + + ad->b = bundle_dup(b); + + /* When syspopup is already loaded, remove the popup and load new popup */ + if (syspopup_has_popup(b)) + { + if (ad->e_timer) + { + ecore_timer_del(ad->e_timer); + ad->e_timer = NULL; + } + if (ad->layout) + { + evas_object_del(ad->layout); + ad->layout = NULL; + } + if (ad->win) + { + evas_object_del(ad->win); + ad->win = NULL; + } + /* Resetting all proporties of syspopup */ + syspopup_reset(b); + } + + /* get text */ + snprintf(key, SYSPOPUP_PARAM_LEN, "%d", SYSPOPUP_TEXT); + ad->text = bundle_get_val(b, (const char *)key); + if (!ad->text) + { + elm_exit(); + } + + /* get tickernoti style */ + snprintf(key, SYSPOPUP_PARAM_LEN, "%d", SYSPOPUP_STYLE); + ad->style = bundle_get_val(b, (const char *)key); + if (!ad->style) ad->style = "default"; + + /* get orient */ + snprintf(key, SYSPOPUP_PARAM_LEN, "%d", SYSPOPUP_ORIENT); + const char *orient = bundle_get_val(b, (const char *)key); + if (!orient) + { + /* default orient */ + ad->orient = _ELM_TICKERNOTI_ORIENT_TOP; + } + else + { + ad->orient = atoi(orient); + } + + /* get timeout */ + snprintf(key, SYSPOPUP_PARAM_LEN, "%d", SYSPOPUP_TIMEOUT); + const char *timeout = bundle_get_val(b, (const char *)key); + if (!timeout) + { + /* default timeout */ + ad->timeout = -1; + } + else + { + ad->timeout = atoi(timeout); + } + + load_small_popup(ad); + + return 0; +} + +int main(int argc, char *argv[]) +{ + + struct appdata ad; + struct appcore_ops ops = { + .create = __app_create, + .terminate = __app_terminate, + .pause = __app_pause, + .resume = __app_resume, + .reset = __app_reset, + }; + + memset(&ad, 0x0, sizeof(struct appdata)); + ops.data = &ad; + + return appcore_efl_main(PACKAGE, &argc, &argv, &ops); +} + diff --git a/src/tickernoti-syspopup.h b/src/tickernoti-syspopup.h new file mode 100644 index 0000000..224b2d7 --- /dev/null +++ b/src/tickernoti-syspopup.h @@ -0,0 +1,74 @@ +/* + * tickernoti + * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + +#ifndef __TICKERNOTI_SYSPOPUP_APP_H__ +#define __TICKERNOTI_SYSPOPUP_APP_H__ + +#if !defined(PACKAGE) +#define PACKAGE "tickernoti_syspopup" +#endif +//TODO: what is the path? +#define EDJ_PATH PREFIX"/res/edje" +#define TICKERNOTI_EDJ EDJ_PATH"/tickernoti.edj" +#define TICKERNOTI_DEFAULT_BG_MIN_HEIGHT "98" +#define TICKERNOTI_INFO_BG_MIN_HEIGHT "50" + +enum syspopup_param { + SYSPOPUP_STYLE = 0, + SYSPOPUP_TEXT, + SYSPOPUP_ORIENT, + SYSPOPUP_TIMEOUT + /* When we need to deliver other parameters to tickernoti-syspopup + * add the types of parameters */ +}; + +typedef enum +{ + //TODO: ENUM name + _ELM_TICKERNOTI_ORIENT_TOP = 0, + _ELM_TICKERNOTI_ORIENT_BOTTOM, + _ELM_TICKERNOTI_ORIENT_LAST +} _Elm_Tickernoti_Orient; + +typedef enum +{ + _ELM_TICKERNOTI_DEFAULT, + _ELM_TICKERNOTI_DETAILVIEW +} _Elm_Tickernoti_Mode; + +struct appdata { + Evas_Object *win; + bundle *b; + const char* style; + const char* text; + int timeout; + Ecore_Timer *e_timer; + + Evas_Object *layout; + Ecore_Event_Handler *rotation_event_handler; + int noti_height; + int angle; + _Elm_Tickernoti_Mode mode; + _Elm_Tickernoti_Orient orient; + + /* add more variables here */ +}; + +#endif /* __TICKERNOTI_SYSPOPUP_APP_H__ */ +