sync with private git
authoryoungsub ko <ys4610.ko@samsung.com>
Tue, 10 Sep 2013 04:52:30 +0000 (13:52 +0900)
committeryoungsub ko <ys4610.ko@samsung.com>
Tue, 10 Sep 2013 04:52:30 +0000 (13:52 +0900)
15 files changed:
CMakeLists.txt
doc/notification_doc.h [new file with mode: 0755]
include/notification.h
include/notification_ipc.h
include/notification_list.h
include/notification_setting.h [new file with mode: 0755]
include/notification_status.h
include/notification_type.h
packaging/notification.spec
src/notification.c
src/notification_db.c
src/notification_ipc.c
src/notification_noti.c
src/notification_setting.c [new file with mode: 0755]
src/notification_status.c

index fba58f1..c69cbbf 100755 (executable)
@@ -18,13 +18,15 @@ SET(SRCS ./src/notification.c
        ./src/notification_db.c
        ./src/notification_list.c
        ./src/notification_status.c
-       ./src/notification_ipc.c)
+       ./src/notification_ipc.c
+       ./src/notification_setting.c)
 SET(HEADERS ./include/notification.h 
        ./include/notification_error.h 
        ./include/notification_type.h 
        ./include/notification_list.h
        ./include/notification_status.h
        ./include/notification_ipc.h
+       ./include/notification_setting.h
        ./include/notification_noti.h)
 
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
diff --git a/doc/notification_doc.h b/doc/notification_doc.h
new file mode 100755 (executable)
index 0000000..a767e1b
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ *  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.
+ *
+ */
+
+/**
+ *
+ * @ingroup NOTIFICATION_LIBRARY
+ * @defgroup NOTIFICATION_MODULE notification APIs
+ * @brief Notification APIs
+ *
+ * @section NOTIFICATION_MODULE_HEADER Required Header
+ *   \#include <notification.h>
+ * @section NOTIFICATION_MODULE_OVERVIEW Overview
+ * It provides functions for creating and inserting and updating notification.
+ *
+ * @ingroup NOTIFICATION_LIBRARY
+ * @defgroup NOTIFICATION_LIST notification list APIs
+ * @brief linked list of notification data
+ *
+ * @section NOTIFICATION_LIST_MODULE_HEADER Required Header
+ *   \#include <notification_list.h>
+ * @section NOTIFICATION_LIST_MODULE_OVERVIEW Overview
+ * It provides functions for handling
+ *
+ * @ingroup NOTIFICATION_LIBRARY
+ * @defgroup NOTIFICATION_STATUS notification status APIs
+ * @brief APIs displaying plain text message on the indicator area
+ *
+ * @section NOTIFICATION_STATUS_MODULE_HEADER Required Header
+ *   \#include <notification_status.h>
+ * @section NOTIFICATION_STATUS_MODULE_OVERVIEW Overview
+ * Notification status APIs
+ *
+ * @ingroup NOTIFICATION_LIBRARY
+ * @defgroup NOTIFICATION_TYPE notification type
+ * @brief Type for notification APIs
+ *
+ * @section NOTIFICATION_TYPE_MODULE_HEADER Required Header
+ *   \#include <notification_type.h>
+ * @section NOTIFICATION_TYPE_MODULE_OVERVIEW Overview
+ * Type defines and enumerations for Notification APIs
+ *
+ * @ingroup NOTIFICATION_LIBRARY
+ * @defgroup NOTIFICATION_DEPRECATED deprecated APIs
+ * @brief deprecated APIs
+ *
+ */
index 9748dc6..ddc7e9c 100755 (executable)
 #include <notification_type.h>
 #include <notification_list.h>
 #include <notification_status.h>
