tizen 2.3.1 release tizen_2.3.1 submit/tizen_2.3.1/20150915.075725 tizen_2.3.1_release
authorjk7744.park <jk7744.park@samsung.com>
Tue, 8 Sep 2015 13:09:16 +0000 (22:09 +0900)
committerjk7744.park <jk7744.park@samsung.com>
Tue, 8 Sep 2015 13:09:16 +0000 (22:09 +0900)
19 files changed:
CMakeLists.txt
LICENSE.APLv2 [moved from LICENSE with 97% similarity, mode: 0644]
NOTICE [new file with mode: 0644]
TC/testcase/utc_efl_util_set_notification_window_level.c
capi-ui-efl-util.pc.in
debian/README [deleted file]
debian/capi-ui-efl-util-dev.install [deleted file]
debian/capi-ui-efl-util-dev.postinst [deleted file]
debian/capi-ui-efl-util.install [deleted file]
debian/capi-ui-efl-util.postinst [deleted file]
debian/changelog [deleted file]
debian/compat [deleted file]
debian/control [deleted file]
debian/rules [deleted file]
doc/ui_efl_util_doc.h [new file with mode: 0755]
include/efl_util.h
include/efl_util_private.h [new file with mode: 0755]
packaging/capi-ui-efl-util.spec
src/efl_util.c

index a1cdd13..a624985 100755 (executable)
@@ -28,7 +28,7 @@ ENDIF("${ARCH}" STREQUAL "arm")
 ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
 ADD_DEFINITIONS("-DSLP_DEBUG")
 
-SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}")
 
 aux_source_directory(src SOURCES)
 ADD_LIBRARY(${fw_name} SHARED ${SOURCES})
@@ -42,7 +42,7 @@ SET_TARGET_PROPERTIES(${fw_name}
      CLEAN_DIRECT_OUTPUT 1
 )
 
-INSTALL(TARGETS ${fw_name} DESTINATION lib)
+INSTALL(TARGETS ${fw_name} DESTINATION ${LIB_INSTALL_DIR})
 INSTALL(
         DIRECTORY ${INC_DIR}/ DESTINATION include/ui
         FILES_MATCHING
@@ -60,7 +60,7 @@ CONFIGURE_FILE(
     ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc
     @ONLY
 )
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION lib/pkgconfig)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
 
 IF(UNIX)
 
old mode 100755 (executable)
new mode 100644 (file)
similarity index 97%
rename from LICENSE
rename to LICENSE.APLv2
index bbe9d02..ec68963
--- a/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.\r
 \r
                                  Apache License\r
                            Version 2.0, January 2004\r
diff --git a/NOTICE b/NOTICE
new file mode 100644 (file)
index 0000000..fbd8b61
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,3 @@
+Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under the Apache License, Version 2.0.
+Please, see the LICENSE.APLv2 file for Apache License, Version 2 terms and conditions.
index 0c9ab66..e3afb6d 100755 (executable)
@@ -11,7 +11,7 @@
  * 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. 
+ * limitations under the License.
  */
 
 #include <tet_api.h>
@@ -38,9 +38,11 @@ static void utc_efl_util_get_notification_window_level_negative_2(void);
 
 static void utc_efl_util_set_notification_window_level_positive_1(void);
 static void utc_efl_util_set_notification_window_level_positive_2(void);
+static void utc_efl_util_set_notification_window_level_positive_3(void);
 
 static void utc_efl_util_get_notification_window_level_positive_1(void);
 static void utc_efl_util_get_notification_window_level_positive_2(void);
+static void utc_efl_util_get_notification_window_level_positive_3(void);
 
 
 struct tet_testlist tet_testlist[] = {
@@ -51,8 +53,10 @@ struct tet_testlist tet_testlist[] = {
        { utc_efl_util_get_notification_window_level_negative_2, 1 },
        { utc_efl_util_set_notification_window_level_positive_1, 1 },
        { utc_efl_util_set_notification_window_level_positive_2, 1 },
+       { utc_efl_util_set_notification_window_level_positive_3, 1 },
        { utc_efl_util_get_notification_window_level_positive_1, 1 },
        { utc_efl_util_get_notification_window_level_positive_2, 1 },
+       { utc_efl_util_get_notification_window_level_positive_3, 1 },
        { NULL, 0 },
 };
 
@@ -88,9 +92,9 @@ static Evas_Object* create_normal_win(const char *name)
                elm_win_borderless_set(eo, EINA_TRUE);
                evas_object_smart_callback_add(eo, "delete,request",
                                win_del, NULL);
-               elm_win_indicator_state_set(eo, EINA_TRUE);
+               elm_win_indicator_mode_set(eo, ELM_WIN_INDICATOR_SHOW);
        }
