Tue, 05 Aug 2003 11:08:40 +0000
[gaim-migrate @ 6877]
Moved some utility functions out of dialogs.c and into gtkutils.c.
| 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
faa69c8f503d
[gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
63 | void *(*notify_emails)(size_t count, gboolean detailed, |
|
faa69c8f503d
[gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
64 | const char **subjects, const char **froms, |
|
faa69c8f503d
[gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
65 | const char **tos, const char **urls, |
|
faa69c8f503d
[gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
66 | GCallback cb, void *user_data); |
| 5437 | 67 | |
|
5476
6f863ea68018
[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 | ||
|
5944
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5522
diff
changeset
|
72 | |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5522
diff
changeset
|
73 | #ifdef __cplusplus |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5522
diff
changeset
|
74 | extern "C" { |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5522
diff
changeset
|
75 | #endif |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5522
diff
changeset
|
76 | |
| 5437 | 77 | /**************************************************************************/ |
| 78 | /** @name Notification API */ | |
| 79 | /**************************************************************************/ | |
| 80 | /*@{*/ | |
| 81 | ||
| 82 | /** | |
| 83 | * Displays a notification message to the user. | |
| 84 | * | |
| 85 | * @param handle The plugin or connection handle. | |
| 86 | * @param type The notification type. | |
| 87 | * @param title The title of the message. | |
| 88 | * @param primary The main point of the message. | |
| 89 | * @param secondary The secondary information. | |
| 90 | * @param cb The callback to call when the user closes | |
| 91 | * the notification. | |
| 92 | * @param user_data The data to pass to the callback. | |
| 93 | * | |
| 94 | * @return A UI-specific handle. | |
| 95 | */ | |
|
6356
27990c4f9a9f
[gaim-migrate @ 6855]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
96 | void *gaim_notify_message(void *handle, GaimNotifyMsgType type, |
| 5437 | 97 | const char *title, const char *primary, |
| 98 | const char *secondary, GCallback cb, | |
| 99 | void *user_data); | |
| 100 | ||
| 101 | /** | |
| 102 | * Displays a single e-mail notification to the user. | |
| 103 | * | |
| 104 | * @param handle The plugin or connection handle. | |
| 105 | * @param subject The subject of the e-mail. | |
| 106 | * @param from The from address. | |
| 107 | * @param to The destination address. | |
| 108 | * @param url The URL where the message can be read. | |
| 109 | * @param cb The callback to call when the user closes | |
| 110 | * the notification. | |
| 111 | * @param user_data The data to pass to the callback. | |
| 112 | * | |
| 113 | * @return A UI-specific handle. | |
| 114 | */ | |
| 115 | void *gaim_notify_email(void *handle, const char *subject, | |
| 116 | const char *from, const char *to, | |
| 117 | const char *url, GCallback cb, | |
| 118 | void *user_data); | |
| 119 | ||
| 120 | /** | |
| 121 | * Displays a notification for multiple e-mails to the user. | |
| 122 | * | |
| 123 | * @param handle The plugin or connection handle. | |
| 124 | * @param count The number of e-mails. | |
|
5522
faa69c8f503d
[gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
125 | * @param detailed @c TRUE if there is information for each e-mail in the |
|
faa69c8f503d
[gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
126 | * arrays. |
| 5437 | 127 | * @param subjects The array of subjects. |
| 128 | * @param froms The array of from addresses. | |
| 129 | * @param tos The array of destination addresses. | |
| 130 | * @param url The URLs where the messages can be read. | |
| 131 | * @param cb The callback to call when the user closes | |
| 132 | * the notification. | |
| 133 | * @param user_data The data to pass to the callback. | |
| 134 | * | |
| 135 | * @return A UI-specific handle. | |
| 136 | */ | |
|
5522
faa69c8f503d
[gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
137 | void *gaim_notify_emails(void *handle, size_t count, gboolean detailed, |
| 5437 | 138 | const char **subjects, const char **froms, |
| 139 | const char **tos, const char **urls, | |
| 140 | GCallback cb, void *user_data); | |
| 141 | ||
| 142 | /** | |
| 143 | * Closes a notification. | |
| 144 | * | |
| 145 | * This should be used only by the UI operation functions and part of the | |
| 146 | * core. | |
| 147 | * | |
|
5476
6f863ea68018
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
148 | * @param type The notification type. |
|
6f863ea68018
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
149 | * @param ui_handle The notification UI handle. |
| 5437 | 150 | */ |
|
5476
6f863ea68018
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
151 | void gaim_notify_close(GaimNotifyType type, void *ui_handle); |
| 5437 | 152 | |
| 153 | /** | |
| 154 | * Closes all notifications registered with the specified handle. | |
| 155 | * | |
| 156 | * @param handle The handle. | |
| 157 | */ | |
| 158 | void gaim_notify_close_with_handle(void *handle); | |
| 159 | ||
| 160 | /** | |
| 161 | * A wrapper for gaim_notify_message that displays an information message. | |
| 162 | */ | |
| 163 | #define gaim_notify_info(handle, title, primary, secondary) \ | |
| 164 | gaim_notify_message((handle), GAIM_NOTIFY_MSG_INFO, (title), \ | |
| 165 | (primary), (secondary), NULL, NULL) | |
| 166 | ||
| 167 | /** | |
| 168 | * A wrapper for gaim_notify_message that displays a warning message. | |
| 169 | */ | |
| 170 | #define gaim_notify_warning(handle, title, primary, secondary) \ | |
| 171 | gaim_notify_message((handle), GAIM_NOTIFY_MSG_WARNING, (title), \ | |
| 172 | (primary), (secondary), NULL, NULL) | |
| 173 | ||
| 174 | /** | |
| 175 | * A wrapper for gaim_notify_message that displays an error message. | |
| 176 | */ | |
| 177 | #define gaim_notify_error(handle, title, primary, secondary) \ | |
| 178 | gaim_notify_message((handle), GAIM_NOTIFY_MSG_ERROR, (title), \ | |
| 179 | (primary), (secondary), NULL, NULL) | |
| 180 | ||
| 181 | /*@}*/ | |
| 182 | ||
| 183 | /**************************************************************************/ | |
| 184 | /** @name UI Operations API */ | |
| 185 | /**************************************************************************/ | |
| 186 | /*@{*/ | |
| 187 | ||
| 188 | /** | |
| 189 | * Sets the UI operations structure to be used when displaying a | |
| 190 | * notification. | |
| 191 | * | |
| 192 | * @param ops The UI operations structure. | |
| 193 | */ | |
| 194 | void gaim_set_notify_ui_ops(GaimNotifyUiOps *ops); | |
| 195 | ||
| 196 | /** | |
| 197 | * Returns the UI operations structure to be used when displaying a | |
| 198 | * notification. | |
| 199 | * | |
| 200 | * @param ops The UI operations structure. | |
| 201 | */ | |
| 202 | GaimNotifyUiOps *gaim_get_notify_ui_ops(void); | |
|
5944
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5522
diff
changeset
|
203 | |
|
5497
da3c08f3af25
[gaim-migrate @ 5893]
Mark Doliner <markdoliner@pidgin.im>
parents:
5476
diff
changeset
|
204 | /*@}*/ |
| 5437 | 205 | |
|
5944
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5522
diff
changeset
|
206 | #ifdef __cplusplus |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5522
diff
changeset
|
207 | } |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5522
diff
changeset
|
208 | #endif |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5522
diff
changeset
|
209 | |
| 5437 | 210 | #endif /* _GAIM_NOTIFY_H_ */ |