+#include <notification_setting.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 /**
- * @defgroup NOTIFICATION_LIBRARY Notification Library
- * @brief This notification library provides UI notification event. Inserted notification event is displaying Notification Tray, Indicator, etc.
+ * @file notification.h
+ * @brief This file contains the notification APIs
  */
 
 /**
- * @ingroup NOTIFICATION_LIBRARY
- * @defgroup NOTIFICATION notification core API
- * @brief Notification core API
- */
-
-/**
- * @addtogroup NOTIFICATION
+ * @addtogroup NOTIFICATION_MODULE
  * @{
  */
 
 /**
- * @brief This function will be deprecated.
- * @see notification_set_image()
- *
- */
-notification_error_e notification_set_icon(notification_h noti,
-                                          const char *icon_path);
-
-/**
- * @brief This function will be deprecated.
- * @see notification_get_image()
- *
- */
-notification_error_e notification_get_icon(notification_h noti,
-                                          char **icon_path);
-
-/**
- * @brief This function set image path according to type.
+ * @brief Set absolute path for image file to display on notification view
  * @details 
  * @remarks
  * @param[in] noti notification handle
@@ -106,7 +85,7 @@ notification_error_e notification_set_image(notification_h noti,
                                            const char *image_path);
 
 /**
- * @brief This function get image path according to type.
+ * @brief Get absolute path for image file
  * @details 
  * @remarks Do not free image_path. It will be freed when notification_free() or notification_free_list().
  * @param[in] noti notification handle
@@ -139,7 +118,7 @@ notification_error_e notification_get_image(notification_h noti,
                                            char **image_path);
 
 /**
- * @brief This function set time infomation.
+ * @brief Set a timestamp
  * @details If input_time is 0, time information is set by current time.
  * @remarks
  * @param[in] noti notification handle
@@ -175,7 +154,7 @@ notification_error_e notification_set_time(notification_h noti,
                                           time_t input_time);
 
 /**
- * @brief This function get time information.
+ * @brief Get a timestamp
  * @details If ret_time is 0, time information is not set before.
  * @remarks
  * @param[in] noti notification handle
@@ -205,7 +184,7 @@ notification_error_e notification_get_time(notification_h noti,
                                           time_t * ret_time);
 
 /**
- * @brief This function get insert time information.
+ * @brief Get timestamp that the notification is inserted
  * @details If ret_time is 0, this notification data is not inserted before.
  * @remarks
  * @param[in] noti notification handle
@@ -235,43 +214,7 @@ notification_error_e notification_get_insert_time(notification_h noti,
                                                  time_t * ret_time);
 
 /**
- * @brief This function will be deprecated.
- * @see notification_set_text()
- *
- */
-notification_error_e notification_set_title(notification_h noti,
-                                           const char *title,
-                                           const char *loc_title);
-
-/**
- * @brief This function will be deprecated.
- * @see notification_get_text()
- *
- */
-notification_error_e notification_get_title(notification_h noti,
-                                           char **title,
-                                           char **loc_title);
-
-/**
- * @brief This function will be deprecated.
- * @see notification_set_text()
- *
- */
-notification_error_e notification_set_content(notification_h noti,
-                                             const char *content,
-                                             const char *loc_content);
-
-/**
- * @brief This function will be deprecated.
- * @see notification_get_text()
- *
- */
-notification_error_e notification_get_content(notification_h noti,
-                                             char **content,
-                                             char **loc_content);
-
-/**
- * @brief This function set text.
+ * @brief Set text to display on the notification view
  * @details Set title, content string. If text is formated data(only support %d, %f, %s), type - value pair should be set.
  * If %d, type NOTIFICATION_VARIABLE_TYPE_INT and value is integer value.
  * If %f, type NOTIFICATION_VARIABLE_TYPE_DOUBLE and value is double value.
@@ -321,7 +264,7 @@ notification_error_e notification_set_text(notification_h noti,
                                           int args_type, ...);
 
 /**
- * @brief This function get text.
+ * @brief Get the text from the notification handle
  * @details
  * @remarks
  * @param[in] noti notification handle
@@ -354,8 +297,8 @@ notification_error_e notification_get_text(notification_h noti,
                                           char **text);
 
 /**
- * @brief This function set timestamp to text. the timestamp value will be converted to string
- * @details set
+ * @brief Set a timestamp to display on the notification view
+ * @details the timestamp will be converted to formatted string and it will be displayed on the setted text area
  * @remarks
  * @param[in] noti notification handle
  * @param[in] type notification text type
@@ -371,8 +314,8 @@ notification_error_e notification_set_time_to_text(notification_h noti, notifica
                                                                time_t time);
 
 /**
- * @brief This function get timestamp from text
- * @details set
+ * @brief Get a timestamp from the notification handle
+ * @details
  * @remarks
  * @param[in] noti notification handle
  * @param[in] type notification text type
@@ -388,7 +331,7 @@ notification_error_e notification_get_time_from_text(notification_h noti, notifi
                                                                time_t *time);
 
 /**
- * @brief This function set text domain.
+ * @brief Set text domain to localize the notification
  * @details
  * @remarks
  * @param[in] noti notification handle
@@ -426,7 +369,7 @@ notification_error_e notification_set_text_domain(notification_h noti,
                                                  const char *dir);
 
 /**
- * @brief This function get text domain.
+ * @brief Get text domain from the notification handle
  * @details
  * @remarks Do not free returned domain and dir. These are freed when notification_free or notification_free_list.
  * @param[in] noti notification handle
@@ -460,7 +403,7 @@ notification_error_e notification_get_text_domain(notification_h noti,
                                                  char **dir);
 
 /**
- * @brief This function set notification sound.
+ * @brief Set sound option for the notification
  * @details
  * @remarks
  * @param[in] noti notification handle
@@ -492,7 +435,7 @@ notification_error_e notification_set_sound(notification_h noti,
                                            const char *path);
 
 /**
- * @brief This function get notification sound.
+ * @brief Get sound option from the notification handle
  * @details
  * @remarks
  * @param[in] noti notification handle
@@ -525,7 +468,7 @@ notification_error_e notification_get_sound(notification_h noti,
                                            const char **path);
 
 /**
- * @brief This function set notification vibration.
+ * @brief Set vibrate option for the notification
  * @details
  * @remarks
  * @param[in] noti notification handle
@@ -557,7 +500,7 @@ notification_error_e notification_set_vibration(notification_h noti,
                                                const char *path);
 
 /**
-  * @brief This function get notification vibration.
+  * @brief Get vibrate option from the notification handle
   * @details
   * @remarks
   * @param[in] noti notification handle
@@ -590,7 +533,7 @@ notification_error_e notification_get_vibration(notification_h noti,
                                                const char **path);
 
 /**
- * @brief This function set led notification.
+ * @brief Set option of displaying the LED
  * @details
  * @remarks
  * @param[in] noti notification handle
@@ -622,7 +565,7 @@ notification_error_e notification_set_led(notification_h noti,
                                                int led_argb);
 
 /**
-  * @brief This function get notification led.
+  * @brief Get option of displaying the LED from the notification handle
   * @details
   * @remarks
   * @param[in] noti notification handle
@@ -655,7 +598,7 @@ notification_error_e notification_get_led(notification_h noti,
                                                int *led_argb);
 
 /**
- * @brief This function set time period of flashing LED
+ * @brief Set time period of flashing the LED
  * @details
  * @remarks
  * @param[in] noti notification handle
@@ -686,7 +629,7 @@ notification_error_e notification_set_led_time_period(notification_h noti,
                                                int on_ms, int off_ms);
 
 /**
-  * @brief This function get time period of flashing LED
+  * @brief Get time period of flashing the LED from the notification handle
   * @details
   * @remarks
   * @param[in] noti notification handle
@@ -719,35 +662,7 @@ notification_error_e notification_get_led_time_period(notification_h noti,
                                                int *on_ms, int *off_ms);
 
 /**
- * @brief This function will be deprecated.
- * @see notification_set_execute_option()
- *
- */
-notification_error_e notification_set_application(notification_h noti, const char *pkgname);   /* Do not use this */
-
-/**
- * @brief This function will be deprecated.
- * @see notification_get_execute_option()
- *
- */
-notification_error_e notification_get_application(notification_h noti, char **pkgname);        /* Do not use this */
-
-/**
- * @brief This function will be deprecated.
- * @see notification_set_execute_option()
- *
- */
-notification_error_e notification_set_args(notification_h noti, bundle * args, bundle * group_args);   /* Do not use this */
-
-/**
- * @brief This function will be deprecated.
- * @see notification_get_execute_option()
- *
- */
-notification_error_e notification_get_args(notification_h noti, bundle ** args, bundle ** group_args); /* Do not use this */
-
-/**
- * @brief This function set execute option.
+ * @brief Set execution option for a notification
  * @details When notification data selected in display application, application launched by appsvc_run_service with service_handle.
  * @remarks
  * @param[in] noti notification handle
@@ -793,7 +708,7 @@ notification_error_e notification_set_execute_option(notification_h noti,
                                                     bundle *service_handle);
 
 /**
- * @brief This function get execute option.
+ * @brief Get execution option from the notification handle
  * @details
  * @remarks
  * @param[in] noti notification handle
@@ -831,7 +746,7 @@ notification_error_e notification_get_execute_option(notification_h noti,
                                                     bundle **service_handle);
 
 /**
- * @brief This function set notification property.
+ * @brief Set the property of the notification
  * @details
  * @remarks
  * @param[in] noti notification handle
@@ -868,7 +783,7 @@ notification_error_e notification_set_property(notification_h noti,
                                               int flags);
 
 /**
- * @brief This function get notification property.
+ * @brief Get the property of the notification from the notification handle
  * @details
  * @remarks
  * @param[in] noti notification handle
@@ -899,7 +814,7 @@ notification_error_e notification_get_property(notification_h noti,
                                               int *flags);
 
 /**
- * @brief This function set display application list.
+ * @brief Set applications to display the notification
  * @details All display application is enable(NOTIFICATION_DISPLAY_APP_ALL) if you are not call this API.
  * @remarks
  * @param[in] noti notification handle
@@ -937,7 +852,7 @@ notification_error_e notification_set_display_applist(notification_h noti,
                                                      int applist);
 
 /**
- * @brief This function get display application list.
+ * @brief Get application list to display the notification from the notification handle
  * @details
  * @remarks
  * @param[in] noti notification handle
@@ -968,7 +883,7 @@ notification_error_e notification_get_display_applist(notification_h noti,
                                                      int *applist);
 
 /**
- * @brief This function set initial size for ongoing type.
+ * @brief Set initial size for ongoing type.
  * @details After notification_insert, it does not upate size. If you want to update size, please call notification_update_size().
  * @remarks
  * @param[in] noti notification handle
@@ -1004,7 +919,7 @@ notification_error_e notification_set_size(notification_h noti,
                                           double size);
 
 /**
- * @brief This function get progress size.
+ * @brief Get progress size.
  * @details
  * @remarks
  * @param[in] noti notification handle
@@ -1035,7 +950,7 @@ notification_error_e notification_get_size(notification_h noti,
                                           double *size);
 
 /**
- * @brief This function set initial progress for ongoing type.
+ * @brief Set initial progress for ongoing type.
  * @details After notification_insert, it does not upate progress. If you want to update progress, please call notification_update_progress().
  * @remarks
  * @param[in] noti notification handle
@@ -1071,9 +986,9 @@ notification_error_e notification_set_progress(notification_h noti,
                                               double percentage);
 
 /**
- * @brief This function get progress percentage.
+ * @brief Get progress from the notification handle
  * @details
- * @remarks
+ * @remarks At the end of the operation, progress should be 1.0
  * @param[in] noti notification handle
  * @param[out] percentage progress percentage
  * @return NOTIFICATION_ERROR_NONE if success, other value if failure
@@ -1102,7 +1017,7 @@ notification_error_e notification_get_progress(notification_h noti,
                                               double *percentage);
 
 /**
- * @brief This function set caller_pkgname.
+ * @brief Set the package name of caller
  * @details caller_pkgname is set automatically when notification_new. We are not recommend to use this API.
  * @remarks
  * @param[in] noti notification handle
@@ -1126,7 +1041,7 @@ notification_error_e notification_get_progress(notification_h noti,
                return;
        }
 
-       noti_err  = notification_set_pkgname(noti, "org.tizen.phone");
+       noti_err  = notification_set_pkgname(noti, "com.samsung.phone");
        if(noti_err != NOTIFICATION_ERROR_NONE) {
                notification_free(noti);
                return;
@@ -1138,7 +1053,7 @@ notification_error_e notification_set_pkgname(notification_h noti,
                                              const char *pkgname);
 
 /**
- * @brief This function get caller pkgname.
+ * @brief Get the package name of caller from the notification handle
  * @details
  * @remarks
  * @param[in] noti notification handle
@@ -1169,11 +1084,11 @@ notification_error_e notification_get_pkgname(notification_h noti,
                                              char **pkgname);
 
 /**
- * @brief This function set layout type of notification
- * @details caller can set displaying layout of notification with this API
+ * @brief Set the layout of the notification view
+ * @details caller can set displaying layout of notification
  * @remarks
  * @param[in] noti notification handle
- * @param[in] layout type
+ * @param[in] type of layout
  * @return NOTIFICATION_ERROR_NONE if success, other value if failure
  * @retval NOTIFICATION_ERROR_NONE - success
  * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
@@ -1185,11 +1100,11 @@ notification_error_e notification_set_layout(notification_h noti,
                notification_ly_type_e layout);
 
 /**
- * @brief This function get layout type of notification
+ * @brief Get the layout of the notification view from the notification handle
  * @details
  * @remarks
  * @param[in] noti notification handle
- * @param[out] layout type of notification
+ * @param[out] type of layout
  * @return NOTIFICATION_ERROR_NONE if success, other value if failure
  * @retval NOTIFICATION_ERROR_NONE - success
  * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
@@ -1201,68 +1116,9 @@ notification_error_e notification_get_layout(notification_h noti,
                notification_ly_type_e *layout);
 
 /**
- * @brief This function set application badge count.
- * @details
- * @remarks
- * @param[in] pkgname If NULL, caller pkgname is set internally.
- * @param[in] group_id group id
- * @param[in] count badge count
- * @return NOTIFICATION_ERROR_NONE if success, other value if failure
- * @retval NOTIFICATION_ERROR_NONE - success
- * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
- * @pre 
- * @post
- * @see
- * @par Sample code:
-#include <notification.h>
- ...
-  {
-        notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
-        
-        noti_err  = notification_set_badge(NULL, NOTIFICATION_GROUP_ID_NONE, 5);
-        if(noti_err != NOTIFICATION_ERROR_NONE) {
-                return;
-        }
- }
- * @endcode
- */
-notification_error_e notification_set_badge(const char *pkgname,
-                                           int group_id, int count);
-
-/**
- * @brief This function get application badge count.
- * @details
- * @remarks
- * @param[in] pkgname If NULL, caller pkgname is set internally.
- * @param[in] group_id group id
- * @param[out] count badge count
- * @return NOTIFICATION_ERROR_NONE if success, other value if failure
- * @retval NOTIFICATION_ERROR_NONE - success
- * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
- * @pre 
- * @post
- * @see
- * @par Sample code:
-#include <notification.h>
- ...
-  {
-        notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
-        int count = 0;
-        
-        noti_err  = notification_get_badge(NULL, NOTIFICATION_GROUP_ID_NONE, &count);
-        if(noti_err != NOTIFICATION_ERROR_NONE) {
-                return;
-        }
- }
- * @endcode
- */
-notification_error_e notification_get_badge(const char *pkgname,
-                                           int group_id, int *count);
-
-/**
- * @brief This function get Group ID and Private ID
+ * @brief Get Group ID and Private ID
  * @details
- * @remarks
+ * @remarks ID is valid only after inserting the notification
  * @param[in] noti notification handle
  * @param[out] group_id Group ID
  * @param[out] priv_id Private ID
@@ -1291,7 +1147,7 @@ notification_error_e notification_get_id(notification_h noti,
                                         int *group_id, int *priv_id);
 
 /**
- * @brief This function get notification type
+ * @brief Get the type of notification
  * @details
  * @remarks
  * @param[in] noti notification handle
@@ -1321,8 +1177,8 @@ notification_error_e notification_get_type(notification_h noti,
                                           notification_type_e * type);
 
 /**
- * @brief This function insert notification data.
- * @details Notification data is inserted to DB and then notification data is displaying display application.
+ * @brief Insert a notification
+ * @details A notification will be inserted to DB and then it will be appeared on the notification area
  * When notification_new() call, if priv_id is NOTIFICATION_PRIV_ID_NONE, priv_id is return internally set priv_id.
  * @remarks
  * @param[in] noti notification handle
@@ -1351,8 +1207,8 @@ notification_error_e notification_insert(notification_h noti,
                                         int *priv_id);
 
 /**
- * @brief This function update notification data.
- * @details Display application update UI.
+ * @brief Update notification data.
+ * @details The updated notification will be appeared on the notification area
  * @remarks
  * @param[in] noti notification handle that is created by notification_new().
  * @return NOTIFICATION_ERROR_NONE if success, other value if failure
@@ -1379,9 +1235,9 @@ notification_error_e notification_insert(notification_h noti,
 notification_error_e notification_update(notification_h noti);
 
 /**
- * @brief This function updates notification data.
- * @details Display application update UI.
- * @remarks
+ * @brief Update a notification
+ * @details The updated notification will be appeared on the notification area
+ * @remarks This function update a notification in async manner
  * @param[in] noti notification handle that is created by notification_new().
  * @param[in] result_cb callback called when update completed
  * @param[in] user_data user data which you want to use in callback
@@ -1437,7 +1293,7 @@ notification_error_e notification_update_async(notification_h noti,
 notification_error_e notifiation_clear(notification_type_e type);
 
 /**
- * @brief This function delete notification by type. 
+ * @brief Delete all the notifications of the type.
  * @details If pkgname is NULL, caller_pkgname is set internally.
  * @remarks
  * @param[in] pkgname caller application package name or NULL
@@ -1466,69 +1322,7 @@ notification_error_e notification_delete_all_by_type(const char *pkgname,
                                                     notification_type_e type);
 
 /**
- * @brief This function delete group notification data by group ID.
- * @details If pkgname is NULL, caller_pkgname is set internally.
- * @remarks
- * @param[in] pkgname caller application package name or NULL
- * @param[in] type notification type
- * @param[in] group_id group ID
- * @return NOTIFICATION_ERROR_NONE if success, other value if failure
- * @retval NOTIFICATION_ERROR_NONE - success
- * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
- * @pre
- * @post
- * @see
- * @par Sample code:
- * @code
-#include <notification.h>
-...
- {
-       notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
-
-       noti_err  = notification_delete_group_by_group_id(NULL, NOTIFICATION_TYPE_NOTI, APP_GROUP_ID);
-       if(noti_err != NOTIFICATION_ERROR_NONE) {
-               return;
-       }
-}
- * @endcode
- */
-notification_error_e notification_delete_group_by_group_id(const char *pkgname,
-                                                          notification_type_e type,
-                                                          int group_id);
-
-/**
- * @brief This function delete group notification data that include priv_id.
- * @details If pkgname is NULL, caller_pkgname is set internally.
- * @remarks
- * @param[in] pkgname caller application package name or NULL
- * @param[in] type notification type
- * @param[in] priv_id priv ID
- * @return NOTIFICATION_ERROR_NONE if success, other value if failure
- * @retval NOTIFICATION_ERROR_NONE - success
- * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
- * @pre
- * @post
- * @see
- * @par Sample code:
- * @code
-#include <notification.h>
-...
- {
-       notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
-
-       noti_err  = notification_delete_group_by_priv_id(NULL, NOTIFICATION_TYPE_NOTI, APP_PRIV_ID);
-       if(noti_err != NOTIFICATION_ERROR_NONE) {
-               return;
-       }
-}
- * @endcode
- */
-notification_error_e notification_delete_group_by_priv_id(const char *pkgname,
-                                                         notification_type_e type,
-                                                         int priv_id);
-
-/**
- * @brief This function delete notification data that private ID is priv_id.
+ * @brief Delete a notification by priv_id.
  * @details If pkgname is NULL, caller_pkgname is set internally.
  * @remarks
  * @param[in] pkgname caller application package name or NULL
@@ -1559,7 +1353,7 @@ notification_error_e notification_delete_by_priv_id(const char *pkgname,
                                                    int priv_id);
 
 /**
- * @brief This function delete notification data from DB
+ * @brief Delete a notification with the given handle
  * @details notification_delete() remove notification data from DB and notification_free release menory of notification data.
  * @remarks
  * @param[in] noti notification handle
@@ -1590,8 +1384,8 @@ notification_error_e notification_delete_by_priv_id(const char *pkgname,
 notification_error_e notification_delete(notification_h noti);
 
 /**
- * @brief This function update progressive data of inserted notification data. Only work at NOTIFICATION_TYPE_ONGOING type.
- * @details Display application update UI.
+ * @brief Update progress of inserted notification. Only for the ongoing notification(NOTIFICATION_TYPE_ONGOING)
+ * @details notification view on notification area could be updated
  * @remarks
  * @param[in] noti notification handle or NULL if priv_id is valid
  * @param[in] priv_id private ID
@@ -1620,8 +1414,8 @@ notification_error_e notification_update_progress(notification_h noti,
                                                  double progress);
 
 /**
- * @brief This function update progressive data of inserted notification data. Only work at NOTIFICATION_TYPE_ONGOING type.
- * @details Display application update UI.
+ * @brief Update size of inserted notification data. Only for the ongoing notification(NOTIFICATION_TYPE_ONGOING)
+ * @details notification view on notification area could be updated
  * @remarks
  * @param[in] noti notification handle or NULL if priv_id is valid
  * @param[in] priv_id private ID
@@ -1648,12 +1442,38 @@ notification_error_e notification_update_progress(notification_h noti,
 notification_error_e notification_update_size(notification_h noti,
                                              int priv_id, double size);
 
+/**
+ * @brief Update content of inserted notification data. Only for the ongoing notification(NOTIFICATION_TYPE_ONGOING)
+ * @details notification view on notification area could be updated
+ * @remarks
+ * @param[in] noti notification handle or NULL if priv_id is valid
+ * @param[in] priv_id private ID
+ * @param[in] content text to update
+ * @return NOTIFICATION_ERROR_NONE if success, other value if failure
+ * @retval NOTIFICATION_ERROR_NONE - success
+ * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value
+ * @pre
+ * @post
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+ {
+       notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
+
+       noti_err  = notification_update_content(NULL, APP_NOTI_PRIV_ID, "updated string");
+       if(noti_err != NOTIFICATION_ERROR_NONE) {
+               return;
+       }
+}
+ * @endcode
+ */
 notification_error_e notification_update_content(notification_h noti,
                                                         int priv_id,
                                                         const char *content);
 
 /**
- * @brief This function create internal structure data and return notification handle.
+ * @brief Create internal structure data and return notification handle.
  * @details Available type is #NOTIFICATION_TYPE_NOTI and #NOTIFICATION_TYPE_ONGOING.
  * #NOTIFICATION_TYPE_NOTI is remaining notification data evenif device is restarted.
  * #NOTIFICATION_TYPE_ONGOING can display progressive feather, but notification data is removed after device is restarted.
@@ -1722,14 +1542,8 @@ notification_h notification_new(notification_type_e type, int group_id,
 notification_h notification_create(notification_type_e type);
 
 /**
- * @brief This function create internal structure data and return notification handle.
- * @details Available type is #NOTIFICATION_TYPE_NOTI and #NOTIFICATION_TYPE_ONGOING.
- * #NOTIFICATION_TYPE_NOTI is remaining notification data evenif device is restarted.
- * #NOTIFICATION_TYPE_ONGOING can display progressive feather, but notification data is removed after device is restarted.
- * If group_id is #NOTIFICATION_GROUP_ID_NONE, notification data is not grouping. #NOTIFICATION_GROUP_ID_DEFAULT,
- * notification data is grouping with same title. Positive number ( > 0 ) is grouping with same number.
- * If priv_id is #NOTIFICATION_PRIV_ID_NONE, priv_id is set internally and return it when notification_insert() call.
- * Positive number and zero ( >= 0 ) is application set private ID. These ID should have be unique each application package.
+ * @brief load a notification from the notification DB with private id
+ * @details
  * @remarks
  * @param[in] type notification type
  * @param[in] group_id Group ID
@@ -1748,7 +1562,7 @@ notification_h notification_create(notification_type_e type);
 {
        notification_h noti = NULL;
 
-       noti = notification_load(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE);
+       noti = notification_load("org.tizen.app", priv_id);
        if(noti == NULL) {
                return;
        }
@@ -1760,7 +1574,7 @@ notification_h notification_load(char *pkgname,
                                int priv_id);
 
 /**
- * @brief This function create notification clone.
+ * @brief Create a notification clone
  * @details Newly created notification handle is returned.
  * @remarks This clone notification handle should be call notification_free().
  * @param[in] noti notification handle
@@ -1788,7 +1602,7 @@ notification_h notification_load(char *pkgname,
 notification_error_e notification_clone(notification_h noti, notification_h *clone);
 
 /**
- * @brief This function free internal structure data of notification handle.
+ * @brief Free internal structure data of notification handle.
  * @details Internal data of notification handle is released. Notification data that inserted is not deleted.
  * @remarks
  * @param[in] noti notification handle
@@ -1822,267 +1636,240 @@ notification_error_e notification_clone(notification_h noti, notification_h *clo
 notification_error_e notification_free(notification_h noti);
 
 /**
- * @brief This function register notification chagned callback.
- * @details 
+ * @}
+ */
+
+/**
+ * @addtogroup NOTIFICATION_LIST
+ * @{
+ */
+
+/**
+ * @brief This function return notification list handle.
+ * @details If count is -1, all of notification list is returned.
  * @remarks
- * @param[in] changed_cb callback function
- * @param[in] user_data user data
+ * @param[in] type notification type
+ * @param[in] count returned notification data number
+ * @param[out] NOTIFICATION_ERROR_NONE if success, other value if failure.
  * @return NOTIFICATION_ERROR_NONE if success, other value if failure.
  * @retval NOTIFICATION_ERROR_NONE - success
  * @retval NOTIFICATION_ERROR_INVALID_DATA - invalid parameter
- * @pre notification_new()
+ * @pre
  * @post
- * @see notification_unresister_changed_cb()
+ * @see #notification_list_h
  * @par Sample code:
  * @code
 #include <notification.h>
 ...
 {
-       noti_err = notification_resister_changed_cb(app_changed_cb, user_data);
+       notification_list_h noti_list = NULL;
+       notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
+
+       noti_err = notification_get_list(NOTIFICATION_TYPE_NONE, -1, &noti_list);
        if(noti_err != NOTIFICATION_ERROR_NONE) {
                return;
        }
 }
  * @endcode
  */
