comparison src/notify.c @ 14001:66d01a547603

[gaim-migrate @ 16586] It is feasible that a UI is finished with notifying the user via the Notification API within the UI callback and has no need of a ui_handle to deal with closing the notification at a later date nor to tell the gaim core at a later point that it is finished with the data. If the ui_op for a notification returns a ui_handle of NULL, the GaimNotifyCloseCallback (if non-NULL) is now called immediately and the info structure is freed. If the op returns a non-NULL value, which is the case for all of gtkgaim's functions, the behavior is unchanged. committer: Tailor Script <tailor@pidgin.im>
author Evan Schoenberg <evan.s@dreskin.net>
date Thu, 27 Jul 2006 20:02:57 +0000
parents 6a5aaf46bd52
children fccb5cfa33b9
comparison
equal deleted inserted replaced
14000:f327a27f7f07 14001:66d01a547603
56 info->ui_handle = ops->notify_message(type, title, primary, 56 info->ui_handle = ops->notify_message(type, title, primary,
57 secondary); 57 secondary);
58 info->cb = cb; 58 info->cb = cb;
59 info->cb_user_data = user_data; 59 info->cb_user_data = user_data;
60 60
61 handles = g_list_append(handles, info); 61 if (info->ui_handle != NULL) {
62 62 handles = g_list_append(handles, info);
63 return info->ui_handle; 63
64 return info->ui_handle;
65
66 } else {
67 if (info->cb != NULL)
68 info->cb(info->cb_user_data);
69
70 g_free(info);
71
72 return NULL;
73 }
64 } 74 }
65 75
66 return NULL; 76 return NULL;
67 } 77 }
68 78
83 info->handle = handle; 93 info->handle = handle;
84 info->ui_handle = ops->notify_email(handle, subject, from, to, url); 94 info->ui_handle = ops->notify_email(handle, subject, from, to, url);
85 info->cb = cb; 95 info->cb = cb;
86 info->cb_user_data = user_data; 96 info->cb_user_data = user_data;
87 97
88 handles = g_list_append(handles, info); 98 if (info->ui_handle != NULL) {
99 handles = g_list_append(handles, info);
100
101 return info->ui_handle;
102
103 } else {
104 if (info->cb != NULL)
105 info->cb(info->cb_user_data);
106
107 g_free(info);
108
109 return NULL;
110 }
89 111
90 return info->ui_handle; 112 return info->ui_handle;
91 } 113 }
92 114
93 return NULL; 115 return NULL;
123 info->ui_handle = ops->notify_emails(handle, count, detailed, subjects, 145 info->ui_handle = ops->notify_emails(handle, count, detailed, subjects,
124 froms, tos, urls); 146 froms, tos, urls);
125 info->cb = cb; 147 info->cb = cb;
126 info->cb_user_data = user_data; 148 info->cb_user_data = user_data;
127 149
128 handles = g_list_append(handles, info); 150 if (info->ui_handle != NULL) {
129 151 handles = g_list_append(handles, info);
130 return info->ui_handle; 152
153 return info->ui_handle;
154
155 } else {
156 if (info->cb != NULL)
157 info->cb(info->cb_user_data);
158
159 g_free(info);
160
161 return NULL;
162 }
131 } 163 }
132 164
133 return NULL; 165 return NULL;
134 } 166 }
135 167
152 info->handle = handle; 184 info->handle = handle;
153 info->ui_handle = ops->notify_formatted(title, primary, secondary, text); 185 info->ui_handle = ops->notify_formatted(title, primary, secondary, text);
154 info->cb = cb; 186 info->cb = cb;
155 info->cb_user_data = user_data; 187 info->cb_user_data = user_data;
156 188
157 handles = g_list_append(handles, info); 189 if (info->ui_handle != NULL) {
158 190 handles = g_list_append(handles, info);
159 return info->ui_handle; 191
192 return info->ui_handle;
193
194 } else {
195 if (info->cb != NULL)
196 info->cb(info->cb_user_data);
197
198 g_free(info);
199
200 return NULL;
201 }
160 } 202 }
161 203
162 return NULL; 204 return NULL;
163 } 205 }
164 206
181 info->ui_handle = ops->notify_searchresults(gc, title, primary, 223 info->ui_handle = ops->notify_searchresults(gc, title, primary,
182 secondary, results, user_data); 224 secondary, results, user_data);
183 info->cb = cb; 225 info->cb = cb;
184 info->cb_user_data = user_data; 226 info->cb_user_data = user_data;
185 227
186 handles = g_list_append(handles, info); 228 if (info->ui_handle != NULL) {
229 handles = g_list_append(handles, info);
230
231 return info->ui_handle;
232
233 } else {
234 if (info->cb != NULL)
235 info->cb(info->cb_user_data);
236
237 g_free(info);
238
239 return NULL;
240 }
187 241
188 return info->ui_handle; 242 return info->ui_handle;
189 } 243 }
190 244
191 return NULL; 245 return NULL;
373 427
374 info->ui_handle = ops->notify_userinfo(gc, who, infotext); 428 info->ui_handle = ops->notify_userinfo(gc, who, infotext);
375 info->cb = cb; 429 info->cb = cb;
376 info->cb_user_data = user_data; 430 info->cb_user_data = user_data;
377 431
378 handles = g_list_append(handles, info);
379
380 g_free(infotext); 432 g_free(infotext);
381 return info->ui_handle; 433
434 if (info->ui_handle != NULL) {
435 handles = g_list_append(handles, info);
436
437 return info->ui_handle;
438
439 } else {
440 if (info->cb != NULL)
441 info->cb(info->cb_user_data);
442
443 g_free(info);
444
445 return NULL;
446 }
382 } 447 }
383 448
384 return NULL; 449 return NULL;
385 } 450 }
386 451
399 info = g_new0(GaimNotifyInfo, 1); 464 info = g_new0(GaimNotifyInfo, 1);
400 info->type = GAIM_NOTIFY_URI; 465 info->type = GAIM_NOTIFY_URI;
401 info->handle = handle; 466 info->handle = handle;
402 info->ui_handle = ops->notify_uri(uri); 467 info->ui_handle = ops->notify_uri(uri);
403 468
404 handles = g_list_append(handles, info); 469 if (info->ui_handle != NULL) {
405 470 handles = g_list_append(handles, info);
406 return info->ui_handle; 471
472 return info->ui_handle;
473
474 } else {
475 g_free(info);
476
477 return NULL;
478 }
407 } 479 }
408 480
409 return NULL; 481 return NULL;
410 } 482 }
411 483