4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
28 #include <dbus/dbus.h>
29 #include <dbus/dbus-glib-lowlevel.h>
32 #include <app_control_internal.h>
37 #include <vconf-keys.h>
40 #include <notification.h>
41 #include <notification_list.h>
42 #include <notification_debug.h>
43 #include <notification_private.h>
44 #include <notification_noti.h>
45 #include <notification_ongoing.h>
46 #include <notification_group.h>
47 #include <notification_ipc.h>
48 #include <notification_internal.h>
50 typedef struct _notification_cb_list notification_cb_list_s;
52 typedef enum __notification_cb_type {
53 NOTIFICATION_CB_NORMAL = 1,
54 NOTIFICATION_CB_DETAILED,
55 } _notification_cb_type_e;
57 struct _notification_cb_list {
58 notification_cb_list_s *prev;
59 notification_cb_list_s *next;
61 _notification_cb_type_e cb_type;
62 void (*changed_cb) (void *data, notification_type_e type);
63 void (*detailed_changed_cb) (void *data, notification_type_e type, notification_op *op_list, int num_op);
67 static notification_cb_list_s *g_notification_cb_list = NULL;
69 void notification_call_changed_cb(notification_op *op_list, int op_num)
71 notification_cb_list_s *noti_cb_list = NULL;
72 notification_type_e type = 0;
74 if (g_notification_cb_list == NULL)
77 noti_cb_list = g_notification_cb_list;
79 while (noti_cb_list->prev != NULL)
80 noti_cb_list = noti_cb_list->prev;
83 if (op_list == NULL) {
84 NOTIFICATION_ERR("invalid data");
88 notification_get_type(op_list->noti, &type);
90 while (noti_cb_list != NULL) {
91 if (noti_cb_list->cb_type == NOTIFICATION_CB_NORMAL && noti_cb_list->changed_cb) {
92 noti_cb_list->changed_cb(noti_cb_list->data,
95 if (noti_cb_list->cb_type == NOTIFICATION_CB_DETAILED && noti_cb_list->detailed_changed_cb) {
96 noti_cb_list->detailed_changed_cb(noti_cb_list->data,
97 type, op_list, op_num);
100 noti_cb_list = noti_cb_list->next;
104 EXPORT_API int notification_add_deferred_task(
105 void (*deferred_task_cb)(void *data), void *user_data)
107 if (deferred_task_cb == NULL)
108 return NOTIFICATION_ERROR_INVALID_PARAMETER;
110 return notification_ipc_add_deffered_task(deferred_task_cb, user_data);
113 EXPORT_API int notification_del_deferred_task(
114 void (*deferred_task_cb)(void *data))
116 if (deferred_task_cb == NULL)
117 return NOTIFICATION_ERROR_INVALID_PARAMETER;
119 return notification_ipc_del_deffered_task(deferred_task_cb);
122 EXPORT_API int notification_resister_changed_cb(void (*changed_cb)
123 (void *data, notification_type_e type),
126 notification_cb_list_s *noti_cb_list_new = NULL;
127 notification_cb_list_s *noti_cb_list = NULL;
129 if (changed_cb == NULL)
130 return NOTIFICATION_ERROR_INVALID_PARAMETER;
132 if (notification_ipc_monitor_init() != NOTIFICATION_ERROR_NONE)
133 return NOTIFICATION_ERROR_IO_ERROR;
136 (notification_cb_list_s *) malloc(sizeof(notification_cb_list_s));
138 if (noti_cb_list_new == NULL) {
139 NOTIFICATION_ERR("malloc failed");
140 return NOTIFICATION_ERROR_OUT_OF_MEMORY;
143 noti_cb_list_new->next = NULL;
144 noti_cb_list_new->prev = NULL;
146 noti_cb_list_new->cb_type = NOTIFICATION_CB_NORMAL;
147 noti_cb_list_new->changed_cb = changed_cb;
148 noti_cb_list_new->detailed_changed_cb = NULL;
149 noti_cb_list_new->data = user_data;
151 if (g_notification_cb_list == NULL) {
152 g_notification_cb_list = noti_cb_list_new;
154 noti_cb_list = g_notification_cb_list;
156 while (noti_cb_list->next != NULL)
157 noti_cb_list = noti_cb_list->next;
160 noti_cb_list->next = noti_cb_list_new;
161 noti_cb_list_new->prev = noti_cb_list;
163 return NOTIFICATION_ERROR_NONE;
166 EXPORT_API int notification_unresister_changed_cb(void (*changed_cb)
167 (void *data, notification_type_e type))
169 notification_cb_list_s *noti_cb_list = NULL;
170 notification_cb_list_s *noti_cb_list_prev = NULL;
171 notification_cb_list_s *noti_cb_list_next = NULL;
173 noti_cb_list = g_notification_cb_list;
175 if (changed_cb == NULL)
176 return NOTIFICATION_ERROR_INVALID_PARAMETER;
178 if (noti_cb_list == NULL)
179 return NOTIFICATION_ERROR_INVALID_PARAMETER;
181 while (noti_cb_list->prev != NULL)
182 noti_cb_list = noti_cb_list->prev;
186 if (noti_cb_list->changed_cb == changed_cb) {
187 noti_cb_list_prev = noti_cb_list->prev;
188 noti_cb_list_next = noti_cb_list->next;
190 if (noti_cb_list_prev == NULL)
191 g_notification_cb_list = noti_cb_list_next;
193 noti_cb_list_prev->next = noti_cb_list_next;
195 if (noti_cb_list_next == NULL) {
196 if (noti_cb_list_prev != NULL)
197 noti_cb_list_prev->next = NULL;
200 noti_cb_list_next->prev = noti_cb_list_prev;
205 if (g_notification_cb_list == NULL)
206 notification_ipc_monitor_fini();
208 return NOTIFICATION_ERROR_NONE;
210 noti_cb_list = noti_cb_list->next;
211 } while (noti_cb_list != NULL);
213 return NOTIFICATION_ERROR_INVALID_PARAMETER;
216 EXPORT_API int notification_update_progress(notification_h noti,
220 char *caller_pkgname = NULL;
221 int input_priv_id = 0;
223 double input_progress = 0.0;
225 if (priv_id <= NOTIFICATION_PRIV_ID_NONE) {
227 return NOTIFICATION_ERROR_INVALID_PARAMETER;
229 input_priv_id = noti->priv_id;
232 input_priv_id = priv_id;
236 caller_pkgname = notification_get_pkgname_by_pid();
238 caller_pkgname = strdup(noti->caller_pkgname);
241 input_progress = 0.0;
242 else if (progress > 1.0)
243 input_progress = 1.0;
245 input_progress = progress;
247 ret = notification_ongoing_update_progress(caller_pkgname, input_priv_id,
251 free(caller_pkgname);
256 EXPORT_API int notification_update_size(notification_h noti,
260 char *caller_pkgname = NULL;
261 int input_priv_id = 0;
263 double input_size = 0.0;
265 if (priv_id <= NOTIFICATION_PRIV_ID_NONE) {
267 return NOTIFICATION_ERROR_INVALID_PARAMETER;
269 input_priv_id = noti->priv_id;
271 input_priv_id = priv_id;
275 caller_pkgname = notification_get_pkgname_by_pid();
277 caller_pkgname = strdup(noti->caller_pkgname);
284 ret = notification_ongoing_update_size(caller_pkgname, input_priv_id,
288 free(caller_pkgname);
293 EXPORT_API int notification_update_content(notification_h noti,
297 char *caller_pkgname = NULL;
298 int input_priv_id = 0;
301 if (priv_id <= NOTIFICATION_PRIV_ID_NONE) {
303 return NOTIFICATION_ERROR_INVALID_PARAMETER;
305 input_priv_id = noti->priv_id;
308 input_priv_id = priv_id;
312 caller_pkgname = notification_get_pkgname_by_pid();
314 caller_pkgname = strdup(noti->caller_pkgname);
316 ret = notification_ongoing_update_content(caller_pkgname, input_priv_id,
320 free(caller_pkgname);
325 /* notification_set_icon will be removed */
326 EXPORT_API int notification_set_icon(notification_h noti,
327 const char *icon_path)
329 int ret_err = NOTIFICATION_ERROR_NONE;
332 notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON,
338 /* notification_get_icon will be removed */
339 EXPORT_API int notification_get_icon(notification_h noti,
342 int ret_err = NOTIFICATION_ERROR_NONE;
343 char *ret_image_path = NULL;
346 notification_get_image(noti, NOTIFICATION_IMAGE_TYPE_ICON,
349 if (ret_err == NOTIFICATION_ERROR_NONE && icon_path != NULL)
350 *icon_path = ret_image_path;
355 EXPORT_API int notification_set_title(notification_h noti,
357 const char *loc_title)
359 int noti_err = NOTIFICATION_ERROR_NONE;
361 noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE,
363 NOTIFICATION_VARIABLE_TYPE_NONE);
368 EXPORT_API int notification_get_title(notification_h noti,
372 int noti_err = NOTIFICATION_ERROR_NONE;
373 char *ret_text = NULL;
376 notification_get_text(noti, NOTIFICATION_TEXT_TYPE_TITLE,
382 if (loc_title != NULL)
388 EXPORT_API int notification_set_content(notification_h noti,
390 const char *loc_content)
392 int noti_err = NOTIFICATION_ERROR_NONE;
394 noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT,
395 content, loc_content,
396 NOTIFICATION_VARIABLE_TYPE_NONE);
401 EXPORT_API int notification_get_content(notification_h noti,
405 int noti_err = NOTIFICATION_ERROR_NONE;
406 char *ret_text = NULL;
409 notification_get_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT,
415 if (loc_content != NULL)
423 (VCONFKEY_SETAPPL_STATE_TICKER_NOTI_DISPLAY_CONTENT_BOOL, &boolval);
425 if (ret == -1 || boolval == 0) {
426 if (content != NULL && noti->default_content != NULL)
427 *content = noti->default_content;
429 if (loc_content != NULL && noti->loc_default_content != NULL)
430 *loc_content = noti->loc_default_content;
435 EXPORT_API int notification_set_application(notification_h noti,
438 if (noti == NULL || pkgname == NULL)
439 return NOTIFICATION_ERROR_INVALID_PARAMETER;
441 if (noti->launch_pkgname)
442 free(noti->launch_pkgname);
444 noti->launch_pkgname = strdup(pkgname);
446 return NOTIFICATION_ERROR_NONE;
449 EXPORT_API int notification_get_application(notification_h noti,
452 if (noti == NULL || pkgname == NULL)
453 return NOTIFICATION_ERROR_INVALID_PARAMETER;
455 if (noti->launch_pkgname)
456 *pkgname = noti->launch_pkgname;
458 *pkgname = noti->caller_pkgname;
460 return NOTIFICATION_ERROR_NONE;
463 EXPORT_API int notification_set_args(notification_h noti,
467 if (noti == NULL || args == NULL)
468 return NOTIFICATION_ERROR_INVALID_PARAMETER;
471 bundle_free(noti->args);
473 noti->args = bundle_dup(args);
475 if (noti->group_args) {
476 bundle_free(noti->group_args);
477 noti->group_args = NULL;
480 if (group_args != NULL)
481 noti->group_args = bundle_dup(group_args);
483 return NOTIFICATION_ERROR_NONE;
486 EXPORT_API int notification_get_args(notification_h noti,
488 bundle ** group_args)
490 if (noti == NULL || args == NULL)
491 return NOTIFICATION_ERROR_INVALID_PARAMETER;
498 if (group_args != NULL && noti->group_args)
499 *group_args = noti->group_args;
501 return NOTIFICATION_ERROR_NONE;
504 EXPORT_API int notification_get_grouping_list(notification_type_e type, int count,
505 notification_list_h * list)
507 notification_list_h get_list = NULL;
511 return NOTIFICATION_ERROR_INVALID_PARAMETER;
513 ret = notification_noti_get_grouping_list(type, count, &get_list);
514 if (ret != NOTIFICATION_ERROR_NONE)
519 return NOTIFICATION_ERROR_NONE;
522 EXPORT_API int notification_delete_group_by_group_id(const char *pkgname,
523 notification_type_e type,
527 char *caller_pkgname = NULL;
530 caller_pkgname = notification_get_pkgname_by_pid();
532 caller_pkgname = strdup(pkgname);
534 ret = notification_ipc_request_delete_multiple(type, caller_pkgname);
537 free(caller_pkgname);
542 EXPORT_API int notification_delete_group_by_priv_id(const char *pkgname,
543 notification_type_e type,
547 char *caller_pkgname = NULL;
550 caller_pkgname = notification_get_pkgname_by_pid();
552 caller_pkgname = strdup(pkgname);
554 ret = notification_ipc_request_delete_single(type, caller_pkgname, priv_id);
557 free(caller_pkgname);
562 EXPORT_API int notification_get_count(notification_type_e type,
565 int priv_id, int *count)
568 char *caller_pkgname = NULL;
571 return NOTIFICATION_ERROR_INVALID_PARAMETER;
574 caller_pkgname = notification_get_pkgname_by_pid();
576 caller_pkgname = strdup(pkgname);
578 ret = notification_ipc_request_get_count(
586 free(caller_pkgname);
591 EXPORT_API int notification_clear(notification_type_e type)
595 if (type <= NOTIFICATION_TYPE_NONE || type >= NOTIFICATION_TYPE_MAX)
596 return NOTIFICATION_ERROR_INVALID_PARAMETER;
598 ret = notification_ipc_request_delete_multiple(type, NULL);
603 EXPORT_API int notification_op_get_data(notification_op *noti_op, notification_op_data_type_e type,
606 if (noti_op == NULL || data == NULL)
607 return NOTIFICATION_ERROR_INVALID_PARAMETER;
610 case NOTIFICATION_OP_DATA_TYPE:
611 *((int*)data) = noti_op->type;
613 case NOTIFICATION_OP_DATA_PRIV_ID:
614 *((int*)data) = noti_op->priv_id;
616 case NOTIFICATION_OP_DATA_NOTI:
617 *((notification_h *)data) = noti_op->noti;
619 case NOTIFICATION_OP_DATA_EXTRA_INFO_1:
620 *((int*)data) = noti_op->extra_info_1;
622 case NOTIFICATION_OP_DATA_EXTRA_INFO_2:
623 *((int*)data) = noti_op->extra_info_2;
626 return NOTIFICATION_ERROR_INVALID_PARAMETER;
630 return NOTIFICATION_ERROR_NONE;
633 EXPORT_API int notification_set_pkgname(notification_h noti,
636 /* check noti and pkgname are valid data */
637 if (noti == NULL || pkgname == NULL)
638 return NOTIFICATION_ERROR_INVALID_PARAMETER;
640 /* Remove previous caller pkgname */
641 if (noti->caller_pkgname) {
642 free(noti->caller_pkgname);
643 noti->caller_pkgname = NULL;
646 noti->caller_pkgname = strdup(pkgname);
648 return NOTIFICATION_ERROR_NONE;
651 EXPORT_API int notification_delete_all_by_type(const char *pkgname,
652 notification_type_e type)
655 char *caller_pkgname = NULL;
657 if (type <= NOTIFICATION_TYPE_NONE || type >= NOTIFICATION_TYPE_MAX)
658 return NOTIFICATION_ERROR_INVALID_PARAMETER;
661 caller_pkgname = notification_get_pkgname_by_pid();
663 caller_pkgname = strdup(pkgname);
665 ret = notification_ipc_request_delete_multiple(type, caller_pkgname);
668 free(caller_pkgname);
673 EXPORT_API int notification_delete_by_priv_id(const char *pkgname,
674 notification_type_e type,
678 char *caller_pkgname = NULL;
680 if (priv_id <= NOTIFICATION_PRIV_ID_NONE)
681 return NOTIFICATION_ERROR_INVALID_PARAMETER;
684 caller_pkgname = notification_get_pkgname_by_pid();
686 caller_pkgname = strdup(pkgname);
688 ret = notification_ipc_request_delete_single(type, caller_pkgname, priv_id);
691 free(caller_pkgname);
696 EXPORT_API int notification_set_execute_option(notification_h noti,
697 notification_execute_type_e type,
700 bundle *service_handle)
702 char buf_key[32] = { 0, };
703 char *ret_val = NULL;
707 return NOTIFICATION_ERROR_INVALID_PARAMETER;
709 if (type <= NOTIFICATION_EXECUTE_TYPE_NONE
710 || type >= NOTIFICATION_EXECUTE_TYPE_MAX)
711 return NOTIFICATION_ERROR_INVALID_PARAMETER;
713 /* Create execute option bundle if does not exist */
714 if (noti->b_execute_option == NULL)
715 noti->b_execute_option = bundle_create();
717 b = noti->b_execute_option;
722 snprintf(buf_key, sizeof(buf_key), "text%d", type);
724 /* Check text key exist */
725 bundle_get_str(b, buf_key, &ret_val);
727 /* Remove previous data */
728 bundle_del(b, buf_key);
731 bundle_add_str(b, buf_key, text);
737 snprintf(buf_key, sizeof(buf_key), "key%d", type);
739 /* Check key key exist */
740 bundle_get_str(b, buf_key, &ret_val);
742 /* Remove previous data */
743 bundle_del(b, buf_key);
746 bundle_add_str(b, buf_key, key);
750 case NOTIFICATION_EXECUTE_TYPE_RESPONDING:
751 /* Remove previous data if exist */
752 if (noti->b_service_responding != NULL) {
753 bundle_free(noti->b_service_responding);
754 noti->b_service_responding = NULL;
757 /* Save service handle */
758 if (service_handle != NULL)
759 noti->b_service_responding = bundle_dup(service_handle);
762 case NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH:
763 /* Remove previous data if exist */
764 if (noti->b_service_single_launch != NULL) {
765 bundle_free(noti->b_service_single_launch);
766 noti->b_service_single_launch = NULL;
769 /* Save service handle */
770 if (service_handle != NULL)
771 noti->b_service_single_launch =
772 bundle_dup(service_handle);
775 case NOTIFICATION_EXECUTE_TYPE_MULTI_LAUNCH:
776 /* Remove previous data if exist */
777 if (noti->b_service_multi_launch != NULL) {
778 bundle_free(noti->b_service_multi_launch);
779 noti->b_service_multi_launch = NULL;
782 /* Save service handle */
783 if (service_handle != NULL)
784 noti->b_service_multi_launch =
785 bundle_dup(service_handle);
790 return NOTIFICATION_ERROR_NONE;
793 EXPORT_API int notification_get_id(notification_h noti,
794 int *group_id, int *priv_id)
796 /* check noti is valid data */
798 return NOTIFICATION_ERROR_INVALID_PARAMETER;
800 /* Check group_id is valid data */
803 if (noti->group_id < NOTIFICATION_GROUP_ID_NONE)
804 *group_id = NOTIFICATION_GROUP_ID_NONE;
806 *group_id = noti->group_id;
809 /* Check priv_id is valid data */
812 *priv_id = noti->priv_id;
814 return NOTIFICATION_ERROR_NONE;
817 EXPORT_API notification_h notification_load(char *pkgname,
821 notification_h noti = NULL;
823 noti = (notification_h)calloc(1, sizeof(struct _notification));
825 NOTIFICATION_ERR("NO MEMORY : noti == NULL");
829 ret = notification_ipc_request_load_noti_by_priv_id(noti, pkgname, priv_id);
830 if (ret != NOTIFICATION_ERROR_NONE) {
831 notification_free(noti);
838 EXPORT_API notification_h notification_new(notification_type_e type,
839 int group_id, int priv_id)
841 return notification_create(type);
844 static void _notification_get_text_domain(notification_h noti)
847 if (noti->domain != NULL) {
851 if (noti->dir != NULL) {
857 EXPORT_API int notification_get_execute_option(notification_h noti,
858 notification_execute_type_e type,
860 bundle **service_handle)
862 char buf_key[32] = { 0, };
863 char *ret_val = NULL;
864 char *get_str = NULL;
868 return NOTIFICATION_ERROR_INVALID_PARAMETER;
870 if (type <= NOTIFICATION_EXECUTE_TYPE_NONE
871 || type >= NOTIFICATION_EXECUTE_TYPE_MAX)
872 return NOTIFICATION_ERROR_INVALID_PARAMETER;
876 case NOTIFICATION_EXECUTE_TYPE_RESPONDING:
877 b = noti->b_service_responding;
879 case NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH:
880 b = noti->b_service_single_launch;
882 case NOTIFICATION_EXECUTE_TYPE_MULTI_LAUNCH:
883 b = noti->b_service_multi_launch;
892 /* Get text domain and dir */
893 if (noti->domain == NULL || noti->dir == NULL)
894 _notification_get_text_domain(noti);
897 snprintf(buf_key, sizeof(buf_key), "key%d", type);
899 /* Check key key exist */
900 bundle_get_str(b, buf_key, &ret_val);
901 if (ret_val != NULL && noti->domain != NULL
902 && noti->dir != NULL) {
903 /* Get application string */
904 bindtextdomain(noti->domain, noti->dir);
906 get_str = dgettext(noti->domain, ret_val);
909 } else if (ret_val != NULL) {
910 /* Get system string */
911 get_str = dgettext("sys_string", ret_val);
916 snprintf(buf_key, sizeof(buf_key), "text%d",
919 bundle_get_str(b, buf_key, &ret_val);
926 if (service_handle != NULL)
929 return NOTIFICATION_ERROR_NONE;
932 EXPORT_API int notification_insert(notification_h noti,
938 /* Check noti is vaild data */
940 return NOTIFICATION_ERROR_INVALID_PARAMETER;
942 /* Check noti type is valid type */
943 if (noti->type <= NOTIFICATION_TYPE_NONE
944 || noti->type >= NOTIFICATION_TYPE_MAX)
945 return NOTIFICATION_ERROR_INVALID_PARAMETER;
947 /* Save insert time */
948 noti->insert_time = time(NULL);
949 ret = notification_ipc_request_insert(noti, &id);
950 if (ret != NOTIFICATION_ERROR_NONE)
954 NOTIFICATION_DBG("from master:%d", id);
956 /* If priv_id is valid data, set priv_id */
958 *priv_id = noti->priv_id;
960 return NOTIFICATION_ERROR_NONE;
963 EXPORT_API int notification_update_async(notification_h noti,
964 void (*result_cb)(int priv_id, int result, void *data), void *user_data)
969 return NOTIFICATION_ERROR_INVALID_PARAMETER;
971 /* Update insert time ? */
972 noti->insert_time = time(NULL);
973 ret = notification_ipc_request_update_async(noti, result_cb, user_data);
978 EXPORT_API int notification_register_detailed_changed_cb(
979 void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op),
982 notification_cb_list_s *noti_cb_list_new = NULL;
983 notification_cb_list_s *noti_cb_list = NULL;
985 if (detailed_changed_cb == NULL)
986 return NOTIFICATION_ERROR_INVALID_PARAMETER;
988 if (notification_ipc_monitor_init() != NOTIFICATION_ERROR_NONE)
989 return NOTIFICATION_ERROR_IO_ERROR;
992 (notification_cb_list_s *) malloc(sizeof(notification_cb_list_s));
994 if (noti_cb_list_new == NULL) {
995 NOTIFICATION_ERR("malloc failed");
996 return NOTIFICATION_ERROR_OUT_OF_MEMORY;
999 noti_cb_list_new->next = NULL;
1000 noti_cb_list_new->prev = NULL;
1002 noti_cb_list_new->cb_type = NOTIFICATION_CB_DETAILED;
1003 noti_cb_list_new->changed_cb = NULL;
1004 noti_cb_list_new->detailed_changed_cb = detailed_changed_cb;
1005 noti_cb_list_new->data = user_data;
1007 if (g_notification_cb_list == NULL) {
1008 g_notification_cb_list = noti_cb_list_new;
1010 noti_cb_list = g_notification_cb_list;
1012 while (noti_cb_list->next != NULL)
1013 noti_cb_list = noti_cb_list->next;
1016 noti_cb_list->next = noti_cb_list_new;
1017 noti_cb_list_new->prev = noti_cb_list;
1019 return NOTIFICATION_ERROR_NONE;
1022 EXPORT_API int notification_unregister_detailed_changed_cb(
1023 void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op),
1026 notification_cb_list_s *noti_cb_list = NULL;
1027 notification_cb_list_s *noti_cb_list_prev = NULL;
1028 notification_cb_list_s *noti_cb_list_next = NULL;
1030 noti_cb_list = g_notification_cb_list;
1032 if (detailed_changed_cb == NULL)
1033 return NOTIFICATION_ERROR_INVALID_PARAMETER;
1035 if (noti_cb_list == NULL)
1036 return NOTIFICATION_ERROR_INVALID_PARAMETER;
1039 while (noti_cb_list->prev != NULL)
1040 noti_cb_list = noti_cb_list->prev;
1044 if (noti_cb_list->detailed_changed_cb == detailed_changed_cb) {
1045 noti_cb_list_prev = noti_cb_list->prev;
1046 noti_cb_list_next = noti_cb_list->next;
1048 if (noti_cb_list_prev == NULL)
1049 g_notification_cb_list = noti_cb_list_next;
1051 noti_cb_list_prev->next = noti_cb_list_next;
1053 if (noti_cb_list_next == NULL) {
1054 if (noti_cb_list_prev != NULL)
1055 noti_cb_list_prev->next = NULL;
1058 noti_cb_list_next->prev = noti_cb_list_prev;
1063 if (g_notification_cb_list == NULL)
1064 notification_ipc_monitor_fini();
1066 return NOTIFICATION_ERROR_NONE;
1068 noti_cb_list = noti_cb_list->next;
1069 } while (noti_cb_list != NULL);
1071 return NOTIFICATION_ERROR_INVALID_PARAMETER;
1074 EXPORT_API int notification_is_service_ready(void)
1076 return notification_ipc_is_master_ready();