-notification_error_e
-notification_resister_changed_cb(
-       void (*changed_cb)(void *data, notification_type_e type),
-       void *user_data);
+notification_error_e notification_get_list(notification_type_e type,
+                                          int count,
+                                          notification_list_h * list);
 
 /**
- * @brief This function unregister notification chagned callback.
- * @details 
- * @remarks
- * @param[in] changed_cb callback function
- * @return NOTIFICATION_ERROR_NONE if success, other value if failure.
- * @retval NOTIFICATION_ERROR_NONE - success
- * @retval NOTIFICATION_ERROR_INVALID_DATA - invalid parameter
- * @pre notification_new()
- * @post
- * @see notification_resister_changed_cb()
- * @par Sample code:
- * @code
-#include <notification.h>
-...
-{
-       noti_err = notification_unresister_changed_cb(app_changed_cb);
-       if(noti_err != NOTIFICATION_ERROR_NONE) {
-               return;
-       }
-}
- * @endcode
+ * @brief This function will be deprecated.
+ * @see notification_get_grouping_list()
+ *
  */
-notification_error_e
-notification_unresister_changed_cb(
-       void (*changed_cb)(void *data, notification_type_e type));
+notification_error_e notification_get_grouping_list(notification_type_e type,
+                                                   int count,
+                                                   notification_list_h *list);
 
 /**
- * @brief This function register notification chagned callback.
- * @details
+ * @brief This function return notification detail list handle of grouping data.
+ * @details If count is -1, all of notification list is returned.
  * @remarks
- * @param[in] changed_cb callback function
- * @param[in] user_data user data
+ * @param[in] pkgname caller application package name
+ * @param[in] group_id group id
+ * @param[in] priv_id private id
+ * @param[in] count returned notification data number
+ * @param[out] list notification list handle
  * @return NOTIFICATION_ERROR_NONE if success, other value if failure.
  * @retval NOTIFICATION_ERROR_NONE - success
  * @retval NOTIFICATION_ERROR_INVALID_DATA - invalid parameter
- * @pre notification_new()
+ * @pre
  * @post
- * @see notification_unresister_changed_cb()
+ * @see #notification_list_h
  * @par Sample code:
  * @code
 #include <notification.h>
 ...
 {
-       noti_err = notification_resister_changed_cb(app_changed_cb, user_data);
+       notification_list_h noti_list = NULL;
+       notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
+
+       noti_err = notification_get_detail_list(pkgname, group_id, priv_id, -1, &noti_list);
        if(noti_err != NOTIFICATION_ERROR_NONE) {
                return;
        }
 }
  * @endcode
  */
-notification_error_e
-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);
+notification_error_e notification_get_detail_list(const char *pkgname,
+                                                 int group_id,
+                                                 int priv_id,
+                                                 int count,
+                                                 notification_list_h *list);
 
 /**
- * @brief This function unregister notification chagned callback.
+ * @brief Free notification list
  * @details
  * @remarks
- * @param[in] changed_cb callback function
+ * @param[in] list notification list handle
  * @return NOTIFICATION_ERROR_NONE if success, other value if failure.
  * @retval NOTIFICATION_ERROR_NONE - success
  * @retval NOTIFICATION_ERROR_INVALID_DATA - invalid parameter
- * @pre notification_new()
+ * @pre notification_get_grouping_list() or notification_get_detail_list ()
  * @post
- * @see notification_resister_changed_cb()
+ * @see #notification_list_h
  * @par Sample code:
  * @code
 #include <notification.h>
 ...
 {
-       noti_err = notification_unresister_changed_cb(app_changed_cb);
+       notification_list_h noti_list = NULL;
+       notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
+
+       ...
+
+       noti_err = notification_free_list(noti_list);
        if(noti_err != NOTIFICATION_ERROR_NONE) {
                return;
        }
 }
  * @endcode
  */
-notification_error_e
-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);
+notification_error_e notification_free_list(notification_list_h list);
 
 /**
- * @brief This function get notification data count.
- * @details Count is the result of the conditions that type, pkgname, group_id, priv_id.
+ * @}
+ */
+
+/**
+ * @brief Register a callback for all notification events
+ * @details The registered callback could be called for all notification events
  * @remarks
- * @param[in] type notification type
- * @param[in] pkgname caller application package name
- * @param[in] group_id group id
- * @param[in] priv_id private id
- * @param[out] count notification data number
+ * @param[in] changed_cb callback function
+ * @param[in] user_data user data
  * @return NOTIFICATION_ERROR_NONE if success, other value if failure.
  * @retval NOTIFICATION_ERROR_NONE - success
  * @retval NOTIFICATION_ERROR_INVALID_DATA - invalid parameter
- * @pre
+ * @pre notification_new()
  * @post
- * @see #notification_type_e
+ * @see notification_unresister_changed_cb()
  * @par Sample code:
  * @code
 #include <notification.h>
 ...
 {
-       notification_list_h noti_list = NULL;
-       notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
-       int count = 0;
-       
-       noti_err = notification_get_count(NOTIFICATION_TYPE_NONE, NULL, NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE, &count);
+       noti_err = notification_resister_changed_cb(app_changed_cb, user_data);
        if(noti_err != NOTIFICATION_ERROR_NONE) {
                return;
        }
 }
  * @endcode
  */
-notification_error_e notification_get_count(notification_type_e type,
-                                           const char *pkgname,
-                                           int group_id, int priv_id,
-                                           int *count);
-
-/**
- * @brief This function will be deprecated.
- * @see notification_get_grouping_list()
- *
- */
-notification_error_e notification_get_list(notification_type_e type,
-                                          int count,
-                                          notification_list_h * list);
+notification_error_e
+notification_resister_changed_cb(
+       void (*changed_cb)(void *data, notification_type_e type),
+       void *user_data);
 
 /**
- * @brief This function return notification grouping list handle.
- * @details If count is -1, all of notification list is returned.
+ * @brief Unregister a callback for all notification events
+ * @details
  * @remarks
- * @param[in] type notification type
- * @param[in] count returned notification data number
- * @param[out] list notification list handle
+ * @param[in] changed_cb callback function
  * @return NOTIFICATION_ERROR_NONE if success, other value if failure.
  * @retval NOTIFICATION_ERROR_NONE - success
  * @retval NOTIFICATION_ERROR_INVALID_DATA - invalid parameter
  * @pre
  * @post
- * @see #notification_list_h
+ * @see notification_resister_changed_cb()
  * @par Sample code:
  * @code
 #include <notification.h>
 ...
 {
-       notification_list_h noti_list = NULL;
-       notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
-       
-       noti_err = notification_get_grouping_list(NOTIFICATION_TYPE_NONE, -1, &noti_list);
+       noti_err = notification_unresister_changed_cb(app_changed_cb);
        if(noti_err != NOTIFICATION_ERROR_NONE) {
                return;
        }
 }
  * @endcode
  */
