Move internal API set to internal header file.
authorKyuho Jo <kyuho.jo@samsung.com>
Thu, 7 May 2015 04:53:56 +0000 (13:53 +0900)
committerKyuho Jo <kyuho.jo@samsung.com>
Mon, 11 May 2015 05:12:04 +0000 (14:12 +0900)
Change-Id: Id94c88aedec1f7add24363d8cffc26fc72d39936
Signed-off-by: Kyuho Jo <kyuho.jo@samsung.com>
CMakeLists.txt
include/notification.h
include/notification_internal.h
include/notification_ongoing_flag.h [new file with mode: 0644]
include/notification_status.h
include/notification_status_internal.h [new file with mode: 0644]
packaging/notification.spec
src/notification.c
src/notification_setting.c
src/notification_status.c
test-app/main.c

index 9569af9..9cb1b17 100644 (file)
@@ -31,7 +31,9 @@ SET(HEADERS-DEVEL
        ./include/notification_error.h
        ./include/notification_type.h
        ./include/notification_list.h
+       ./include/notification_ongoing_flag.h
        ./include/notification_status.h
+       ./include/notification_status_internal.h
        ./include/notification_setting.h
        ./include/notification_setting_internal.h
    )
index 02a4fb0..db5897a 100644 (file)
@@ -1007,41 +1007,6 @@ int notification_get_layout(notification_h noti,
  */
 int notification_get_type(notification_h noti,
                                           notification_type_e * type);
-
-/**
- * @internal
- * @brief Inserts a notification.
- * @details The notification will be inserted to the database and then it will appear in the notification area.
- *          When notification_create() is called, if priv_id is #NOTIFICATION_PRIV_ID_NONE, priv_id returns the internally set priv_id.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/notification
- * @param[in]  noti    The notification handle
- * @param[out] priv_id The private ID
- * @return #NOTIFICATION_ERROR_NONE on success,
- *         otherwise any other value on failure
- * @retval #NOTIFICATION_ERROR_NONE         Success
- * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
- * @pre Notification handle should be created by notification_create().
- * @post notification_free().
- * @par Sample code:
- * @code
-#include <notification.h>
-...
- {
-       int noti_err = NOTIFICATION_ERROR_NONE;
-
-       noti_err  = notification_insert(noti, NULL);
-       if(noti_err != NOTIFICATION_ERROR_NONE) {
-               return;
-       }
-}
- * @endcode
- */
-int notification_insert(notification_h noti,
-                                        int *priv_id);
-
 /**
  * @brief Updates notification data.
  * @details The updated notification will appear in the notification area.
@@ -1072,40 +1037,6 @@ int notification_insert(notification_h noti,
 int notification_update(notification_h noti);
 
 /**
- * @internal
- * @brief Updates a notification, asynchronously.
- * @details The updated notification will appear in the notification area.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/notification
- * @remarks This function updates the notification asynchronously.
- * @param[in] noti      The notification handle that is created by notification_create()
- * @param[in] result_cb The callback called when an update completed
- * @param[in] user_data The user data which you want to use in callback
- * @return #NOTIFICATION_ERROR_NONE on success,
- *         otherwise any other value on failure
- * @retval #NOTIFICATION_ERROR_NONE         Success
- * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
- * @retval #NOTIFICATION_ERROR_NOT_EXIST_ID Priv ID does not exist
- * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
- * @par Sample code:
- * @code
-#include <notification.h>
-...
- {
-       int noti_err = NOTIFICATION_ERROR_NONE;
-
-       noti_err  = notification_update_async(NULL, result_cb, data);
-       if(noti_err != NOTIFICATION_ERROR_NONE) {
-               return;
-       }
-}
- * @endcode
- */
-int notification_update_async(notification_h noti,
-               void (*result_cb)(int priv_id, int result, void *data), void *user_data);
-
-/**
  * @brief Deletes a notification with the given handle.
  * @details notification_delete() removes notification data from database and notification_free() releases memory of notification data.
  * @since_tizen 2.3
@@ -1240,66 +1171,6 @@ int notification_free(notification_h noti);
  */
 
 /**
- * @internal
- * @brief Registers a callback for all notification events.
- * @details The registered callback could be called for all notification events.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/notification
- * @param[in] changed_cb The callback function
- * @param[in] user_data  The user data
- * @return #NOTIFICATION_ERROR_NONE on success,
- *         otherwise any other value on failure
- * @retval #NOTIFICATION_ERROR_NONE         Success
- * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
- * @see notification_unregister_detailed_changed_cb()
- * @par Sample code:
- * @code
-#include <notification.h>
-...
-{
-       noti_err = notification_register_detailed_changed_cb(app_changed_cb, user_data);
-       if(noti_err != NOTIFICATION_ERROR_NONE) {
-               return;
-       }
-}
- * @endcode
- */
-int notification_register_detailed_changed_cb(
-               void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op),
-               void *user_data);
-
-/**
- * @internal
- * @brief Unregisters a callback for all notification events.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/notification
- * @param[in] changed_cb The callback function
- * @return #NOTIFICATION_ERROR_NONE on success,
- *         otherwise any other value on failure
- * @retval #NOTIFICATION_ERROR_NONE         Success
- * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
- * @see notification_register_detailed_changed_cb()
- * @par Sample code:
- * @code
-#include <notification.h>
-...
-{
-       noti_err = notification_register_detailed_changed_cb(app_changed_cb, user_data);
-       if(noti_err != NOTIFICATION_ERROR_NONE) {
-               return;
-       }
-}
- * @endcode
- */
-int notification_unregister_detailed_changed_cb(
-               void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op),
-               void *user_data);
-
-/**
  * @brief Sets the tag of the notification handle.
  * @since_tizen 2.3
  * @param[in] noti Notification handle
@@ -1362,35 +1233,6 @@ int notification_set_tag(notification_h noti, const char *tag);
 int notification_get_tag(notification_h noti, const char **tag);
 
 /**
- * @internal
- * @brief Gets the package name of the notification
- * @remarks The pkgname must be released using free()
- * @since_tizen 2.4
- * @privlevel NP
- * @param[in] noti Notification handle
- * @param[out] pkgname package name of the notification
- * @return NOTIFICATION_ERROR_NONE on success, other value on failure
- * @retval NOTIFICATION_ERROR_NONE Success
- * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
- * @par Sample code:
- * @code
-#include <notification.h>
-...
-{
-       notification_h noti = NULL;
-       int noti_err = NOTIFICATION_ERROR_NONE;
-       char *pkgname = NULL;
-
-       noti_err  = notification_get_pkgname(noti, &pkgname);
-       if(noti_err != NOTIFICATION_ERROR_NONE) {
-               return;
-       }
-}
- * @endcode
- */
-int notification_get_pkgname(notification_h noti, char **pkgname);
-
-/**
  * @brief Loads a notification from the notification's database with the tag.
  * @since_tizen 2.3
  * @privlevel public
@@ -1550,6 +1392,37 @@ int notification_set_permission(notification_h handle, notification_permission_t
  */
 int notification_get_permission(notification_h handle, notification_permission_type_e *permission_type, const char **app_id);
 
