62463d8cac7f3b82f820048db8ca2c4244d10785
[platform/core/appfw/badge.git] / include / badge_internal.h
1 /*
2  *  libbadge
3  *
4  * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Youngjoo Park <yjoo93.park@samsung.com>,
7  *      Seungtaek Chung <seungtaek.chung@samsung.com>, Youngsub Ko <ys4610.ko@samsung.com>
8  *
9  * Licensed under the Apache License, Version 2.0 (the License);
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an AS IS BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  */
22
23 #ifndef __BADGE_INTERNAL_DEF_H__
24 #define __BADGE_INTERNAL_DEF_H__
25
26 #include <stdbool.h>
27 #include <stdarg.h>
28
29 #include "badge_error.h"
30 #include "badge.h"
31
32 #ifndef EXPORT_API
33 #define EXPORT_API __attribute__ ((visibility("default")))
34 #endif
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif /* __cplusplus */
39
40 typedef struct _badge_h badge_h;
41
42 char *_badge_get_pkgname_by_pid(void);
43
44 int _badge_is_existing(const char *pkgname, bool *existing);
45
46 int _badge_foreach_existed(badge_cb callback, void *data);
47
48 int _badge_insert(badge_h *badge);
49
50 int _badge_remove(const char *caller, const char *pkgname);
51
52 int _badget_set_count(const char *caller, const char *pkgname,
53                         unsigned int count);
54
55 int _badget_get_count(const char *pkgname, unsigned int *count);
56
57 int _badget_set_display(const char *pkgname,
58                         unsigned int is_display);
59
60 int _badget_get_display(const char *pkgname, unsigned int *is_display);
61
62 int _badge_register_changed_cb(badge_change_cb callback, void *data);
63
64 int _badge_unregister_changed_cb(badge_change_cb callback);
65
66 int _badge_free(badge_h *badge);
67
68 badge_h *_badge_new(const char *pkgname, const char *writable_pkgs,
69                 int *err);
70
71 char *_badge_pkgs_new(int *err, const char *pkg1, ...);
72
73 char *_badge_pkgs_new_valist(int *err,
74                         const char *pkg1, va_list args);
75
76 void badge_changed_cb_call(unsigned int action, const char *pkgname,
77                         unsigned int count);
78
79 /**
80  * @internal
81  * @brief Creates a badge for the designated package.
82  * @since_tizen 2.3
83  * @privlevel public
84  * @privilege %http://tizen.org/privilege/notification
85  * @details Creates new badge to display.
86  * @param[in] pkgname The name of the designated package
87  * @param[in] writable_pkg The name of package which is authorized to change the badge
88  * @return #BADGE_ERROR_NONE if success, other value if failure
89  * @see #badge_error_e
90  * @par Sample code:
91  * @code
92 #include <badge.h>
93 ...
94 {
95         int err = BADGE_ERROR_NONE;
96
97         err = badge_create("org.tizen.sms", "org.tizen.sms2");
98         if(err != BADGE_ERROR_NONE) {
99                 return;
100         }
101
102 }
103  * @endcode
104  */
105 int badge_create(const char *pkgname, const char *writable_pkg);
106
107 /**
108  * @brief This function sets badge property for designated package.
109  * @param[in] pkgname The name of designated package
110  * @param[in] property name
111  * @param[in] property value
112  * @return #BADGE_ERROR_NONE if success, other value if failure
113  * @see #badge_error_e
114  */
115 int badge_setting_property_set(const char *pkgname, const char *property, const char *value);
116
117 /**
118  * @brief This function gets badge property for designated package.
119  * @param[in] pkgname The name of designated package
120  * @param[in] property name
121  * @param[in] pointer which can save the getting value
122  * @return #BADGE_ERROR_NONE if success, other value if failure
123  * @see #badge_error_e
124  */
125 int badge_setting_property_get(const char *pkgname, const char *property, char **value);
126
127 #ifdef __cplusplus
128 }
129 #endif /* __cplusplus */
130
131 #endif /* __BADGE_INTERNAL_DEF_H__ */
132