-       
+
        return eo;
 }
 
@@ -106,9 +110,9 @@ static Evas_Object* create_notification_win(const char *name)
                elm_win_borderless_set(eo, EINA_TRUE);
                evas_object_smart_callback_add(eo, "delete,request",
                                win_del, NULL);
-               elm_win_indicator_state_set(eo, EINA_TRUE);
+               elm_win_indicator_mode_set(eo, ELM_WIN_INDICATOR_SHOW);
        }
-       
+
        return eo;
 }
 
@@ -294,6 +298,35 @@ static void utc_efl_util_set_notification_window_level_positive_2(void)
 /**
  * @brief Positive test case of efl_util_set_notification_window_level()
  */
+static void utc_efl_util_set_notification_window_level_positive_3(void)
+{
+       Evas_Object *win;
+       int ret1, ret2, ret3;
+
+       win = create_notification_win("Notification Type Window");
+       if (!win)
+       {
+               dts_fail(API_SET_NOTIFICATION_WINDOW_LEVEL, "failed to create window");
+       }
+
+       ret1 = efl_util_set_notification_window_level(win, EFL_UTIL_NOTIFICATION_LEVEL_1);
+       ret2 = efl_util_set_notification_window_level(win, EFL_UTIL_NOTIFICATION_LEVEL_2);
+       ret3 = efl_util_set_notification_window_level(win, EFL_UTIL_NOTIFICATION_LEVEL_3);
+
+       if (ret3 == EFL_UTIL_ERROR_NONE)
+       {
+               dts_pass(API_SET_NOTIFICATION_WINDOW_LEVEL, "passed");
+       }
+       else
+       {
+               dts_fail(API_SET_NOTIFICATION_WINDOW_LEVEL, "failed");
+       }
+}
+
+
+/**
+ * @brief Positive test case of efl_util_set_notification_window_level()
+ */
 static void utc_efl_util_get_notification_window_level_positive_1(void)
 {
        Evas_Object *win;
@@ -365,3 +398,41 @@ static void utc_efl_util_get_notification_window_level_positive_2(void)
        }
 }
 
+
+/**
+ * @brief Positive test case of efl_util_set_notification_window_level()
+ */
+static void utc_efl_util_get_notification_window_level_positive_3(void)
+{
+       Evas_Object *win;
+       int ret;
+       int level;
+
+       win = create_notification_win("Notification Type Window");
+       if (!win)
+       {
+               dts_fail(API_GET_NOTIFICATION_WINDOW_LEVEL, "failed to create window");
+       }
+       efl_util_set_notification_window_level(win, EFL_UTIL_NOTIFICATION_LEVEL_1);
+       efl_util_set_notification_window_level(win, EFL_UTIL_NOTIFICATION_LEVEL_3);
+
+       level = -1;
+       ret = efl_util_get_notification_window_level(win,  &level);
+
+       if (ret == EFL_UTIL_ERROR_NONE)
+       {
+               if (level == EFL_UTIL_NOTIFICATION_LEVEL_3)
+               {
+                       dts_pass(API_GET_NOTIFICATION_WINDOW_LEVEL, "passed");
+               }
+               else
+               {
+                       dts_fail(API_GET_NOTIFICATION_WINDOW_LEVEL, "failed - level is wrong");
+               }
+       }
+       else
+       {
+               dts_fail(API_GET_NOTIFICATION_WINDOW_LEVEL, "failed - return value is wrong");
+       }
+}
+
index 3938d56..b9737af 100755 (executable)
@@ -3,7 +3,7 @@
 
 prefix=@PREFIX@
 exec_prefix=/usr
