1. new public API set for setting/getting permissions of the notification.
authorKyuho Jo <kyuho.jo@samsung.com>
Tue, 21 Apr 2015 06:28:12 +0000 (15:28 +0900)
committerKyuho Jo <kyuho.jo@samsung.com>
Wed, 22 Apr 2015 02:14:20 +0000 (11:14 +0900)
2. new internal API set for setting/getting property of settings.

Change-Id: I982fce9538d11d6465a02e6abb4f91431e1145f8
Signed-off-by: Kyuho Jo <kyuho.jo@samsung.com>
CMakeLists.txt
include/notification.h
include/notification_internal.h
include/notification_setting.h
include/notification_type.h
packaging/notification.spec
src/notification.c
src/notification_noti.c
src/notification_setting.c

index 53ec14544f340ce7faaf87d42609311b9a631ccd..8afaab4bfcd7a62d8dfd9b40e637f7b88bf4f541 100755 (executable)
@@ -13,7 +13,7 @@ SET(DBFILE ".notification.db")
 SET(MAJOR_VER 0)
 SET(VERSION ${MAJOR_VER}.1.0)
 
-ADD_SUBDIRECTORY(test-app)
+ADD_SUBDIRECTORY(test-app)
 
 SET(SRCS 
        ./src/notification.c
@@ -31,7 +31,10 @@ SET(HEADERS-DEVEL
        ./include/notification_error.h
        ./include/notification_type.h
        ./include/notification_list.h
-       ./include/notification_status.h)
+       ./include/notification_status.h
+       ./include/notification_setting.h
+   )
+
 
 SET(HEADERS-SERVICE-DEVEL
        ./include/notification_ipc.h
index f371f8a465a301f0b2f75602b8a71d738d7efc43..84b30f1d0c0e21e2c91dd2eb9fb34c74fdafb2e5 100755 (executable)
@@ -854,7 +854,7 @@ int notification_get_property(notification_h noti,
                return;
        }
 
-       noti_err  = notification_set_display_applist(noti, NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_TICKER);
+       noti_err  = notification_set_display_applist(noti, NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_TICKER | NOTIFICATION_DISPLAY_APP_INDICATOR);
        if(noti_err != NOTIFICATION_ERROR_NONE) {
                notification_free(noti);
                return;
@@ -1660,6 +1660,81 @@ int notification_delete_all(notification_type_e type);
  */
 int notification_post(notification_h noti);
 
+/**
+ * @brief Sets permissions to application for updating or deletin the notification
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/notification
+ * @param[in] noti Notification handle
+ * @param[in] permission_type permission type
+ * @param[in] app_id target application id
+ * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
+ * @see #notification_get_permission
+ * @see #notification_permission_type_e
+ * @see #notification_h
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+       notification_h noti = NULL;
+       int noti_err = NOTIFICATION_ERROR_NONE;
+
+       noti = notification_create(NOTIFICATION_TYPE_NOTI);
+       if(noti == NULL) {
+               return;
+       }
+       ...
+
+       noti_err = notification_set_permission(noti, NOTIFICATION_PERMISSION_TYPE_DELETE, "org.tizen.xxx");
+       if(noti_err != NOTIFICATION_ERROR_NONE) {
+               return;
+       }
+}
+ * @endcode
+ */
+int notification_set_permission(notification_h handle, notification_permission_type_e permission_type, const char *app_id);
+
+/**
+ * @brief Gets permissions of the notification
+ * @remarks app_id must not be freed. This will be free with notification_free.
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/notification
+ * @param[in] noti Notification handle
+ * @param[out] permission_type permission type
+ * @param[out] app_id target application id
+ * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
+ * @see #notification_set_permission
+ * @see #notification_permission_type_e
+ * @see #notification_h
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+       int noti_err = NOTIFICATION_ERROR_NONE;
+       notification_permission_type_e permission_type;
+       const char *app_id = NULL;
+
+       ...
+
+       noti_err = notification_get_permission(noti, &permission_type, &app_id);
+       if(noti_err != NOTIFICATION_ERROR_NONE) {
+               return;
+       }
+}
+ * @endcode
+ */
+int notification_get_permission(notification_h handle, notification_permission_type_e *permission_type, const char **app_id);
+
+
 /**
  * @}
  */
index 694428455acff7aacb0cbd2397a73dfed8edcefd..c8df1128b4e50478ccd364734239c285ab3307b7 100755 (executable)
@@ -577,34 +577,6 @@ NOTIFICATION_DEPRECATED_API int notification_get_execute_option(notification_h n
                                                     const char **text,
                                                     bundle **service_handle);
 
-/**
- * @internal
- * @brief This function sets notification property for designated package.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege http://tizen.org/privilege/core/notification
- * @param[in] pkgname The name of designated package
- * @param[in] property name
- * @param[in] property value
- * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
- * @see #notification_error_e
- */
-int notification_setting_property_set(const char *pkgname, const char *property, const char *value);
-
-/**
- * @internal
- * @brief This function gets notification property for designated package.
- * @since_tizen 2.3
- * @privlevel public
- * @privilege http://tizen.org/privilege/core/notification
- * @param[in] pkgname The name of designated package
- * @param[in] property name
- * @param[in] pointer which can save the getting value
- * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
- * @see #notification
- */
-int notification_setting_property_get(const char *pkgname, const char *property, char **value);
-
 /**
  * @}
  */
index 6acc7bfff97c8c7f91e1846a1f49bafb267791a7..0bc92bbdd0fd4e45fb1e227a1c8c033eeae6b631 100755 (executable)
@@ -30,8 +30,41 @@ typedef struct _notification_setting_h notification_setting_h;
 extern "C" {
 #endif
 
-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);
+typedef enum _notification_setting_property {
+       NOTIFICATION_SETTING_PROPERTY_ALLOW_TO_NOTIFY = 1,
+       NOTIFICATION_SETTING_PROPERTY_DO_NOT_DISTURB = 2,
+       NOTIFICATION_SETTING_PROPERTY_VISIBILITY_CLASS = 3,
+} notification_setting_property_e;
+
+
+
+/**
+ * @internal
+ * @brief This function sets notification property for designated package.
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/core/notification
+ * @param[in] pkgname The name of designated package
+ * @param[in] property name
+ * @param[in] property value
+ * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
+ * @see #notification_error_e
+ */
+int notification_setting_property_set(const char *pkgname, const char *property, const char *value);
+
+/**
+ * @internal
+ * @brief This function gets notification property for designated package.
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/core/notification
+ * @param[in] pkgname The name of designated package
+ * @param[in] property name
+ * @param[in] pointer which can save the getting value
+ * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
+ * @see #notification
+ */
+int notification_setting_property_get(const char *pkgname, const char *property, char **value);
 
 #ifdef __cplusplus
 }
index 056c89b40b5e40754526bf61f5b85ff6fc329ca6..b606c46985f5d7daad74a4f6c7d9477f702e8cca 100755 (executable)
@@ -402,6 +402,11 @@ typedef struct _notification_op {
        notification_h noti;    /**< Notification handler */
 } notification_op;
 
+typedef enum notification_permission_type {
+    NOTIFICATION_PERMISSION_TYPE_NONE = 0,
+    NOTIFICATION_PERMISSION_TYPE_DELETE = 1,
+    NOTIFICATION_PERMISSION_TYPE_UPDATE = 2,
+} notification_permission_type_e;
 /**
  * @}
  */
index 7a4706cbea59e61a56dc2962869d0af944b9ea84..4cc7d46bc362dbe8dca3bdaa47c921d42934fdaa 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       notification
 Summary:    notification library
-Version:    0.2.25
+Version:    0.2.27
 Release:    1
 Group:      TBD
 License:    Apache
@@ -168,8 +168,8 @@ fi
 
 chown :5000 /opt/dbspace/.notification.db
 chown :5000 /opt/dbspace/.notification.db-journal
-chmod 640 /opt/dbspace/.notification.db
-chmod 640 /opt/dbspace/.notification.db-journal
+chmod 644 /opt/dbspace/.notification.db
+chmod 644 /opt/dbspace/.notification.db-journal
 if [ -f /usr/lib/rpm-plugins/msm.so ]
 then
     chsmack -a 'notification::db' /opt/dbspace/.notification.db*
@@ -193,6 +193,7 @@ vconftool set -t string memory/private/libstatus/message "" -i -g 5000 -f  $SMAC
 %{_includedir}/notification/notification_type.h
 %{_includedir}/notification/notification_list.h
 %{_includedir}/notification/notification_status.h
+%{_includedir}/notification/notification_setting.h
 %{_libdir}/pkgconfig/notification.pc
 
 %files service-devel
index b49e5a934ca95717fbdee3ae3f77177d9c61cb9d..419f52aba7745321e497c7b54f61b89392dd7b5f 100755 (executable)
@@ -546,7 +546,6 @@ EXPORT_API int notification_get_text(notification_h noti,
        char buf_key[32] = { 0, };
        const char *ret_val = NULL;
        const char *get_str = NULL;
-       const char *get_check_type_str = NULL;
        notification_text_type_e check_type = NOTIFICATION_TEXT_TYPE_NONE;
        //int display_option_flag = 0;
 
@@ -3131,6 +3130,16 @@ EXPORT_API int notification_register_toast_message(void (*posted_toast_cb) (void
 void notification_call_posted_toast_cb(const char *message)
 {
        if (posted_toast_message_cb != NULL) {
-               posted_toast_message_cb(message);
+               posted_toast_message_cb((void*)message);
        }
 }
+
+EXPORT_API int notification_set_permission(notification_h handle, notification_permission_type_e permission_type, const char *app_id)
+{
+       return NOTIFICATION_ERROR_INVALID_OPERATION;
+}
+
+EXPORT_API int notification_get_permission(notification_h handle, notification_permission_type_e *permission_type, const char **app_id)
+{
+       return NOTIFICATION_ERROR_INVALID_OPERATION;
+}
index 0fe85cfd6cbe9fd84ce17387bad9060fcd37628f..dbfdd0aaada0e2c9de1e252ab975d1bbcea505e4 100755 (executable)
@@ -1813,8 +1813,7 @@ err:
        return ret;
 }
 
-static void
-popup_timeout_cb(void *data, Evas_Object *obj, void *event_info)
+static void popup_timeout_cb(void *data, Evas_Object *obj, void *event_info)
 {
        Eina_List *list = NULL;
        char *msg = NULL;
index 6e532c03b38b960c7dd0c4cd1532c665c8a21181..8c0ede6ccbdc4f2d2f2a4c49aa1ad7cb57021e2a 100755 (executable)
@@ -30,6 +30,7 @@
 #include <notification_debug.h>
 #include <notification_ipc.h>
 #include <notification_private.h>
+#include <notification_setting.h>
 
 #define NOTIFICATION_SETTING_DB "notification_setting"
 #define NOTIFICATION_SETTING_DB_PATH "/opt/usr/dbspace/.notification_parser.db"