+/**
+ * @brief Gets the package name of the notification
+ * @remarks The pkgname must be released using free()
+ * @since_tizen 2.4
+ * @param[in] noti Notification handle
+ * @param[out] pkgname The package name of the notification
+ * @return #NOTIFICATION_ERROR_NONE on success, otherwise a negative error value
+ * @retval NOTIFICATION_ERROR_NONE Success
+ * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+       notification_h noti = NULL;
+       int noti_err = NOTIFICATION_ERROR_NONE;
+       char *pkgname = NULL;
+
+       ...
+
+       noti_err  = notification_get_pkgname(noti, &pkgname);
+
+       if(noti_err != NOTIFICATION_ERROR_NONE) {
+               notification_free(noti);
+               free(pkgname);
+               return;
+       }
+}
+ * @endcode
+ */
+int notification_get_pkgname(notification_h noti, char **pkgname);
 
 /**
  * @}
index 0de1b98..f22ce53 100644 (file)
@@ -577,11 +577,134 @@ NOTIFICATION_DEPRECATED_API int notification_get_execute_option(notification_h n
                                                     const char **text,
                                                     bundle **service_handle);
 
-int notification_set_ongoing_flag(notification_h noti, bool ongoing_flag);
+/**
+ * @internal
+ * @brief Inserts a notification.
+ * @details The notification will be inserted to the database and then it will appear in the notification area.
+ *          When notification_create() is called, if priv_id is #NOTIFICATION_PRIV_ID_NONE, priv_id returns the internally set priv_id.
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/notification
+ * @param[in]  noti    The notification handle
+ * @param[out] priv_id The private ID
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ *         otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE         Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
+ * @pre Notification handle should be created by notification_create().
+ * @post notification_free().
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+ {
+       int noti_err = NOTIFICATION_ERROR_NONE;
 
-int notification_get_ongoing_flag(notification_h noti, bool *ongoing_flag);
+       noti_err  = notification_insert(noti, NULL);
+       if(noti_err != NOTIFICATION_ERROR_NONE) {
+               return;
+       }
+}
+ * @endcode
+ */
+int notification_insert(notification_h noti,
+                                        int *priv_id);
 
 /**
+ * @internal
+ * @brief Updates a notification, asynchronously.
+ * @details The updated notification will appear in the notification area.
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/notification
+ * @remarks This function updates the notification asynchronously.
+ * @param[in] noti      The notification handle that is created by notification_create()
+ * @param[in] result_cb The callback called when an update completed
+ * @param[in] user_data The user data which you want to use in callback
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ *         otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE         Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
+ * @retval #NOTIFICATION_ERROR_NOT_EXIST_ID Priv ID does not exist
+ * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+ {
+       int noti_err = NOTIFICATION_ERROR_NONE;
+
+       noti_err  = notification_update_async(NULL, result_cb, data);
+       if(noti_err != NOTIFICATION_ERROR_NONE) {
+               return;
+       }
+}
+ * @endcode
+ */
+int notification_update_async(notification_h noti,
+               void (*result_cb)(int priv_id, int result, void *data), void *user_data);
+
+/**
+ * @internal
+ * @brief Registers a callback for all notification events.
+ * @details The registered callback could be called for all notification events.
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/notification
+ * @param[in] changed_cb The callback function
+ * @param[in] user_data  The user data
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ *         otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE         Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
+ * @see notification_unregister_detailed_changed_cb()
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+       noti_err = notification_register_detailed_changed_cb(app_changed_cb, user_data);
+       if(noti_err != NOTIFICATION_ERROR_NONE) {
+               return;
+       }
+}
+ * @endcode
+ */
+int notification_register_detailed_changed_cb(
+               void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op),
+               void *user_data);
+
+/**
+ * @internal
+ * @brief Unregisters a callback for all notification events.
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/notification
+ * @param[in] changed_cb The callback function
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ *         otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE         Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
+ * @see notification_register_detailed_changed_cb()
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+       noti_err = notification_register_detailed_changed_cb(app_changed_cb, user_data);
+       if(noti_err != NOTIFICATION_ERROR_NONE) {
+               return;
+       }
+}
+ * @endcode
+ */
+int notification_unregister_detailed_changed_cb(
+               void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op),
+               void *user_data);
+/**
  * @}
  */
 
