2 * Copyright (c) 2000 - 2016 Samsung Electronics Co., Ltd. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
23 #include <dbus/dbus.h>
24 #include <dbus/dbus-glib-lowlevel.h>
27 #include <app_control_internal.h>
32 #include <vconf-keys.h>
35 #include <notification.h>
36 #include <notification_list.h>
37 #include <notification_debug.h>
38 #include <notification_private.h>
39 #include <notification_noti.h>
40 #include <notification_ongoing.h>
41 #include <notification_group.h>
42 #include <notification_ipc.h>
43 #include <notification_internal.h>
45 typedef struct _notification_cb_list notification_cb_list_s;
47 typedef enum __notification_cb_type {
48 NOTIFICATION_CB_NORMAL = 1,
49 NOTIFICATION_CB_DETAILED,
50 } _notification_cb_type_e;
52 struct _notification_cb_list {
53 notification_cb_list_s *prev;
54 notification_cb_list_s *next;
56 _notification_cb_type_e cb_type;
57 void (*changed_cb) (void *data, notification_type_e type);
58 void (*detailed_changed_cb) (void *data, notification_type_e type, notification_op *op_list, int num_op);
62 static notification_cb_list_s *g_notification_cb_list = NULL;
64 void notification_call_changed_cb(notification_op *op_list, int op_num)
66 notification_cb_list_s *noti_cb_list = NULL;
67 notification_type_e type = 0;
69 if (g_notification_cb_list == NULL)
72 noti_cb_list = g_notification_cb_list;
74 while (noti_cb_list->prev != NULL)
75 noti_cb_list = noti_cb_list->prev;
78 if (op_list == NULL) {
79 NOTIFICATION_ERR("invalid data");
83 notification_get_type(op_list->noti, &type);
85 while (noti_cb_list != NULL) {
86 if (noti_cb_list->cb_type == NOTIFICATION_CB_NORMAL && noti_cb_list->changed_cb) {
87 noti_cb_list->changed_cb(noti_cb_list->data,
90 if (noti_cb_list->cb_type == NOTIFICATION_CB_DETAILED && noti_cb_list->detailed_changed_cb) {
91 noti_cb_list->detailed_changed_cb(noti_cb_list->data,
92 type, op_list, op_num);
95 noti_cb_list = noti_cb_list->next;
99 EXPORT_API int notification_add_deferred_task(
100 void (*deferred_task_cb)(void *data), void *user_data)
102 if (deferred_task_cb == NULL)
103 return NOTIFICATION_ERROR_INVALID_PARAMETER;
105 return notification_ipc_add_deffered_task(deferred_task_cb, user_data);
108 EXPORT_API int notification_del_deferred_task(
109 void (*deferred_task_cb)(void *data))
111 if (deferred_task_cb == NULL)
112 return NOTIFICATION_ERROR_INVALID_PARAMETER;
114 return notification_ipc_del_deffered_task(deferred_task_cb);
117 EXPORT_API int notification_resister_changed_cb(void (*changed_cb)
118 (void *data, notification_type_e type),
121 notification_cb_list_s *noti_cb_list_new = NULL;
122 notification_cb_list_s *noti_cb_list = NULL;
124 if (changed_cb == NULL)
125 return NOTIFICATION_ERROR_INVALID_PARAMETER;
127 if (notification_ipc_monitor_init() != NOTIFICATION_ERROR_NONE)
128 return NOTIFICATION_ERROR_IO_ERROR;
131 (notification_cb_list_s *) malloc(sizeof(notification_cb_list_s));
133 if (noti_cb_list_new == NULL) {
134 NOTIFICATION_ERR("malloc failed");
135 return NOTIFICATION_ERROR_OUT_OF_MEMORY;
138 noti_cb_list_new->next = NULL;
139 noti_cb_list_new->prev = NULL;
141 noti_cb_list_new->cb_type = NOTIFICATION_CB_NORMAL;
142 noti_cb_list_new->changed_cb = changed_cb;
143 noti_cb_list_new->detailed_changed_cb = NULL;
144 noti_cb_list_new->data = user_data;
146 if (g_notification_cb_list == NULL) {
147 g_notification_cb_list = noti_cb_list_new;
149 noti_cb_list = g_notification_cb_list;
151 while (noti_cb_list->next != NULL)
152 noti_cb_list = noti_cb_list->next;
155 noti_cb_list->next = noti_cb_list_new;
156 noti_cb_list_new->prev = noti_cb_list;
158 return NOTIFICATION_ERROR_NONE;
161 EXPORT_API int notification_unresister_changed_cb(void (*changed_cb)
162 (void *data, notification_type_e type))
164 notification_cb_list_s *noti_cb_list = NULL;
165 notification_cb_list_s *noti_cb_list_prev = NULL;
166 notification_cb_list_s *noti_cb_list_next = NULL;
168 noti_cb_list = g_notification_cb_list;
170 if (changed_cb == NULL)
171 return NOTIFICATION_ERROR_INVALID_PARAMETER;
173 if (noti_cb_list == NULL)
174 return NOTIFICATION_ERROR_INVALID_PARAMETER;
176 while (noti_cb_list->prev != NULL)
177 noti_cb_list = noti_cb_list->prev;
181 if (noti_cb_list->changed_cb == changed_cb) {
182 noti_cb_list_prev = noti_cb_list->prev;
183 noti_cb_list_next = noti_cb_list->next;
185 if (noti_cb_list_prev == NULL)
186 g_notification_cb_list = noti_cb_list_next;
188 noti_cb_list_prev->next = noti_cb_list_next;
190 if (noti_cb_list_next == NULL) {
191 if (noti_cb_list_prev != NULL)
192 noti_cb_list_prev->next = NULL;
195 noti_cb_list_next->prev = noti_cb_list_prev;
200 if (g_notification_cb_list == NULL)
201 notification_ipc_monitor_fini();
203 return NOTIFICATION_ERROR_NONE;
205 noti_cb_list = noti_cb_list->next;
206 } while (noti_cb_list != NULL);
208 return NOTIFICATION_ERROR_INVALID_PARAMETER;
211 EXPORT_API int notification_update_progress(notification_h noti,
215 char *caller_pkgname = NULL;
216 int input_priv_id = 0;
218 double input_progress = 0.0;
220 if (priv_id <= NOTIFICATION_PRIV_ID_NONE) {
222 return NOTIFICATION_ERROR_INVALID_PARAMETER;
224 input_priv_id = noti->priv_id;
227 input_priv_id = priv_id;
231 caller_pkgname = notification_get_pkgname_by_pid();
233 caller_pkgname = strdup(noti->caller_pkgname);
236 input_progress = 0.0;
237 else if (progress > 1.0)
238 input_progress = 1.0;
240 input_progress = progress;
242 ret = notification_ongoing_update_progress(caller_pkgname, input_priv_id,
246 free(caller_pkgname);
251 EXPORT_API int notification_update_size(notification_h noti,
255 char *caller_pkgname = NULL;
256 int input_priv_id = 0;
258 double input_size = 0.0;
260 if (priv_id <= NOTIFICATION_PRIV_ID_NONE) {
262 return NOTIFICATION_ERROR_INVALID_PARAMETER;
264 input_priv_id = noti->priv_id;
266 input_priv_id = priv_id;
270 caller_pkgname = notification_get_pkgname_by_pid();
272 caller_pkgname = strdup(noti->caller_pkgname);
279 ret = notification_ongoing_update_size(caller_pkgname, input_priv_id,
283 free(caller_pkgname);
288 EXPORT_API int notification_update_content(notification_h noti,
292 char *caller_pkgname = NULL;
293 int input_priv_id = 0;
296 if (priv_id <= NOTIFICATION_PRIV_ID_NONE) {
298 return NOTIFICATION_ERROR_INVALID_PARAMETER;
300 input_priv_id = noti->priv_id;
303 input_priv_id = priv_id;
307 caller_pkgname = notification_get_pkgname_by_pid();
309 caller_pkgname = strdup(noti->caller_pkgname);
311 ret = notification_ongoing_update_content(caller_pkgname, input_priv_id,
315 free(caller_pkgname);
320 /* notification_set_icon will be removed */
321 EXPORT_API int notification_set_icon(notification_h noti,
322 const char *icon_path)
324 int ret_err = NOTIFICATION_ERROR_NONE;
327 notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON,
333 /* notification_get_icon will be removed */
334 EXPORT_API int notification_get_icon(notification_h noti,
337 int ret_err = NOTIFICATION_ERROR_NONE;
338 char *ret_image_path = NULL;
341 notification_get_image(noti, NOTIFICATION_IMAGE_TYPE_ICON,
344 if (ret_err == NOTIFICATION_ERROR_NONE && icon_path != NULL)
345 *icon_path = ret_image_path;
350 EXPORT_API int notification_set_title(notification_h noti,
352 const char *loc_title)
354 int noti_err = NOTIFICATION_ERROR_NONE;
356 noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE,
358 NOTIFICATION_VARIABLE_TYPE_NONE);
363 EXPORT_API int notification_get_title(notification_h noti,
367 int noti_err = NOTIFICATION_ERROR_NONE;
368 char *ret_text = NULL;
371 notification_get_text(noti, NOTIFICATION_TEXT_TYPE_TITLE,
377 if (loc_title != NULL)
383 EXPORT_API int notification_set_content(notification_h noti,
385 const char *loc_content)
387 int noti_err = NOTIFICATION_ERROR_NONE;
389 noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT,
390 content, loc_content,
391 NOTIFICATION_VARIABLE_TYPE_NONE);
396 EXPORT_API int notification_get_content(notification_h noti,
400 int noti_err = NOTIFICATION_ERROR_NONE;
401 char *ret_text = NULL;
404 notification_get_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT,
410 if (loc_content != NULL)
418 (VCONFKEY_SETAPPL_STATE_TICKER_NOTI_DISPLAY_CONTENT_BOOL, &boolval);
420 if (ret == -1 || boolval == 0) {
421 if (content != NULL && noti->default_content != NULL)
422 *content = noti->default_content;
424 if (loc_content != NULL && noti->loc_default_content != NULL)
425 *loc_content = noti->loc_default_content;
430 EXPORT_API int notification_set_application(notification_h noti,
433 if (noti == NULL || pkgname == NULL)
434 return NOTIFICATION_ERROR_INVALID_PARAMETER;
436 if (noti->launch_pkgname)
437 free(noti->launch_pkgname);
439 noti->launch_pkgname = strdup(pkgname);
441 return NOTIFICATION_ERROR_NONE;
444 EXPORT_API int notification_get_application(notification_h noti,
447 if (noti == NULL || pkgname == NULL)
448 return NOTIFICATION_ERROR_INVALID_PARAMETER;
450 if (noti->launch_pkgname)
451 *pkgname = noti->launch_pkgname;
453 *pkgname = noti->caller_pkgname;
455 return NOTIFICATION_ERROR_NONE;
458 EXPORT_API int notification_set_args(notification_h noti, bundle *args,
461 if (noti == NULL || args == NULL)
462 return NOTIFICATION_ERROR_INVALID_PARAMETER;
465 bundle_free(noti->args);
467 noti->args = bundle_dup(args);
469 if (noti->group_args) {
470 bundle_free(noti->group_args);
471 noti->group_args = NULL;
474 if (group_args != NULL)
475 noti->group_args = bundle_dup(group_args);
477 return NOTIFICATION_ERROR_NONE;
480 EXPORT_API int notification_get_args(notification_h noti,
484 if (noti == NULL || args == NULL)
485 return NOTIFICATION_ERROR_INVALID_PARAMETER;
492 if (group_args != NULL && noti->group_args)
493 *group_args = noti->group_args;
495 return NOTIFICATION_ERROR_NONE;
498 EXPORT_API int notification_get_grouping_list(notification_type_e type, int count,
499 notification_list_h *list)
501 notification_list_h get_list = NULL;
505 return NOTIFICATION_ERROR_INVALID_PARAMETER;
507 ret = notification_noti_get_grouping_list(type, count, &get_list);
508 if (ret != NOTIFICATION_ERROR_NONE)
513 return NOTIFICATION_ERROR_NONE;
516 EXPORT_API int notification_delete_group_by_group_id(const char *pkgname,
517 notification_type_e type,
521 char *caller_pkgname = NULL;
524 caller_pkgname = notification_get_pkgname_by_pid();
526 caller_pkgname = strdup(pkgname);
528 ret = notification_ipc_request_delete_multiple(type, caller_pkgname);
531 free(caller_pkgname);
536 EXPORT_API int notification_delete_group_by_priv_id(const char *pkgname,
537 notification_type_e type,
541 char *caller_pkgname = NULL;
544 caller_pkgname = notification_get_pkgname_by_pid();
546 caller_pkgname = strdup(pkgname);
548 ret = notification_ipc_request_delete_single(type, caller_pkgname, priv_id);
551 free(caller_pkgname);
556 EXPORT_API int notification_get_count(notification_type_e type,
559 int priv_id, int *count)
562 char *caller_pkgname = NULL;
565 return NOTIFICATION_ERROR_INVALID_PARAMETER;
568 caller_pkgname = notification_get_pkgname_by_pid();
570 caller_pkgname = strdup(pkgname);
572 ret = notification_ipc_request_get_count(
580 free(caller_pkgname);
585 EXPORT_API int notification_clear(notification_type_e type)
589 if (type <= NOTIFICATION_TYPE_NONE || type >= NOTIFICATION_TYPE_MAX)
590 return NOTIFICATION_ERROR_INVALID_PARAMETER;
592 ret = notification_ipc_request_delete_multiple(type, NULL);
597 EXPORT_API int notification_op_get_data(notification_op *noti_op, notification_op_data_type_e type,
600 if (noti_op == NULL || data == NULL)
601 return NOTIFICATION_ERROR_INVALID_PARAMETER;
604 case NOTIFICATION_OP_DATA_TYPE:
605 *((int *)data) = noti_op->type;
607 case NOTIFICATION_OP_DATA_PRIV_ID:
608 *((int *)data) = noti_op->priv_id;
610 case NOTIFICATION_OP_DATA_NOTI:
611 *((notification_h *)data) = noti_op->noti;
613 case NOTIFICATION_OP_DATA_EXTRA_INFO_1:
614 *((int *)data) = noti_op->extra_info_1;
616 case NOTIFICATION_OP_DATA_EXTRA_INFO_2:
617 *((int *)data) = noti_op->extra_info_2;
620 return NOTIFICATION_ERROR_INVALID_PARAMETER;
624 return NOTIFICATION_ERROR_NONE;
627 EXPORT_API int notification_set_pkgname(notification_h noti,
630 /* check noti and pkgname are valid data */
631 if (noti == NULL || pkgname == NULL)
632 return NOTIFICATION_ERROR_INVALID_PARAMETER;
634 /* Remove previous caller pkgname */
635 if (noti->caller_pkgname) {
636 free(noti->caller_pkgname);
637 noti->caller_pkgname = NULL;
640 noti->caller_pkgname = strdup(pkgname);
642 return NOTIFICATION_ERROR_NONE;
645 EXPORT_API int notification_delete_all_by_type(const char *pkgname,
646 notification_type_e type)
649 char *caller_pkgname = NULL;
651 if (type <= NOTIFICATION_TYPE_NONE || type >= NOTIFICATION_TYPE_MAX)
652 return NOTIFICATION_ERROR_INVALID_PARAMETER;
655 caller_pkgname = notification_get_pkgname_by_pid();
657 caller_pkgname = strdup(pkgname);
659 ret = notification_ipc_request_delete_multiple(type, caller_pkgname);
662 free(caller_pkgname);
667 EXPORT_API int notification_delete_by_priv_id(const char *pkgname,
668 notification_type_e type,
672 char *caller_pkgname = NULL;
674 if (priv_id <= NOTIFICATION_PRIV_ID_NONE)
675 return NOTIFICATION_ERROR_INVALID_PARAMETER;
678 caller_pkgname = notification_get_pkgname_by_pid();
680 caller_pkgname = strdup(pkgname);
682 ret = notification_ipc_request_delete_single(type, caller_pkgname, priv_id);
685 free(caller_pkgname);
690 EXPORT_API int notification_set_execute_option(notification_h noti,
691 notification_execute_type_e type,
694 bundle *service_handle)
696 char buf_key[32] = { 0, };
697 char *ret_val = NULL;
701 return NOTIFICATION_ERROR_INVALID_PARAMETER;
703 if (type <= NOTIFICATION_EXECUTE_TYPE_NONE
704 || type >= NOTIFICATION_EXECUTE_TYPE_MAX)
705 return NOTIFICATION_ERROR_INVALID_PARAMETER;
707 /* Create execute option bundle if does not exist */
708 if (noti->b_execute_option == NULL)
709 noti->b_execute_option = bundle_create();
711 b = noti->b_execute_option;
716 snprintf(buf_key, sizeof(buf_key), "text%d", type);
718 /* Check text key exist */
719 bundle_get_str(b, buf_key, &ret_val);
721 /* Remove previous data */
722 bundle_del(b, buf_key);
725 bundle_add_str(b, buf_key, text);
731 snprintf(buf_key, sizeof(buf_key), "key%d", type);
733 /* Check key key exist */
734 bundle_get_str(b, buf_key, &ret_val);
736 /* Remove previous data */
737 bundle_del(b, buf_key);
740 bundle_add_str(b, buf_key, key);
744 case NOTIFICATION_EXECUTE_TYPE_RESPONDING:
745 /* Remove previous data if exist */
746 if (noti->b_service_responding != NULL) {
747 bundle_free(noti->b_service_responding);
748 noti->b_service_responding = NULL;
751 /* Save service handle */
752 if (service_handle != NULL)
753 noti->b_service_responding = bundle_dup(service_handle);
756 case NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH:
757 /* Remove previous data if exist */
758 if (noti->b_service_single_launch != NULL) {
759 bundle_free(noti->b_service_single_launch);
760 noti->b_service_single_launch = NULL;
763 /* Save service handle */
764 if (service_handle != NULL)
765 noti->b_service_single_launch =
766 bundle_dup(service_handle);
769 case NOTIFICATION_EXECUTE_TYPE_MULTI_LAUNCH:
770 /* Remove previous data if exist */
771 if (noti->b_service_multi_launch != NULL) {
772 bundle_free(noti->b_service_multi_launch);
773 noti->b_service_multi_launch = NULL;
776 /* Save service handle */
777 if (service_handle != NULL)
778 noti->b_service_multi_launch =
779 bundle_dup(service_handle);
784 return NOTIFICATION_ERROR_NONE;
787 EXPORT_API int notification_get_id(notification_h noti,
788 int *group_id, int *priv_id)
790 /* check noti is valid data */
792 return NOTIFICATION_ERROR_INVALID_PARAMETER;
794 /* Check group_id is valid data */
797 if (noti->group_id < NOTIFICATION_GROUP_ID_NONE)
798 *group_id = NOTIFICATION_GROUP_ID_NONE;
800 *group_id = noti->group_id;
803 /* Check priv_id is valid data */
806 *priv_id = noti->priv_id;
808 return NOTIFICATION_ERROR_NONE;
811 EXPORT_API notification_h notification_load(char *pkgname,
815 notification_h noti = NULL;
817 noti = (notification_h)calloc(1, sizeof(struct _notification));
819 NOTIFICATION_ERR("NO MEMORY : noti == NULL");
823 ret = notification_ipc_request_load_noti_by_priv_id(noti, pkgname, priv_id);
824 if (ret != NOTIFICATION_ERROR_NONE) {
825 notification_free(noti);
832 EXPORT_API notification_h notification_new(notification_type_e type,
833 int group_id, int priv_id)
835 return notification_create(type);
838 static void _notification_get_text_domain(notification_h noti)
841 if (noti->domain != NULL) {
845 if (noti->dir != NULL) {
851 EXPORT_API int notification_get_execute_option(notification_h noti,
852 notification_execute_type_e type,
854 bundle **service_handle)
856 char buf_key[32] = { 0, };
857 char *ret_val = NULL;
858 char *get_str = NULL;
862 return NOTIFICATION_ERROR_INVALID_PARAMETER;
864 if (type <= NOTIFICATION_EXECUTE_TYPE_NONE
865 || type >= NOTIFICATION_EXECUTE_TYPE_MAX)
866 return NOTIFICATION_ERROR_INVALID_PARAMETER;
870 case NOTIFICATION_EXECUTE_TYPE_RESPONDING:
871 b = noti->b_service_responding;
873 case NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH:
874 b = noti->b_service_single_launch;
876 case NOTIFICATION_EXECUTE_TYPE_MULTI_LAUNCH:
877 b = noti->b_service_multi_launch;
886 /* Get text domain and dir */
887 if (noti->domain == NULL || noti->dir == NULL)
888 _notification_get_text_domain(noti);
891 snprintf(buf_key, sizeof(buf_key), "key%d", type);
893 /* Check key key exist */
894 bundle_get_str(b, buf_key, &ret_val);
895 if (ret_val != NULL && noti->domain != NULL
896 && noti->dir != NULL) {
897 /* Get application string */
898 bindtextdomain(noti->domain, noti->dir);
900 get_str = dgettext(noti->domain, ret_val);
903 } else if (ret_val != NULL) {
904 /* Get system string */
905 get_str = dgettext("sys_string", ret_val);
910 snprintf(buf_key, sizeof(buf_key), "text%d",
913 bundle_get_str(b, buf_key, &ret_val);
920 if (service_handle != NULL)
923 return NOTIFICATION_ERROR_NONE;
926 EXPORT_API int notification_insert(notification_h noti,
932 /* Check noti is vaild data */
934 return NOTIFICATION_ERROR_INVALID_PARAMETER;
936 /* Check noti type is valid type */
937 if (noti->type <= NOTIFICATION_TYPE_NONE
938 || noti->type >= NOTIFICATION_TYPE_MAX)
939 return NOTIFICATION_ERROR_INVALID_PARAMETER;
941 /* Save insert time */
942 noti->insert_time = time(NULL);
943 ret = notification_ipc_request_insert(noti, &id);
944 if (ret != NOTIFICATION_ERROR_NONE)
948 NOTIFICATION_DBG("from master:%d", id);
950 /* If priv_id is valid data, set priv_id */
952 *priv_id = noti->priv_id;
954 return NOTIFICATION_ERROR_NONE;
957 EXPORT_API int notification_update_async(notification_h noti,
958 void (*result_cb)(int priv_id, int result, void *data), void *user_data)
963 return NOTIFICATION_ERROR_INVALID_PARAMETER;
965 /* Update insert time ? */
966 noti->insert_time = time(NULL);
967 ret = notification_ipc_request_update_async(noti, result_cb, user_data);
972 EXPORT_API int notification_register_detailed_changed_cb(
973 void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op),
976 notification_cb_list_s *noti_cb_list_new = NULL;
977 notification_cb_list_s *noti_cb_list = NULL;
979 if (detailed_changed_cb == NULL)
980 return NOTIFICATION_ERROR_INVALID_PARAMETER;
982 if (notification_ipc_monitor_init() != NOTIFICATION_ERROR_NONE)
983 return NOTIFICATION_ERROR_IO_ERROR;
986 (notification_cb_list_s *) malloc(sizeof(notification_cb_list_s));
988 if (noti_cb_list_new == NULL) {
989 NOTIFICATION_ERR("malloc failed");
990 return NOTIFICATION_ERROR_OUT_OF_MEMORY;
993 noti_cb_list_new->next = NULL;
994 noti_cb_list_new->prev = NULL;
996 noti_cb_list_new->cb_type = NOTIFICATION_CB_DETAILED;
997 noti_cb_list_new->changed_cb = NULL;
998 noti_cb_list_new->detailed_changed_cb = detailed_changed_cb;
999 noti_cb_list_new->data = user_data;
1001 if (g_notification_cb_list == NULL) {
1002 g_notification_cb_list = noti_cb_list_new;
1004 noti_cb_list = g_notification_cb_list;
1006 while (noti_cb_list->next != NULL)
1007 noti_cb_list = noti_cb_list->next;
1010 noti_cb_list->next = noti_cb_list_new;
1011 noti_cb_list_new->prev = noti_cb_list;
1013 return NOTIFICATION_ERROR_NONE;
1016 EXPORT_API int notification_unregister_detailed_changed_cb(
1017 void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op),
1020 notification_cb_list_s *noti_cb_list = NULL;
1021 notification_cb_list_s *noti_cb_list_prev = NULL;
1022 notification_cb_list_s *noti_cb_list_next = NULL;
1024 noti_cb_list = g_notification_cb_list;
1026 if (detailed_changed_cb == NULL)
1027 return NOTIFICATION_ERROR_INVALID_PARAMETER;
1029 if (noti_cb_list == NULL)
1030 return NOTIFICATION_ERROR_INVALID_PARAMETER;
1033 while (noti_cb_list->prev != NULL)
1034 noti_cb_list = noti_cb_list->prev;
1038 if (noti_cb_list->detailed_changed_cb == detailed_changed_cb) {
1039 noti_cb_list_prev = noti_cb_list->prev;
1040 noti_cb_list_next = noti_cb_list->next;
1042 if (noti_cb_list_prev == NULL)
1043 g_notification_cb_list = noti_cb_list_next;
1045 noti_cb_list_prev->next = noti_cb_list_next;
1047 if (noti_cb_list_next == NULL) {
1048 if (noti_cb_list_prev != NULL)
1049 noti_cb_list_prev->next = NULL;
1052 noti_cb_list_next->prev = noti_cb_list_prev;
1057 if (g_notification_cb_list == NULL)
1058 notification_ipc_monitor_fini();
1060 return NOTIFICATION_ERROR_NONE;
1062 noti_cb_list = noti_cb_list->next;
1063 } while (noti_cb_list != NULL);
1065 return NOTIFICATION_ERROR_INVALID_PARAMETER;
1068 EXPORT_API int notification_is_service_ready(void)
1070 return notification_ipc_is_master_ready();