Mercurial > pidgin.yaz
annotate src/notify.h @ 5555:6503d24fda09
[gaim-migrate @ 5956]
Time to release 0.65cvs!
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Fri, 30 May 2003 00:02:42 +0000 |
parents | a3e6a5ef49b5 |
children | 158196b2db19 |
rev | line source |
---|---|
5437 | 1 /** |
2 * @file notify.h Notification API | |
3 * @ingroup core | |
4 * | |
5 * gaim | |
6 * | |
7 * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org> | |
8 * | |
9 * This program is free software; you can redistribute it and/or modify | |
10 * it under the terms of the GNU General Public License as published by | |
11 * the Free Software Foundation; either version 2 of the License, or | |
12 * (at your option) any later version. | |
13 * | |
14 * This program is distributed in the hope that it will be useful, | |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 * GNU General Public License for more details. | |
18 * | |
19 * You should have received a copy of the GNU General Public License | |
20 * along with this program; if not, write to the Free Software | |
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
22 */ | |
23 #ifndef _GAIM_NOTIFY_H_ | |
24 #define _GAIM_NOTIFY_H_ | |
25 | |
26 #include <stdlib.h> | |
27 #include <glib-object.h> | |
28 #include <glib.h> | |
29 | |
30 /** | |
31 * Notification types. | |
32 */ | |
33 typedef enum | |
34 { | |
35 GAIM_NOTIFY_MESSAGE = 0, /**< Message notification. */ | |
36 GAIM_NOTIFY_EMAIL, /**< Single e-mail notification. */ | |
37 GAIM_NOTIFY_EMAILS /**< Multiple e-mail notification. */ | |
38 | |
39 } GaimNotifyType; | |
40 | |
41 /** | |
42 * Notification message types. | |
43 */ | |
44 typedef enum | |
45 { | |
46 GAIM_NOTIFY_MSG_ERROR = 0, /**< Error notification. */ | |
47 GAIM_NOTIFY_MSG_WARNING, /**< Warning notification. */ | |
48 GAIM_NOTIFY_MSG_INFO /**< Information notification. */ | |
49 | |
50 } GaimNotifyMsgType; | |
51 | |
52 /** | |
53 * Notification UI operations. | |
54 */ | |
55 typedef struct | |
56 { | |
57 void *(*notify_message)(GaimNotifyMsgType type, const char *title, | |
58 const char *primary, const char *secondary, | |
59 GCallback cb, void *user_data); | |
60 void *(*notify_email)(const char *subject, const char *from, | |
61 const char *to, const char *url, | |
62 GCallback cb, void *user_data); | |
5522
a3e6a5ef49b5
[gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
63 void *(*notify_emails)(size_t count, gboolean detailed, |
a3e6a5ef49b5
[gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
64 const char **subjects, const char **froms, |
a3e6a5ef49b5
[gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
65 const char **tos, const char **urls, |
a3e6a5ef49b5
[gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
66 GCallback cb, void *user_data); |
5437 | 67 |
5476
9bcd8cd625ae
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
68 void (*close_notify)(GaimNotifyType type, void *ui_handle); |
5437 | 69 |
70 } GaimNotifyUiOps; | |
71 | |
72 /**************************************************************************/ | |
73 /** @name Notification API */ | |
74 /**************************************************************************/ | |
75 /*@{*/ | |
76 | |
77 /** | |
78 * Displays a notification message to the user. | |
79 * | |
80 * @param handle The plugin or connection handle. | |
81 * @param type The notification type. | |
82 * @param title The title of the message. | |
83 * @param primary The main point of the message. | |
84 * @param secondary The secondary information. | |
85 * @param cb The callback to call when the user closes | |
86 * the notification. | |
87 * @param user_data The data to pass to the callback. | |
88 * | |
89 * @return A UI-specific handle. | |
90 */ | |
91 void *gaim_notify_message(void *handle, GaimNotifyType type, | |
92 const char *title, const char *primary, | |
93 const char *secondary, GCallback cb, | |
94 void *user_data); | |
95 | |
96 /** | |
97 * Displays a single e-mail notification to the user. | |
98 * | |
99 * @param handle The plugin or connection handle. | |
100 * @param subject The subject of the e-mail. | |
101 * @param from The from address. | |
102 * @param to The destination address. | |
103 * @param url The URL where the message can be read. | |
104 * @param cb The callback to call when the user closes | |
105 * the notification. | |
106 * @param user_data The data to pass to the callback. | |
107 * | |
108 * @return A UI-specific handle. | |
109 */ | |
110 void *gaim_notify_email(void *handle, const char *subject, | |
111 const char *from, const char *to, | |
112 const char *url, GCallback cb, | |
113 void *user_data); | |
114 | |
115 /** | |
116 * Displays a notification for multiple e-mails to the user. | |
117 * | |
118 * @param handle The plugin or connection handle. | |
119 * @param count The number of e-mails. | |
5522
a3e6a5ef49b5
[gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
120 * @param detailed @c TRUE if there is information for each e-mail in the |
a3e6a5ef49b5
[gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
121 * arrays. |
5437 | 122 * @param subjects The array of subjects. |
123 * @param froms The array of from addresses. | |
124 * @param tos The array of destination addresses. | |
125 * @param url The URLs where the messages can be read. | |
126 * @param cb The callback to call when the user closes | |
127 * the notification. | |
128 * @param user_data The data to pass to the callback. | |
129 * | |
130 * @return A UI-specific handle. | |
131 */ | |
5522
a3e6a5ef49b5
[gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
132 void *gaim_notify_emails(void *handle, size_t count, gboolean detailed, |
5437 | 133 const char **subjects, const char **froms, |
134 const char **tos, const char **urls, | |
135 GCallback cb, void *user_data); | |
136 | |
137 /** | |
138 * Closes a notification. | |
139 * | |
140 * This should be used only by the UI operation functions and part of the | |
141 * core. | |
142 * | |
5476
9bcd8cd625ae
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
143 * @param type The notification type. |
9bcd8cd625ae
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
144 * @param ui_handle The notification UI handle. |
5437 | 145 */ |
5476
9bcd8cd625ae
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
146 void gaim_notify_close(GaimNotifyType type, void *ui_handle); |
5437 | 147 |
148 /** | |
149 * Closes all notifications registered with the specified handle. | |
150 * | |
151 * @param handle The handle. | |
152 */ | |
153 void gaim_notify_close_with_handle(void *handle); | |
154 | |
155 /** | |
156 * A wrapper for gaim_notify_message that displays an information message. | |
157 */ | |
158 #define gaim_notify_info(handle, title, primary, secondary) \ | |
159 gaim_notify_message((handle), GAIM_NOTIFY_MSG_INFO, (title), \ | |
160 (primary), (secondary), NULL, NULL) | |
161 | |
162 /** | |
163 * A wrapper for gaim_notify_message that displays a warning message. | |
164 */ | |
165 #define gaim_notify_warning(handle, title, primary, secondary) \ | |
166 gaim_notify_message((handle), GAIM_NOTIFY_MSG_WARNING, (title), \ | |
167 (primary), (secondary), NULL, NULL) | |
168 | |
169 /** | |
170 * A wrapper for gaim_notify_message that displays an error message. | |
171 */ | |
172 #define gaim_notify_error(handle, title, primary, secondary) \ | |
173 gaim_notify_message((handle), GAIM_NOTIFY_MSG_ERROR, (title), \ | |
174 (primary), (secondary), NULL, NULL) | |
175 | |
176 /*@}*/ | |
177 | |
178 /**************************************************************************/ | |
179 /** @name UI Operations API */ | |
180 /**************************************************************************/ | |
181 /*@{*/ | |
182 | |
183 /** | |
184 * Sets the UI operations structure to be used when displaying a | |
185 * notification. | |
186 * | |
187 * @param ops The UI operations structure. | |
188 */ | |
189 void gaim_set_notify_ui_ops(GaimNotifyUiOps *ops); | |
190 | |
191 /** | |
192 * Returns the UI operations structure to be used when displaying a | |
193 * notification. | |
194 * | |
195 * @param ops The UI operations structure. | |
196 */ | |
197 GaimNotifyUiOps *gaim_get_notify_ui_ops(void); | |
5497 | 198 /*@}*/ |
5437 | 199 |
200 #endif /* _GAIM_NOTIFY_H_ */ |