diff --git a/include/notification_ongoing_flag.h b/include/notification_ongoing_flag.h
new file mode 100644 (file)
index 0000000..f1f5594
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+ *  libnotification
+ *
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Kyuho Jo <kyuho.jo@samsung.com>
+ *
+ * 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 __NOTIFICATION_ONGOING_FLAG_H__
+#define __NOTIFICATION_ONGOING_FLAG_H__
+
+#include <notification.h>
+
+/**
+ * @brief Sets the ongoing flag of the notification
+ * @since_tizen 2.4
+ * @param[in] noti  The notification handle
+ * @param[in] ongoing_flag The ongoing flag
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ *         otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE         Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+       notification_h noti = NULL;
+       int noti_err = NOTIFICATION_ERROR_NONE;
+       bundle *b = NULL;
+
+       noti = notification_create(NOTIFICATION_TYPE_NOTI);
+       if(noti == NULL) {
+               return;
+       }
+
+       noti_err  = notification_set_ongoing_flag(noti, true);
+       if(noti_err != NOTIFICATION_ERROR_NONE) {
+               notification_free(noti);
+               return;
+       }
+}
+ * @endcode
+ */
+int notification_set_ongoing_flag(notification_h noti, bool ongoing_flag);
+
+/**
+ * @brief Gets the ongoing flag of the notification
+ * @since_tizen 2.4
+ * @param[in]  noti  The notification handle
+ * @param[out] ongoing_flag The ongoing flag
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ *         otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE         Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+       notification_h noti = NULL;
+       int noti_err = NOTIFICATION_ERROR_NONE;
+       bool ongoing_flag = 0;
+
+       noti_err  = notification_get_ongoing_flag(noti, &ongoing_flag);
+       if(noti_err != NOTIFICATION_ERROR_NONE) {
+               return;
+       }
+}
+ * @endcode
+ */
+int notification_get_ongoing_flag(notification_h noti, bool *ongoing_flag);
+
+#endif                         /* __NOTIFICATION_ONGOING_H__ */
index 2d1a8a4..4f09435 100644 (file)
@@ -36,41 +36,6 @@ extern "C" {
  */
 
 /**
- * @internal
- * @brief Called when a new message is posted.
- * @since_tizen 2.3
- * @param[in] message The message posted
- * @param[in] data    The user data
- * @pre notification_status_monitor_message_cb_set() used to register this callback.
- * @see notification_status_monitor_message_cb_set()
-*/
-typedef void (*notification_status_message_cb)(const char *message, void *data);
-
-/**
- * @internal
- * @brief Registers a callback to receive a message.
- * @since_tizen 2.3
- * @param[in] callback The callback function
- * @param[in] data     The user_data
- * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
- * @retval #NOTIFICATION_ERROR_NONE Success
- * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #NOTIFICATION_ERROR_FROM_DBUS Error from DBus
- */
-int notification_status_monitor_message_cb_set(notification_status_message_cb callback, void *user_data);
-
-/**
- * @internal
- * @brief Unregisters a callback to receive a message.
- * @since_tizen 2.3
- * @param[in] callback The callback function
- * @param[in] data     The user_data
- * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
- * @retval #NOTIFICATION_ERROR_NONE Success
- */
-int notification_status_monitor_message_cb_unset(void);
-
-/**
  * @brief Sends a string (message) to the notification status monitor.
  * @since_tizen 2.3
  * @privlevel public
diff --git a/include/notification_status_internal.h b/include/notification_status_internal.h
new file mode 100644 (file)
index 0000000..800505f
--- /dev/null
@@ -0,0 +1,109 @@
+/*
+ *  libnotification
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ *
+ * 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 __NOTIFICATION_STATUS_INTERNAL_DEF_H__
+#define __NOTIFICATION_STATUS_INTERNAL_DEF_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * @file notification_status_internal.h
+ */
+
+/**
+ * @addtogroup NOTIFICATION_STATUS
+ * @{
+ */
+
+/**
+ * @internal
+ * @brief Unregisters a callback for all notification events.
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/notification
+ * @param[in] changed_cb The callback function
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ *         otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE         Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
+ * @see notification_register_detailed_changed_cb()
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+       noti_err = notification_register_detailed_changed_cb(app_changed_cb, user_data);
+       if(noti_err != NOTIFICATION_ERROR_NONE) {
+               return;
+       }
+}
+ * @endcode
+ */
+int notification_unregister_detailed_changed_cb(
+               void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op),
+               void *user_data);
+
+/**
+ * @internal
+ * @brief Called when a new message is posted.
+ * @since_tizen 2.3
+ * @param[in] message The message posted
+ * @param[in] data    The user data
+ * @pre notification_status_monitor_message_cb_set() used to register this callback.
+ * @see notification_status_monitor_message_cb_set()
+*/
+typedef void (*notification_status_message_cb)(const char *message, void *data);
+
+/**
+ * @internal
+ * @brief Registers a callback to receive a message.
+ * @since_tizen 2.3
+ * @param[in] callback The callback function
+ * @param[in] data     The user_data
+ * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #NOTIFICATION_ERROR_FROM_DBUS Error from DBus
+ */
+int notification_status_monitor_message_cb_set(notification_status_message_cb callback, void *user_data);
+
+/**
+ * @internal
+ * @brief Unregisters a callback to receive a message.
+ * @since_tizen 2.3
+ * @param[in] callback The callback function
+ * @param[in] data     The user_data
+ * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ */
+int notification_status_monitor_message_cb_unset(void);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* __NOTIFICATION_STATUS_INTERNAL_DEF_H__ */
index db9eb43..98d793f 100644 (file)
@@ -1,6 +1,6 @@
 Name:       notification
 Summary:    notification library
