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;
128 (notification_cb_list_s *) malloc(sizeof(notification_cb_list_s));
130 if (noti_cb_list_new == NULL) {
131 NOTIFICATION_ERR("malloc failed");
132 return NOTIFICATION_ERROR_OUT_OF_MEMORY;
135 noti_cb_list_new->next = NULL;
136 noti_cb_list_new->prev = NULL;
138 noti_cb_list_new->cb_type = NOTIFICATION_CB_NORMAL;
139 noti_cb_list_new->changed_cb = changed_cb;
140 noti_cb_list_new->detailed_changed_cb = NULL;
141 noti_cb_list_new->data = user_data;
143 if (g_notification_cb_list == NULL) {
144 g_notification_cb_list = noti_cb_list_new;
146 noti_cb_list = g_notification_cb_list;
148 while (noti_cb_list->next != NULL)
149 noti_cb_list = noti_cb_list->next;
152 noti_cb_list->next = noti_cb_list_new;
153 noti_cb_list_new->prev = noti_cb_list;
156 if (notification_ipc_monitor_init() != NOTIFICATION_ERROR_NONE) {
157 notification_unresister_changed_cb(changed_cb);
158 return NOTIFICATION_ERROR_IO_ERROR;
161 return NOTIFICATION_ERROR_NONE;
164 EXPORT_API int notification_unresister_changed_cb(void (*changed_cb)
165 (void *data, notification_type_e type))
167 notification_cb_list_s *noti_cb_list = NULL;
168 notification_cb_list_s *noti_cb_list_prev = NULL;
169 notification_cb_list_s *noti_cb_list_next = NULL;
171 noti_cb_list = g_notification_cb_list;
173 if (changed_cb == NULL)
174 return NOTIFICATION_ERROR_INVALID_PARAMETER;
176 if (noti_cb_list == NULL)
177 return NOTIFICATION_ERROR_INVALID_PARAMETER;
179 while (noti_cb_list->prev != NULL)
180 noti_cb_list = noti_cb_list->prev;
184 if (noti_cb_list->changed_cb == changed_cb) {
185 noti_cb_list_prev = noti_cb_list->prev;
186 noti_cb_list_next = noti_cb_list->next;
188 if (noti_cb_list_prev == NULL)
189 g_notification_cb_list = noti_cb_list_next;
191 noti_cb_list_prev->next = noti_cb_list_next;
193 if (noti_cb_list_next == NULL) {
194 if (noti_cb_list_prev != NULL)
195 noti_cb_list_prev->next = NULL;
198 noti_cb_list_next->prev = noti_cb_list_prev;
203 if (g_notification_cb_list == NULL)
204 notification_ipc_monitor_fini();
206 return NOTIFICATION_ERROR_NONE;
208 noti_cb_list = noti_cb_list->next;
209 } while (noti_cb_list != NULL);
211 return NOTIFICATION_ERROR_INVALID_PARAMETER;
214 EXPORT_API int notification_update_progress(notification_h noti,
218 char *caller_pkgname = NULL;
219 int input_priv_id = 0;
221 double input_progress = 0.0;
223 if (priv_id <= NOTIFICATION_PRIV_ID_NONE) {
225 return NOTIFICATION_ERROR_INVALID_PARAMETER;
227 input_priv_id = noti->priv_id;
230 input_priv_id = priv_id;
234 caller_pkgname = notification_get_pkgname_by_pid();
236 caller_pkgname = strdup(noti->caller_pkgname);
239 input_progress = 0.0;
240 else if (progress > 1.0)
241 input_progress = 1.0;
243 input_progress = progress;
245 ret = notification_ongoing_update_progress(caller_pkgname, input_priv_id,
249 free(caller_pkgname);
254 EXPORT_API int notification_update_size(notification_h noti,
258 char *caller_pkgname = NULL;
259 int input_priv_id = 0;
261 double input_size = 0.0;
263 if (priv_id <= NOTIFICATION_PRIV_ID_NONE) {
265 return NOTIFICATION_ERROR_INVALID_PARAMETER;
267 input_priv_id = noti->priv_id;
269 input_priv_id = priv_id;
273 caller_pkgname = notification_get_pkgname_by_pid();
275 caller_pkgname = strdup(noti->caller_pkgname);
282 ret = notification_ongoing_update_size(caller_pkgname, input_priv_id,
286 free(caller_pkgname);
291 EXPORT_API int notification_update_content(notification_h noti,
295 char *caller_pkgname = NULL;
296 int input_priv_id = 0;
299 if (priv_id <= NOTIFICATION_PRIV_ID_NONE) {
301 return NOTIFICATION_ERROR_INVALID_PARAMETER;
303 input_priv_id = noti->priv_id;
306 input_priv_id = priv_id;
310 caller_pkgname = notification_get_pkgname_by_pid();
312 caller_pkgname = strdup(noti->caller_pkgname);
314 ret = notification_ongoing_update_content(caller_pkgname, input_priv_id,
318 free(caller_pkgname);
323 /* notification_set_icon will be removed */
324 EXPORT_API int notification_set_icon(notification_h noti,
325 const char *icon_path)
327 int ret_err = NOTIFICATION_ERROR_NONE;
330 notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON,
336 /* notification_get_icon will be removed */
337 EXPORT_API int notification_get_icon(notification_h noti,
340 int ret_err = NOTIFICATION_ERROR_NONE;
341 char *ret_image_path = NULL;
344 notification_get_image(noti, NOTIFICATION_IMAGE_TYPE_ICON,
347 if (ret_err == NOTIFICATION_ERROR_NONE && icon_path != NULL)
348 *icon_path = ret_image_path;
353 EXPORT_API int notification_set_title(notification_h noti,
355 const char *loc_title)
357 int noti_err = NOTIFICATION_ERROR_NONE;
359 noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE,
361 NOTIFICATION_VARIABLE_TYPE_NONE);
366 EXPORT_API int notification_get_title(notification_h noti,
370 int noti_err = NOTIFICATION_ERROR_NONE;
371 char *ret_text = NULL;
374 notification_get_text(noti, NOTIFICATION_TEXT_TYPE_TITLE,
380 if (loc_title != NULL)
386 EXPORT_API int notification_set_content(notification_h noti,
388 const char *loc_content)
390 int noti_err = NOTIFICATION_ERROR_NONE;
392 noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT,
393 content, loc_content,
394 NOTIFICATION_VARIABLE_TYPE_NONE);
399 EXPORT_API int notification_get_content(notification_h noti,
403 int noti_err = NOTIFICATION_ERROR_NONE;
404 char *ret_text = NULL;
407 notification_get_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT,
413 if (loc_content != NULL)
421 (VCONFKEY_SETAPPL_STATE_TICKER_NOTI_DISPLAY_CONTENT_BOOL, &boolval);
423 if (ret == -1 || boolval == 0) {
424 if (content != NULL && noti->default_content != NULL)
425 *content = noti->default_content;
427 if (loc_content != NULL && noti->loc_default_content != NULL)
428 *loc_content = noti->loc_default_content;
433 EXPORT_API int notification_set_application(notification_h noti,
436 if (noti == NULL || pkgname == NULL)
437 return NOTIFICATION_ERROR_INVALID_PARAMETER;
439 if (noti->launch_pkgname)
440 free(noti->launch_pkgname);
442 noti->launch_pkgname = strdup(pkgname);
444 return NOTIFICATION_ERROR_NONE;
447 EXPORT_API int notification_get_application(notification_h noti,
450 if (noti == NULL || pkgname == NULL)
451 return NOTIFICATION_ERROR_INVALID_PARAMETER;
453 if (noti->launch_pkgname)
454 *pkgname = noti->launch_pkgname;
456 *pkgname = noti->caller_pkgname;
458 return NOTIFICATION_ERROR_NONE;
461 EXPORT_API int notification_set_args(notification_h noti, bundle *args,
464 if (noti == NULL || args == NULL)
465 return NOTIFICATION_ERROR_INVALID_PARAMETER;
468 bundle_free(noti->args);
470 noti->args = bundle_dup(args);
472 if (noti->group_args) {
473 bundle_free(noti->group_args);
474 noti->group_args = NULL;
477 if (group_args != NULL)
478 noti->group_args = bundle_dup(group_args);
480 return NOTIFICATION_ERROR_NONE;
483 EXPORT_API int notification_get_args(notification_h noti,
487 if (noti == NULL || args == NULL)
488 return NOTIFICATION_ERROR_INVALID_PARAMETER;
495 if (group_args != NULL && noti->group_args)
496 *group_args = noti->group_args;
498 return NOTIFICATION_ERROR_NONE;
501 EXPORT_API int notification_get_grouping_list(notification_type_e type, int count,
502 notification_list_h *list)
504 notification_list_h get_list = NULL;
508 return NOTIFICATION_ERROR_INVALID_PARAMETER;
510 ret = notification_noti_get_grouping_list(type, count, &get_list);
511 if (ret != NOTIFICATION_ERROR_NONE)
516 return NOTIFICATION_ERROR_NONE;
519 EXPORT_API int notification_delete_group_by_group_id(const char *pkgname,
520 notification_type_e type,
524 char *caller_pkgname = NULL;
527 caller_pkgname = notification_get_pkgname_by_pid();
529 caller_pkgname = strdup(pkgname);
531 ret = notification_ipc_request_delete_multiple(type, caller_pkgname);
534 free(caller_pkgname);
539 EXPORT_API int notification_delete_group_by_priv_id(const char *pkgname,
540 notification_type_e type,
544 char *caller_pkgname = NULL;
547 caller_pkgname = notification_get_pkgname_by_pid();
549 caller_pkgname = strdup(pkgname);
551 ret = notification_ipc_request_delete_single(type, caller_pkgname, priv_id);
554 free(caller_pkgname);
559 EXPORT_API int notification_get_count(notification_type_e type,
562 int priv_id, int *count)
565 char *caller_pkgname = NULL;
568 return NOTIFICATION_ERROR_INVALID_PARAMETER;
571 caller_pkgname = notification_get_pkgname_by_pid();
573 caller_pkgname = strdup(pkgname);
575 ret = notification_ipc_request_get_count(
583 free(caller_pkgname);
588 EXPORT_API int notification_clear(notification_type_e type)
592 if (type <= NOTIFICATION_TYPE_NONE || type >= NOTIFICATION_TYPE_MAX)
593 return NOTIFICATION_ERROR_INVALID_PARAMETER;
595 ret = notification_ipc_request_delete_multiple(type, NULL);
600 EXPORT_API int notification_op_get_data(notification_op *noti_op, notification_op_data_type_e type,
603 if (noti_op == NULL || data == NULL)
604 return NOTIFICATION_ERROR_INVALID_PARAMETER;
607 case NOTIFICATION_OP_DATA_TYPE:
608 *((int *)data) = noti_op->type;
610 case NOTIFICATION_OP_DATA_PRIV_ID:
611 *((int *)data) = noti_op->priv_id;
613 case NOTIFICATION_OP_DATA_NOTI:
614 *((notification_h *)data) = noti_op->noti;
616 case NOTIFICATION_OP_DATA_EXTRA_INFO_1:
617 *((int *)data) = noti_op->extra_info_1;
619 case NOTIFICATION_OP_DATA_EXTRA_INFO_2:
620 *((int *)data) = noti_op->extra_info_2;
623 return NOTIFICATION_ERROR_INVALID_PARAMETER;
627 return NOTIFICATION_ERROR_NONE;
630 EXPORT_API int notification_set_pkgname(notification_h noti,
633 /* check noti and pkgname are valid data */
634 if (noti == NULL || pkgname == NULL)
635 return NOTIFICATION_ERROR_INVALID_PARAMETER;
637 /* Remove previous caller pkgname */
638 if (noti->caller_pkgname) {
639 free(noti->caller_pkgname);
640 noti->caller_pkgname = NULL;
643 noti->caller_pkgname = strdup(pkgname);
645 return NOTIFICATION_ERROR_NONE;
648 EXPORT_API int notification_delete_all_by_type(const char *pkgname,
649 notification_type_e type)
652 char *caller_pkgname = NULL;
654 if (type <= NOTIFICATION_TYPE_NONE || type >= NOTIFICATION_TYPE_MAX)
655 return NOTIFICATION_ERROR_INVALID_PARAMETER;
658 caller_pkgname = notification_get_pkgname_by_pid();
660 caller_pkgname = strdup(pkgname);
662 ret = notification_ipc_request_delete_multiple(type, caller_pkgname);
665 free(caller_pkgname);
670 EXPORT_API int notification_delete_by_priv_id(const char *pkgname,
671 notification_type_e type,
675 char *caller_pkgname = NULL;
677 if (priv_id <= NOTIFICATION_PRIV_ID_NONE)
678 return NOTIFICATION_ERROR_INVALID_PARAMETER;
681 caller_pkgname = notification_get_pkgname_by_pid();
683 caller_pkgname = strdup(pkgname);
685 ret = notification_ipc_request_delete_single(type, caller_pkgname, priv_id);
688 free(caller_pkgname);
693 EXPORT_API int notification_set_execute_option(notification_h noti,
694 notification_execute_type_e type,
697 bundle *service_handle)
699 char buf_key[32] = { 0, };
700 char *ret_val = NULL;
704 return NOTIFICATION_ERROR_INVALID_PARAMETER;
706 if (type <= NOTIFICATION_EXECUTE_TYPE_NONE
707 || type >= NOTIFICATION_EXECUTE_TYPE_MAX)
708 return NOTIFICATION_ERROR_INVALID_PARAMETER;
710 /* Create execute option bundle if does not exist */
711 if (noti->b_execute_option == NULL)
712 noti->b_execute_option = bundle_create();
714 b = noti->b_execute_option;
719 snprintf(buf_key, sizeof(buf_key), "text%d", type);
721 /* Check text key exist */
722 bundle_get_str(b, buf_key, &ret_val);
724 /* Remove previous data */
725 bundle_del(b, buf_key);
728 bundle_add_str(b, buf_key, text);
734 snprintf(buf_key, sizeof(buf_key), "key%d", type);
736 /* Check key key exist */
737 bundle_get_str(b, buf_key, &ret_val);
739 /* Remove previous data */
740 bundle_del(b, buf_key);
743 bundle_add_str(b, buf_key, key);
747 case NOTIFICATION_EXECUTE_TYPE_RESPONDING:
748 /* Remove previous data if exist */
749 if (noti->b_service_responding != NULL) {
750 bundle_free(noti->b_service_responding);
751 noti->b_service_responding = NULL;
754 /* Save service handle */
755 if (service_handle != NULL)
756 noti->b_service_responding = bundle_dup(service_handle);
759 case NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH:
760 /* Remove previous data if exist */
761 if (noti->b_service_single_launch != NULL) {
762 bundle_free(noti->b_service_single_launch);
763 noti->b_service_single_launch = NULL;
766 /* Save service handle */
767 if (service_handle != NULL)
768 noti->b_service_single_launch =
769 bundle_dup(service_handle);
772 case NOTIFICATION_EXECUTE_TYPE_MULTI_LAUNCH:
773 /* Remove previous data if exist */
774 if (noti->b_service_multi_launch != NULL) {
775 bundle_free(noti->b_service_multi_launch);
776 noti->b_service_multi_launch = NULL;
779 /* Save service handle */
780 if (service_handle != NULL)
781 noti->b_service_multi_launch =
782 bundle_dup(service_handle);
787 return NOTIFICATION_ERROR_NONE;
790 EXPORT_API int notification_get_id(notification_h noti,
791 int *group_id, int *priv_id)
793 /* check noti is valid data */
795 return NOTIFICATION_ERROR_INVALID_PARAMETER;
797 /* Check group_id is valid data */
800 if (noti->group_id < NOTIFICATION_GROUP_ID_NONE)
801 *group_id = NOTIFICATION_GROUP_ID_NONE;
803 *group_id = noti->group_id;
806 /* Check priv_id is valid data */
809 *priv_id = noti->priv_id;
811 return NOTIFICATION_ERROR_NONE;
814 EXPORT_API notification_h notification_load(char *pkgname,
818 notification_h noti = NULL;
820 noti = (notification_h)calloc(1, sizeof(struct _notification));
822 NOTIFICATION_ERR("NO MEMORY : noti == NULL");
826 ret = notification_ipc_request_load_noti_by_priv_id(noti, pkgname, priv_id);
827 if (ret != NOTIFICATION_ERROR_NONE) {
828 notification_free(noti);
835 EXPORT_API notification_h notification_new(notification_type_e type,
836 int group_id, int priv_id)
838 return notification_create(type);
841 static void _notification_get_text_domain(notification_h noti)
844 if (noti->domain != NULL) {
848 if (noti->dir != NULL) {
854 EXPORT_API int notification_get_execute_option(notification_h noti,
855 notification_execute_type_e type,
857 bundle **service_handle)
859 char buf_key[32] = { 0, };
860 char *ret_val = NULL;
861 char *get_str = NULL;
865 return NOTIFICATION_ERROR_INVALID_PARAMETER;
867 if (type <= NOTIFICATION_EXECUTE_TYPE_NONE
868 || type >= NOTIFICATION_EXECUTE_TYPE_MAX)
869 return NOTIFICATION_ERROR_INVALID_PARAMETER;
873 case NOTIFICATION_EXECUTE_TYPE_RESPONDING:
874 b = noti->b_service_responding;
876 case NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH:
877 b = noti->b_service_single_launch;
879 case NOTIFICATION_EXECUTE_TYPE_MULTI_LAUNCH:
880 b = noti->b_service_multi_launch;
889 /* Get text domain and dir */
890 if (noti->domain == NULL || noti->dir == NULL)
891 _notification_get_text_domain(noti);
894 snprintf(buf_key, sizeof(buf_key), "key%d", type);
896 /* Check key key exist */
897 bundle_get_str(b, buf_key, &ret_val);
898 if (ret_val != NULL && noti->domain != NULL
899 && noti->dir != NULL) {
900 /* Get application string */
901 bindtextdomain(noti->domain, noti->dir);
903 get_str = dgettext(noti->domain, ret_val);
906 } else if (ret_val != NULL) {
907 /* Get system string */
908 get_str = dgettext("sys_string", ret_val);
913 snprintf(buf_key, sizeof(buf_key), "text%d",
916 bundle_get_str(b, buf_key, &ret_val);
923 if (service_handle != NULL)
926 return NOTIFICATION_ERROR_NONE;
929 EXPORT_API int notification_insert(notification_h noti,
935 /* Check noti is vaild data */
937 return NOTIFICATION_ERROR_INVALID_PARAMETER;
939 /* Check noti type is valid type */
940 if (noti->type <= NOTIFICATION_TYPE_NONE
941 || noti->type >= NOTIFICATION_TYPE_MAX)
942 return NOTIFICATION_ERROR_INVALID_PARAMETER;
944 /* Save insert time */
945 noti->insert_time = time(NULL);
946 ret = notification_ipc_request_insert(noti, &id);
947 if (ret != NOTIFICATION_ERROR_NONE)
951 NOTIFICATION_DBG("from master:%d", id);
953 /* If priv_id is valid data, set priv_id */
955 *priv_id = noti->priv_id;
957 return NOTIFICATION_ERROR_NONE;
960 EXPORT_API int notification_update_async(notification_h noti,
961 void (*result_cb)(int priv_id, int result, void *data), void *user_data)
966 return NOTIFICATION_ERROR_INVALID_PARAMETER;
968 /* Update insert time ? */
969 noti->insert_time = time(NULL);
970 ret = notification_ipc_request_update_async(noti, result_cb, user_data);
975 EXPORT_API int notification_register_detailed_changed_cb(
976 void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op),
979 notification_cb_list_s *noti_cb_list_new = NULL;
980 notification_cb_list_s *noti_cb_list = NULL;
982 if (detailed_changed_cb == NULL)
983 return NOTIFICATION_ERROR_INVALID_PARAMETER;
985 if (notification_ipc_monitor_init() != NOTIFICATION_ERROR_NONE)
986 return NOTIFICATION_ERROR_IO_ERROR;
989 (notification_cb_list_s *) malloc(sizeof(notification_cb_list_s));
991 if (noti_cb_list_new == NULL) {
992 NOTIFICATION_ERR("malloc failed");
993 return NOTIFICATION_ERROR_OUT_OF_MEMORY;
996 noti_cb_list_new->next = NULL;
997 noti_cb_list_new->prev = NULL;
999 noti_cb_list_new->cb_type = NOTIFICATION_CB_DETAILED;
1000 noti_cb_list_new->changed_cb = NULL;
1001 noti_cb_list_new->detailed_changed_cb = detailed_changed_cb;
1002 noti_cb_list_new->data = user_data;
1004 if (g_notification_cb_list == NULL) {
1005 g_notification_cb_list = noti_cb_list_new;
1007 noti_cb_list = g_notification_cb_list;
1009 while (noti_cb_list->next != NULL)
1010 noti_cb_list = noti_cb_list->next;
1013 noti_cb_list->next = noti_cb_list_new;
1014 noti_cb_list_new->prev = noti_cb_list;
1016 return NOTIFICATION_ERROR_NONE;
1019 EXPORT_API int notification_unregister_detailed_changed_cb(
1020 void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op),
1023 notification_cb_list_s *noti_cb_list = NULL;
1024 notification_cb_list_s *noti_cb_list_prev = NULL;
1025 notification_cb_list_s *noti_cb_list_next = NULL;
1027 noti_cb_list = g_notification_cb_list;
1029 if (detailed_changed_cb == NULL)
1030 return NOTIFICATION_ERROR_INVALID_PARAMETER;
1032 if (noti_cb_list == NULL)
1033 return NOTIFICATION_ERROR_INVALID_PARAMETER;
1036 while (noti_cb_list->prev != NULL)
1037 noti_cb_list = noti_cb_list->prev;
1041 if (noti_cb_list->detailed_changed_cb == detailed_changed_cb) {
1042 noti_cb_list_prev = noti_cb_list->prev;
1043 noti_cb_list_next = noti_cb_list->next;
1045 if (noti_cb_list_prev == NULL)
1046 g_notification_cb_list = noti_cb_list_next;
1048 noti_cb_list_prev->next = noti_cb_list_next;
1050 if (noti_cb_list_next == NULL) {
1051 if (noti_cb_list_prev != NULL)
1052 noti_cb_list_prev->next = NULL;
1055 noti_cb_list_next->prev = noti_cb_list_prev;
1060 if (g_notification_cb_list == NULL)
1061 notification_ipc_monitor_fini();
1063 return NOTIFICATION_ERROR_NONE;
1065 noti_cb_list = noti_cb_list->next;
1066 } while (noti_cb_list != NULL);
1068 return NOTIFICATION_ERROR_INVALID_PARAMETER;
1071 EXPORT_API int notification_is_service_ready(void)
1073 return notification_ipc_is_master_ready();