-libdir=/usr/lib
+libdir=@LIB_INSTALL_DIR@
 includedir=/usr/include/ui
 
 Name: @PC_NAME@
diff --git a/debian/README b/debian/README
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/debian/capi-ui-efl-util-dev.install b/debian/capi-ui-efl-util-dev.install
deleted file mode 100755 (executable)
index 761a28b..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-/usr/include/*
-/usr/include/*/*
-/usr/lib/pkgconfig/*.pc
-
diff --git a/debian/capi-ui-efl-util-dev.postinst b/debian/capi-ui-efl-util-dev.postinst
deleted file mode 100755 (executable)
index 1a24852..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#!/bin/sh
diff --git a/debian/capi-ui-efl-util.install b/debian/capi-ui-efl-util.install
deleted file mode 100755 (executable)
index 4a755a4..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/usr/lib/lib*.so*
diff --git a/debian/capi-ui-efl-util.postinst b/debian/capi-ui-efl-util.postinst
deleted file mode 100755 (executable)
index 1a24852..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#!/bin/sh
diff --git a/debian/changelog b/debian/changelog
deleted file mode 100755 (executable)
index e64298c..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-capi-ui-efl-util (0.1.0-5) unstable; urgency=low
-
-   * Added version numbering 
-   * Git: slp/api/efl-util
-   * Tag: capi-ui-efl-util_0.1.0-5
-
- -- Kyuhun Jung <kyuhun.jung@samsung.com>  Wed, 15 Feb 2012 10:50:29 +0900
-
-capi-ui-efl-util (0.1.0-4) unstable; urgency=low
-
-   * Update boilerplate
-   * Git: slp/api/efl-util
-   * Tag: capi-ui-efl-util_0.1.0-4
-
- -- Kyuhun Jung <kyuhun.jung@samsung.com>  Tue, 06 Dec 2011 12:57:25 +0300
-
-capi-ui-efl-util (0.1.0-3) unstable; urgency=low
-
-   * Using Tizen namespace
-   * Git: slp-source.sec.samsung.net:slp/api/efl-util
-   * Tag: capi-ui-efl-util_0.1.0-3
-
- -- Kyuhun Jung <kyuhun.jung@samsung.com>  Wed, 23 Nov 2011 06:59:55 +0300
-
-capi-ui-efl-util (0.1.0-2) unstable; urgency=low
-
-   * Implement getter API
-   * Git: slp-source.sec.samsung.net:slp/api/efl-util
-   * Tag: capi-ui-efl-util_0.1.0-2
-
- -- Kyuhun Jung <kyuhun.jung@samsung.com>  Mon, 10 Oct 2011 12:42:46 +0300
-
-capi-ui-efl-util (0.1.0-1) unstable; urgency=low
-
-   * Alpha release
-   * Git: slp-source.sec.samsung.net:slp/api/efl-util
-   * Tag: capi-ui-efl-util_0.1.0-1
-
- -- Kyuhun Jung <kyuhun.jung@samsung.com>  Tue, 27 Sep 2011 21:11:54 +0900
-
-capi-ui-efl-util (0.0.1-1) unstable; urgency=low
-
-   * Initial upload
-   * Git: slp-source.sec.samsung.net:slp/api/efl-util
-   * Tag: capi-ui-efl-util_0.0.1-1
-
- -- Kyuhun Jung <kyuhun.jung@samsung.com>  Mon, 26 Sep 2011 19:14:07 +0900
-
diff --git a/debian/compat b/debian/compat
deleted file mode 100644 (file)
index 7ed6ff8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-5
diff --git a/debian/control b/debian/control
deleted file mode 100755 (executable)
index 9f768c6..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-
-Source: capi-ui-efl-util
-Section: libs
-Priority: extra
-Maintainer: Kyuhun Jung <kyuhun.jung@samsung.com>
-Build-Depends: debhelper (>= 5), dlog-dev, libslp-utilx-dev, libelm-dev, capi-base-common-dev
-
-Package: capi-ui-efl-util
-Architecture: any
-Depends: ${shilbs:Depends}, ${misc:Depends}
-Description: An EFL utility library in Tizen Native API
-
-Package: capi-ui-efl-util-dev
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, capi-ui-efl-util (= ${Source-Version}), dlog-dev, libslp-utilx-dev, libelm-dev, capi-base-common-dev
-Description: An EFL utility library in Tizen Native API (DEV)
-
-Package: capi-ui-efl-util-dbg
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, capi-ui-efl-util (= ${Source-Version})
-Description: An EFL utility library in Tizen Native API (DBG)
-
diff --git a/debian/rules b/debian/rules
deleted file mode 100755 (executable)
index 3815f73..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/usr/bin/make -f
-
-CFLAGS = -Wall -g
-
-ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
-       CFLAGS += -O0
-else
-       CFLAGS += -O2
-endif
-CMAKE_ROOT_DIR ?= $(CURDIR)
-CMAKE_BUILD_DIR ?= $(CURDIR)/cmake_build_tmp
-
-FULLVER ?= $(shell dpkg-parsechangelog | grep Version: | cut -d ' ' -f 2 | cut -d '-' -f 1)
-MAJORVER ?= $(shell echo $(FULLVER) | cut -d '.' -f 1)
-
-configure: configure-stamp
-configure-stamp:
-       dh_testdir
-       mkdir -p $(CMAKE_BUILD_DIR) && cd $(CMAKE_BUILD_DIR) && cmake .. -DFULLVER=${FULLVER} -DMAJORVER=${MAJORVER}
-       touch configure-stamp
-
-
-build: build-stamp
-build-stamp: configure-stamp 
-       dh_testdir
-       cd $(CMAKE_BUILD_DIR) && $(MAKE)
-       touch $@
-
-clean:
-       cd $(CMAKE_ROOT_DIR)
-       dh_testdir
-       dh_testroot
-       rm -f build-stamp configure-stamp
-       rm -f `find . -name *.pc`
-       rm -rf $(CMAKE_BUILD_DIR)
-       dh_clean
-       
-install: build
-       dh_testdir
-       dh_testroot
-       dh_clean -k 
-       dh_installdirs
-
-       cd $(CMAKE_BUILD_DIR) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
-
-binary-indep: build install
-
-binary-arch: build install
-       dh_testdir
-       dh_testroot
-       dh_installchangelogs 
-       dh_installdocs
-       dh_installexamples
-       dh_install --sourcedir=debian/tmp
-       dh_installman
-       dh_link
-       dh_strip --dbg-package=capi-ui-efl-util-dbg
-       dh_fixperms
-       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/doc/ui_efl_util_doc.h b/doc/ui_efl_util_doc.h
new file mode 100755 (executable)
index 0000000..64de8d0
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_UI_EFL_UTIL_DOC_H__
+#define __TIZEN_UI_EFL_UTIL_DOC_H__
+
+/**
+ * @ingroup CAPI_UI_FRAMEWORK
+ * @defgroup CAPI_EFL_UTIL_MODULE EFL UTIL
+ * @brief 
+ * 
+ * @section CAPI_EFL_UTIL_MODULE_HEADER Required Header
+ *   \#include <efl_util.h>
+ *
+ * @section CAPI_EFL_UTIL_MODULE_OVERVIEW Overview
+ * The EFL UTIL API provides functions to get the level of given notification windows
+ * and to change the notification window levels with the given values. 
+ *
+ * The notification window level is used in ordering the notification windows.
+ * The notification window which is set to #EFL_UTIL_NOTIFICATION_LEVEL_2 will be 
+ * placed above the window which is set to #EFL_UTIL_NOTIFICATION_LEVEL_1. 
+ * If there are notification windows that have the same levels, the latest created 
+ * notification window is placed on top of the other window.
+ *
+ */
+
+#endif /* __TIZEN_UI_EFL_UTIL_DOC_H__ */
index 9c8d7ad..88b5b4f 100755 (executable)
@@ -11,7 +11,7 @@
  * 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. 
