summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryoungsub ko <ys4610.ko@samsung.com>2014-04-05 14:00:39 +0900
committeryoungsub ko <ys4610.ko@samsung.com>2014-04-05 14:07:46 +0900
commit38b527ff42613fc0c17e3c70e542c931b2d63687 (patch)
tree35ea3eb47e9f26b4075cc7b31c55438fd4a9e1df
parentc1442f0881c165a677a5d61d30e0c626b4eb7b4e (diff)
downloadnotification-38b527ff42613fc0c17e3c70e542c931b2d63687.tar.gz
notification-38b527ff42613fc0c17e3c70e542c931b2d63687.tar.bz2
notification-38b527ff42613fc0c17e3c70e542c931b2d63687.zip
split API set application API and service APIsubmit/tizen/20140430.015603
Change-Id: I8bea1fd6ca27deeb52ecb562759b3c3d3226c8e3
-rwxr-xr-xCMakeLists.txt27
-rwxr-xr-xinclude/notification_ipc.h2
-rwxr-xr-xinclude/notification_setting.h5
-rwxr-xr-xinclude/notification_setting_service.h37
-rwxr-xr-xinclude/notification_status.h2
-rwxr-xr-xnotification-service.pc.in11
-rwxr-xr-xpackaging/notification.spec39
-rwxr-xr-xsrc/notification.c488
-rwxr-xr-xsrc/notification_db.c29
-rwxr-xr-xsrc/notification_ipc.c9
-rwxr-xr-xsrc/notification_setting.c17
-rwxr-xr-xsrc/notification_status.c3
12 files changed, 399 insertions, 270 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bf6772f..fe012ea 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,7 +11,8 @@ SET(DBFILE ".notification.db")
SET(MAJOR_VER 0)
SET(VERSION ${MAJOR_VER}.1.0)
-SET(SRCS ./src/notification.c
+SET(SRCS
+ ./src/notification.c
./src/notification_noti.c
./src/notification_ongoing.c
./src/notification_group.c
@@ -20,14 +21,18 @@ SET(SRCS ./src/notification.c
./src/notification_status.c
./src/notification_ipc.c
./src/notification_setting.c)
-SET(HEADERS ./include/notification.h
- ./include/notification_error.h
- ./include/notification_type.h
+SET(HEADERS-DEVEL
+ ./include/notification.h
+ ./include/notification_error.h
+ ./include/notification_type.h
./include/notification_list.h
./include/notification_status.h
+ ./include/notification_setting.h)
+
+SET(HEADERS-SERVICE-DEVEL
./include/notification_ipc.h
- ./include/notification_setting.h
- ./include/notification_noti.h)
+ ./include/notification_noti.h
+ ./include/notification_setting_service.h)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
@@ -35,10 +40,12 @@ INCLUDE(FindPkgConfig)
pkg_check_modules(pkgs REQUIRED
sqlite3
db-util
+ vconf
bundle
dlog
ail
aul
+ appsvc
dbus-1
dbus-glib-1
com-core
@@ -69,7 +76,13 @@ CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
INSTALL(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
-FOREACH(hfile ${HEADERS})
+FOREACH(hfile ${HEADERS-DEVEL})
INSTALL(FILES ${CMAKE_SOURCE_DIR}/${hfile} DESTINATION include/${PROJECT_NAME})
ENDFOREACH(hfile)
+CONFIGURE_FILE(${PROJECT_NAME}-service.pc.in ${PROJECT_NAME}-service.pc @ONLY)
+INSTALL(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}-service.pc DESTINATION lib/pkgconfig)
+
+FOREACH(hfile ${HEADERS-SERVICE-DEVEL})
+ INSTALL(FILES ${CMAKE_SOURCE_DIR}/${hfile} DESTINATION include/${PROJECT_NAME}/service)
+ENDFOREACH(hfile)
diff --git a/include/notification_ipc.h b/include/notification_ipc.h
index 8c7681b..d55c264 100755
--- a/include/notification_ipc.h
+++ b/include/notification_ipc.h
@@ -3,7 +3,7 @@
*
* 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>
+ * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>, Youngsub Ko <ys4610.ko@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/include/notification_setting.h b/include/notification_setting.h
index 9e86d5b..4ab999d 100755
--- a/include/notification_setting.h
+++ b/include/notification_setting.h
@@ -3,7 +3,7 @@
*
* 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>
+ * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>, Youngsub Ko <ys4610.ko@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,9 +30,6 @@ typedef struct _notification_setting_h notification_setting_h;
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);
diff --git a/include/notification_setting_service.h b/include/notification_setting_service.h
new file mode 100755
index 0000000..1fea418
--- /dev/null
+++ b/include/notification_setting_service.h
@@ -0,0 +1,37 @@
+/*
+ * 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>, Youngsub Ko <ys4610.ko@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_SERVICE_H__
+#define __NOTIFICATION_SETTING_SERVICE_H__
+
+#include <notification.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);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __NOTIFICATION_SETTING_SERVICE_H__ */
diff --git a/include/notification_status.h b/include/notification_status.h
index 2a05f48..84c4d02 100755
--- a/include/notification_status.h
+++ b/include/notification_status.h
@@ -3,7 +3,7 @@
*
* 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>
+ * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>, Youngsub Ko <ys4610.ko@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/notification-service.pc.in b/notification-service.pc.in
new file mode 100755
index 0000000..2708490
--- /dev/null
+++ b/notification-service.pc.in
@@ -0,0 +1,11 @@
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@/service
+
+Name: notification
+Description: Notification Library
+Version: @VERSION@
+Requires: bundle
+Libs: -L${libdir} -lnotification
+Cflags: -I${includedir}
diff --git a/packaging/notification.spec b/packaging/notification.spec
index 555c043..24a8523 100755
--- a/packaging/notification.spec
+++ b/packaging/notification.spec
@@ -9,11 +9,13 @@ Source1001: notification.manifest
BuildRequires: pkgconfig(sqlite3)
BuildRequires: pkgconfig(db-util)
BuildRequires: pkgconfig(heynoti)
+BuildRequires: pkgconfig(vconf)
BuildRequires: pkgconfig(bundle)
BuildRequires: pkgconfig(dbus-1)
BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(ail)
BuildRequires: pkgconfig(aul)
+BuildRequires: pkgconfig(appsvc)
BuildRequires: pkgconfig(dbus-glib-1)
BuildRequires: pkgconfig(com-core)
BuildRequires: pkgconfig(ecore)
@@ -25,7 +27,7 @@ Requires(post): /usr/bin/sqlite3
Requires(postun): /sbin/ldconfig
%description
-Client library for sending notifications.
+Client/Server library for sending notifications.
%prep
%setup -q
@@ -33,22 +35,34 @@ cp %{SOURCE1001} .
%package devel
Summary: Notification library (devel)
-Group: Development/Applications
+Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
%description devel
Development files needed to build software that needs to system a system notification.
+%package service-devel
+Summary: Notification library (service-devel)
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description service-devel
+Development files needed to build notification service
+
%build
%cmake .
make %{?jobs:-j%jobs}
%install
+rm -rf %{buildroot}
%make_install
mkdir -p %{buildroot}/usr/share/license
cp -f LICENSE.APLv2.0 %{buildroot}/usr/share/license/%{name}
+%clean
+rm -rf %{buildroot}
+
%post
/sbin/ldconfig
@@ -141,10 +155,11 @@ fi
chown :5000 /opt/dbspace/.notification.db
chown :5000 /opt/dbspace/.notification.db-journal
-chmod 660 /opt/dbspace/.notification.db
-chmod 660 /opt/dbspace/.notification.db-journal
+chmod 640 /opt/dbspace/.notification.db
+chmod 640 /opt/dbspace/.notification.db-journal
chsmack -a 'notification::db' /opt/dbspace/.notification.db*
-vconftool set -t string memory/private/libstatus/message "" -i -g 5000
+SMACK_OPTION="-s system::vconf_misc"
+vconftool set -t string memory/private/libstatus/message "" -i -g 5000 -f $SMACK_OPTION
%postun -p /sbin/ldconfig
@@ -156,5 +171,17 @@ vconftool set -t string memory/private/libstatus/message "" -i -g 5000
%files devel
%defattr(-,root,root,-)
-%{_includedir}/notification/*.h
+%{_includedir}/notification/notification.h
+%{_includedir}/notification/notification_error.h
+%{_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
+%defattr(-,root,root,-)
+%{_includedir}/notification/service/notification_ipc.h
+%{_includedir}/notification/service/notification_noti.h
+%{_includedir}/notification/service/notification_setting_service.h
+%{_libdir}/pkgconfig/notification-service.pc
diff --git a/src/notification.c b/src/notification.c
index 27a440f..f11ac22 100755
--- a/src/notification.c
+++ b/src/notification.c
@@ -30,6 +30,7 @@
#include <aul.h>
#include <ail.h>
+#include <appsvc.h>
#include <vconf-keys.h>
#include <vconf.h>
@@ -121,39 +122,6 @@ static void _notification_get_text_domain(notification_h noti)
}
}
-/* notification_set_icon will be removed */
-EXPORT_API notification_error_e notification_set_icon(notification_h noti,
- const char *icon_path)
-{
- int ret_err = NOTIFICATION_ERROR_NONE;
-
- ret_err =
- notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON,
- icon_path);
-
- return ret_err;
-}
-
-/* notification_get_icon will be removed */
-EXPORT_API notification_error_e notification_get_icon(notification_h noti,
- char **icon_path)
-{
- int ret_err = NOTIFICATION_ERROR_NONE;
- char *ret_image_path = NULL;
-
- ret_err =
- notification_get_image(noti, NOTIFICATION_IMAGE_TYPE_ICON,
- &ret_image_path);
-
- if (ret_err == NOTIFICATION_ERROR_NONE && icon_path != NULL) {
- *icon_path = ret_image_path;
-
- //NOTIFICATION_DBG("Get icon : %s", *icon_path);
- }
-
- return ret_err;
-}
-
EXPORT_API notification_error_e notification_set_image(notification_h noti,
notification_image_type_e type,
const char *image_path)
@@ -305,92 +273,6 @@ EXPORT_API notification_error_e notification_get_insert_time(notification_h noti
return NOTIFICATION_ERROR_NONE;
}
-EXPORT_API notification_error_e notification_set_title(notification_h noti,
- const char *title,
- const char *loc_title)
-{
- int noti_err = NOTIFICATION_ERROR_NONE;
-
- noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE,
- title, loc_title,
- NOTIFICATION_VARIABLE_TYPE_NONE);
-
- return noti_err;
-}
-
-EXPORT_API notification_error_e notification_get_title(notification_h noti,
- char **title,
- char **loc_title)
-{
- int noti_err = NOTIFICATION_ERROR_NONE;
- char *ret_text = NULL;
-
- noti_err =
- notification_get_text(noti, NOTIFICATION_TEXT_TYPE_TITLE,
- &ret_text);
-
- if (title != NULL) {
- *title = ret_text;
- }
-
- if (loc_title != NULL) {
- *loc_title = NULL;
- }
-
- return noti_err;
-}
-
-EXPORT_API notification_error_e notification_set_content(notification_h noti,
- const char *content,
- const char *loc_content)
-{
- int noti_err = NOTIFICATION_ERROR_NONE;
-
- noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT,
- content, loc_content,
- NOTIFICATION_VARIABLE_TYPE_NONE);
-
- return noti_err;
-}
-
-EXPORT_API notification_error_e notification_get_content(notification_h noti,
- char **content,
- char **loc_content)
-{
- int noti_err = NOTIFICATION_ERROR_NONE;
- char *ret_text = NULL;
-
- noti_err =
- notification_get_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT,
- &ret_text);
-
- if (content != NULL) {
- *content = ret_text;
- }
-
- if (loc_content != NULL) {
- *loc_content = NULL;
- }
-
- return noti_err;
-
-#if 0
- ret =
- vconf_get_bool
- (VCONFKEY_SETAPPL_STATE_TICKER_NOTI_DISPLAY_CONTENT_BOOL, &boolval);
-
- if (ret == -1 || boolval == 0) {
- if (content != NULL && noti->default_content != NULL) {
- *content = noti->default_content;
- }
-
- if (loc_content != NULL && noti->loc_default_content != NULL) {
- *loc_content = noti->loc_default_content;
- }
- }
-#endif
-}
-
EXPORT_API notification_error_e notification_set_text(notification_h noti,
notification_text_type_e type,
const char *text,
@@ -1342,53 +1224,6 @@ EXPORT_API notification_error_e notification_get_application(notification_h noti
return NOTIFICATION_ERROR_NONE;
}
-EXPORT_API notification_error_e notification_set_args(notification_h noti,
- bundle * args,
- bundle * group_args)
-{
- if (noti == NULL || args == NULL) {
- return NOTIFICATION_ERROR_INVALID_DATA;
- }
-
- if (noti->args) {
- bundle_free(noti->args);
- }
-
- noti->args = bundle_dup(args);
-
- if (noti->group_args) {
- bundle_free(noti->group_args);
- noti->group_args = NULL;
- }
-
- if (group_args != NULL) {
- noti->group_args = bundle_dup(group_args);
- }
-
- return NOTIFICATION_ERROR_NONE;
-}
-
-EXPORT_API notification_error_e notification_get_args(notification_h noti,
- bundle ** args,
- bundle ** group_args)
-{
- if (noti == NULL || args == NULL) {
- return NOTIFICATION_ERROR_INVALID_DATA;
- }
-
- if (noti->args) {
- *args = noti->args;
- } else {
- *args = NULL;
- }
-
- if (group_args != NULL && noti->group_args) {
- *group_args = noti->group_args;
- }
-
- return NOTIFICATION_ERROR_NONE;
-}
-
EXPORT_API notification_error_e notification_set_execute_option(notification_h noti,
notification_execute_type_e type,
const char *text,
@@ -1447,7 +1282,7 @@ EXPORT_API notification_error_e notification_set_execute_option(notification_h n
bundle_add(b, buf_key, key);
}
- switch (type) {
+ switch ((int)type) {
case NOTIFICATION_EXECUTE_TYPE_RESPONDING:
/* Remove previous data if exist */
if (noti->b_service_responding != NULL) {
@@ -1486,10 +1321,6 @@ EXPORT_API notification_error_e notification_set_execute_option(notification_h n
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;
@@ -1915,60 +1746,6 @@ EXPORT_API notification_error_e notification_delete_all_by_type(const char *pkgn
return NOTIFICATION_ERROR_NONE;
}
-EXPORT_API notification_error_e notification_delete_group_by_group_id(const char *pkgname,
- notification_type_e type,
- int group_id)
-{
- int ret = 0;
- char *caller_pkgname = NULL;
-
- if (pkgname == NULL) {
- caller_pkgname = _notification_get_pkgname_by_pid();
- } else {
- caller_pkgname = strdup(pkgname);
- }
-
- ret = notification_ipc_request_delete_multiple(type, caller_pkgname);
- if (ret != NOTIFICATION_ERROR_NONE) {
- if (caller_pkgname) {
- free(caller_pkgname);
- }
- return ret;
- }
-
- if (caller_pkgname) {
- free(caller_pkgname);
- }
- return NOTIFICATION_ERROR_NONE;
-}
-
-EXPORT_API notification_error_e notification_delete_group_by_priv_id(const char *pkgname,
- notification_type_e type,
- int priv_id)
-{
- int ret = 0;
- char *caller_pkgname = NULL;
-
- if (pkgname == NULL) {
- caller_pkgname = _notification_get_pkgname_by_pid();
- } else {
- caller_pkgname = strdup(pkgname);
- }
-
- ret = notification_ipc_request_delete_single(type, caller_pkgname, priv_id);
- if (ret != NOTIFICATION_ERROR_NONE) {
- if (caller_pkgname) {
- free(caller_pkgname);
- }
- return ret;
- }
-
- if (caller_pkgname) {
- free(caller_pkgname);
- }
- return NOTIFICATION_ERROR_NONE;
-}
-
EXPORT_API notification_error_e notification_delete_by_priv_id(const char *pkgname,
notification_type_e type,
int priv_id)
@@ -2421,6 +2198,9 @@ notification_resister_changed_cb(void (*changed_cb)
notification_cb_list_s *noti_cb_list_new = NULL;
notification_cb_list_s *noti_cb_list = NULL;
+ if (changed_cb == NULL) {
+ return NOTIFICATION_ERROR_INVALID_DATA;
+ }
if (notification_ipc_monitor_init() != NOTIFICATION_ERROR_NONE) {
return NOTIFICATION_ERROR_IO;
}
@@ -2461,6 +2241,9 @@ notification_unresister_changed_cb(void (*changed_cb)
noti_cb_list = g_notification_cb_list;
+ if (changed_cb == NULL) {
+ return NOTIFICATION_ERROR_INVALID_DATA;
+ }
if (noti_cb_list == NULL) {
return NOTIFICATION_ERROR_INVALID_DATA;
}
@@ -2509,6 +2292,9 @@ notification_register_detailed_changed_cb(
notification_cb_list_s *noti_cb_list_new = NULL;
notification_cb_list_s *noti_cb_list = NULL;
+ if (detailed_changed_cb == NULL) {
+ return NOTIFICATION_ERROR_INVALID_DATA;
+ }
if (notification_ipc_monitor_init() != NOTIFICATION_ERROR_NONE) {
return NOTIFICATION_ERROR_IO;
}
@@ -2550,6 +2336,9 @@ notification_unregister_detailed_changed_cb(
noti_cb_list = g_notification_cb_list;
+ if (detailed_changed_cb == NULL) {
+ return NOTIFICATION_ERROR_INVALID_DATA;
+ }
if (noti_cb_list == NULL) {
return NOTIFICATION_ERROR_INVALID_DATA;
}
@@ -2598,6 +2387,10 @@ EXPORT_API notification_error_e notification_get_count(notification_type_e type,
int ret = 0;
int noti_count = 0;
+ if (count == NULL) {
+ return NOTIFICATION_ERROR_INVALID_DATA;
+ }
+
ret =
notification_noti_get_count(type, pkgname, group_id, priv_id,
&noti_count);
@@ -2605,9 +2398,7 @@ EXPORT_API notification_error_e notification_get_count(notification_type_e type,
return ret;
}
- if (count != NULL) {
- *count = noti_count;
- }
+ *count = noti_count;
return NOTIFICATION_ERROR_NONE;
}
@@ -2619,6 +2410,10 @@ EXPORT_API notification_error_e notification_get_list(notification_type_e type,
notification_list_h get_list = NULL;
int ret = 0;
+ if (list == NULL) {
+ return NOTIFICATION_ERROR_INVALID_DATA;
+ }
+
ret = notification_noti_get_grouping_list(type, count, &get_list);
if (ret != NOTIFICATION_ERROR_NONE) {
return ret;
@@ -2636,6 +2431,10 @@ notification_get_grouping_list(notification_type_e type, int count,
notification_list_h get_list = NULL;
int ret = 0;
+ if (list == NULL) {
+ return NOTIFICATION_ERROR_INVALID_DATA;
+ }
+
ret = notification_noti_get_grouping_list(type, count, &get_list);
if (ret != NOTIFICATION_ERROR_NONE) {
return ret;
@@ -2655,6 +2454,10 @@ EXPORT_API notification_error_e notification_get_detail_list(const char *pkgname
notification_list_h get_list = NULL;
int ret = 0;
+ if (list == NULL) {
+ return NOTIFICATION_ERROR_INVALID_DATA;
+ }
+
ret =
notification_noti_get_detail_list(pkgname, group_id, priv_id, count,
&get_list);
@@ -2673,7 +2476,6 @@ EXPORT_API notification_error_e notification_free_list(notification_list_h list)
notification_h noti = NULL;
if (list == NULL) {
- NOTIFICATION_ERR("INVALID DATA : list == NULL");
return NOTIFICATION_ERROR_INVALID_DATA;
}
@@ -2766,6 +2568,10 @@ EXPORT_API notification_error_e
notification_add_deffered_task(
void (*deffered_task_cb)(void *data), void *user_data)
{
+ if (deffered_task_cb == NULL) {
+ return NOTIFICATION_ERROR_INVALID_DATA;
+ }
+
return notification_ipc_add_deffered_task(deffered_task_cb, user_data);
}
@@ -2773,5 +2579,229 @@ EXPORT_API notification_error_e
notification_del_deffered_task(
void (*deffered_task_cb)(void *data))
{
+ if (deffered_task_cb == NULL) {
+ return NOTIFICATION_ERROR_INVALID_DATA;
+ }
+
return notification_ipc_del_deffered_task(deffered_task_cb);
}
+
+/* notification_set_icon will be removed */
+EXPORT_API notification_error_e notification_set_icon(notification_h noti,
+ const char *icon_path)
+{
+ int ret_err = NOTIFICATION_ERROR_NONE;
+
+ ret_err =
+ notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON,
+ icon_path);
+
+ return ret_err;
+}
+
+/* notification_get_icon will be removed */
+EXPORT_API notification_error_e notification_get_icon(notification_h noti,
+ char **icon_path)
+{
+ int ret_err = NOTIFICATION_ERROR_NONE;
+ char *ret_image_path = NULL;
+
+ ret_err =
+ notification_get_image(noti, NOTIFICATION_IMAGE_TYPE_ICON,
+ &ret_image_path);
+
+ if (ret_err == NOTIFICATION_ERROR_NONE && icon_path != NULL) {
+ *icon_path = ret_image_path;
+
+ //NOTIFICATION_DBG("Get icon : %s", *icon_path);
+ }
+
+ return ret_err;
+}
+
+EXPORT_API notification_error_e notification_set_title(notification_h noti,
+ const char *title,
+ const char *loc_title)
+{
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE,
+ title, loc_title,
+ NOTIFICATION_VARIABLE_TYPE_NONE);
+
+ return noti_err;
+}
+
+EXPORT_API notification_error_e notification_get_title(notification_h noti,
+ char **title,
+ char **loc_title)
+{
+ int noti_err = NOTIFICATION_ERROR_NONE;
+ char *ret_text = NULL;
+
+ noti_err =
+ notification_get_text(noti, NOTIFICATION_TEXT_TYPE_TITLE,
+ &ret_text);
+
+ if (title != NULL) {
+ *title = ret_text;
+ }
+
+ if (loc_title != NULL) {
+ *loc_title = NULL;
+ }
+
+ return noti_err;
+}
+
+EXPORT_API notification_error_e notification_set_content(notification_h noti,
+ const char *content,
+ const char *loc_content)
+{
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT,
+ content, loc_content,
+ NOTIFICATION_VARIABLE_TYPE_NONE);
+
+ return noti_err;
+}
+
+EXPORT_API notification_error_e notification_get_content(notification_h noti,
+ char **content,
+ char **loc_content)
+{
+ int noti_err = NOTIFICATION_ERROR_NONE;
+ char *ret_text = NULL;
+
+ noti_err =
+ notification_get_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT,
+ &ret_text);
+
+ if (content != NULL) {
+ *content = ret_text;
+ }
+
+ if (loc_content != NULL) {
+ *loc_content = NULL;
+ }
+
+ return noti_err;
+
+#if 0
+ ret =
+ vconf_get_bool
+ (VCONFKEY_SETAPPL_STATE_TICKER_NOTI_DISPLAY_CONTENT_BOOL, &boolval);
+
+ if (ret == -1 || boolval == 0) {
+ if (content != NULL && noti->default_content != NULL) {
+ *content = noti->default_content;
+ }
+
+ if (loc_content != NULL && noti->loc_default_content != NULL) {
+ *loc_content = noti->loc_default_content;
+ }
+ }
+#endif
+}
+
+EXPORT_API notification_error_e notification_set_args(notification_h noti,
+ bundle * args,
+ bundle * group_args)
+{
+ if (noti == NULL || args == NULL) {
+ return NOTIFICATION_ERROR_INVALID_DATA;
+ }
+
+ if (noti->args) {
+ bundle_free(noti->args);
+ }
+
+ noti->args = bundle_dup(args);
+
+ if (noti->group_args) {
+ bundle_free(noti->group_args);
+ noti->group_args = NULL;
+ }
+
+ if (group_args != NULL) {
+ noti->group_args = bundle_dup(group_args);
+ }
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API notification_error_e notification_get_args(notification_h noti,
+ bundle ** args,
+ bundle ** group_args)
+{
+ if (noti == NULL || args == NULL) {
+ return NOTIFICATION_ERROR_INVALID_DATA;
+ }
+
+ if (noti->args) {
+ *args = noti->args;
+ } else {
+ *args = NULL;
+ }
+
+ if (group_args != NULL && noti->group_args) {
+ *group_args = noti->group_args;
+ }
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API notification_error_e notification_delete_group_by_group_id(const char *pkgname,
+ notification_type_e type,
+ int group_id)
+{
+ int ret = 0;
+ char *caller_pkgname = NULL;
+
+ if (pkgname == NULL) {
+ caller_pkgname = _notification_get_pkgname_by_pid();
+ } else {
+ caller_pkgname = strdup(pkgname);
+ }
+
+ ret = notification_ipc_request_delete_multiple(type, caller_pkgname);
+ if (ret != NOTIFICATION_ERROR_NONE) {
+ if (caller_pkgname) {
+ free(caller_pkgname);
+ }
+ return ret;
+ }
+
+ if (caller_pkgname) {
+ free(caller_pkgname);
+ }
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API notification_error_e notification_delete_group_by_priv_id(const char *pkgname,
+ notification_type_e type,
+ int priv_id)
+{
+ int ret = 0;
+ char *caller_pkgname = NULL;
+
+ if (pkgname == NULL) {
+ caller_pkgname = _notification_get_pkgname_by_pid();
+ } else {
+ caller_pkgname = strdup(pkgname);
+ }
+
+ ret = notification_ipc_request_delete_single(type, caller_pkgname, priv_id);
+ if (ret != NOTIFICATION_ERROR_NONE) {
+ if (caller_pkgname) {
+ free(caller_pkgname);
+ }
+ return ret;
+ }
+
+ if (caller_pkgname) {
+ free(caller_pkgname);
+ }
+ return NOTIFICATION_ERROR_NONE;
+}
diff --git a/src/notification_db.c b/src/notification_db.c
index 0bc01e7..7796fa5 100755
--- a/src/notification_db.c
+++ b/src/notification_db.c
@@ -67,20 +67,37 @@ int notification_db_close(sqlite3 ** db)
int notification_db_exec(sqlite3 * db, const char *query, int *num_changes)
{
int ret = 0;
- char *err_msg = NULL;
+ sqlite3_stmt *stmt = NULL;
if (db == NULL) {
return NOTIFICATION_ERROR_INVALID_DATA;
}
+ if (query == NULL) {
+ return NOTIFICATION_ERROR_INVALID_DATA;
+ }
- ret = sqlite3_exec(db, query, NULL, NULL, &err_msg);
+ ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
if (ret != SQLITE_OK) {
- NOTIFICATION_ERR("SQL error(%d) : %s", ret, err_msg);
- sqlite3_free(err_msg);
+ NOTIFICATION_ERR("DB err(%d) : %s", ret,
+ sqlite3_errmsg(db));
return NOTIFICATION_ERROR_FROM_DB;
}
- if (num_changes != NULL) {
- *num_changes = sqlite3_changes(db);
+
+ if (stmt != NULL) {
+ ret = sqlite3_step(stmt);
+ if (ret == SQLITE_OK || ret == SQLITE_DONE) {
+ if (num_changes != NULL) {
+ *num_changes = sqlite3_changes(db);
+ }
+ sqlite3_finalize(stmt);
+ } else {
+ NOTIFICATION_ERR("DB err(%d) : %s", ret,
+ sqlite3_errmsg(db));
+ sqlite3_finalize(stmt);
+ return NOTIFICATION_ERROR_FROM_DB;
+ }
+ } else {
+ return NOTIFICATION_ERROR_FROM_DB;
}
return NOTIFICATION_ERROR_NONE;
diff --git a/src/notification_ipc.c b/src/notification_ipc.c
index 1ea374a..19af87c 100755
--- a/src/notification_ipc.c
+++ b/src/notification_ipc.c
@@ -3,7 +3,7 @@
*
* 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>
+ * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>, Youngsub Ko <ys4610.ko@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -863,6 +863,7 @@ notification_error_e notification_ipc_request_insert(notification_h noti, int *p
}
packet_unref(result);
} else {
+ NOTIFICATION_ERR("failed to receive answer(insert)");
return NOTIFICATION_ERROR_SERVICE_NOT_READY;
}
@@ -894,6 +895,7 @@ notification_error_e notification_ipc_request_delete_single(notification_type_e
}
packet_unref(result);
} else {
+ NOTIFICATION_ERR("failed to receive answer(delete)");
return NOTIFICATION_ERROR_SERVICE_NOT_READY;
}
@@ -922,6 +924,7 @@ notification_error_e notification_ipc_request_delete_multiple(notification_type_
NOTIFICATION_ERR("num deleted:%d", num_deleted);
packet_unref(result);
} else {
+ NOTIFICATION_ERR("failed to receive answer(delete multiple)");
return NOTIFICATION_ERROR_SERVICE_NOT_READY;
}
@@ -949,6 +952,7 @@ notification_error_e notification_ipc_request_update(notification_h noti)
}
packet_unref(result);
} else {
+ NOTIFICATION_ERR("failed to receive answer(update)");
return NOTIFICATION_ERROR_SERVICE_NOT_READY;
}
@@ -1075,6 +1079,7 @@ notification_error_e notification_ipc_request_refresh(void)
}
packet_unref(result);
} else {
+ NOTIFICATION_ERR("failed to receive answer(refresh)");
return NOTIFICATION_ERROR_SERVICE_NOT_READY;
}
@@ -1102,6 +1107,7 @@ notification_error_e notification_ipc_noti_setting_property_set(const char *pkgn
}
packet_unref(result);
} else {
+ NOTIFICATION_ERR("failed to receive answer(delete)");
return NOTIFICATION_ERROR_SERVICE_NOT_READY;
}
@@ -1132,6 +1138,7 @@ notification_error_e notification_ipc_noti_setting_property_get(const char *pkgn
}
packet_unref(result);
} else {
+ NOTIFICATION_ERR("failed to receive answer(delete)");
return NOTIFICATION_ERROR_SERVICE_NOT_READY;
}
diff --git a/src/notification_setting.c b/src/notification_setting.c
index 246f964..6fac097 100755
--- a/src/notification_setting.c
+++ b/src/notification_setting.c
@@ -3,7 +3,7 @@
*
* 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>
+ * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>, Youngsub Ko <ys4610.ko@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -167,7 +167,6 @@ EXPORT_API notification_error_e notification_setting_db_set(const char *pkgname,
sqlite3 *db = NULL;
char *sqlbuf = NULL;
int sqlret;
- char *err_msg = NULL;
const char *column = NULL;
if (!pkgname)
@@ -204,24 +203,16 @@ EXPORT_API notification_error_e notification_setting_db_set(const char *pkgname,
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;
- }
+ result = notification_db_exec(db, sqlbuf, NULL);
return_close_db:
- if (err_msg)
- sqlite3_free(err_msg);
-
if (sqlbuf)
sqlite3_free(sqlbuf);
sqlret = db_util_close(db);
- if (sqlret != SQLITE_OK)
+ if (sqlret != SQLITE_OK) {
NOTIFICATION_WARN("fail to db_util_close - [%d]", sqlret);
+ }
return result;
}
diff --git a/src/notification_status.c b/src/notification_status.c
index 97fbe41..b0a1d4e 100755
--- a/src/notification_status.c
+++ b/src/notification_status.c
@@ -3,7 +3,7 @@
*
* 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>
+ * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>, Youngsub Ko <ys4610.ko@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -72,7 +72,6 @@ static void __notification_status_message_change_cb(keynode_t *node, void *user_
return;
}
- NOTIFICATION_DBG("message : %s", message);
md.callback(message, md.data);
}