-notification_error_e notification_get_grouping_list(notification_type_e type,
-                                                   int count,
-                                                   notification_list_h *list);
+notification_error_e
+notification_unresister_changed_cb(
+       void (*changed_cb)(void *data, notification_type_e type));
 
 /**
- * @brief This function return notification detail list handle of grouping data.
- * @details If count is -1, all of notification list is returned.
+ * @brief Register a callback for all notification events
+ * @details The registered callback could be called for all notification events
  * @remarks
- * @param[in] pkgname caller application package name
- * @param[in] group_id group id
- * @param[in] priv_id private id
- * @param[in] count returned notification data number
- * @param[out] list notification list handle
+ * @param[in] changed_cb callback function
+ * @param[in] user_data user data
  * @return NOTIFICATION_ERROR_NONE if success, other value if failure.
  * @retval NOTIFICATION_ERROR_NONE - success
  * @retval NOTIFICATION_ERROR_INVALID_DATA - invalid parameter
  * @pre
  * @post
- * @see #notification_list_h
+ * @see notification_unregister_detailed_changed_cb()
  * @par Sample code:
  * @code
 #include <notification.h>
 ...
 {
-       notification_list_h noti_list = NULL;
-       notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
-       
-       noti_err = notification_get_detail_list(pkgname, group_id, priv_id, -1, &noti_list);
+       noti_err = notification_resister_changed_cb(app_changed_cb, user_data);
        if(noti_err != NOTIFICATION_ERROR_NONE) {
                return;
        }
 }
  * @endcode
  */
-notification_error_e notification_get_detail_list(const char *pkgname,
-                                                 int group_id,
-                                                 int priv_id,
-                                                 int count,
-                                                 notification_list_h *list);
+notification_error_e
+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);
 
 /**
- * @brief This function release notification list.
+ * @brief Unregister a callback for all notification events
  * @details
  * @remarks
- * @param[in] list notification list handle
+ * @param[in] changed_cb callback function
  * @return NOTIFICATION_ERROR_NONE if success, other value if failure.
  * @retval NOTIFICATION_ERROR_NONE - success
  * @retval NOTIFICATION_ERROR_INVALID_DATA - invalid parameter
- * @pre notification_get_grouping_list() or notification_get_detail_list ()
+ * @pre
  * @post
- * @see #notification_list_h
+ * @see notification_register_detailed_changed_cb()
  * @par Sample code:
  * @code
 #include <notification.h>
 ...
 {
-       notification_list_h noti_list = NULL;
-       notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
-
-       ...
-       
-       noti_err = notification_free_list(noti_list);
+       noti_err = notification_unresister_changed_cb(app_changed_cb);
        if(noti_err != NOTIFICATION_ERROR_NONE) {
                return;
        }
 }
  * @endcode
  */
-notification_error_e notification_free_list(notification_list_h list);
-
-/** 
- * @}
- */
+notification_error_e
+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 You can get the information about notification operation using this function
+ * @brief Get the information of notification event
  * @details
  * @remarks
  * @param[in] list notification list handle
@@ -2111,6 +1898,121 @@ notification_error_e notification_add_deffered_task(
 notification_error_e notification_del_deffered_task(
                void (*deffered_task_cb)(void *data));
 
+/**
+ * @addtogroup NOTIFICATION_DEPRECATED
+ * @{
+ */
+
+/**
+ * @brief This function will be deprecated.
+ * @see notification_set_image()
+ *
+ */
+notification_error_e notification_set_icon(notification_h noti,
+                                          const char *icon_path);
+
+/**
+ * @brief This function will be deprecated.
+ * @see notification_get_image()
+ *
+ */
+notification_error_e notification_get_icon(notification_h noti,
+                                          char **icon_path);
+
+/**
+ * @brief This function will be deprecated.
+ * @see notification_set_text()
+ *
+ */
+notification_error_e notification_set_title(notification_h noti,
+                                           const char *title,
+                                           const char *loc_title);
+
+/**
+ * @brief This function will be deprecated.
+ * @see notification_get_text()
+ *
+ */
+notification_error_e notification_get_title(notification_h noti,
+                                           char **title,
+                                           char **loc_title);
+
+/**
+ * @brief This function will be deprecated.
+ * @see notification_set_text()
+ *
+ */
+notification_error_e notification_set_content(notification_h noti,
+                                             const char *content,
+                                             const char *loc_content);
+
+/**
+ * @brief This function will be deprecated.
+ * @see notification_get_text()
+ *
+ */
+notification_error_e notification_get_content(notification_h noti,
+                                             char **content,
+                                             char **loc_content);
+
+/**
+ * @brief This function will be deprecated.
+ * @see notification_set_execute_option()
+ *
+ */
+notification_error_e notification_set_application(notification_h noti, const char *pkgname);   /* Do not use this */
+
+/**
+ * @brief This function will be deprecated.
+ * @see notification_get_execute_option()
+ *
+ */
+notification_error_e notification_get_application(notification_h noti, char **pkgname);        /* Do not use this */
+
+/**
+ * @brief This function will be deprecated.
+ * @see notification_set_execute_option()
+ *
+ */
+notification_error_e notification_set_args(notification_h noti, bundle * args, bundle * group_args);   /* Do not use this */
+
+/**
+ * @brief This function will be deprecated.
+ * @see notification_get_execute_option()
+ *
+ */
+notification_error_e notification_get_args(notification_h noti, bundle ** args, bundle ** group_args); /* Do not use this */
+
+/**
+ * @brief This function will be deprecated.
+ * @see notification_delete_by_priv_id()
+ *
+ */
+notification_error_e notification_delete_group_by_group_id(const char *pkgname,
+                                                          notification_type_e type,
+                                                          int group_id);
+
+/**
+ * @brief This function will be deprecated.
+ * @see notification_delete_by_priv_id()
+ *
+ */
+notification_error_e notification_delete_group_by_priv_id(const char *pkgname,
+                                                         notification_type_e type,
+                                                         int priv_id);
+/**
+ * @brief This function will be deprecated.
+ *
+ */
+notification_error_e notification_get_count(notification_type_e type,
+                                           const char *pkgname,
+                                           int group_id, int priv_id,
+                                           int *count);
+
+/**
+ * @}
+ */
+
 #ifdef __cplusplus
 }
 #endif
index 31bdca5..e70a26f 100755 (executable)
@@ -51,6 +51,9 @@ int notification_ipc_is_master_ready(void);
 notification_error_e notification_ipc_add_deffered_task(void (*deffered_task_cb)(void *data), void *user_data);
 notification_error_e notification_ipc_del_deffered_task(void (*deffered_task_cb)(void *data));
 
+notification_error_e notification_ipc_noti_setting_property_set(const char *pkgname, const char *property, const char *value);
+notification_error_e notification_ipc_noti_setting_property_get(const char *pkgname, const char *property, char **value);
+
 #ifdef __cplusplus
 }
 #endif