+ * limitations under the License.
  */
 
 
@@ -26,61 +26,118 @@ extern "C" {
 #endif
 
 /**
+ * @file efl_util.h
+ */
+
+/**
  * @addtogroup CAPI_EFL_UTIL_MODULE
  * @{
  */
 
 
 /**
- * @brief Enumerations of error code for EFL UTIL
+ * @brief Enumeration for EFL UTIL ERROR.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  */
 typedef enum
 {
        EFL_UTIL_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
        EFL_UTIL_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
-       EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE = TIZEN_ERROR_APPLICATION_CLASS | 0x08  /**< Not supported window type */
+       EFL_UTIL_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
+       EFL_UTIL_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permisson denied */
+       EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE = TIZEN_ERROR_EFL_UTIL | 0x01  /**< Window type not supported */
 } efl_util_error_e;
 
 
-/**                                                 
- * @brief Enumeration of notification window's priority level
- * 
+/**
+ * @brief Enumeration of notification window's priority level.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  */
 typedef enum
 {
-       EFL_UTIL_NOTIFICATION_LEVEL_1, /**< Default notification level*/
-       EFL_UTIL_NOTIFICATION_LEVEL_2, /**< Higher notification level than default*/
-} efl_util_notification_level_e; 
+       EFL_UTIL_NOTIFICATION_LEVEL_1, /**< Default notification level */
+       EFL_UTIL_NOTIFICATION_LEVEL_2, /**< Higher notification level than default */
+       EFL_UTIL_NOTIFICATION_LEVEL_3, /**< The highest notification level */
+} efl_util_notification_level_e;
 
 
 
 /**
  * @brief Sets the priority level for the specified notification window, asynchronously.
- *
- * @remark This API can be used for notification type window only
- * @param [in] window EFL window 
- * @param [in] level The notification window level
- * @return 0 on success, otherwise a negative error value.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/window.priority.set
+ * @remarks This API can be used for a notification type window only.
+ * @param[in] window The EFL window
+ * @param[in] level The notification window level
+ * @return @c 0 on success,
+ *         otherwise a negative error value
  * @retval #EFL_UTIL_ERROR_NONE Successful
  * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE Not supported window type
+ * @retval #EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE Window type not supported
  */
 int efl_util_set_notification_window_level (Evas_Object *window, efl_util_notification_level_e level);
 
 
 /**
  * @brief Gets the priority level for the specified notification window, asynchronously.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @remark This API can be used for notification type window only
- * @param [in] window EFL window 
- * @param [out] level The notification window level
- * @return 0 on success, otherwise a negative error value.
+ * @remarks This API can be used for a notification type window only.
+ * @param[in] window The EFL window
+ * @param[out] level The notification window level
+ * @return @c 0 on success,
+ *         otherwise a negative error value
  * @retval #EFL_UTIL_ERROR_NONE Successful
  * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE Not supported window type
+ * @retval #EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE Window type not supported
  */
 int efl_util_get_notification_window_level (Evas_Object *window, efl_util_notification_level_e* level);
 
