annotate src/notify.c @ 14000:f327a27f7f07

[gaim-migrate @ 16585] A fix for the nasty libxml corruption crash in jabber, from Henning Norn. committer: Tailor Script <tailor@pidgin.im>
author Ethan Blanton <elb@pidgin.im>
date Thu, 27 Jul 2006 18:58:14 +0000
parents 6a5aaf46bd52
children 66d01a547603
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5437
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1 /**
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2 * @file notify.c Notification API
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3 * @ingroup core
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4 *
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5 * gaim
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6 *
8046
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7035
diff changeset
7 * Gaim is the legal property of its developers, whose names are too numerous
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7035
diff changeset
8 * to list here. Please refer to the COPYRIGHT file distributed with this
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7035
diff changeset
9 * source distribution.
6465
fb64cc87bc96 [gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents: 6381
diff changeset
10 *
5437
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 * (at your option) any later version.
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 *
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 * This program is distributed in the hope that it will be useful,
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 * GNU General Public License for more details.
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 *
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22 * along with this program; if not, write to the Free Software
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
24 */
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
25 #include "notify.h"
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
26
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
27 static GaimNotifyUiOps *notify_ui_ops = NULL;
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
28 static GList *handles = NULL;
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
29
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
30 typedef struct
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
31 {
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
32 GaimNotifyType type;
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
33 void *handle;
5476
9bcd8cd625ae [gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents: 5437
diff changeset
34 void *ui_handle;
12242
976677e67239 [gaim-migrate @ 14544]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
35 GaimNotifyCloseCallback cb;
976677e67239 [gaim-migrate @ 14544]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
36 gpointer cb_user_data;
5437
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
37 } GaimNotifyInfo;
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
38
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
39 void *
6356
ee0044f3e377 [gaim-migrate @ 6855]
Christian Hammond <chipx86@chipx86.com>
parents: 6106
diff changeset
40 gaim_notify_message(void *handle, GaimNotifyMsgType type,
5437
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
41 const char *title, const char *primary,
12242
976677e67239 [gaim-migrate @ 14544]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
42 const char *secondary, GaimNotifyCloseCallback cb, gpointer user_data)
5437
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
43 {
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
44 GaimNotifyUiOps *ops;
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
45
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
46 g_return_val_if_fail(primary != NULL, NULL);
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
47
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6465
diff changeset
48 ops = gaim_notify_get_ui_ops();
5437
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
49
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
50 if (ops != NULL && ops->notify_message != NULL) {
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
51 GaimNotifyInfo *info;
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
52
5476
9bcd8cd625ae [gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents: 5437
diff changeset
53 info = g_new0(GaimNotifyInfo, 1);
9bcd8cd625ae [gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents: 5437
diff changeset
54 info->type = GAIM_NOTIFY_MESSAGE;
9bcd8cd625ae [gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents: 5437
diff changeset
55 info->handle = handle;
9bcd8cd625ae [gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents: 5437
diff changeset
56 info->ui_handle = ops->notify_message(type, title, primary,
12242
976677e67239 [gaim-migrate @ 14544]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
57 secondary);
976677e67239 [gaim-migrate @ 14544]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
58 info->cb = cb;
976677e67239 [gaim-migrate @ 14544]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
59 info->cb_user_data = user_data;
5437
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
60
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
61 handles = g_list_append(handles, info);
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
62
5476
9bcd8cd625ae [gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents: 5437
diff changeset
63 return info->ui_handle;
5437
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
64 }
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
65
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
66 return NULL;
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
67 }
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
68
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
69 void *
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
70 gaim_notify_email(void *handle, const char *subject, const char *from,
12242
976677e67239 [gaim-migrate @ 14544]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
71 const char *to, const char *url, GaimNotifyCloseCallback cb,
12220
64254fbabc7b [gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents: 12129
diff changeset
72 gpointer user_data)
5437
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
73 {
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
74 GaimNotifyUiOps *ops;
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
75
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6465
diff changeset
76 ops = gaim_notify_get_ui_ops();
5437
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
77
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
78 if (ops != NULL && ops->notify_email != NULL) {
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
79 GaimNotifyInfo *info;
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
80
5476
9bcd8cd625ae [gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents: 5437
diff changeset
81 info = g_new0(GaimNotifyInfo, 1);
9bcd8cd625ae [gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents: 5437
diff changeset
82 info->type = GAIM_NOTIFY_EMAIL;
9bcd8cd625ae [gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents: 5437
diff changeset
83 info->handle = handle;
12647
852df2d9d4f8 [gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents: 12624
diff changeset
84 info->ui_handle = ops->notify_email(handle, subject, from, to, url);
12242
976677e67239 [gaim-migrate @ 14544]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
85 info->cb = cb;
976677e67239 [gaim-migrate @ 14544]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
86 info->cb_user_data = user_data;
5437
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
87
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
88 handles = g_list_append(handles, info);
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
89
5476
9bcd8cd625ae [gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents: 5437
diff changeset
90 return info->ui_handle;
5437
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
91 }
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
92
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
93 return NULL;
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
94 }
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
95
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
96 void *
5522
a3e6a5ef49b5 [gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents: 5476
diff changeset
97 gaim_notify_emails(void *handle, size_t count, gboolean detailed,
a3e6a5ef49b5 [gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents: 5476
diff changeset
98 const char **subjects, const char **froms,
a3e6a5ef49b5 [gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents: 5476
diff changeset
99 const char **tos, const char **urls,
12242
976677e67239 [gaim-migrate @ 14544]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
100 GaimNotifyCloseCallback cb, gpointer user_data)
5437
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
101 {
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
102 GaimNotifyUiOps *ops;
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
103
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
104 g_return_val_if_fail(count != 0, NULL);
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
105
5522
a3e6a5ef49b5 [gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents: 5476
diff changeset
106 if (count == 1) {
a3e6a5ef49b5 [gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents: 5476
diff changeset
107 return gaim_notify_email(handle,
a3e6a5ef49b5 [gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents: 5476
diff changeset
108 (subjects == NULL ? NULL : *subjects),
a3e6a5ef49b5 [gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents: 5476
diff changeset
109 (froms == NULL ? NULL : *froms),
a3e6a5ef49b5 [gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents: 5476
diff changeset
110 (tos == NULL ? NULL : *tos),
a3e6a5ef49b5 [gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents: 5476
diff changeset
111 (urls == NULL ? NULL : *urls),
a3e6a5ef49b5 [gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents: 5476
diff changeset
112 cb, user_data);
a3e6a5ef49b5 [gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents: 5476
diff changeset
113 }
a3e6a5ef49b5 [gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents: 5476
diff changeset
114
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6465
diff changeset
115 ops = gaim_notify_get_ui_ops();
5437
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
116
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
117 if (ops != NULL && ops->notify_emails != NULL) {
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
118 GaimNotifyInfo *info;
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
119
5476
9bcd8cd625ae [gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents: 5437
diff changeset
120 info = g_new0(GaimNotifyInfo, 1);
9bcd8cd625ae [gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents: 5437
diff changeset
121 info->type = GAIM_NOTIFY_EMAILS;
9bcd8cd625ae [gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents: 5437
diff changeset
122 info->handle = handle;
12647
852df2d9d4f8 [gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents: 12624
diff changeset
123 info->ui_handle = ops->notify_emails(handle, count, detailed, subjects,
12242
976677e67239 [gaim-migrate @ 14544]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
124 froms, tos, urls);
976677e67239 [gaim-migrate @ 14544]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
125 info->cb = cb;
976677e67239 [gaim-migrate @ 14544]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
126 info->cb_user_data = user_data;
5437
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
127
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
128 handles = g_list_append(handles, info);
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
129
5476
9bcd8cd625ae [gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents: 5437
diff changeset
130 return info->ui_handle;
5437
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
131 }
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
132
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
133 return NULL;
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
134 }
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
135
6381
e006685f75aa [gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents: 6356
diff changeset
136 void *
e006685f75aa [gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents: 6356
diff changeset
137 gaim_notify_formatted(void *handle, const char *title, const char *primary,
e006685f75aa [gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents: 6356
diff changeset
138 const char *secondary, const char *text,
12242
976677e67239 [gaim-migrate @ 14544]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
139 GaimNotifyCloseCallback cb, gpointer user_data)
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 GaimNotifyUiOps *ops;
e006685f75aa [gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents: 6356
diff changeset
142
e006685f75aa [gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents: 6356
diff changeset
143 g_return_val_if_fail(primary != NULL, NULL);
e006685f75aa [gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents: 6356
diff changeset
144
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6465
diff changeset
145 ops = gaim_notify_get_ui_ops();
6381
e006685f75aa [gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents: 6356
diff changeset
146
e006685f75aa [gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents: 6356
diff changeset
147 if (ops != NULL && ops->notify_formatted != NULL) {
e006685f75aa [gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents: 6356
diff changeset
148 GaimNotifyInfo *info;
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 info = g_new0(GaimNotifyInfo, 1);
e006685f75aa [gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents: 6356
diff changeset
151 info->type = GAIM_NOTIFY_FORMATTED;
e006685f75aa [gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents: 6356
diff changeset
152 info->handle = handle;
12242
976677e67239 [gaim-migrate @ 14544]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
153 info->ui_handle = ops->notify_formatted(title, primary, secondary, text);
976677e67239 [gaim-migrate @ 14544]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
154 info->cb = cb;
976677e67239 [gaim-migrate @ 14544]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
155 info->cb_user_data = user_data;
6381
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 handles = g_list_append(handles, info);
e006685f75aa [gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents: 6356
diff changeset
158
e006685f75aa [gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents: 6356
diff changeset
159 return info->ui_handle;
e006685f75aa [gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents: 6356
diff changeset
160 }
e006685f75aa [gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents: 6356
diff changeset
161
e006685f75aa [gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents: 6356
diff changeset
162 return NULL;
e006685f75aa [gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents: 6356
diff changeset
163 }
e006685f75aa [gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents: 6356
diff changeset
164
10439
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10240
diff changeset
165 void *
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10240
diff changeset
166 gaim_notify_searchresults(GaimConnection *gc, const char *title,
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10240
diff changeset
167 const char *primary, const char *secondary,
13640
d12bbe6da705 [gaim-migrate @ 16038]
Bartoz Oler <bartosz@pidgin.im>
parents: 12647
diff changeset
168 GaimNotifySearchResults *results, GaimNotifyCloseCallback cb,
d12bbe6da705 [gaim-migrate @ 16038]
Bartoz Oler <bartosz@pidgin.im>
parents: 12647
diff changeset
169 gpointer user_data)
10439
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10240
diff changeset
170 {
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10240
diff changeset
171 GaimNotifyUiOps *ops;
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10240
diff changeset
172
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10240
diff changeset
173 ops = gaim_notify_get_ui_ops();
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10240
diff changeset
174
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10240
diff changeset
175 if (ops != NULL && ops->notify_searchresults != NULL) {
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10240
diff changeset
176 GaimNotifyInfo *info;
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10240
diff changeset
177
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10240
diff changeset
178 info = g_new0(GaimNotifyInfo, 1);
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10240
diff changeset
179 info->type = GAIM_NOTIFY_SEARCHRESULTS;
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10240
diff changeset
180 info->handle = gc;
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10240
diff changeset
181 info->ui_handle = ops->notify_searchresults(gc, title, primary,
13640
d12bbe6da705 [gaim-migrate @ 16038]
Bartoz Oler <bartosz@pidgin.im>
parents: 12647
diff changeset
182 secondary, results, user_data);
12242
976677e67239 [gaim-migrate @ 14544]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
183 info->cb = cb;
976677e67239 [gaim-migrate @ 14544]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
184 info->cb_user_data = user_data;
10439
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10240
diff changeset
185
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10240
diff changeset
186 handles = g_list_append(handles, info);
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10240
diff changeset
187
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10240
diff changeset
188 return info->ui_handle;
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10240
diff changeset
189 }
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10240
diff changeset
190
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10240
diff changeset
191 return NULL;
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10240
diff changeset
192 }
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10240
diff changeset
193
11359
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
194 void
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
195 gaim_notify_searchresults_free(GaimNotifySearchResults *results)
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
196 {
12624
851b0bd7eb52 [gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents: 12257
diff changeset
197 GList *l;
11359
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
198
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
199 g_return_if_fail(results != NULL);
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
200
12624
851b0bd7eb52 [gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents: 12257
diff changeset
201 for (l = results->buttons; l; l = g_list_delete_link(l, l)) {
11359
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
202 GaimNotifySearchButton *button = l->data;
13976
6a5aaf46bd52 [gaim-migrate @ 16534]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13640
diff changeset
203 g_free(button->label);
11359
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
204 g_free(button);
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
205 }
12624
851b0bd7eb52 [gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents: 12257
diff changeset
206 results->buttons = NULL;
11359
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
207
12624
851b0bd7eb52 [gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents: 12257
diff changeset
208 for (l = results->rows; l; l = g_list_delete_link(l, l)) {
851b0bd7eb52 [gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents: 12257
diff changeset
209 GList *row = l->data;
851b0bd7eb52 [gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents: 12257
diff changeset
210 for (; row; row = g_list_delete_link(row, row)) {
851b0bd7eb52 [gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents: 12257
diff changeset
211 gchar *str = row->data;
11359
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
212 g_free(str);
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
213 }
12624
851b0bd7eb52 [gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents: 12257
diff changeset
214 }
851b0bd7eb52 [gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents: 12257
diff changeset
215 results->rows = NULL;
11359
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
216
12624
851b0bd7eb52 [gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents: 12257
diff changeset
217 for (l = results->columns; l; l = g_list_delete_link(l, l)) {
11359
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
218 GaimNotifySearchColumn *column = l->data;
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
219 g_free(column->title);
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
220 g_free(column);
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
221 }
12624
851b0bd7eb52 [gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents: 12257
diff changeset
222 results->columns = NULL;
851b0bd7eb52 [gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents: 12257
diff changeset
223
851b0bd7eb52 [gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents: 12257
diff changeset
224 g_free(results);
11359
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
225 }
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
226
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
227 void
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
228 gaim_notify_searchresults_new_rows(GaimConnection *gc,
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
229 GaimNotifySearchResults *results,
13640
d12bbe6da705 [gaim-migrate @ 16038]
Bartoz Oler <bartosz@pidgin.im>
parents: 12647
diff changeset
230 void *data)
11359
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
231 {
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
232 GaimNotifyUiOps *ops;
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
233
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
234 ops = gaim_notify_get_ui_ops();
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
235
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
236 if (ops != NULL && ops->notify_searchresults != NULL) {
13640
d12bbe6da705 [gaim-migrate @ 16038]
Bartoz Oler <bartosz@pidgin.im>
parents: 12647
diff changeset
237 ops->notify_searchresults_new_rows(gc, results, data);
11359
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
238 }
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
239 }
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
240
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
241 void
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
242 gaim_notify_searchresults_button_add(GaimNotifySearchResults *results,
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
243 GaimNotifySearchButtonType type,
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
244 GaimNotifySearchResultsCallback cb)
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
245 {
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
246 GaimNotifySearchButton *button;
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
247
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
248 g_return_if_fail(results != NULL);
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
249 g_return_if_fail(cb != NULL);
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
250
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
251 button = g_new0(GaimNotifySearchButton, 1);
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
252 button->callback = cb;
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
253 button->type = type;
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
254
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
255 results->buttons = g_list_append(results->buttons, button);
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
256 }
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
257
12624
851b0bd7eb52 [gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents: 12257
diff changeset
258
851b0bd7eb52 [gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents: 12257
diff changeset
259 void
851b0bd7eb52 [gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents: 12257
diff changeset
260 gaim_notify_searchresults_button_add_labeled(GaimNotifySearchResults *results,
851b0bd7eb52 [gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents: 12257
diff changeset
261 const char *label,
851b0bd7eb52 [gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents: 12257
diff changeset
262 GaimNotifySearchResultsCallback cb) {
851b0bd7eb52 [gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents: 12257
diff changeset
263 GaimNotifySearchButton *button;
851b0bd7eb52 [gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents: 12257
diff changeset
264
851b0bd7eb52 [gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents: 12257
diff changeset
265 g_return_if_fail(results != NULL);
851b0bd7eb52 [gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents: 12257
diff changeset
266 g_return_if_fail(cb != NULL);
851b0bd7eb52 [gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents: 12257
diff changeset
267 g_return_if_fail(label != NULL);
851b0bd7eb52 [gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents: 12257
diff changeset
268 g_return_if_fail(*label != '\0');
851b0bd7eb52 [gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents: 12257
diff changeset
269
851b0bd7eb52 [gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents: 12257
diff changeset
270 button = g_new0(GaimNotifySearchButton, 1);
851b0bd7eb52 [gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents: 12257
diff changeset
271 button->callback = cb;
851b0bd7eb52 [gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents: 12257
diff changeset
272 button->type = GAIM_NOTIFY_BUTTON_LABELED;
851b0bd7eb52 [gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents: 12257
diff changeset
273 button->label = g_strdup(label);
851b0bd7eb52 [gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents: 12257
diff changeset
274
851b0bd7eb52 [gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents: 12257
diff changeset
275 results->buttons = g_list_append(results->buttons, button);
851b0bd7eb52 [gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents: 12257
diff changeset
276 }
851b0bd7eb52 [gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents: 12257
diff changeset
277
851b0bd7eb52 [gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents: 12257
diff changeset
278
11359
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
279 GaimNotifySearchResults *
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
280 gaim_notify_searchresults_new()
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
281 {
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
282 GaimNotifySearchResults *rs = g_new0(GaimNotifySearchResults, 1);
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
283
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
284 return rs;
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
285 }
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
286
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
287 void
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
288 gaim_notify_searchresults_column_add(GaimNotifySearchResults *results,
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
289 GaimNotifySearchColumn *column)
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
290 {
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
291 g_return_if_fail(results != NULL);
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
292 g_return_if_fail(column != NULL);
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
293
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
294 results->columns = g_list_append(results->columns, column);
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
295 }
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
296
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
297 void gaim_notify_searchresults_row_add(GaimNotifySearchResults *results,
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
298 GList *row)
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
299 {
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
300 g_return_if_fail(results != NULL);
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
301 g_return_if_fail(row != NULL);
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
302
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
303 results->rows = g_list_append(results->rows, row);
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
304 }
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
305
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
306 GaimNotifySearchColumn *
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
307 gaim_notify_searchresults_column_new(const char *title)
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
308 {
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
309 GaimNotifySearchColumn *sc;
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
310
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
311 g_return_val_if_fail(title != NULL, NULL);
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
312
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
313 sc = g_new0(GaimNotifySearchColumn, 1);
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
314 sc->title = g_strdup(title);
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
315
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
316 return sc;
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
317 }
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
318
12257
ca27de274225 [gaim-migrate @ 14559]
Richard Laager <rlaager@wiktel.com>
parents: 12242
diff changeset
319 guint
11359
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
320 gaim_notify_searchresults_get_columns_count(GaimNotifySearchResults *results)
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
321 {
12257
ca27de274225 [gaim-migrate @ 14559]
Richard Laager <rlaager@wiktel.com>
parents: 12242
diff changeset
322 g_return_val_if_fail(results != NULL, 0);
11359
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
323
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
324 return g_list_length(results->columns);
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
325 }
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
326
12257
ca27de274225 [gaim-migrate @ 14559]
Richard Laager <rlaager@wiktel.com>
parents: 12242
diff changeset
327 guint
11359
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
328 gaim_notify_searchresults_get_rows_count(GaimNotifySearchResults *results)
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
329 {
12257
ca27de274225 [gaim-migrate @ 14559]
Richard Laager <rlaager@wiktel.com>
parents: 12242
diff changeset
330 g_return_val_if_fail(results != NULL, 0);
11359
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
331
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
332 return g_list_length(results->rows);
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
333 }
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
334
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
335 char *
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
336 gaim_notify_searchresults_column_get_title(GaimNotifySearchResults *results,
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
337 unsigned int column_id)
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
338 {
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
339 g_return_val_if_fail(results != NULL, NULL);
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
340
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
341 return ((GaimNotifySearchColumn *)g_list_nth_data(results->columns, column_id))->title;
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
342 }
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
343
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
344 GList *
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
345 gaim_notify_searchresults_row_get(GaimNotifySearchResults *results,
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
346 unsigned int row_id)
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
347 {
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
348 g_return_val_if_fail(results != NULL, NULL);
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
349
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
350 return g_list_nth_data(results->rows, row_id);
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
351 }
9480e0d0f563 [gaim-migrate @ 13581]
Bartoz Oler <bartosz@pidgin.im>
parents: 10439
diff changeset
352
10439
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10240
diff changeset
353 void *
11531
bf763a1b2454 [gaim-migrate @ 13780]
Luke Schierer <lschiere@pidgin.im>
parents: 11359
diff changeset
354 gaim_notify_userinfo(GaimConnection *gc, const char *who,
12242
976677e67239 [gaim-migrate @ 14544]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
355 const char *text, GaimNotifyCloseCallback cb, gpointer user_data)
9797
62eb9fe24692 [gaim-migrate @ 10665]
Luke Schierer <lschiere@pidgin.im>
parents: 8046
diff changeset
356 {
62eb9fe24692 [gaim-migrate @ 10665]
Luke Schierer <lschiere@pidgin.im>
parents: 8046
diff changeset
357 GaimNotifyUiOps *ops;
11531
bf763a1b2454 [gaim-migrate @ 13780]
Luke Schierer <lschiere@pidgin.im>
parents: 11359
diff changeset
358
11533
c9b815aeddc1 [gaim-migrate @ 13782]
Richard Laager <rlaager@wiktel.com>
parents: 11531
diff changeset
359 g_return_val_if_fail(who != NULL, NULL);
9797
62eb9fe24692 [gaim-migrate @ 10665]
Luke Schierer <lschiere@pidgin.im>
parents: 8046
diff changeset
360
62eb9fe24692 [gaim-migrate @ 10665]
Luke Schierer <lschiere@pidgin.im>
parents: 8046
diff changeset
361 ops = gaim_notify_get_ui_ops();
62eb9fe24692 [gaim-migrate @ 10665]
Luke Schierer <lschiere@pidgin.im>
parents: 8046
diff changeset
362
62eb9fe24692 [gaim-migrate @ 10665]
Luke Schierer <lschiere@pidgin.im>
parents: 8046
diff changeset
363 if (ops != NULL && ops->notify_userinfo != NULL) {
62eb9fe24692 [gaim-migrate @ 10665]
Luke Schierer <lschiere@pidgin.im>
parents: 8046
diff changeset
364 GaimNotifyInfo *info;
12129
216988c717da [gaim-migrate @ 14429]
Richard Laager <rlaager@wiktel.com>
parents: 11533
diff changeset
365 char *infotext = g_strdup(text);
9797
62eb9fe24692 [gaim-migrate @ 10665]
Luke Schierer <lschiere@pidgin.im>
parents: 8046
diff changeset
366
62eb9fe24692 [gaim-migrate @ 10665]
Luke Schierer <lschiere@pidgin.im>
parents: 8046
diff changeset
367 info = g_new0(GaimNotifyInfo, 1);
62eb9fe24692 [gaim-migrate @ 10665]
Luke Schierer <lschiere@pidgin.im>
parents: 8046
diff changeset
368 info->type = GAIM_NOTIFY_USERINFO;
62eb9fe24692 [gaim-migrate @ 10665]
Luke Schierer <lschiere@pidgin.im>
parents: 8046
diff changeset
369 info->handle = gc;
12129
216988c717da [gaim-migrate @ 14429]
Richard Laager <rlaager@wiktel.com>
parents: 11533
diff changeset
370
216988c717da [gaim-migrate @ 14429]
Richard Laager <rlaager@wiktel.com>
parents: 11533
diff changeset
371 gaim_signal_emit(gaim_notify_get_handle(), "displaying-userinfo",
216988c717da [gaim-migrate @ 14429]
Richard Laager <rlaager@wiktel.com>
parents: 11533
diff changeset
372 gaim_connection_get_account(gc), who, &infotext);
216988c717da [gaim-migrate @ 14429]
Richard Laager <rlaager@wiktel.com>
parents: 11533
diff changeset
373
12242
976677e67239 [gaim-migrate @ 14544]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
374 info->ui_handle = ops->notify_userinfo(gc, who, infotext);
976677e67239 [gaim-migrate @ 14544]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
375 info->cb = cb;
976677e67239 [gaim-migrate @ 14544]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
376 info->cb_user_data = user_data;
9797
62eb9fe24692 [gaim-migrate @ 10665]
Luke Schierer <lschiere@pidgin.im>
parents: 8046
diff changeset
377
62eb9fe24692 [gaim-migrate @ 10665]
Luke Schierer <lschiere@pidgin.im>
parents: 8046
diff changeset
378 handles = g_list_append(handles, info);
62eb9fe24692 [gaim-migrate @ 10665]
Luke Schierer <lschiere@pidgin.im>
parents: 8046
diff changeset
379
12129
216988c717da [gaim-migrate @ 14429]
Richard Laager <rlaager@wiktel.com>
parents: 11533
diff changeset
380 g_free(infotext);
9797
62eb9fe24692 [gaim-migrate @ 10665]
Luke Schierer <lschiere@pidgin.im>
parents: 8046
diff changeset
381 return info->ui_handle;
62eb9fe24692 [gaim-migrate @ 10665]
Luke Schierer <lschiere@pidgin.im>
parents: 8046
diff changeset
382 }
62eb9fe24692 [gaim-migrate @ 10665]
Luke Schierer <lschiere@pidgin.im>
parents: 8046
diff changeset
383
62eb9fe24692 [gaim-migrate @ 10665]
Luke Schierer <lschiere@pidgin.im>
parents: 8046
diff changeset
384 return NULL;
62eb9fe24692 [gaim-migrate @ 10665]
Luke Schierer <lschiere@pidgin.im>
parents: 8046
diff changeset
385 }
62eb9fe24692 [gaim-migrate @ 10665]
Luke Schierer <lschiere@pidgin.im>
parents: 8046
diff changeset
386
6465
fb64cc87bc96 [gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents: 6381
diff changeset
387 void *
10240
95ca0db2d01d [gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 10209
diff changeset
388 gaim_notify_uri(void *handle, const char *uri)
6465
fb64cc87bc96 [gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents: 6381
diff changeset
389 {
fb64cc87bc96 [gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents: 6381
diff changeset
390 GaimNotifyUiOps *ops;
fb64cc87bc96 [gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents: 6381
diff changeset
391
fb64cc87bc96 [gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents: 6381
diff changeset
392 g_return_val_if_fail(uri != NULL, NULL);
fb64cc87bc96 [gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents: 6381
diff changeset
393
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6465
diff changeset
394 ops = gaim_notify_get_ui_ops();
6465
fb64cc87bc96 [gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents: 6381
diff changeset
395
fb64cc87bc96 [gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents: 6381
diff changeset
396 if (ops != NULL && ops->notify_uri != NULL) {
fb64cc87bc96 [gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents: 6381
diff changeset
397 GaimNotifyInfo *info;
fb64cc87bc96 [gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents: 6381
diff changeset
398
fb64cc87bc96 [gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents: 6381
diff changeset
399 info = g_new0(GaimNotifyInfo, 1);
fb64cc87bc96 [gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents: 6381
diff changeset
400 info->type = GAIM_NOTIFY_URI;
fb64cc87bc96 [gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents: 6381
diff changeset
401 info->handle = handle;
10240
95ca0db2d01d [gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 10209
diff changeset
402 info->ui_handle = ops->notify_uri(uri);
6465
fb64cc87bc96 [gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents: 6381
diff changeset
403
fb64cc87bc96 [gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents: 6381
diff changeset
404 handles = g_list_append(handles, info);
fb64cc87bc96 [gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents: 6381
diff changeset
405
fb64cc87bc96 [gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents: 6381
diff changeset
406 return info->ui_handle;
fb64cc87bc96 [gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents: 6381
diff changeset
407 }
fb64cc87bc96 [gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents: 6381
diff changeset
408
fb64cc87bc96 [gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents: 6381
diff changeset
409 return NULL;
fb64cc87bc96 [gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents: 6381
diff changeset
410 }
fb64cc87bc96 [gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents: 6381
diff changeset
411
5437
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
412 void
5476
9bcd8cd625ae [gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents: 5437
diff changeset
413 gaim_notify_close(GaimNotifyType type, void *ui_handle)
5437
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
414 {
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
415 GList *l;
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
416 GaimNotifyUiOps *ops;
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
417
5476
9bcd8cd625ae [gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents: 5437
diff changeset
418 g_return_if_fail(ui_handle != NULL);
5437
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
419
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6465
diff changeset
420 ops = gaim_notify_get_ui_ops();
5437
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
421
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
422 for (l = handles; l != NULL; l = l->next) {
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
423 GaimNotifyInfo *info = l->data;
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
424
5476
9bcd8cd625ae [gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents: 5437
diff changeset
425 if (info->ui_handle == ui_handle) {
5437
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
426 handles = g_list_remove(handles, info);
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
427
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
428 if (ops != NULL && ops->close_notify != NULL)
5476
9bcd8cd625ae [gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents: 5437
diff changeset
429 ops->close_notify(info->type, ui_handle);
5437
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
430
12242
976677e67239 [gaim-migrate @ 14544]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
431 if (info->cb != NULL)
976677e67239 [gaim-migrate @ 14544]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
432 info->cb(info->cb_user_data);
976677e67239 [gaim-migrate @ 14544]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
433
5437
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
434 g_free(info);
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
435
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
436 break;
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
437 }
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
438 }
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
439 }
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
440
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
441 void
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
442 gaim_notify_close_with_handle(void *handle)
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
443 {
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
444 GList *l, *l_next;
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
445 GaimNotifyUiOps *ops;
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
446
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
447 g_return_if_fail(handle != NULL);
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
448
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6465
diff changeset
449 ops = gaim_notify_get_ui_ops();
5437
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
450
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
451 for (l = handles; l != NULL; l = l_next) {
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
452 GaimNotifyInfo *info = l->data;
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
453
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
454 l_next = l->next;
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
455
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
456 if (info->handle == handle) {
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
457 handles = g_list_remove(handles, info);
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
458
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
459 if (ops != NULL && ops->close_notify != NULL)
5476
9bcd8cd625ae [gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents: 5437
diff changeset
460 ops->close_notify(info->type, info->ui_handle);
5437
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
461
12242
976677e67239 [gaim-migrate @ 14544]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
462 if (info->cb != NULL)
976677e67239 [gaim-migrate @ 14544]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
463 info->cb(info->cb_user_data);
976677e67239 [gaim-migrate @ 14544]
Richard Laager <rlaager@wiktel.com>
parents: 12220
diff changeset
464
5437
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
465 g_free(info);
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
466 }
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
467 }
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
468 }
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
469
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
470 void
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6465
diff changeset
471 gaim_notify_set_ui_ops(GaimNotifyUiOps *ops)
5437
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
472 {
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
473 notify_ui_ops = ops;
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
474 }
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
475
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
476 GaimNotifyUiOps *
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6465
diff changeset
477 gaim_notify_get_ui_ops(void)
5437
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
478 {
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
479 return notify_ui_ops;
0031a613a87d [gaim-migrate @ 5819]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
480 }
12129
216988c717da [gaim-migrate @ 14429]
Richard Laager <rlaager@wiktel.com>
parents: 11533
diff changeset
481
216988c717da [gaim-migrate @ 14429]
Richard Laager <rlaager@wiktel.com>
parents: 11533
diff changeset
482 void *
216988c717da [gaim-migrate @ 14429]
Richard Laager <rlaager@wiktel.com>
parents: 11533
diff changeset
483 gaim_notify_get_handle(void)
216988c717da [gaim-migrate @ 14429]
Richard Laager <rlaager@wiktel.com>
parents: 11533
diff changeset
484 {
216988c717da [gaim-migrate @ 14429]
Richard Laager <rlaager@wiktel.com>
parents: 11533
diff changeset
485 static int handle;
216988c717da [gaim-migrate @ 14429]
Richard Laager <rlaager@wiktel.com>
parents: 11533
diff changeset
486
216988c717da [gaim-migrate @ 14429]
Richard Laager <rlaager@wiktel.com>
parents: 11533
diff changeset
487 return &handle;
216988c717da [gaim-migrate @ 14429]
Richard Laager <rlaager@wiktel.com>
parents: 11533
diff changeset
488 }
216988c717da [gaim-migrate @ 14429]
Richard Laager <rlaager@wiktel.com>
parents: 11533
diff changeset
489
216988c717da [gaim-migrate @ 14429]
Richard Laager <rlaager@wiktel.com>
parents: 11533
diff changeset
490 void
216988c717da [gaim-migrate @ 14429]
Richard Laager <rlaager@wiktel.com>
parents: 11533
diff changeset
491 gaim_notify_init(void)
216988c717da [gaim-migrate @ 14429]
Richard Laager <rlaager@wiktel.com>
parents: 11533
diff changeset
492 {
216988c717da [gaim-migrate @ 14429]
Richard Laager <rlaager@wiktel.com>
parents: 11533
diff changeset
493 gpointer handle = gaim_notify_get_handle();
216988c717da [gaim-migrate @ 14429]
Richard Laager <rlaager@wiktel.com>
parents: 11533
diff changeset
494
216988c717da [gaim-migrate @ 14429]
Richard Laager <rlaager@wiktel.com>
parents: 11533
diff changeset
495 gaim_signal_register(handle, "displaying-userinfo",
216988c717da [gaim-migrate @ 14429]
Richard Laager <rlaager@wiktel.com>
parents: 11533
diff changeset
496 gaim_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3,
216988c717da [gaim-migrate @ 14429]
Richard Laager <rlaager@wiktel.com>
parents: 11533
diff changeset
497 gaim_value_new(GAIM_TYPE_SUBTYPE,
216988c717da [gaim-migrate @ 14429]
Richard Laager <rlaager@wiktel.com>
parents: 11533
diff changeset
498 GAIM_SUBTYPE_ACCOUNT),
216988c717da [gaim-migrate @ 14429]
Richard Laager <rlaager@wiktel.com>
parents: 11533
diff changeset
499 gaim_value_new(GAIM_TYPE_STRING),
216988c717da [gaim-migrate @ 14429]
Richard Laager <rlaager@wiktel.com>
parents: 11533
diff changeset
500 gaim_value_new_outgoing(GAIM_TYPE_STRING));
216988c717da [gaim-migrate @ 14429]
Richard Laager <rlaager@wiktel.com>
parents: 11533
diff changeset
501 }
216988c717da [gaim-migrate @ 14429]
Richard Laager <rlaager@wiktel.com>
parents: 11533
diff changeset
502
216988c717da [gaim-migrate @ 14429]
Richard Laager <rlaager@wiktel.com>
parents: 11533
diff changeset
503 void
216988c717da [gaim-migrate @ 14429]
Richard Laager <rlaager@wiktel.com>
parents: 11533
diff changeset
504 gaim_notify_uninit(void)
216988c717da [gaim-migrate @ 14429]
Richard Laager <rlaager@wiktel.com>
parents: 11533
diff changeset
505 {
216988c717da [gaim-migrate @ 14429]
Richard Laager <rlaager@wiktel.com>
parents: 11533
diff changeset
506 gaim_signals_unregister_by_instance(gaim_notify_get_handle());
216988c717da [gaim-migrate @ 14429]
Richard Laager <rlaager@wiktel.com>
parents: 11533
diff changeset
507 }