2 * Copyright (c) 2009-2015 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.
21 #include "noti_util.h"
22 #include "smart_alert.h"
24 static inline int __quickpanel_service_update_event_count(const char *pkgname, const char *vconfkey)
26 int ret = 0, count = 0;
27 notification_h noti = NULL;
28 notification_list_h noti_list = NULL;
30 retif(pkgname == NULL, 0, "Invalid parameter!");
31 retif(vconfkey == NULL, 0, "Invalid parameter!");
33 notification_get_detail_list(pkgname, NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE, -1, ¬i_list);
34 if (noti_list != NULL) {
35 noti = notification_list_get_data(noti_list);
37 count = quickpanel_noti_util_get_event_count_from_noti(noti);
38 ret = vconf_set_int(vconfkey, count);
40 ERR("event set:%s, count:%d", pkgname, count);
43 ERR("failed to set vconf key[%s] : %d", vconfkey, ret);
46 ERR("no data found:%s", pkgname);
48 notification_free_list(noti_list);
51 ret = vconf_set_int(vconfkey, 0);
53 ERR("event unset:%s", pkgname);
56 ERR("failed to set vconf key[%s] : %d", vconfkey, ret);
63 HAPI void quickpanel_smart_alert_update_info(notification_h noti)
66 int event_count_call = 0;
67 int event_count_vtcall = 0;
70 event_count_call = quickpanel_noti_util_get_event_count_by_pkgname(SMART_ALARM_CALL_PKGNAME);
71 event_count_vtcall = quickpanel_noti_util_get_event_count_by_pkgname(SMART_ALARM_VTCALL_PKGNAME);
72 ERR("call event set, count:%d", MAX(event_count_call, event_count_vtcall));
74 notification_get_pkgname(noti, &pkgname);
75 retif(pkgname == NULL, , "Invalid parameter!");
77 if (strncmp(pkgname, SMART_ALARM_CALL_PKGNAME, strlen(pkgname)) == 0
78 || strncmp(pkgname, SMART_ALARM_VTCALL_PKGNAME, strlen(pkgname)) == 0) {
79 event_count_call = quickpanel_noti_util_get_event_count_by_pkgname(SMART_ALARM_CALL_PKGNAME);
80 event_count_vtcall = quickpanel_noti_util_get_event_count_by_pkgname(SMART_ALARM_VTCALL_PKGNAME);
82 ERR("call event set, count:%d", MAX(event_count_call, event_count_vtcall));