Mercurial > pidgin
annotate src/notify.c @ 12115:e9790eb93216
[gaim-migrate @ 14415]
quoth charkins:
" This patch has a few small fixes for the visibility
stuff in gtkblist.c.
First, tracking of the ICONIFIED state of the blist was
removed. This was intended to allow the blist to
"remember" if it was minimized between restarts.
Unfortunately, this is not possible because the
ICONIFIED state gets set when the blist is on a
different desktop with many window managers.
Second, while talking about the ICONIFIED issue on
#gtk@GIMPNet, muntyan_ asked about a bug where the
blist would get shown on an account re-connect with
1.5.0. Luke mentioned something about this with cvs as
well. This patch introduces a check in
gaim_gtk_blist_show() to prevent the window from being
shown if it already exists and is visible.
Third, sadrul pointed me to a one-line fix for the
missing blist on startup. I added a second line to make
sure the blist restores its proper size as well.
Finally, when the last visibility manager is removed,
gaim will now minimize the blist if it was previously
hidden, rather than showing it. This could prevent a
race condition with out-of-process applets, preventing
gaim from maintaining the visibility state properly
between restarts.
This was 'cvs diff'ed against the last available anon
cvs from Friday. Hopefully it'll apply cleanly."
it did.
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Wed, 16 Nov 2005 17:55:26 +0000 |
parents | c9b815aeddc1 |
children | 216988c717da |
rev | line source |
---|---|
5437 | 1 /** |
2 * @file notify.c Notification API | |
3 * @ingroup core | |
4 * | |
5 * gaim | |
6 * | |
8046 | 7 * Gaim is the legal property of its developers, whose names are too numerous |
8 * to list here. Please refer to the COPYRIGHT file distributed with this | |
9 * source distribution. | |
6465
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
10 * |
5437 | 11 * This program is free software; you can redistribute it and/or modify |
12 * it under the terms of the GNU General Public License as published by | |
13 * the Free Software Foundation; either version 2 of the License, or | |
14 * (at your option) any later version. | |
15 * | |
16 * This program is distributed in the hope that it will be useful, | |
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 * GNU General Public License for more details. | |
20 * | |
21 * You should have received a copy of the GNU General Public License | |
22 * along with this program; if not, write to the Free Software | |
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
24 */ | |
25 #include "notify.h" | |
26 | |
27 static GaimNotifyUiOps *notify_ui_ops = NULL; | |
28 static GList *handles = NULL; | |
29 | |
30 typedef struct | |
31 { | |
32 GaimNotifyType type; | |
33 void *handle; | |
5476
9bcd8cd625ae
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
34 void *ui_handle; |
5437 | 35 |
36 } GaimNotifyInfo; | |
37 | |
38 void * | |
6356
ee0044f3e377
[gaim-migrate @ 6855]
Christian Hammond <chipx86@chipx86.com>
parents:
6106
diff
changeset
|
39 gaim_notify_message(void *handle, GaimNotifyMsgType type, |
5437 | 40 const char *title, const char *primary, |
41 const char *secondary, GCallback cb, void *user_data) | |
42 { | |
43 GaimNotifyUiOps *ops; | |
44 | |
45 g_return_val_if_fail(primary != NULL, NULL); | |
46 | |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6465
diff
changeset
|
47 ops = gaim_notify_get_ui_ops(); |
5437 | 48 |
49 if (ops != NULL && ops->notify_message != NULL) { | |
50 GaimNotifyInfo *info; | |
51 | |
5476
9bcd8cd625ae
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
52 info = g_new0(GaimNotifyInfo, 1); |
9bcd8cd625ae
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
53 info->type = GAIM_NOTIFY_MESSAGE; |
9bcd8cd625ae
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
54 info->handle = handle; |
9bcd8cd625ae
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
55 info->ui_handle = ops->notify_message(type, title, primary, |
9bcd8cd625ae
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
56 secondary, cb, user_data); |
5437 | 57 |
58 handles = g_list_append(handles, info); | |
59 | |
5476
9bcd8cd625ae
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
60 return info->ui_handle; |
5437 | 61 } |
62 | |
63 return NULL; | |
64 } | |
65 | |
66 void * | |
67 gaim_notify_email(void *handle, const char *subject, const char *from, | |
68 const char *to, const char *url, GCallback cb, | |
69 void *user_data) | |
70 { | |
71 GaimNotifyUiOps *ops; | |
72 | |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6465
diff
changeset
|
73 ops = gaim_notify_get_ui_ops(); |
5437 | 74 |
75 if (ops != NULL && ops->notify_email != NULL) { | |
76 GaimNotifyInfo *info; | |
77 | |
5476
9bcd8cd625ae
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
78 info = g_new0(GaimNotifyInfo, 1); |
9bcd8cd625ae
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
79 info->type = GAIM_NOTIFY_EMAIL; |
9bcd8cd625ae
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
80 info->handle = handle; |
9bcd8cd625ae
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
81 info->ui_handle = ops->notify_email(subject, from, to, url, cb, |
9bcd8cd625ae
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
82 user_data); |
5437 | 83 |
84 handles = g_list_append(handles, info); | |
85 | |
5476
9bcd8cd625ae
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
86 return info->ui_handle; |
5437 | 87 } |
88 | |
89 return NULL; | |
90 } | |
91 | |
92 void * | |
5522
a3e6a5ef49b5
[gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
93 gaim_notify_emails(void *handle, size_t count, gboolean detailed, |
a3e6a5ef49b5
[gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
94 const char **subjects, const char **froms, |
a3e6a5ef49b5
[gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
95 const char **tos, const char **urls, |
5437 | 96 GCallback cb, void *user_data) |
97 { | |
98 GaimNotifyUiOps *ops; | |
99 | |
100 g_return_val_if_fail(count != 0, NULL); | |
101 | |
5522
a3e6a5ef49b5
[gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
102 if (count == 1) { |
a3e6a5ef49b5
[gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
103 return gaim_notify_email(handle, |
a3e6a5ef49b5
[gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
104 (subjects == NULL ? NULL : *subjects), |
a3e6a5ef49b5
[gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
105 (froms == NULL ? NULL : *froms), |
a3e6a5ef49b5
[gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
106 (tos == NULL ? NULL : *tos), |
a3e6a5ef49b5
[gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
107 (urls == NULL ? NULL : *urls), |
a3e6a5ef49b5
[gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
108 cb, user_data); |
a3e6a5ef49b5
[gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
109 } |
a3e6a5ef49b5
[gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
110 |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6465
diff
changeset
|
111 ops = gaim_notify_get_ui_ops(); |
5437 | 112 |
113 if (ops != NULL && ops->notify_emails != NULL) { | |
114 GaimNotifyInfo *info; | |
115 | |
5476
9bcd8cd625ae
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
116 info = g_new0(GaimNotifyInfo, 1); |
9bcd8cd625ae
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
117 info->type = GAIM_NOTIFY_EMAILS; |
9bcd8cd625ae
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
118 info->handle = handle; |
5522
a3e6a5ef49b5
[gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
119 info->ui_handle = ops->notify_emails(count, detailed, subjects, |
a3e6a5ef49b5
[gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
120 froms, tos, urls, cb, user_data); |
5437 | 121 |
122 handles = g_list_append(handles, info); | |
123 | |
5476
9bcd8cd625ae
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
124 return info->ui_handle; |
5437 | 125 } |
126 | |
127 return NULL; | |
128 } | |
129 | |
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
130 void * |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
131 gaim_notify_formatted(void *handle, const char *title, const char *primary, |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
132 const char *secondary, const char *text, |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
133 GCallback cb, void *user_data) |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
134 { |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
135 GaimNotifyUiOps *ops; |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
136 |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
137 g_return_val_if_fail(primary != NULL, NULL); |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
138 |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6465
diff
changeset
|
139 ops = gaim_notify_get_ui_ops(); |
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
140 |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
141 if (ops != NULL && ops->notify_formatted != NULL) { |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
142 GaimNotifyInfo *info; |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
143 |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
144 info = g_new0(GaimNotifyInfo, 1); |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
145 info->type = GAIM_NOTIFY_FORMATTED; |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
146 info->handle = handle; |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
147 info->ui_handle = ops->notify_formatted(title, primary, secondary, |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
148 text, cb, user_data); |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
149 |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
150 handles = g_list_append(handles, info); |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
151 |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
152 return info->ui_handle; |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
153 } |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
154 |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
155 return NULL; |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
156 } |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
157 |
10439 | 158 void * |
159 gaim_notify_searchresults(GaimConnection *gc, const char *title, | |
160 const char *primary, const char *secondary, | |
11359 | 161 GaimNotifySearchResults *results, GCallback cb, void *user_data) |
10439 | 162 { |
163 GaimNotifyUiOps *ops; | |
164 | |
165 ops = gaim_notify_get_ui_ops(); | |
166 | |
167 if (ops != NULL && ops->notify_searchresults != NULL) { | |
168 GaimNotifyInfo *info; | |
169 | |
170 info = g_new0(GaimNotifyInfo, 1); | |
171 info->type = GAIM_NOTIFY_SEARCHRESULTS; | |
172 info->handle = gc; | |
173 info->ui_handle = ops->notify_searchresults(gc, title, primary, | |
174 secondary, results, | |
175 cb, user_data); | |
176 | |
177 handles = g_list_append(handles, info); | |
178 | |
179 return info->ui_handle; | |
180 } | |
181 | |
182 return NULL; | |
183 } | |
184 | |
11359 | 185 void |
186 gaim_notify_searchresults_free(GaimNotifySearchResults *results) | |
187 { | |
188 GList *l, *m; | |
189 | |
190 g_return_if_fail(results != NULL); | |
191 | |
192 for (l = results->buttons; l != NULL; l = l->next) { | |
193 GaimNotifySearchButton *button = l->data; | |
194 | |
195 results->buttons = g_list_remove(results->buttons, button); | |
196 g_free(button); | |
197 } | |
198 g_list_free(results->buttons); | |
199 | |
200 for (l = results->rows; l != NULL; l = l->next) { | |
201 GList *row = l->data; | |
202 | |
203 for (m = row; m != NULL; m = m->next) { | |
204 gchar *str = m->data; | |
205 | |
206 m = g_list_remove(m, str); | |
207 g_free(str); | |
208 } | |
209 | |
210 results->rows = g_list_remove(results->rows, row); | |
211 g_list_free(row); | |
212 } | |
213 g_list_free(results->rows); | |
214 | |
215 for (l = results->columns; l != NULL; l = l->next) { | |
216 GaimNotifySearchColumn *column = l->data; | |
217 | |
218 results->columns = g_list_remove(results->columns, column); | |
219 g_free(column->title); | |
220 g_free(column); | |
221 } | |
222 g_list_free(results->columns); | |
223 } | |
224 | |
225 void | |
226 gaim_notify_searchresults_new_rows(GaimConnection *gc, | |
227 GaimNotifySearchResults *results, | |
228 void *data, void *user_data) | |
229 { | |
230 GaimNotifyUiOps *ops; | |
231 | |
232 ops = gaim_notify_get_ui_ops(); | |
233 | |
234 if (ops != NULL && ops->notify_searchresults != NULL) { | |
235 ops->notify_searchresults_new_rows(gc, results, data, user_data); | |
236 } | |
237 } | |
238 | |
239 void | |
240 gaim_notify_searchresults_button_add(GaimNotifySearchResults *results, | |
241 GaimNotifySearchButtonType type, | |
242 GaimNotifySearchResultsCallback cb) | |
243 { | |
244 GaimNotifySearchButton *button; | |
245 | |
246 g_return_if_fail(results != NULL); | |
247 g_return_if_fail(cb != NULL); | |
248 | |
249 button = g_new0(GaimNotifySearchButton, 1); | |
250 button->callback = cb; | |
251 button->type = type; | |
252 | |
253 results->buttons = g_list_append(results->buttons, button); | |
254 } | |
255 | |
256 GaimNotifySearchResults * | |
257 gaim_notify_searchresults_new() | |
258 { | |
259 GaimNotifySearchResults *rs = g_new0(GaimNotifySearchResults, 1); | |
260 | |
261 return rs; | |
262 } | |
263 | |
264 void | |
265 gaim_notify_searchresults_column_add(GaimNotifySearchResults *results, | |
266 GaimNotifySearchColumn *column) | |
267 { | |
268 g_return_if_fail(results != NULL); | |
269 g_return_if_fail(column != NULL); | |
270 | |
271 results->columns = g_list_append(results->columns, column); | |
272 } | |
273 | |
274 void gaim_notify_searchresults_row_add(GaimNotifySearchResults *results, | |
275 GList *row) | |
276 { | |
277 g_return_if_fail(results != NULL); | |
278 g_return_if_fail(row != NULL); | |
279 | |
280 results->rows = g_list_append(results->rows, row); | |
281 } | |
282 | |
283 GaimNotifySearchColumn * | |
284 gaim_notify_searchresults_column_new(const char *title) | |
285 { | |
286 GaimNotifySearchColumn *sc; | |
287 | |
288 g_return_val_if_fail(title != NULL, NULL); | |
289 | |
290 sc = g_new0(GaimNotifySearchColumn, 1); | |
291 sc->title = g_strdup(title); | |
292 | |
293 return sc; | |
294 } | |
295 | |
296 int | |
297 gaim_notify_searchresults_get_columns_count(GaimNotifySearchResults *results) | |
298 { | |
299 g_return_val_if_fail(results != NULL, -1); | |
300 | |
301 return g_list_length(results->columns); | |
302 } | |
303 | |
304 int | |
305 gaim_notify_searchresults_get_rows_count(GaimNotifySearchResults *results) | |
306 { | |
307 g_return_val_if_fail(results != NULL, -1); | |
308 | |
309 return g_list_length(results->rows); | |
310 } | |
311 | |
312 char * | |
313 gaim_notify_searchresults_column_get_title(GaimNotifySearchResults *results, | |
314 unsigned int column_id) | |
315 { | |
316 g_return_val_if_fail(results != NULL, NULL); | |
317 | |
318 return ((GaimNotifySearchColumn *)g_list_nth_data(results->columns, column_id))->title; | |
319 } | |
320 | |
321 GList * | |
322 gaim_notify_searchresults_row_get(GaimNotifySearchResults *results, | |
323 unsigned int row_id) | |
324 { | |
325 g_return_val_if_fail(results != NULL, NULL); | |
326 | |
327 return g_list_nth_data(results->rows, row_id); | |
328 } | |
329 | |
10439 | 330 void * |
11531
bf763a1b2454
[gaim-migrate @ 13780]
Luke Schierer <lschiere@pidgin.im>
parents:
11359
diff
changeset
|
331 gaim_notify_userinfo(GaimConnection *gc, const char *who, |
9797 | 332 const char *text, GCallback cb, void *user_data) |
333 { | |
334 GaimNotifyUiOps *ops; | |
11531
bf763a1b2454
[gaim-migrate @ 13780]
Luke Schierer <lschiere@pidgin.im>
parents:
11359
diff
changeset
|
335 |
11533
c9b815aeddc1
[gaim-migrate @ 13782]
Richard Laager <rlaager@wiktel.com>
parents:
11531
diff
changeset
|
336 g_return_val_if_fail(who != NULL, NULL); |
9797 | 337 |
338 ops = gaim_notify_get_ui_ops(); | |
339 | |
340 if (ops != NULL && ops->notify_userinfo != NULL) { | |
341 GaimNotifyInfo *info; | |
342 | |
343 info = g_new0(GaimNotifyInfo, 1); | |
344 info->type = GAIM_NOTIFY_USERINFO; | |
345 info->handle = gc; | |
11533
c9b815aeddc1
[gaim-migrate @ 13782]
Richard Laager <rlaager@wiktel.com>
parents:
11531
diff
changeset
|
346 info->ui_handle = ops->notify_userinfo(gc, who, |
c9b815aeddc1
[gaim-migrate @ 13782]
Richard Laager <rlaager@wiktel.com>
parents:
11531
diff
changeset
|
347 text, cb, user_data); |
9797 | 348 |
349 handles = g_list_append(handles, info); | |
350 | |
351 return info->ui_handle; | |
352 } | |
353 | |
354 return NULL; | |
355 } | |
356 | |
6465
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
357 void * |
10240
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10209
diff
changeset
|
358 gaim_notify_uri(void *handle, const char *uri) |
6465
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
359 { |
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
360 GaimNotifyUiOps *ops; |
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
361 |
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
362 g_return_val_if_fail(uri != NULL, NULL); |
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
363 |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6465
diff
changeset
|
364 ops = gaim_notify_get_ui_ops(); |
6465
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
365 |
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
366 if (ops != NULL && ops->notify_uri != NULL) { |
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
367 GaimNotifyInfo *info; |
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
368 |
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
369 info = g_new0(GaimNotifyInfo, 1); |
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
370 info->type = GAIM_NOTIFY_URI; |
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
371 info->handle = handle; |
10240
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10209
diff
changeset
|
372 info->ui_handle = ops->notify_uri(uri); |
6465
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
373 |
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
374 handles = g_list_append(handles, info); |
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
375 |
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
376 return info->ui_handle; |
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
377 } |
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
378 |
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
379 return NULL; |
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
380 } |
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
381 |
5437 | 382 void |
5476
9bcd8cd625ae
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
383 gaim_notify_close(GaimNotifyType type, void *ui_handle) |
5437 | 384 { |
385 GList *l; | |
386 GaimNotifyUiOps *ops; | |
387 | |
5476
9bcd8cd625ae
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
388 g_return_if_fail(ui_handle != NULL); |
5437 | 389 |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6465
diff
changeset
|
390 ops = gaim_notify_get_ui_ops(); |
5437 | 391 |
392 for (l = handles; l != NULL; l = l->next) { | |
393 GaimNotifyInfo *info = l->data; | |
394 | |
5476
9bcd8cd625ae
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
395 if (info->ui_handle == ui_handle) { |
5437 | 396 handles = g_list_remove(handles, info); |
397 | |
398 if (ops != NULL && ops->close_notify != NULL) | |
5476
9bcd8cd625ae
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
399 ops->close_notify(info->type, ui_handle); |
5437 | 400 |
401 g_free(info); | |
402 | |
403 break; | |
404 } | |
405 } | |
406 } | |
407 | |
408 void | |
409 gaim_notify_close_with_handle(void *handle) | |
410 { | |
411 GList *l, *l_next; | |
412 GaimNotifyUiOps *ops; | |
413 | |
414 g_return_if_fail(handle != NULL); | |
415 | |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6465
diff
changeset
|
416 ops = gaim_notify_get_ui_ops(); |
5437 | 417 |
418 for (l = handles; l != NULL; l = l_next) { | |
419 GaimNotifyInfo *info = l->data; | |
420 | |
421 l_next = l->next; | |
422 | |
423 if (info->handle == handle) { | |
424 handles = g_list_remove(handles, info); | |
425 | |
426 if (ops != NULL && ops->close_notify != NULL) | |
5476
9bcd8cd625ae
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
427 ops->close_notify(info->type, info->ui_handle); |
5437 | 428 |
429 g_free(info); | |
430 } | |
431 } | |
432 } | |
433 | |
434 void | |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6465
diff
changeset
|
435 gaim_notify_set_ui_ops(GaimNotifyUiOps *ops) |
5437 | 436 { |
437 notify_ui_ops = ops; | |
438 } | |
439 | |
440 GaimNotifyUiOps * | |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6465
diff
changeset
|
441 gaim_notify_get_ui_ops(void) |
5437 | 442 { |
443 return notify_ui_ops; | |
444 } |