summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyuho Jo <kyuho.jo@samsung.com>2015-04-21 15:28:12 +0900
committerKyuho Jo <kyuho.jo@samsung.com>2015-04-22 11:14:20 +0900
commit956ddf2e3c442282f1076cfebd3a72d8d520fc42 (patch)
tree21a5f148f5655589aec79b51092f38f1955f11d5
parent44e2f4831958f38840103e2c96868b108293c761 (diff)
downloadnotification-956ddf2e3c442282f1076cfebd3a72d8d520fc42.tar.gz
notification-956ddf2e3c442282f1076cfebd3a72d8d520fc42.tar.bz2
notification-956ddf2e3c442282f1076cfebd3a72d8d520fc42.zip
1. new public API set for setting/getting permissions of the notification.
2. new internal API set for setting/getting property of settings. Change-Id: I982fce9538d11d6465a02e6abb4f91431e1145f8 Signed-off-by: Kyuho Jo <kyuho.jo@samsung.com>
-rwxr-xr-xCMakeLists.txt7
-rwxr-xr-xinclude/notification.h77
-rwxr-xr-xinclude/notification_internal.h28
-rwxr-xr-xinclude/notification_setting.h37
-rwxr-xr-xinclude/notification_type.h5
-rwxr-xr-xpackaging/notification.spec7
-rwxr-xr-xsrc/notification.c13
-rwxr-xr-xsrc/notification_noti.c3
-rwxr-xr-xsrc/notification_setting.c1
9 files changed, 138 insertions, 40 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 53ec145..8afaab4 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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
diff --git a/include/notification.h b/include/notification.h
index f371f8a..84b30f1 100755
--- a/include/notification.h
+++ b/include/notification.h
@@ -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;
@@ -1661,6 +1661,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);
+
+
+/**
* @}
*/
diff --git a/include/notification_internal.h b/include/notification_internal.h
index 6944284..c8df112 100755
--- a/include/notification_internal.h
+++ b/include/notification_internal.h
@@ -578,34 +578,6 @@ NOTIFICATION_DEPRECATED_API int notification_get_execute_option(notification_h n
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);
-
-/**
* @}
*/
diff --git a/include/notification_setting.h b/include/notification_setting.h
index 6acc7bf..0bc92bb 100755
--- a/include/notification_setting.h
+++ b/include/notification_setting.h
@@ -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
}
diff --git a/include/notification_type.h b/include/notification_type.h
index 056c89b..b606c46 100755
--- a/include/notification_type.h
+++ b/include/notification_type.h
@@ -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;
/**
* @}
*/
diff --git a/packaging/notification.spec b/packaging/notification.spec
index 7a4706c..4cc7d46 100755
--- a/packaging/notification.spec
+++ b/packaging/notification.spec
@@ -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
diff --git a/src/notification.c b/src/notification.c
index b49e5a9..419f52a 100755
--- a/src/notification.c
+++ b/src/notification.c
@@ -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;
+}
diff --git a/src/notification_noti.c b/src/notification_noti.c
index 0fe85cf..dbfdd0a 100755
--- a/src/notification_noti.c
+++ b/src/notification_noti.c
@@ -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;
diff --git a/src/notification_setting.c b/src/notification_setting.c
index 6e532c0..8c0ede6 100755
--- a/src/notification_setting.c
+++ b/src/notification_setting.c
@@ -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"