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})
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
${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)
-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
--- /dev/null
+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.
* 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>
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[] = {
{ 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 },
};
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;
}
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;
}
/**
* @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;
}
}
+
+/**
+ * @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");
+ }
+}
+
prefix=@PREFIX@
exec_prefix=/usr
-libdir=/usr/lib
+libdir=@LIB_INSTALL_DIR@
includedir=/usr/include/ui
Name: @PC_NAME@
+++ /dev/null
-/usr/include/*
-/usr/include/*/*
-/usr/lib/pkgconfig/*.pc
-
+++ /dev/null
-/usr/lib/lib*.so*
+++ /dev/null
-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
-
+++ /dev/null
-
-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)
-
+++ /dev/null
-#!/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
-
--- /dev/null
+/*
+ * 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__ */
* 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.
*/
#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);
+
+
/**
* @}
*/
--- /dev/null
+/*
+ * 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__
-#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
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
%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
%files
%{_libdir}/libcapi-ui-efl-util.so.*
+/usr/share/license/%{name}
%files devel
%{_includedir}/ui/*.h
* 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)
// 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);
{
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;
}
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)
// 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)
}
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;
+}
+