+
+/**
+ * @brief Called when an error occurs for setting notification window level
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in]  window  The EFL window
+ * @param[in]  error_code      The error code (#EFL_UTIL_ERROR_PERMISSION_DENIED)
+ * @param[in]  user_data       The user data passed from the callback registration function
+ * @see efl_util_set_notification_window_level_error_cb()
+ * @see efl_util_unset_notification_window_level_error_cb()
+ */
+typedef void (*efl_util_notification_window_level_error_cb)(Evas_Object *window, int error_code, void *user_data);
+
+
+/**
+ * @brief Registers a callback function to be invoked when an error which set the notification level occurs.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] window   The EFL window
+ * @param[in] callback The callback function to register
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return @c 0 on success,
+ *                otherwise a negative error value
+ * @retval #EFL_UTIL_ERROR_NONE Successful
+ * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #EFL_UTIL_ERROR_OUT_OF_MEMORY Out of memory
+ * @post  efl_util_notification_window_level_error_cb() will be invoked.
+ * @see efl_util_unset_notification_window_level_error_cb()
+ * @see efl_util_notification_window_level_error_cb()
+ */
+int efl_util_set_notification_window_level_error_cb(Evas_Object *window, efl_util_notification_window_level_error_cb callback, void *user_data);
+
+
+/**
+ * @brief Unregisters the callback function.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] window The EFL window
+ * @return @c 0 on success,
+ *                otherwise a negative error value
+ * @retval #EFL_UTIL_ERROR_NONE Successful
+ * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see efl_util_set_notification_window_level_error_cb()
+ */
+int efl_util_unset_notification_window_level_error_cb(Evas_Object *window);
+
+
 /**
  * @}
  */
