Mercurial > pidgin.yaz
annotate src/notify.h @ 5476:9bcd8cd625ae
[gaim-migrate @ 5872]
Some little tidy-ups.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Thu, 22 May 2003 05:23:14 +0000 |
parents | 0031a613a87d |
children | 3c7748b24410 |
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); | |
63 void *(*notify_emails)(size_t count, const char **subjects, | |
64 const char **froms, const char **tos, | |
65 const char **urls, GCallback cb, | |
66 void *user_data); | |
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. | |
120 * @param subjects The array of subjects. | |
121 * @param froms The array of from addresses. | |
122 * @param tos The array of destination addresses. | |
123 * @param url The URLs where the messages can be read. | |
124 * @param cb The callback to call when the user closes | |
125 * the notification. | |
126 * @param user_data The data to pass to the callback. | |
127 * | |
128 * @return A UI-specific handle. | |
129 */ | |
130 void *gaim_notify_emails(void *handle, size_t count, | |
131 const char **subjects, const char **froms, | |
132 const char **tos, const char **urls, | |
133 GCallback cb, void *user_data); | |
134 | |
135 /** | |
136 * Closes a notification. | |
137 * | |
138 * This should be used only by the UI operation functions and part of the | |
139 * core. | |
140 * | |
5476
9bcd8cd625ae
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
141 * @param type The notification type. |
9bcd8cd625ae
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
142 * @param ui_handle The notification UI handle. |
5437 | 143 */ |
5476
9bcd8cd625ae
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
144 void gaim_notify_close(GaimNotifyType type, void *ui_handle); |
5437 | 145 |
146 /** | |
147 * Closes all notifications registered with the specified handle. | |
148 * | |
149 * @param handle The handle. | |
150 */ | |
151 void gaim_notify_close_with_handle(void *handle); | |
152 | |
153 /** | |
154 * A wrapper for gaim_notify_message that displays an information message. | |
155 */ | |
156 #define gaim_notify_info(handle, title, primary, secondary) \ | |
157 gaim_notify_message((handle), GAIM_NOTIFY_MSG_INFO, (title), \ | |
158 (primary), (secondary), NULL, NULL) | |
159 | |
160 /** | |
161 * A wrapper for gaim_notify_message that displays a warning message. | |
162 */ | |
163 #define gaim_notify_warning(handle, title, primary, secondary) \ | |
164 gaim_notify_message((handle), GAIM_NOTIFY_MSG_WARNING, (title), \ | |
165 (primary), (secondary), NULL, NULL) | |
166 | |
167 /** | |
168 * A wrapper for gaim_notify_message that displays an error message. | |
169 */ | |
170 #define gaim_notify_error(handle, title, primary, secondary) \ | |
171 gaim_notify_message((handle), GAIM_NOTIFY_MSG_ERROR, (title), \ | |
172 (primary), (secondary), NULL, NULL) | |
173 | |
174 /*@}*/ | |
175 | |
176 /**************************************************************************/ | |
177 /** @name UI Operations API */ | |
178 /**************************************************************************/ | |
179 /*@{*/ | |
180 | |
181 /** | |
182 * Sets the UI operations structure to be used when displaying a | |
183 * notification. | |
184 * | |
185 * @param ops The UI operations structure. | |
186 */ | |
187 void gaim_set_notify_ui_ops(GaimNotifyUiOps *ops); | |
188 | |
189 /** | |
190 * Returns the UI operations structure to be used when displaying a | |
191 * notification. | |
192 * | |
193 * @param ops The UI operations structure. | |
194 */ | |
195 GaimNotifyUiOps *gaim_get_notify_ui_ops(void); | |
196 | |
197 #endif /* _GAIM_NOTIFY_H_ */ |