comparison src/notify.h @ 12242:976677e67239

[gaim-migrate @ 14544] Rework the notify API close callbacks. They are now called by the core, instead of the UI. Prior to a couple days ago, they weren't actually implemented in the UI at all. As a side note, if anyone knows why gpointer is declared as a T_GaimObj instead of a T_PTR, please let me know. That seems wrong, especially since void * is a T_PTR and gconstpointer is a T_PTR. This may or may not cause problems for the notify change (void * -> gpointer) to user_data. NOTE: I did not change this, even though I think it's wrong. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Mon, 28 Nov 2005 01:50:56 +0000
parents 64254fbabc7b
children ca27de274225
comparison
equal deleted inserted replaced
12241:4777c5912068 12242:976677e67239
28 #include <stdlib.h> 28 #include <stdlib.h>
29 #include <glib-object.h> 29 #include <glib-object.h>
30 #include <glib.h> 30 #include <glib.h>
31 31
32 #include "connection.h" 32 #include "connection.h"
33
34 /**
35 * Notification close callbacks.
36 */
37 typedef void (*GaimNotifyCloseCallback) (gpointer user_data);
33 38
34 /** 39 /**
35 * Notification types. 40 * Notification types.
36 */ 41 */
37 typedef enum 42 typedef enum
104 * Notification UI operations. 109 * Notification UI operations.
105 */ 110 */
106 typedef struct 111 typedef struct
107 { 112 {
108 void *(*notify_message)(GaimNotifyMsgType type, const char *title, 113 void *(*notify_message)(GaimNotifyMsgType type, const char *title,
109 const char *primary, const char *secondary, 114 const char *primary, const char *secondary);
110 GHookFunc cb, gpointer user_data);
111 void *(*notify_email)(const char *subject, const char *from, 115 void *(*notify_email)(const char *subject, const char *from,
112 const char *to, const char *url, 116 const char *to, const char *url);
113 GHookFunc cb, gpointer user_data);
114 void *(*notify_emails)(size_t count, gboolean detailed, 117 void *(*notify_emails)(size_t count, gboolean detailed,
115 const char **subjects, const char **froms, 118 const char **subjects, const char **froms,
116 const char **tos, const char **urls, 119 const char **tos, const char **urls);
117 GHookFunc cb, gpointer user_data);
118 void *(*notify_formatted)(const char *title, const char *primary, 120 void *(*notify_formatted)(const char *title, const char *primary,
119 const char *secondary, const char *text, 121 const char *secondary, const char *text);
120 GHookFunc cb, gpointer user_data);
121 void *(*notify_searchresults)(GaimConnection *gc, const char *title, 122 void *(*notify_searchresults)(GaimConnection *gc, const char *title,
122 const char *primary, const char *secondary, 123 const char *primary, const char *secondary,
123 GaimNotifySearchResults *results, GHookFunc cb, 124 GaimNotifySearchResults *results);
124 gpointer user_data);
125 void (*notify_searchresults_new_rows)(GaimConnection *gc, 125 void (*notify_searchresults_new_rows)(GaimConnection *gc,
126 GaimNotifySearchResults *results, 126 GaimNotifySearchResults *results,
127 void *data, gpointer user_data); 127 void *data, gpointer user_data);
128 void *(*notify_userinfo)(GaimConnection *gc, const char *who, 128 void *(*notify_userinfo)(GaimConnection *gc, const char *who,
129 const char *text, 129 const char *text);
130 GHookFunc cb, gpointer user_data);
131 void *(*notify_uri)(const char *uri); 130 void *(*notify_uri)(const char *uri);
132 131
133 void (*close_notify)(GaimNotifyType type, void *ui_handle); 132 void (*close_notify)(GaimNotifyType type, void *ui_handle);
134 133
135 } GaimNotifyUiOps; 134 } GaimNotifyUiOps;
160 * 159 *
161 * @return A UI-specific handle. 160 * @return A UI-specific handle.
162 */ 161 */
163 void *gaim_notify_searchresults(GaimConnection *gc, const char *title, 162 void *gaim_notify_searchresults(GaimConnection *gc, const char *title,
164 const char *primary, const char *secondary, 163 const char *primary, const char *secondary,
165 GaimNotifySearchResults *results, GHookFunc cb, 164 GaimNotifySearchResults *results, GaimNotifyCloseCallback cb,
166 gpointer user_data); 165 gpointer user_data);
167 166
168 void gaim_notify_searchresults_free(GaimNotifySearchResults *results); 167 void gaim_notify_searchresults_free(GaimNotifySearchResults *results);
169 168
170 /** 169 /**
285 * 284 *
286 * @return A UI-specific handle. 285 * @return A UI-specific handle.
287 */ 286 */
288 void *gaim_notify_message(void *handle, GaimNotifyMsgType type, 287 void *gaim_notify_message(void *handle, GaimNotifyMsgType type,
289 const char *title, const char *primary, 288 const char *title, const char *primary,
290 const char *secondary, GHookFunc cb, 289 const char *secondary, GaimNotifyCloseCallback cb,
291 gpointer user_data); 290 gpointer user_data);
292 291
293 /** 292 /**
294 * Displays a single e-mail notification to the user. 293 * Displays a single e-mail notification to the user.
295 * 294 *
304 * 303 *
305 * @return A UI-specific handle. 304 * @return A UI-specific handle.
306 */ 305 */
307 void *gaim_notify_email(void *handle, const char *subject, 306 void *gaim_notify_email(void *handle, const char *subject,
308 const char *from, const char *to, 307 const char *from, const char *to,
309 const char *url, GHookFunc cb, 308 const char *url, GaimNotifyCloseCallback cb,
310 gpointer user_data); 309 gpointer user_data);
311 310
312 /** 311 /**
313 * Displays a notification for multiple e-mails to the user. 312 * Displays a notification for multiple e-mails to the user.
314 * 313 *
327 * @return A UI-specific handle. 326 * @return A UI-specific handle.
328 */ 327 */
329 void *gaim_notify_emails(void *handle, size_t count, gboolean detailed, 328 void *gaim_notify_emails(void *handle, size_t count, gboolean detailed,
330 const char **subjects, const char **froms, 329 const char **subjects, const char **froms,
331 const char **tos, const char **urls, 330 const char **tos, const char **urls,
332 GHookFunc cb, gpointer user_data); 331 GaimNotifyCloseCallback cb, gpointer user_data);
333 332
334 /** 333 /**
335 * Displays a notification with formatted text. 334 * Displays a notification with formatted text.
336 * 335 *
337 * The text is essentially a stripped-down format of HTML, the same that 336 * The text is essentially a stripped-down format of HTML, the same that
348 * 347 *
349 * @return A UI-specific handle. 348 * @return A UI-specific handle.
350 */ 349 */
351 void *gaim_notify_formatted(void *handle, const char *title, 350 void *gaim_notify_formatted(void *handle, const char *title,
352 const char *primary, const char *secondary, 351 const char *primary, const char *secondary,
353 const char *text, GHookFunc cb, gpointer user_data); 352 const char *text, GaimNotifyCloseCallback cb, gpointer user_data);
354 353
355 /** 354 /**
356 * Displays user information with formatted text, passing information giving 355 * Displays user information with formatted text, passing information giving
357 * the connection and username from which the user information came. 356 * the connection and username from which the user information came.
358 * 357 *
367 * @param user_data The data to pass to the callback. 366 * @param user_data The data to pass to the callback.
368 * 367 *
369 * @return A UI-specific handle. 368 * @return A UI-specific handle.
370 */ 369 */
371 void *gaim_notify_userinfo(GaimConnection *gc, const char *who, 370 void *gaim_notify_userinfo(GaimConnection *gc, const char *who,
372 const char *text, GHookFunc cb, 371 const char *text, GaimNotifyCloseCallback cb,
373 gpointer user_data); 372 gpointer user_data);
374 373
375 /** 374 /**
376 * Opens a URI or somehow presents it to the user. 375 * Opens a URI or somehow presents it to the user.
377 * 376 *