-Version:    0.2.30
+Version:    0.2.31
 Release:    1
 Group:      TBD
 License:    Apache
@@ -223,7 +223,9 @@ vconftool set -t string memory/private/libstatus/message "" -i -g 5000 -f  $SMAC
 %{_includedir}/notification/notification_error.h
 %{_includedir}/notification/notification_type.h
 %{_includedir}/notification/notification_list.h
+%{_includedir}/notification/notification_ongoing_flag.h
 %{_includedir}/notification/notification_status.h
+%{_includedir}/notification/notification_status_internal.h
 %{_includedir}/notification/notification_setting.h
 %{_includedir}/notification/notification_setting_internal.h
 %{_libdir}/pkgconfig/notification.pc
index 3097938..d8e5127 100644 (file)
@@ -1355,7 +1355,7 @@ EXPORT_API int notification_set_launch_option(notification_h noti,
                return NOTIFICATION_ERROR_INVALID_PARAMETER;
        }
 
-       if ((ret = app_control_to_bundle(app_control, &b)) == APP_CONTROL_ERROR_NONE) {
+       if ((ret = app_control_export_as_bundle(app_control, &b)) == APP_CONTROL_ERROR_NONE) {
                return notification_set_execute_option(noti,
                                NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH,
                                NULL, NULL,
@@ -1429,7 +1429,7 @@ EXPORT_API int notification_set_event_handler(notification_h noti, notification_
                goto out;
        }
 
-       if ((err = app_control_to_bundle(event_handler, &app_control_bundle)) != APP_CONTROL_ERROR_NONE) {
+       if ((err = app_control_export_as_bundle(event_handler, &app_control_bundle)) != APP_CONTROL_ERROR_NONE) {
                NOTIFICATION_ERR("app_control_to_bundle failed [%d]", err);
                goto out;
        }
index a98d1fb..6812a0b 100644 (file)
@@ -690,35 +690,71 @@ out:
        return err;
 }
 
+
 EXPORT_API int notification_setting_db_update_system_setting(int do_not_disturb, int visibility_class)
 {
        int err = NOTIFICATION_ERROR_NONE;
-       sqlite3 *db = NULL;
-       char *sqlbuf = NULL;
+       char *query_buffer = NULL;
        int sqlret;
+       int field_index = 0;
+       sqlite3 *db = NULL;
+       sqlite3_stmt *db_statement = NULL;
 
        sqlret = db_util_open(DBPATH, &db, 0);
+
        if (sqlret != SQLITE_OK || db == NULL) {
-               NOTIFICATION_ERR("db_util_open failed [%s][%d]", DBPATH, sqlret);
-               return NOTIFICATION_ERROR_FROM_DB;
+               NOTIFICATION_ERR("db_util_open failed [%s][%d][%s]", DBPATH, sqlret, sqlite3_errmsg(db));
+               err =  NOTIFICATION_ERROR_FROM_DB;
+               goto return_close_db;
        }
 
-       sqlbuf = sqlite3_mprintf("UPDATE %s SET do_not_disturb = %d, visibility_class = %d ",
-                       NOTIFICATION_SYSTEM_SETTING_DB_TABLE, do_not_disturb, visibility_class);
+       query_buffer = strdup("UPDATE ? SET do_not_disturb = ?, visibility_class = ? ");
 
-       if (!sqlbuf) {
+       if (query_buffer == NULL) {
                NOTIFICATION_ERR("fail to alloc query");
                err = NOTIFICATION_ERROR_OUT_OF_MEMORY;
                goto return_close_db;
        }
 
-       err = notification_db_exec(db, sqlbuf, NULL);
+       sqlret = sqlite3_prepare_v2(db, query_buffer, strlen(query_buffer), &db_statement, NULL);
 
-       return_close_db:
-       if (sqlbuf)
-               sqlite3_free(sqlbuf);
+       if (sqlret != SQLITE_OK) {
+               NOTIFICATION_ERR("sqlite3_prepare_v2 failed [%d][%s]", sqlret, sqlite3_errmsg(db));
+               err =  NOTIFICATION_ERROR_FROM_DB;
+               goto return_close_db;
+       }
+
+       sqlite3_bind_text(db_statement, field_index++, NOTIFICATION_SYSTEM_SETTING_DB_TABLE, -1, SQLITE_STATIC);
+       sqlite3_bind_int(db_statement, field_index++, do_not_disturb);
+       sqlite3_bind_int(db_statement, field_index++, visibility_class);
+
+       sqlret = sqlite3_step(db_statement);
+
+       if (sqlret != SQLITE_OK && sqlret != SQLITE_DONE) {
+               NOTIFICATION_ERR("sqlite3_step failed [%d][%s]", sqlret, sqlite3_errmsg(db));
+               err =  NOTIFICATION_ERROR_FROM_DB;
+               goto return_close_db;
+       }
+
+       sqlret = sqlite3_changes(db);
+
+       if (sqlret != SQLITE_OK && sqlret != SQLITE_DONE) {
+               NOTIFICATION_ERR("sqlite3_changes failed [%d][%s]", sqlret, sqlite3_errmsg(db));
+               err =  NOTIFICATION_ERROR_FROM_DB;
+               goto return_close_db;
+       }
+
+return_close_db:
+
+       if (query_buffer)
+               free(query_buffer);
+
+       if (db_statement)
+               sqlite3_finalize(db_statement);
+
+       if (db)
+               sqlret = db_util_close(db);
 
-       sqlret = db_util_close(db);
        if (sqlret != SQLITE_OK) {
                NOTIFICATION_WARN("fail to db_util_close - [%d]", sqlret);
        }
index 919f018..ee130c7 100644 (file)
@@ -36,6 +36,7 @@
 #include <notification_debug.h>
 #include <notification_private.h>
 #include <notification_status.h>
+#include <notification_status_internal.h>
 
 #define PATH_NAME    "/Org/Tizen/System/Notification/Status_message"
 #define INTERFACE_NAME "org.tizen.system.notification.status_message"
index 0ebe371..cd51f12 100755 (executable)
@@ -356,11 +356,11 @@ static int testapp_test_post_heads_up_notification_with_button()
                goto FINISH_OFF;
        }
 
-       noti_err = notification_post(noti_handle);
-
        app_control_destroy(app_control);
        app_control = NULL;
 
+       noti_err = notification_post(noti_handle);
+
        if (noti_err != NOTIFICATION_ERROR_NONE) {
                testapp_print("notification_post failed[%d]", noti_err);
                goto FINISH_OFF;
@@ -373,11 +373,9 @@ static int testapp_test_post_heads_up_notification_with_button()
                goto FINISH_OFF;
        }
 
-       /*
        if (noti_handle)
                notification_free(noti_handle);
        noti_handle = NULL;
-       */
 
        noti_handle = notification_load(NULL, priv_id);
 
@@ -396,7 +394,7 @@ static int testapp_test_post_heads_up_notification_with_button()
        app_control_get_app_id(app_control, &app_id);
 
        if (app_id) {
-               testapp_print("result app_id [%s]", app_id);
+               testapp_print("result app_id [%s]\n", app_id);
                free(app_id);
        }