diff --git a/include/efl_util_private.h b/include/efl_util_private.h
new file mode 100755 (executable)
index 0000000..52c225c
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_UI_EFL_UTIL_PRIVATE_H__
+#define __TIZEN_UI_EFL_UTIL_PRIVATE_H__
+
+#include <efl_util.h>
+#include <Elementary.h>
+#include <Ecore_X.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct _notification_error_cb_info
+{
+       Evas_Object *window;
+       efl_util_notification_window_level_error_cb err_cb;
+       void *user_data;
+} notification_error_cb_info;
+
+Eina_List *_g_notification_error_cb_info_list;
+static Ecore_Event_Handler* _noti_level_access_result_handler = NULL;
+static int _noti_handler_count = 0;
+static Ecore_X_Atom _noti_level_access_result_atom;
+
+static Eina_Bool _efl_util_client_message(void *data, int type, void *event);
+static notification_error_cb_info *_notification_error_cb_info_find_by_xwin(Ecore_X_Window xwin);
+static notification_error_cb_info *_notification_error_cb_info_find(Evas_Object *window);
+static Eina_Bool _efl_util_notification_info_add(Evas_Object *window, efl_util_notification_window_level_error_cb callback, void *user_data);
+static Eina_Bool _efl_util_notification_info_del(Evas_Object *window);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __TIZEN_UI_EFL_UTIL_PRIVATE_H__
index e559fef..bdf36a8 100644 (file)
@@ -1,7 +1,6 @@
-#sbs-git:slp/api/efl-util capi-ui-efl-util 0.1.0 4d35c6180088e0d005081bf798ab6a20b05e9f14
 Name:       capi-ui-efl-util
 Summary:    An EFL utility library in SLP C API
-Version: 0.1.0
+Version:    0.1.5
 Release:    1
 Group:      TO_BE/FILLED_IN
 License:    TO BE FILLED IN
@@ -10,10 +9,9 @@ BuildRequires:  cmake
 BuildRequires:  pkgconfig(dlog)
 BuildRequires:  pkgconfig(x11)
 BuildRequires:  pkgconfig(utilX)
+BuildRequires:  pkgconfig(ecore-x)
 BuildRequires:  pkgconfig(elementary)
 BuildRequires:  pkgconfig(capi-base-common)
-Requires(post): /sbin/ldconfig
-Requires(postun): /sbin/ldconfig
 
 %description
 
@@ -31,15 +29,16 @@ Requires: %{name} = %{version}-%{release}
 
 %build
 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
-cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
-
-
+%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
 make %{?jobs:-j%jobs}
 
 %install
-rm -rf %{buildroot}
 %make_install
 
+# for license notification
+mkdir -p %{buildroot}/usr/share/license
+cp -a LICENSE.APLv2 %{buildroot}/usr/share/license/%{name}
+
 %post -p /sbin/ldconfig
 
 %postun -p /sbin/ldconfig
@@ -47,6 +46,7 @@ rm -rf %{buildroot}
 
 %files
 %{_libdir}/libcapi-ui-efl-util.so.*
+/usr/share/license/%{name}
 
 %files devel
 %{_includedir}/ui/*.h
index 3d16890..367ec74 100755 (executable)
  * 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. 
+ * limitations under the License.
  */
 
 
 #define LOG_TAG "TIZEN_N_EFL_UTIL"
 
 #include <efl_util.h>