index adeb790..1a8082b 100755 (executable)
@@ -29,9 +29,8 @@ extern "C" {
 #endif
 
 /**
- * @ingroup NOTIFICATION_LIBRARY
- * @defgroup NOTIFICATION_LIST notification list
- * @brief Notification List API
+ * @file notification.h
+ * @brief This file contains the notification list APIs
  */
 
 /**
diff --git a/include/notification_setting.h b/include/notification_setting.h
new file mode 100755 (executable)
index 0000000..9e86d5b
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ *  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_SETTING_H__
+#define __NOTIFICATION_SETTING_H__
+
+#include <notification.h>
+
+typedef struct _notification_setting_h notification_setting_h;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+notification_error_e notification_setting_db_set(const char *pkgname, const char *property, const char *value);
+notification_error_e notification_setting_db_get(const char *pkgname, const char *property, char **value);
+
+notification_error_e notification_setting_property_set(const char *pkgname, const char *property, const char *value);
+notification_error_e notification_setting_property_get(const char *pkgname, const char *property, char **value);
+
+#ifdef __cplusplus
+}
+#endif
+#endif                         /* __NOTIFICATION_SETTING_H__ */
index 8a98865..2a05f48 100755 (executable)
@@ -27,23 +27,6 @@ extern "C" {
 #endif /* __cplusplus */
 
 /**
- * @ingroup NOTIFICATION_LIBRARY
- * @defgroup NOTIFICATION_STATUS_LIBRARY notification status library
- * @brief This notification status library used to display simple plain message on small popup
- */
-
-/**
- * @ingroup NOTIFICATION_STATUS_LIBRARY
- * @defgroup NOTIFICATION_STATUS_LIBRARY_TYPE notification status library type
- * @brief type used by notification status library
- */
-
-/**
- * @addtogroup NOTIFICATION_STATUS_LIBRARY_TYPE
- * @{
- */
-
-/**
 * @brief Called when new message is posted
 * @param[in] message The message posted
 * @param[in] data user data
@@ -53,15 +36,6 @@ extern "C" {
 typedef void (*notification_status_message_cb)(const char *message, void *data);
 
 /**
- * @}
- */
-
-/**
- * @addtogroup NOTIFICATION_STATUS_LIBRARY
- * @{
- */
-
-/**
 * @brief register callback for receiving message
 * @param[in] callback The callback function
 * @param[in] data user_data
@@ -76,6 +50,11 @@ int notification_status_monitor_message_cb_set(notification_status_message_cb ca
 int notification_status_monitor_message_cb_unset(void);
 
 /**
+ * @addtogroup NOTIFICATION_STATUS
+ * @{
+ */
+
+/**
  * @brief This function send string(message) to notification status monitor
  * @details Send the message to notification status monitor.
  * @param[in] message messages you want to post
index 1431bae..8aad6ef 100755 (executable)
@@ -27,9 +27,8 @@ extern "C" {
 #endif
 
 /**
- * @ingroup NOTIFICATION_LIBRARY
- * @defgroup NOTIFICATION_TYPE notification type
- * @brief Notification type
+ * @file notification_type.h
+ * @brief This file contains defines and enumerations for Notification APIs
  */
 
 /**
@@ -38,41 +37,20 @@ extern "C" {
  */
 
 /**
- * @brief Enumeration for notification operation code
- */
-typedef enum _notification_op_type {
-       NOTIFICATION_OP_NONE = 0,
-       NOTIFICATION_OP_INSERT = 1,
-       NOTIFICATION_OP_UPDATE,
-       NOTIFICATION_OP_DELETE,
-       NOTIFICATION_OP_DELETE_ALL,
-       NOTIFICATION_OP_REFRESH,
-       NOTIFICATION_OP_SERVICE_READY,
-} notification_op_type_e;
-
-/**
- * @brief Enumeration for notification operation data code
- */
-typedef enum _notification_op_data_type {
-       NOTIFICATION_OP_DATA_MIN = 0,
-       NOTIFICATION_OP_DATA_TYPE,
-       NOTIFICATION_OP_DATA_PRIV_ID,
-       NOTIFICATION_OP_DATA_NOTI,
-       NOTIFICATION_OP_DATA_EXTRA_INFO_1,
-       NOTIFICATION_OP_DATA_EXTRA_INFO_2,
-       NOTIFICATION_OP_DATA_MAX,
-} notification_op_data_type_e;
-
-/**
  * @brief Enumeration for notification layout type
  */
 typedef enum _notification_ly_type {
        NOTIFICATION_LY_NONE = 0,
        NOTIFICATION_LY_NOTI_EVENT_SINGLE,
+               /**< layout for notification. used to inform single event*/
        NOTIFICATION_LY_NOTI_EVENT_MULTIPLE,
+               /**< layout for notification. used to inform multiple event*/
        NOTIFICATION_LY_NOTI_THUMBNAIL,
+               /**< layout for notification. used to display images*/
        NOTIFICATION_LY_ONGOING_EVENT,
+               /**< layout for ongoing notification. used to display text message*/
        NOTIFICATION_LY_ONGOING_PROGRESS,
+               /**< layout for ongoing notification. used to display progress*/
        NOTIFICATION_LY_MAX,
 } notification_ly_type_e;
 
@@ -81,9 +59,9 @@ typedef enum _notification_ly_type {
  */
 typedef enum _notification_sound_type {
        NOTIFICATION_SOUND_TYPE_NONE = -1,
-                                       /**< Default value. Disable sound */
+                                       /**< Default value. no sound */
        NOTIFICATION_SOUND_TYPE_DEFAULT = 0,
-                                       /**< New chat sound */
+                                       /**< default sound */
        NOTIFICATION_SOUND_TYPE_USER_DATA,
                                        /**< User sound data */
        NOTIFICATION_SOUND_TYPE_MAX,
@@ -95,8 +73,8 @@ typedef enum _notification_sound_type {
  */
 typedef enum _notification_vibration_type {
        NOTIFICATION_VIBRATION_TYPE_NONE = -1,
-                                       /**< Default value. Disable vibration */
-       NOTIFICATION_VIBRATION_TYPE_DEFAULT = 0,/**< New chat vibration */
+                                       /**< Default value. no vibration */
+       NOTIFICATION_VIBRATION_TYPE_DEFAULT = 0,/**< default vibrate pattern */
        NOTIFICATION_VIBRATION_TYPE_USER_DATA,
                                        /**< User vibration data */
        NOTIFICATION_VIBRATION_TYPE_MAX,/**< Max flag */
@@ -107,10 +85,10 @@ typedef enum _notification_vibration_type {
  */
 typedef enum _notification_led_op {
        NOTIFICATION_LED_OP_OFF = -1,
-                                       /**< Default value. Disable led */
-       NOTIFICATION_LED_OP_ON = 0,/**< turn on led with default color */
+                                       /**< Default value. Disable the LED notification */
+       NOTIFICATION_LED_OP_ON = 0,/**< turn on the LED with default color */
        NOTIFICATION_LED_OP_ON_CUSTOM_COLOR,
-                                       /**< turn on led with custom color */
+                                       /**< turn on the LED with custom color */
        NOTIFICATION_LED_OP_MAX,/**< Max flag */
 } notification_led_op_e;
 
@@ -126,39 +104,6 @@ typedef enum _notification_count_display_type {
 } notification_count_display_type_e;
 
 /**
- * @brief Enumeration for notification count position in the text.
- */
-typedef enum _notifcation_count_pos_type {
-       NOTIFICATION_COUNT_POS_NONE = -1,
-                                       /**< Count data is not displaying in the text */
-       NOTIFICATION_COUNT_POS_LEFT = 0,/**< Count data is displaying at the left of the text */
-       NOTIFICATION_COUNT_POS_IN,
-                               /**< Count data is displaying in the text */
-       NOTIFICATION_COUNT_POS_RIGHT,
-                               /**< Count data is displaying at the right of the text */
-       NOTIFICATION_COUNT_POS_MAX,
-                               /**< Max flag */
-} notification_count_pos_type_e;
-
-/**
- * @brief Enumeration for notification variable parameter type
- */
-typedef enum _notification_variable_type {
-       NOTIFICATION_VARIABLE_TYPE_NONE = -1,
-                                       /**< Variable parameter type is NONE */
-       NOTIFICATION_VARIABLE_TYPE_INT = 0,
-                                       /**< Variable parameter type is int */
-       NOTIFICATION_VARIABLE_TYPE_DOUBLE,
-                                       /**< Variable parameter type is double */
-       NOTIFICATION_VARIABLE_TYPE_STRING,
-                                       /**< Variable parameter type is string */
-       NOTIFICATION_VARIABLE_TYPE_COUNT,
-                                       /**< Variable parameter type is count */
-       NOTIFICATION_VARIABLE_TYPE_MAX,
-                               /**< Max flag */
-} notification_variable_type_e;
-
-/**
  * @brief Enumeration for notification text type.
  */
 typedef enum _notification_text_type {
@@ -175,15 +120,15 @@ typedef enum _notification_text_type {
        NOTIFICATION_TEXT_TYPE_INFO_1,
                                                                /**< box contents 1 */
        NOTIFICATION_TEXT_TYPE_INFO_SUB_1,
-                                                               /**< box contents 2 */
+                                                               /**< box contents 1-1 */
        NOTIFICATION_TEXT_TYPE_INFO_2,
-                                                               /**< box contents 3 */
+                                                               /**< box contents 2 */
        NOTIFICATION_TEXT_TYPE_INFO_SUB_2,
-                                                               /**< box contents 4 */
+                                                               /**< box contents 2-1 */
        NOTIFICATION_TEXT_TYPE_INFO_3,
-                                                               /**< box contents 5 */
+                                                               /**< box contents 3 */
        NOTIFICATION_TEXT_TYPE_INFO_SUB_3,
-                                                               /**< box contents 5 */
+                                                               /**< box contents 3-1 */
        NOTIFICATION_TEXT_TYPE_GROUP_TITLE,
                                        /**< Group title */
        NOTIFICATION_TEXT_TYPE_GROUP_CONTENT,
@@ -215,15 +160,15 @@ typedef enum _notification_image_type {
        NOTIFICATION_IMAGE_TYPE_BACKGROUND,
                                                /**< image displayed on background */
        NOTIFICATION_IMAGE_TYPE_LIST_1,
-                                               /**< image for multiple event */
+                                               /**< image for thumbnail list */
        NOTIFICATION_IMAGE_TYPE_LIST_2,
-                                               /**< image for multiple event */
+                                               /**< image for thumbnail list */
        NOTIFICATION_IMAGE_TYPE_LIST_3,
-                                               /**< image for multiple event */
+                                               /**< image for thumbnail list */
        NOTIFICATION_IMAGE_TYPE_LIST_4,
-                                               /**< image for multiple event */
+                                               /**< image for thumbnail list */
        NOTIFICATION_IMAGE_TYPE_LIST_5,
-                                               /**< image for multiple event */
+                                               /**< image for thumbnail list */
        NOTIFICATION_IMAGE_TYPE_MAX,
                                /**< Max flag */
 } notification_image_type_e;
@@ -243,7 +188,7 @@ typedef enum _notification_execute_type {
        NOTIFICATION_EXECUTE_TYPE_NONE = -1,
                                        /**< No operation */
        NOTIFICATION_EXECUTE_TYPE_RESPONDING = 0,
-                                               /**< Responding */
+                                               /**< Responding action*/
        NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH,/**< Launching when notification data is single */
        NOTIFICATION_EXECUTE_TYPE_MULTI_LAUNCH,
                                        /**< Launching when notification data is grouping(multi) */
@@ -318,6 +263,69 @@ enum _notificaton_display_applist {
 };
 
 /**
+ * @}
+ */
+
+/**
+ * @brief Enumeration for notification operation code
+ */
+typedef enum _notification_op_type {
+       NOTIFICATION_OP_NONE = 0,
+       NOTIFICATION_OP_INSERT = 1,
+       NOTIFICATION_OP_UPDATE,
+       NOTIFICATION_OP_DELETE,
+       NOTIFICATION_OP_DELETE_ALL,
+       NOTIFICATION_OP_REFRESH,
+       NOTIFICATION_OP_SERVICE_READY,
+} notification_op_type_e;
+
+/**
+ * @brief Enumeration for notification operation data code
+ */
+typedef enum _notification_op_data_type {
+       NOTIFICATION_OP_DATA_MIN = 0,
+       NOTIFICATION_OP_DATA_TYPE,
+       NOTIFICATION_OP_DATA_PRIV_ID,
+       NOTIFICATION_OP_DATA_NOTI,
+       NOTIFICATION_OP_DATA_EXTRA_INFO_1,
+       NOTIFICATION_OP_DATA_EXTRA_INFO_2,
+       NOTIFICATION_OP_DATA_MAX,
+} notification_op_data_type_e;
+
+/**
+ * @brief Enumeration for notification count position in the text.
+ */
+typedef enum _notifcation_count_pos_type {
+       NOTIFICATION_COUNT_POS_NONE = -1,
+                                       /**< Count data is not displaying in the text */
+       NOTIFICATION_COUNT_POS_LEFT = 0,/**< Count data is displaying at the left of the text */
+       NOTIFICATION_COUNT_POS_IN,
+                               /**< Count data is displaying in the text */
+       NOTIFICATION_COUNT_POS_RIGHT,
+                               /**< Count data is displaying at the right of the text */
+       NOTIFICATION_COUNT_POS_MAX,
+                               /**< Max flag */
+} notification_count_pos_type_e;
+
+/**
+ * @brief Enumeration for notification variable parameter type
+ */
+typedef enum _notification_variable_type {
+       NOTIFICATION_VARIABLE_TYPE_NONE = -1,
+                                       /**< Variable parameter type is NONE */
+       NOTIFICATION_VARIABLE_TYPE_INT = 0,
+                                       /**< Variable parameter type is int */
+       NOTIFICATION_VARIABLE_TYPE_DOUBLE,
+                                       /**< Variable parameter type is double */
+       NOTIFICATION_VARIABLE_TYPE_STRING,
+                                       /**< Variable parameter type is string */
+       NOTIFICATION_VARIABLE_TYPE_COUNT,
+                                       /**< Variable parameter type is count */
+       NOTIFICATION_VARIABLE_TYPE_MAX,
+                               /**< Max flag */
+} notification_variable_type_e;
+
+/**
  * @brief Notification handle
  */
 typedef struct _notification *notification_h;
@@ -332,9 +340,6 @@ typedef struct _notification_op {
        int extra_info_2;
        notification_h noti;
 } notification_op;
-/** 
- * @}
- */
 
 #ifdef __cplusplus
 }
index 56e858b..736314e 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       notification
 Summary:    notification library
-Version:    0.2.9
+Version:    0.2.17
 Release:    1
 Group:      TBD
 License:    Apache-2.0
index 33435b2..d82ebdc 100755 (executable)
@@ -64,12 +64,6 @@ static notification_cb_list_s *g_notification_cb_list = NULL;
 
 #define NOTI_TEXT_RESULT_LEN 2048
 #define NOTI_PKGNAME_LEN       512
-#define NOTI_CHANGED_NOTI      "notification_noti_changed"
-#define NOTI_CHANGED_ONGOING   "notification_ontoing_changed"
-
-#define NOTI_DBUS_BUS_NAME     "org.tizen.libnotification"
-#define NOTI_DBUS_PATH                 "/org/tizen/libnotification"
-#define NOTI_DBUS_INTERFACE    "org.tizen.libnotification.signal"
 
 static char *_notification_get_pkgname_by_pid(void)
 {
@@ -117,62 +111,6 @@ static char *_notification_get_pkgname_by_pid(void)
        return dup_pkgname;
 }
 
-static char *_notification_get_icon(const char *package)
-{
-       ail_appinfo_h handle;
-       ail_error_e ret;
-       char *str = NULL;
-       char *icon = NULL;
-
-       ret = ail_package_get_appinfo(package, &handle);
-       if (ret != AIL_ERROR_OK) {
-               return NULL;
-       }
-
-       ret = ail_appinfo_get_str(handle, AIL_PROP_ICON_STR, &str);
-       if (ret != AIL_ERROR_OK) {
-               ail_package_destroy_appinfo(handle);
-               return NULL;
-       }
-
-       icon = strdup(str);
-
-       ret = ail_package_destroy_appinfo(handle);
-       if (ret != AIL_ERROR_OK) {
-               NOTIFICATION_ERR("Fail to ail_package_destroy_appinfo");
-       }
-
-       return icon;
-}
-
-static char *_notification_get_name(const char *package)
-{
-       ail_appinfo_h handle;
-       ail_error_e ret;
-       char *str = NULL;
-       char *name = NULL;
-
-       ret = ail_package_get_appinfo(package, &handle);
-       if (ret != AIL_ERROR_OK) {
-               return NULL;
-       }
-
-       ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &str);
-       if (ret != AIL_ERROR_OK) {
-               ail_package_destroy_appinfo(handle);
-               return NULL;
-       }
-
-       name = strdup(str);
-
-       ret = ail_package_destroy_appinfo(handle);
-       if (ret != AIL_ERROR_OK) {
-               NOTIFICATION_ERR("Fail to ail_package_destroy_appinfo");
-       }
-
-       return name;
-}
-
 static void _notification_get_text_domain(notification_h noti)
 {
        if (noti->domain != NULL) {
@@ -277,7 +215,6 @@ EXPORT_API notification_error_e notification_get_image(notification_h noti,
        bundle *b = NULL;
        char buf_key[32] = { 0, };
        const char *ret_val = NULL;
-       const char *pkgname = NULL;
 
        /* Check noti and image_path is valid data */
        if (noti == NULL || image_path == NULL) {
@@ -315,31 +252,7 @@ EXPORT_API notification_error_e notification_get_image(notification_h noti,
                        /* image path will be app icon path */
                        *image_path = noti->app_icon_path;
                } else {
-                       /* Get image path using launch_pkgname */
-                       if (noti->launch_pkgname != NULL) {
-                               noti->app_icon_path =
-                                   _notification_get_icon(noti->launch_pkgname);
-                       }
-
-                       /* If app icon path is NULL, get image path using caller_pkgname */
-                       if (noti->app_icon_path == NULL
-                           && noti->caller_pkgname != NULL) {
-                               noti->app_icon_path =
-                                   _notification_get_icon(noti->caller_pkgname);
-                       }
-
-                       /* If app icon path is NULL, get image path using service data */
-                       if (noti->app_icon_path == NULL
-                           && noti->b_service_single_launch != NULL) {
-                               pkgname =
-                                   appsvc_get_pkgname(noti->b_service_single_launch);
-                               if (pkgname != NULL) {
-                                       noti->app_icon_path =
-                                           _notification_get_icon(pkgname);
-                               }
-                       }
-
-                       *image_path = noti->app_icon_path;
+                       *image_path = NULL;
                }
        }
 
@@ -745,11 +658,8 @@ EXPORT_API notification_error_e notification_get_text(notification_h noti,
        bundle *b = NULL;
        char buf_key[32] = { 0, };
        const char *ret_val = NULL;
-       const char *pkgname = NULL;
        const char *get_str = NULL;
        const char *get_check_type_str = NULL;
-       int ret = 0;
-       int boolval = 0;
        notification_text_type_e check_type = NOTIFICATION_TEXT_TYPE_NONE;
        int display_option_flag = 0;
 
@@ -1095,46 +1005,7 @@ EXPORT_API notification_error_e notification_get_text(notification_h noti,
                }
 
        } else {
-               if (check_type == NOTIFICATION_TEXT_TYPE_TITLE
-                   || check_type == NOTIFICATION_TEXT_TYPE_GROUP_TITLE) {
-                       /* Remove app name if exist, because pkgname is changed according to language setting */
-                       if (noti->app_name != NULL) {
-                               free(noti->app_name);
-                               noti->app_name = NULL;
-                       }
-
-                       /* First, get app name from launch_pkgname */
-                       if (noti->launch_pkgname != NULL) {
-                               noti->app_name =
-                                   _notification_get_name(noti->
-                                                          launch_pkgname);
-                       }
-
-                       /* Second, get app name from caller_pkgname */
-                       if (noti->app_name == NULL
-                           && noti->caller_pkgname != NULL) {
-                               noti->app_name =
-                                   _notification_get_name(noti->
-                                                          caller_pkgname);
-                       }
-
-                       /* Third, get app name from service data */
-                       if (noti->app_name == NULL
-                           && noti->b_service_single_launch != NULL) {
-                               pkgname =
-                                   appsvc_get_pkgname(noti->
-                                                      b_service_single_launch);
-
-                               if (pkgname != NULL) {
-                                       noti->app_name =
-                                           _notification_get_name(pkgname);
-                               }
-                       }
-
-                       *text = noti->app_name;
-               } else {
-                       *text = NULL;
-               }
+               *text = NULL;
        }
 
        return NOTIFICATION_ERROR_NONE;
@@ -1218,8 +1089,6 @@ EXPORT_API notification_error_e notification_get_time_from_text(notification_h n
                                                                time_t *time)
 {
        notification_error_e ret = NOTIFICATION_ERROR_NONE;
-       char buf[256] = { 0, };
-       char buf_tag[512] = { 0, };
 
        if (noti == NULL) {
                return NOTIFICATION_ERROR_INVALID_DATA;
@@ -1580,44 +1449,48 @@ EXPORT_API notification_error_e notification_set_execute_option(notification_h n
        }
 
        switch (type) {
-       case NOTIFICATION_EXECUTE_TYPE_RESPONDING:
-               /* Remove previous data if exist */
-               if (noti->b_service_responding != NULL) {
-                       bundle_free(noti->b_service_responding);
-                       noti->b_service_responding = NULL;
-               }
+               case NOTIFICATION_EXECUTE_TYPE_RESPONDING:
+                       /* Remove previous data if exist */
+                       if (noti->b_service_responding != NULL) {
+                               bundle_free(noti->b_service_responding);
+                               noti->b_service_responding = NULL;
+                       }
 
-               /* Save service handle */
-               if (service_handle != NULL) {
-                       noti->b_service_responding = bundle_dup(service_handle);
-               }
-               break;
-       case NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH:
-               /* Remove previous data if exist */
-               if (noti->b_service_single_launch != NULL) {
-                       bundle_free(noti->b_service_single_launch);
-                       noti->b_service_single_launch = NULL;
-               }
+                       /* Save service handle */
+                       if (service_handle != NULL) {
+                               noti->b_service_responding = bundle_dup(service_handle);
+                       }
+                       break;
+               case NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH:
+                       /* Remove previous data if exist */
+                       if (noti->b_service_single_launch != NULL) {
+                               bundle_free(noti->b_service_single_launch);
+                               noti->b_service_single_launch = NULL;
+                       }
 
-               /* Save service handle */
-               if (service_handle != NULL) {
-                       noti->b_service_single_launch =
-                           bundle_dup(service_handle);
-               }
-               break;
-       case NOTIFICATION_EXECUTE_TYPE_MULTI_LAUNCH:
-               /* Remove previous data if exist */
-               if (noti->b_service_multi_launch != NULL) {
-                       bundle_free(noti->b_service_multi_launch);
-                       noti->b_service_multi_launch = NULL;
-               }
+                       /* Save service handle */
+                       if (service_handle != NULL) {
+                               noti->b_service_single_launch =
+                                       bundle_dup(service_handle);
+                       }
+                       break;
+               case NOTIFICATION_EXECUTE_TYPE_MULTI_LAUNCH:
+                       /* Remove previous data if exist */
+                       if (noti->b_service_multi_launch != NULL) {
+                               bundle_free(noti->b_service_multi_launch);
+                               noti->b_service_multi_launch = NULL;
+                       }
 
-               /* Save service handle */
-               if (service_handle != NULL) {
-                       noti->b_service_multi_launch =
-                           bundle_dup(service_handle);
-               }
-               break;
+                       /* Save service handle */
+                       if (service_handle != NULL) {
+                               noti->b_service_multi_launch =
+                                       bundle_dup(service_handle);
+                       }
+                       break;
+               case NOTIFICATION_EXECUTE_TYPE_NONE:
+               case NOTIFICATION_EXECUTE_TYPE_MAX:
+                       NOTIFICATION_ERR("invalid execution type");
+                       break;
        }
 
        return NOTIFICATION_ERROR_NONE;
@@ -1892,75 +1765,6 @@ EXPORT_API notification_error_e notification_get_layout(notification_h noti,
        return NOTIFICATION_ERROR_NONE;
 }
 
-EXPORT_API notification_error_e notification_set_badge(const char *pkgname,
-                                                      int group_id, int count)
-{
-       char *caller_pkgname = NULL;
-       int ret = NOTIFICATION_ERROR_NONE;
-
-       /* Check count is valid count */
-       if (count < 0) {
-               return NOTIFICATION_ERROR_INVALID_DATA;
-       }
-
-       /* Check pkgname */
-       if (pkgname == NULL) {
-               caller_pkgname = _notification_get_pkgname_by_pid();
-
-               /* Set count into Group DB */
-               ret =
-                   notification_group_set_badge(caller_pkgname, group_id,
-                                                count);
-
-               if (caller_pkgname != NULL) {
-                       free(caller_pkgname);
-               }
-       } else {
-               /* Set count into Group DB */
-               ret = notification_group_set_badge(pkgname, group_id, count);
-       }
-
-       return ret;
-}
-
-EXPORT_API notification_error_e notification_get_badge(const char *pkgname,
-                                                      int group_id, int *count)
-{
-       char *caller_pkgname = NULL;
-       int ret = NOTIFICATION_ERROR_NONE;
-       int ret_unread_count = 0;
-
-       /* Check pkgname */
-       if (pkgname == NULL) {
-               caller_pkgname = _notification_get_pkgname_by_pid();
-
-               /* Get count from Group DB */
-               ret =
-                   notification_group_get_badge(caller_pkgname, group_id,
-                                                &ret_unread_count);
-
-               if (caller_pkgname != NULL) {
-                       free(caller_pkgname);
-               }
-       } else {
-               /* Get count from Group DB */
-               ret =
-                   notification_group_get_badge(pkgname, group_id,
-                                                &ret_unread_count);
-       }
-
-       if (ret != NOTIFICATION_ERROR_NONE) {
-               return ret;
-       }
-
-       /* Set count */
-       if (count != NULL) {
-               *count = ret_unread_count;
-       }
-
-       return NOTIFICATION_ERROR_NONE;
-}
-
 EXPORT_API notification_error_e notification_get_id(notification_h noti,
                                                    int *group_id, int *priv_id)
 {
@@ -2057,7 +1861,7 @@ EXPORT_API notification_error_e notification_update(notification_h noti)
        return NOTIFICATION_ERROR_NONE;
 }
 
-EXPORT_API notification_update_async(notification_h noti,
+EXPORT_API notification_error_e notification_update_async(notification_h noti,
                void (*result_cb)(int priv_id, int result, void *data), void *user_data)
 {
        int ret = 0;
@@ -2100,6 +1904,9 @@ EXPORT_API notification_error_e notification_delete_all_by_type(const char *pkgn
 
        ret = notification_ipc_request_delete_multiple(type, caller_pkgname);
        if (ret != NOTIFICATION_ERROR_NONE) {
+               if (caller_pkgname) {
+                       free(caller_pkgname);
+               }
                return ret;
        }
 
@@ -2124,6 +1931,9 @@ EXPORT_API notification_error_e notification_delete_group_by_group_id(const char
 
        ret = notification_ipc_request_delete_multiple(type, caller_pkgname);
        if (ret != NOTIFICATION_ERROR_NONE) {
+               if (caller_pkgname) {
+                       free(caller_pkgname);
+               }
                return ret;
        }
 
@@ -2148,6 +1958,9 @@ EXPORT_API notification_error_e notification_delete_group_by_priv_id(const char
 
        ret = notification_ipc_request_delete_single(type, caller_pkgname, priv_id);
        if (ret != NOTIFICATION_ERROR_NONE) {
+               if (caller_pkgname) {
+                       free(caller_pkgname);
+               }
                return ret;
        }
 
@@ -2176,6 +1989,9 @@ EXPORT_API notification_error_e notification_delete_by_priv_id(const char *pkgna
 
        ret = notification_ipc_request_delete_single(type, caller_pkgname, priv_id);
        if (ret != NOTIFICATION_ERROR_NONE) {
+               if (caller_pkgname) {
+                       free(caller_pkgname);
+               }
                return ret;
        }
 
@@ -2369,12 +2185,11 @@ EXPORT_API notification_h notification_load(char *pkgname,
        int ret = 0;
        notification_h noti = NULL;
 
-       noti = (notification_h) malloc(sizeof(struct _notification));
+       noti = (notification_h) calloc(1, sizeof(struct _notification));
        if (noti == NULL) {
                NOTIFICATION_ERR("NO MEMORY : noti == NULL");
                return NULL;
        }
-       memset(noti, 0x00, sizeof(struct _notification));
 
        ret = notification_noti_get_by_priv_id(noti, pkgname, priv_id);
        if (ret != NOTIFICATION_ERROR_NONE) {
@@ -2394,12 +2209,11 @@ EXPORT_API notification_error_e notification_clone(notification_h noti, notifica
                return NOTIFICATION_ERROR_INVALID_DATA;
        }
 
-       new_noti = (notification_h) malloc(sizeof(struct _notification));
+       new_noti = (notification_h) calloc(1, sizeof(struct _notification));
        if (new_noti == NULL) {
                NOTIFICATION_ERR("NO MEMORY : noti == NULL");
                return NOTIFICATION_ERROR_NO_MEMORY;
        }
-       memset(new_noti, 0x00, sizeof(struct _notification));
 
        new_noti->type = noti->type;
        new_noti->layout = noti->layout;
@@ -2777,24 +2591,6 @@ notification_unregister_detailed_changed_cb(
        return NOTIFICATION_ERROR_INVALID_DATA;
 }
 
-EXPORT_API notification_error_e
-notification_resister_badge_changed_cb(void (*changed_cb)
-                                      (void *data, const char *pkgname,
-                                       int group_id), void *user_data)
-{
-       // Add DBus signal handler
-       return NOTIFICATION_ERROR_NONE;
-}
-
-EXPORT_API notification_error_e
-notification_unresister_badge_changed_cb(void (*changed_cb)
-                                        (void *data, const char *pkgname,
-                                         int group_id))
-{
-       // Del DBus signal handler
-       return NOTIFICATION_ERROR_NONE;
-}
-
 EXPORT_API notification_error_e notification_get_count(notification_type_e type,
                                                       const char *pkgname,
                                                       int group_id,
index 2863668..0bc01e7 100755 (executable)
@@ -31,8 +31,6 @@
 #include <notification_debug.h>
 #include <notification_db.h>
 
-#define SDFTET "/opt/dbspace/.notification_noti.db"
-
 sqlite3 *notification_db_open(const char *dbfile)
 {
        int ret = 0;
index 3fc4f59..e6a6fb1 100755 (executable)
@@ -257,11 +257,17 @@ static void _master_started_cb_service(keynode_t *node,
        int ret = NOTIFICATION_ERROR_NONE;
 
        if (notification_ipc_is_master_ready()) {
+               NOTIFICATION_ERR("try to register a notification service");
+               ret = notification_ipc_monitor_deregister();
+               if (ret != NOTIFICATION_ERROR_NONE) {
+                       NOTIFICATION_ERR("failed to unregister a monitor");
+               }
                ret = notification_ipc_monitor_register();
                if (ret != NOTIFICATION_ERROR_NONE) {
                        NOTIFICATION_ERR("failed to register a monitor");
                }
        } else {
+               NOTIFICATION_ERR("try to unregister a notification service");
                ret = notification_ipc_monitor_deregister();
                if (ret != NOTIFICATION_ERROR_NONE) {
                        NOTIFICATION_ERR("failed to deregister a monitor");
@@ -859,6 +865,7 @@ static notification_error_e notification_ipc_monitor_register(void)
 
        NOTIFICATION_ERR("register a service\n");
 
+       com_core_packet_use_thread(1);
        s_info.server_fd = com_core_packet_client_init(s_info.socket_file, 0, service_table);
        if (s_info.server_fd < 0) {
                NOTIFICATION_ERR("Failed to make a connection to the master\n");
@@ -868,6 +875,7 @@ static notification_error_e notification_ipc_monitor_register(void)
        packet = packet_create("service_register", "");
        if (!packet) {
                NOTIFICATION_ERR("Failed to build a packet\n");
+               com_core_packet_client_fini(s_info.server_fd);
                return NOTIFICATION_ERROR_IO;
        }
 
@@ -1186,3 +1194,62 @@ notification_error_e notification_ipc_request_refresh(void)
 
        return status;
 }
+
+notification_error_e notification_ipc_noti_setting_property_set(const char *pkgname, const char *property, const char *value)
+{
+       int status = 0;
+       int ret = 0;
+       struct packet *packet;
+       struct packet *result;
+
+       packet = packet_create("set_noti_property", "sss", pkgname, property, value);
+       result = com_core_packet_oneshot_send(NOTIFICATION_ADDR,
+                       packet,
+                       NOTIFICATION_IPC_TIMEOUT);
+       packet_destroy(packet);
+
+       if (result != NULL) {
+               if (packet_get(result, "ii", &status, &ret) != 2) {
+                       NOTIFICATION_ERR("Failed to get a result packet");
+                       packet_unref(result);
+                       return NOTIFICATION_ERROR_IO;
+               }
+               packet_unref(result);
+       } else {
+               NOTIFICATION_ERR("failed to receive answer(delete)");
+               return NOTIFICATION_ERROR_SERVICE_NOT_READY;
+       }
+
+       return status;
+}
+
+notification_error_e notification_ipc_noti_setting_property_get(const char *pkgname, const char *property, char **value)
+{
+       int status = 0;
+       char *ret = NULL;
+       struct packet *packet;
+       struct packet *result;
+
+       packet = packet_create("get_noti_property", "ss", pkgname, property);
+       result = com_core_packet_oneshot_send(NOTIFICATION_ADDR,
+                       packet,
+                       NOTIFICATION_IPC_TIMEOUT);
+       packet_destroy(packet);
+
+       if (result != NULL) {
+               if (packet_get(result, "is", &status, &ret) != 2) {
+                       NOTIFICATION_ERR("Failed to get a result packet");
+                       packet_unref(result);
+                       return NOTIFICATION_ERROR_IO;
+               }
+               if (status == NOTIFICATION_ERROR_NONE && ret != NULL) {
+                       *value = strdup(ret);
+               }
+               packet_unref(result);
+       } else {
+               NOTIFICATION_ERR("failed to receive answer(delete)");
+               return NOTIFICATION_ERROR_SERVICE_NOT_READY;
+       }
+
+       return status;
+}
index 825b0dd..0c447fb 100755 (executable)
 
 #define NOTI_BURST_DELETE_UNIT 10
 
+static void __free_and_set(void **target_ptr, void *new_ptr) {
+       if (target_ptr != NULL) {
+               if (*target_ptr != NULL) {
+                       free(*target_ptr);
+               }
+               *target_ptr = new_ptr;
+       }
+}
+
 static int _notification_noti_bind_query_text(sqlite3_stmt * stmt, const char *name,
                                         const char *str)
 {
@@ -113,43 +122,6 @@ static int _notification_noti_check_priv_id(notification_h noti, sqlite3 * db)
        return NOTIFICATION_ERROR_NONE;
 }
 
-static int _notification_noti_get_priv_id(notification_h noti, sqlite3 * db)
-{
-       sqlite3_stmt *stmt = NULL;
-       char query[NOTIFICATION_QUERY_MAX] = { 0, };
-       int ret = NOTIFICATION_ERROR_NONE, result = 0;
-
-       /* Make query to get max priv_id */
-       snprintf(query, sizeof(query),
-                "select max(priv_id) from noti_list where caller_pkgname = '%s'",
-                noti->caller_pkgname);
-
-       ret = sqlite3_prepare(db, query, strlen(query), &stmt, NULL);
-       if (ret != SQLITE_OK) {
-               NOTIFICATION_ERR("Get count DB err(%d) : %s", ret,
-                                sqlite3_errmsg(db));
-               return NOTIFICATION_ERROR_FROM_DB;
-       }
-
-       ret = sqlite3_step(stmt);
-       if (ret == SQLITE_ROW) {
-               result = sqlite3_column_int(stmt, 0);
-       } else {
-               result = 0;
-       }
-
-       sqlite3_finalize(stmt);
-
-       if (result < 0) {
-               return NOTIFICATION_ERROR_FROM_DB;
-       }
-
-       /* Increase result(max priv_id value) for next priv_id */
-       noti->priv_id = result + 1;
-
-       return NOTIFICATION_ERROR_NONE;
-}
-
 static int _notification_noti_get_internal_group_id_by_priv_id(const char *pkgname,
                                                               int priv_id,
                                                               sqlite3 * db)
@@ -181,129 +153,6 @@ static int _notification_noti_get_internal_group_id_by_priv_id(const char *pkgna
        return result;
 }
 
-static int _notification_noti_get_max_internal_group_id(notification_h noti,
-                                                       sqlite3 * db)
-{
-       sqlite3_stmt *stmt = NULL;
-       char query[NOTIFICATION_QUERY_MAX] = { 0, };
-       int ret = NOTIFICATION_ERROR_NONE, result = 0;
-
-       /* Get max internal group id */
-       snprintf(query, sizeof(query),
-                "select max(internal_group_id) from noti_list");
-
-       ret = sqlite3_prepare(db, query, strlen(query), &stmt, NULL);
-       if (ret != SQLITE_OK) {
-               NOTIFICATION_ERR("Get count DB err(%d) : %s", ret,
-                                sqlite3_errmsg(db));
-               return NOTIFICATION_ERROR_FROM_DB;
-       }
-
-       ret = sqlite3_step(stmt);
-       if (ret == SQLITE_ROW) {
-               result = sqlite3_column_int(stmt, 0);
-       } else {
-               result = 0;
-       }
-
-       sqlite3_finalize(stmt);
-
-       return result;
-}
-
-static int _notification_noti_get_internal_group_id(notification_h noti,
-                                                   sqlite3 * db)
-{
-       sqlite3_stmt *stmt = NULL;
-       char query[NOTIFICATION_QUERY_MAX] = { 0, };
-       int ret = NOTIFICATION_ERROR_NONE, result = 0;
-       const char *ret_title = NULL;
-       char buf_key[32] = { 0, };
-
-       if (noti->group_id == NOTIFICATION_GROUP_ID_NONE) {
-               /* If Group ID is NONE Get max internal group ID */
-               result = _notification_noti_get_max_internal_group_id(noti, db);
-               if (result < 0) {
-                       return NOTIFICATION_ERROR_FROM_DB;
-               }
-
-               /* Internal Group ID is max internal group ID + 1 */
-               noti->internal_group_id = result + 1;
-
-               return NOTIFICATION_ERROR_NONE;
-       } else if (noti->group_id == NOTIFICATION_GROUP_ID_DEFAULT) {
-               /* If Group ID is DEFAULT, Get internal group id if it exist */
-               if (noti->b_key != NULL) {
-                       snprintf(buf_key, sizeof(buf_key), "%d",
-                                NOTIFICATION_TEXT_TYPE_TITLE);
-
-                       ret_title = bundle_get_val(noti->b_key, buf_key);
-               }
-
-               if (ret_title == NULL && noti->b_text != NULL) {
-                       snprintf(buf_key, sizeof(buf_key), "%d",
-                                NOTIFICATION_TEXT_TYPE_TITLE);
-
-                       ret_title = bundle_get_val(noti->b_text, buf_key);
-               }
-
-               if (ret_title == NULL) {
-                       ret_title = noti->caller_pkgname;
-               }
-
-               snprintf(query, sizeof(query),
-                        "select internal_group_id from noti_list where title_key = $title_key and group_id = %d",
-                        NOTIFICATION_GROUP_ID_DEFAULT);
-       } else {
-               /* If Group ID is > DEFAULT, Get internal group id if it exit */
-               snprintf(query, sizeof(query),
-                        "select internal_group_id from noti_list where caller_pkgname = '%s' and group_id = %d",
-                        NOTIFICATION_CHECK_STR(noti->caller_pkgname),
-                        noti->group_id);
-       }
-
-       ret = sqlite3_prepare_v2(db, query, -1, &stmt, NULL);
-       if (ret != SQLITE_OK) {
-               NOTIFICATION_ERR("Select Query : %s", query);
-               NOTIFICATION_ERR("Select DB error(%d) : %s", ret,
-                                sqlite3_errmsg(db));
-               if (stmt) {
-                       sqlite3_finalize(stmt);
-               }
-               return NOTIFICATION_ERROR_FROM_DB;
-       }
-
-       /* Bind query */
-       if (ret_title != NULL) {
-               ret =
-                   _notification_noti_bind_query_text(stmt, "$title_key",
-                                                 NOTIFICATION_CHECK_STR
-                                                 (ret_title));
-               if (ret != NOTIFICATION_ERROR_NONE) {
-                       NOTIFICATION_ERR("Bind error : %s", sqlite3_errmsg(db));
-                       if (stmt) {
-                               sqlite3_finalize(stmt);
-                       }
-                       return ret;
-               }
-       }
-
-       ret = sqlite3_step(stmt);
-       if (ret == SQLITE_ROW) {
-               result = sqlite3_column_int(stmt, 0);
-       } else {
-               /* If there is not internal_group_id, create new one */
-               result = _notification_noti_get_max_internal_group_id(noti, db);
-               result++;
-       }
-
-       sqlite3_finalize(stmt);
-
-       noti->internal_group_id = result;
-
-       return NOTIFICATION_ERROR_NONE;
-}
-
 static int _notification_noti_make_query(notification_h noti, char *query,
                                         int query_size)
 {
@@ -618,8 +467,8 @@ static void _notification_noti_populate_from_stmt(sqlite3_stmt * stmt, notificat
 
        noti->type = sqlite3_column_int(stmt, col++);
        noti->layout = sqlite3_column_int(stmt, col++);
-       noti->caller_pkgname = notification_db_column_text(stmt, col++);
-       noti->launch_pkgname = notification_db_column_text(stmt, col++);
+       __free_and_set((void **)&(noti->caller_pkgname), notification_db_column_text(stmt, col++));
+       __free_and_set((void **)&(noti->launch_pkgname), notification_db_column_text(stmt, col++));
        noti->b_image_path = notification_db_column_bundle(stmt, col++);
        noti->group_id = sqlite3_column_int(stmt, col++);
        noti->internal_group_id = 0;
@@ -630,8 +479,8 @@ static void _notification_noti_populate_from_stmt(sqlite3_stmt * stmt, notificat
        noti->b_format_args = notification_db_column_bundle(stmt, col++);
        noti->num_format_args = sqlite3_column_int(stmt, col++);
 
-       noti->domain = notification_db_column_text(stmt, col++);
-       noti->dir = notification_db_column_text(stmt, col++);
+       __free_and_set((void **)&(noti->domain), notification_db_column_text(stmt, col++));
+       __free_and_set((void **)&(noti->dir), notification_db_column_text(stmt, col++));
        noti->time = sqlite3_column_int(stmt, col++);
        noti->insert_time = sqlite3_column_int(stmt, col++);
        noti->args = notification_db_column_bundle(stmt, col++);
@@ -645,9 +494,9 @@ static void _notification_noti_populate_from_stmt(sqlite3_stmt * stmt, notificat
            notification_db_column_bundle(stmt, col++);
 
        noti->sound_type = sqlite3_column_int(stmt, col++);
-       noti->sound_path = notification_db_column_text(stmt, col++);
+       __free_and_set((void **)&(noti->sound_path), notification_db_column_text(stmt, col++));
        noti->vibration_type = sqlite3_column_int(stmt, col++);
-       noti->vibration_path = notification_db_column_text(stmt, col++);
+       __free_and_set((void **)&(noti->vibration_path), notification_db_column_text(stmt, col++));
        noti->led_operation = sqlite3_column_int(stmt, col++);
        noti->led_argb = sqlite3_column_int(stmt, col++);
        noti->led_on_ms = sqlite3_column_int(stmt, col++);
@@ -668,7 +517,7 @@ static notification_h _notification_noti_get_item(sqlite3_stmt * stmt)
 {
        notification_h noti = NULL;
 
-       noti = malloc(sizeof(struct _notification));
+       noti = (notification_h) calloc(1, sizeof(struct _notification));
        if (noti == NULL) {
                return NULL;
        }
@@ -1613,12 +1462,10 @@ notification_error_e notification_noti_get_detail_list(const char *pkgname,
        if (priv_id == NOTIFICATION_PRIV_ID_NONE && group_id == NOTIFICATION_GROUP_ID_NONE) {
                if (status == VCONFKEY_TELEPHONY_SIM_INSERTED) {
                        snprintf(query_where, sizeof(query_where),
-                                "where  caller_pkgname = '%s' ",
-                                pkgname, internal_group_id);
+                                "where  caller_pkgname = '%s' ", pkgname);
                } else {
                        snprintf(query_where, sizeof(query_where),
-                                "where  caller_pkgname = '%s' and flag_simmode = 0 ",
-                                pkgname, internal_group_id);
+                                "where  caller_pkgname = '%s' and flag_simmode = 0 ", pkgname);
                }
        } else {
                internal_group_id =
diff --git a/src/notification_setting.c b/src/notification_setting.c
new file mode 100755 (executable)
index 0000000..246f964
--- /dev/null
@@ -0,0 +1,351 @@
+/*
+ *  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.
+ *
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <db-util.h>
+
+#include <notification.h>
+#include <notification_db.h>
+#include <notification_noti.h>
+#include <notification_debug.h>
+#include <notification_ipc.h>
+#include <notification_setting.h>
+#include <notification_internal.h>
+
+#define NOTIFICATION_SETTING_DB "notification_setting"
+#define NOTIFICATION_SETTING_DB_PATH "/opt/usr/dbspace/.notification_parser.db"
+
+struct _notification_setting_h {
+       char *appid;
+       char *notification;
+       char *sounds;
+       char *contents;
+       char *badge;
+       char *pkgid;
+};
+
+struct prop_table {
+       const char *property;
+       const char *column;
+       const char *default_value;
+};
+
+static struct prop_table g_prop_table[] = {
+               {
+                       .property = "OPT_NOTIFICATION",
+                       .column = "notification",
+                       .default_value = "ON",
+               },
+               {
+                       .property = "OPT_SOUNDS",
+                       .column = "sounds",
+                       .default_value = "ON",
+               },
+               {
+                       .property = "OPT_CONTENTS",
+                       .column = "contents",
+                       .default_value = "ON",
+               },
+               {
+                       .property = "OPT_BADGE",
+                       .column = "badge",
+                       .default_value = "ON",
+               },
+               {
+                       .property = NULL,
+                       .column = NULL,
+                       .default_value = NULL,
+               }
+};
+
+static const char *_get_prop_column(const char *property)
+{
+       int i;
+
+       for (i = 0; g_prop_table[i].property; i++) {
+               if (strcmp(g_prop_table[i].property, property))
+                       continue;
+
+               return g_prop_table[i].column;
+       }
+
+       return NULL;
+}
+
+#ifdef TBD
+static const char *_get_prop_default_value(const char *property)
+{
+       int i;
+
+       for (i = 0; g_prop_table[i].property; i++) {
+               if (strcmp(g_prop_table[i].property, property))
+                       continue;
+
+               return g_prop_table[i].default_value;
+       }
+
+       return NULL;
+}
+#endif
+
+static notification_error_e _is_record_exist(const char *pkgname, sqlite3 *db)
+{
+       sqlite3_stmt *stmt = NULL;
+       int count = 0;
+       int result = NOTIFICATION_ERROR_NONE;
+       char *sqlbuf = NULL;
+       int sqlret;
+
+       if (!pkgname)
+               return NOTIFICATION_ERROR_INVALID_DATA;
+
+       if (!db)
+               return NOTIFICATION_ERROR_INVALID_DATA;
+
+       sqlbuf = sqlite3_mprintf("SELECT count(*) FROM %s WHERE " \
+                        "appid = %Q",
+                        NOTIFICATION_SETTING_DB, pkgname);
+
+       if (!sqlbuf) {
+               NOTIFICATION_ERR("fail to alloc sql query");
+               return NOTIFICATION_ERROR_NO_MEMORY;
+       }
+
+       sqlret = sqlite3_prepare_v2(db, sqlbuf, -1, &stmt, NULL);
+       if (sqlret != SQLITE_OK) {
+               NOTIFICATION_ERR("DB err [%s]", sqlite3_errmsg(db));
+               NOTIFICATION_ERR("query[%s]", sqlbuf);
+               result = NOTIFICATION_ERROR_FROM_DB;
+               goto free_and_return;
+       }
+
+       sqlret = sqlite3_step(stmt);
+       if (sqlret == SQLITE_ROW)
+               count = sqlite3_column_int(stmt, 0);
+       else
+               count = 0;
+
+       if (count > 0)
+               result = NOTIFICATION_ERROR_ALREADY_EXIST_ID;
+       else
+               result = NOTIFICATION_ERROR_NOT_EXIST_ID;
+
+free_and_return:
+       if (sqlbuf)
+               sqlite3_free(sqlbuf);
+
+       if (stmt)
+               sqlite3_finalize(stmt);
+
+       return result;
+}
+
+EXPORT_API notification_error_e notification_setting_db_set(const char *pkgname, const char *property, const char *value)
+{
+       notification_error_e ret = NOTIFICATION_ERROR_NONE;
+       notification_error_e result = NOTIFICATION_ERROR_NONE;
+       sqlite3 *db = NULL;
+       char *sqlbuf = NULL;
+       int sqlret;
+       char *err_msg = NULL;
+       const char *column = NULL;
+
+       if (!pkgname)
+               return NOTIFICATION_ERROR_INVALID_DATA;
+
+       if (!property)
+               return NOTIFICATION_ERROR_INVALID_DATA;
+
+       if (!value)
+               return NOTIFICATION_ERROR_INVALID_DATA;
+
+       column = _get_prop_column(property);
+       if (!column)
+               return NOTIFICATION_ERROR_INVALID_DATA;
+
+       sqlret = db_util_open(NOTIFICATION_SETTING_DB_PATH, &db, 0);
+       if (sqlret != SQLITE_OK || !db) {
+               NOTIFICATION_ERR("fail to db_util_open - [%d]", sqlret);
+               return NOTIFICATION_ERROR_FROM_DB;
+       }
+
+       ret = _is_record_exist(pkgname, db);
+       if (ret != NOTIFICATION_ERROR_ALREADY_EXIST_ID) {
+               result = ret;
+               goto return_close_db;
+       }
+
+       sqlbuf = sqlite3_mprintf("UPDATE %s SET %s = %Q " \
+                       "WHERE appid = %Q",
+                       NOTIFICATION_SETTING_DB, column, value, pkgname);
+       if (!sqlbuf) {
+               NOTIFICATION_ERR("fail to alloc query");
+               result = NOTIFICATION_ERROR_NO_MEMORY;
+               goto return_close_db;
+       }
+
+       sqlret = sqlite3_exec(db, sqlbuf, NULL, NULL, &err_msg);
+       if (sqlret != SQLITE_OK) {
+               NOTIFICATION_ERR("fail to set pkgname[%s] option[%s], value[%s], err[%d - %s]",
+                               pkgname, value, property, sqlret, err_msg);
+               result = NOTIFICATION_ERROR_FROM_DB;
+               goto return_close_db;
+       }
+
+return_close_db:
+       if (err_msg)
+               sqlite3_free(err_msg);
+
+       if (sqlbuf)
+               sqlite3_free(sqlbuf);
+
+       sqlret = db_util_close(db);
+       if (sqlret != SQLITE_OK)
+               NOTIFICATION_WARN("fail to db_util_close - [%d]", sqlret);
+
+       return result;
+}
+
+EXPORT_API notification_error_e notification_setting_db_get(const char *pkgname, const char *property, char **value)
+{
+       notification_error_e ret = NOTIFICATION_ERROR_NONE;
+       notification_error_e result = NOTIFICATION_ERROR_NONE;
+       sqlite3 *db = NULL;
+       char *sqlbuf = NULL;
+       sqlite3_stmt *stmt = NULL;
+       int sqlret;
+       const char *column = NULL;
+
+       if (!pkgname)
+               return NOTIFICATION_ERROR_INVALID_DATA;
+
+       if (!property)
+               return NOTIFICATION_ERROR_INVALID_DATA;
+
+       if (!value)
+               return NOTIFICATION_ERROR_INVALID_DATA;
+
+       column = _get_prop_column(property);
+       if (!column)
+               return NOTIFICATION_ERROR_INVALID_DATA;
+
+       sqlret = db_util_open(NOTIFICATION_SETTING_DB_PATH, &db, 0);
+       if (sqlret != SQLITE_OK || !db) {
+               NOTIFICATION_ERR("fail to db_util_open - [%d]", sqlret);
+               return NOTIFICATION_ERROR_FROM_DB;
+       }
+
+       ret = _is_record_exist(pkgname, db);
+       if (ret != NOTIFICATION_ERROR_ALREADY_EXIST_ID) {
+               result = ret;
+               goto return_close_db;
+       }
+
+       sqlbuf = sqlite3_mprintf("SELECT %s FROM %s " \
+                       "WHERE appid = %Q",
+                       column, NOTIFICATION_SETTING_DB, pkgname);
+       if (!sqlbuf) {
+               NOTIFICATION_ERR("fail to alloc query");
+               result = NOTIFICATION_ERROR_NO_MEMORY;
+               goto return_close_db;
+       }
+
+       sqlret = sqlite3_prepare_v2(db, sqlbuf, -1, &stmt, NULL);
+       if (sqlret != SQLITE_OK) {
+               NOTIFICATION_ERR("fail to prepare %s - [%s]",
+                               sqlbuf, sqlite3_errmsg(db));
+               result = NOTIFICATION_ERROR_FROM_DB;
+               goto return_close_db;
+       }
+
+       sqlret = sqlite3_step(stmt);
+       if (sqlret == SQLITE_ROW) {
+               int get_bytes = sqlite3_column_bytes(stmt, 0);
+               char *get_data = (char *)calloc(get_bytes + 1, sizeof(char));
+               if (get_data != NULL) {
+                       memcpy(get_data, sqlite3_column_text(stmt, 0),
+                                       get_bytes * sizeof(char));
+                       get_data[get_bytes] = '\0';
+                       *value = get_data;
+               } else {
+                       NOTIFICATION_ERR("fail to alloc query");
+                       result = NOTIFICATION_ERROR_NO_MEMORY;
+                       goto return_close_db;
+               }
+       }
+
+return_close_db:
+       if (sqlbuf)
+               sqlite3_free(sqlbuf);
+
+       if (stmt)
+               sqlite3_finalize(stmt);
+
+       sqlret = db_util_close(db);
+       if (sqlret != SQLITE_OK)
+               NOTIFICATION_WARN("fail to db_util_close - [%d]", sqlret);
+
+       return result;
+}
+
+EXPORT_API notification_error_e notification_setting_property_set(const char *pkgname, const char *property, const char *value)
+{
+       int ret = 0;
+
+       if (!pkgname)
+               return NOTIFICATION_ERROR_INVALID_DATA;
+
+       if (!property)
+               return NOTIFICATION_ERROR_INVALID_DATA;
+
+       if (!value)
+               return NOTIFICATION_ERROR_INVALID_DATA;
+
+       ret = notification_ipc_noti_setting_property_set(pkgname, property, value);
+       if (ret != NOTIFICATION_ERROR_NONE) {
+               return ret;
+       }
+
+       return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API notification_error_e notification_setting_property_get(const char *pkgname, const char *property, char **value)
+{
+       int ret = 0;
+
+       if (!pkgname)
+               return NOTIFICATION_ERROR_INVALID_DATA;
+
+       if (!property)
+               return NOTIFICATION_ERROR_INVALID_DATA;
+
+       if (!value)
+               return NOTIFICATION_ERROR_INVALID_DATA;
+
+       ret = notification_ipc_noti_setting_property_get(pkgname, property, value);
+       if (ret != NOTIFICATION_ERROR_NONE) {
+               return ret;
+       }
+
+       return NOTIFICATION_ERROR_NONE;
+}
index 734d30d..97fbe41 100755 (executable)
 #include <errno.h>
 #include <vconf.h>
 
-#include "notification_error.h"
-#include "notification_type.h"
-#include "notification_debug.h"
-#include "notification_status.h"
-
-#ifndef EXPORT_API
-#define EXPORT_API __attribute__ ((visibility("default")))
-#endif
+#include <notification.h>
+#include <notification_db.h>
+#include <notification_noti.h>
+#include <notification_debug.h>
+#include <notification_internal.h>
+#include <notification_status.h>
 
 #define NOTIFICATION_STATUS_MESSAGE_KEY "memory/private/libstatus/message"