+#include <efl_util_private.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 int efl_util_set_notification_window_level (Evas_Object* window, efl_util_notification_level_e level)
 {
        Ecore_X_Window_Type window_type;
-       
+
        if(window == NULL)
        {
                return EFL_UTIL_ERROR_INVALID_PARAMETER;
        }
 
-       if(level < EFL_UTIL_NOTIFICATION_LEVEL_1 || level > EFL_UTIL_NOTIFICATION_LEVEL_2)
-       {
-               return EFL_UTIL_ERROR_INVALID_PARAMETER;
-       }
-       
        Ecore_X_Window xwin = elm_win_xwindow_get(window);
 
        if(ecore_x_netwm_window_type_get(xwin, &window_type) == EINA_TRUE)
@@ -56,7 +52,7 @@ int efl_util_set_notification_window_level (Evas_Object* window, efl_util_notifi
                // fail to get window type
                return EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE;
        }
-       
+
        // this api doesn't have return type
        if(level == EFL_UTIL_NOTIFICATION_LEVEL_1) {
                utilx_set_system_notification_level(ecore_x_display_get(), xwin, UTILX_NOTIFICATION_LEVEL_LOW);
@@ -65,7 +61,15 @@ int efl_util_set_notification_window_level (Evas_Object* window, efl_util_notifi
        {
                utilx_set_system_notification_level(ecore_x_display_get(), xwin, UTILX_NOTIFICATION_LEVEL_NORMAL);
        }
-       
+       else if(level == EFL_UTIL_NOTIFICATION_LEVEL_3)
+       {
+               utilx_set_system_notification_level(ecore_x_display_get(), xwin, UTILX_NOTIFICATION_LEVEL_HIGH);
+       }
+       else
+       {
+               return EFL_UTIL_ERROR_INVALID_PARAMETER;
+       }
+
        return EFL_UTIL_ERROR_NONE;
 }
 
@@ -76,13 +80,12 @@ int efl_util_get_notification_window_level (Evas_Object* window, efl_util_notifi
        Ecore_X_Window_Type window_type;
 
         Utilx_Notification_Level utilx_level;
-       
+
        if(window == NULL)
        {
                return EFL_UTIL_ERROR_INVALID_PARAMETER;
        }
 
-
        Ecore_X_Window xwin = elm_win_xwindow_get(window);
 
        if(ecore_x_netwm_window_type_get(xwin, &window_type) == EINA_TRUE)
@@ -93,7 +96,7 @@ int efl_util_get_notification_window_level (Evas_Object* window, efl_util_notifi
                        // given EFL window's type is not notification type.
                        return EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE;
                }
-               
+
                utilx_level = utilx_get_system_notification_level (ecore_x_display_get(), xwin);
 
                if(utilx_level == UTILX_NOTIFICATION_LEVEL_LOW)
@@ -106,19 +109,189 @@ int efl_util_get_notification_window_level (Evas_Object* window, efl_util_notifi
                }
                else if(utilx_level == UTILX_NOTIFICATION_LEVEL_HIGH)
                {
-                       *level = EFL_UTIL_NOTIFICATION_LEVEL_2;
+                       *level = EFL_UTIL_NOTIFICATION_LEVEL_3;
                }
                else
                {
                        return EFL_UTIL_ERROR_INVALID_PARAMETER;
                }
-               
        }
        else
        {
                // fail to get window type
                return EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE;
        }
-       
+
        return EFL_UTIL_ERROR_NONE;
 }
+
+
+
+int efl_util_set_notification_window_level_error_cb(Evas_Object *window, efl_util_notification_window_level_error_cb callback, void *user_data)
+{
+       Eina_Bool ret = EINA_FALSE;
+
+       if (!window) return EFL_UTIL_ERROR_INVALID_PARAMETER;
+
+       ret = _efl_util_notification_info_add(window, callback, user_data);
+       if (ret)
+       {
+               if (!_noti_level_access_result_atom)
+                       _noti_level_access_result_atom = ecore_x_atom_get("_E_NOTIFICATION_LEVEL_ACCESS_RESULT");
+
+               if (!_noti_level_access_result_handler)
+                       _noti_level_access_result_handler = ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, _efl_util_client_message, NULL);
+               _noti_handler_count++;
+
+               return EFL_UTIL_ERROR_NONE;
+       }
+       else
+       {
+               return EFL_UTIL_ERROR_OUT_OF_MEMORY;
+       }
+}
+
+
+
+int efl_util_unset_notification_window_level_error_cb(Evas_Object *window)
+{
+       Eina_Bool ret = EINA_FALSE;
+
+       if (!window) return EFL_UTIL_ERROR_INVALID_PARAMETER;
+
+       ret = _efl_util_notification_info_del(window);
+       if (ret)
+       {
+               _noti_handler_count--;
+               if (_noti_handler_count == 0)
+               {
+                       if (_noti_level_access_result_handler)
+                       {
+                               ecore_event_handler_del(_noti_level_access_result_handler);
+                               _noti_level_access_result_handler = NULL;
+                       }
+               }
+               return EFL_UTIL_ERROR_NONE;
+       }
+       else
+       {
+               return EFL_UTIL_ERROR_INVALID_PARAMETER;
+       }
+}
+
+
+
+static Eina_Bool _efl_util_client_message(void *data, int type, void *event)
+{
+       Ecore_X_Event_Client_Message *ev;
+
+       ev = event;
+       if (!ev) return ECORE_CALLBACK_PASS_ON;
+
+       if (ev->message_type == _noti_level_access_result_atom)
+       {
+               Ecore_X_Window xwin;
+               xwin = ev->win;
+
+               notification_error_cb_info *cb_info = NULL;
+               cb_info = _notification_error_cb_info_find_by_xwin(xwin);
+               if (cb_info)
+               {
+                       int access = ev->data.l[1];
+                       if (access == 0) // permission denied
+                       {
+                               if (cb_info->err_cb)
+                               {
+                                       cb_info->err_cb(cb_info->window, EFL_UTIL_ERROR_PERMISSION_DENIED, cb_info->user_data);
+                               }
+                       }
+               }
+       }
+
+       return ECORE_CALLBACK_PASS_ON;
+}
+
+
+
+static notification_error_cb_info *_notification_error_cb_info_find_by_xwin(Ecore_X_Window xwin)
+{
+       Eina_List *l;
+       notification_error_cb_info* temp;
+       Ecore_X_Window temp_xwin;
+
+       EINA_LIST_FOREACH(_g_notification_error_cb_info_list, l, temp)
+       {
+               if (temp->window)
+               {
+                       temp_xwin = elm_win_xwindow_get(temp->window);
+                       if (xwin == temp_xwin)
+                       {
+                               return temp;
+                       }
+               }
+       }
+
+       return NULL;
+}
+
+
+
+static notification_error_cb_info *_notification_error_cb_info_find(Evas_Object *window)
+{
+       Eina_List *l;
+       notification_error_cb_info* temp;
+
+       EINA_LIST_FOREACH(_g_notification_error_cb_info_list, l, temp)
+       {
+               if (temp->window == window)
+               {
+                       return temp;
+               }
+       }
+
+       return NULL;
+}
+
+
+
+static Eina_Bool _efl_util_notification_info_add(Evas_Object *window, efl_util_notification_window_level_error_cb callback, void *user_data)
+{
+       notification_error_cb_info* _err_info = _notification_error_cb_info_find(window);
+
+       if (_err_info)
+       {
+               _g_notification_error_cb_info_list = eina_list_remove(_g_notification_error_cb_info_list, _err_info);
+               free(_err_info);
+               _err_info = NULL;
+       }
+
+       _err_info = (notification_error_cb_info*)calloc(1, sizeof(notification_error_cb_info));
+       if (!_err_info)
+       {
+               return EINA_FALSE;
+       }
+       _err_info->window = window;
+       _err_info->err_cb = callback;
+       _err_info->user_data = user_data;
+
+       _g_notification_error_cb_info_list = eina_list_append(_g_notification_error_cb_info_list, _err_info);
+
+       return EINA_TRUE;
+}
+
+
+
+static Eina_Bool _efl_util_notification_info_del(Evas_Object *window)
+{
+       notification_error_cb_info* _err_info = _notification_error_cb_info_find(window);
+       if (!_err_info)
+       {
+               return EINA_FALSE;
+       }
+
+       _g_notification_error_cb_info_list = eina_list_remove(_g_notification_error_cb_info_list, _err_info);
+       free(_err_info);
+
+       return EINA_TRUE;
+}
+