Fri, 02 May 2008 23:16:11 +0000
Cleanup and avoid unnecessary alloc/free.
| 5437 | 1 | /** |
| 2 | * @file notify.c Notification API | |
| 3 | * @ingroup core | |
|
20330
650a7af9c238
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@pidgin.im>
parents:
19859
diff
changeset
|
4 | */ |
|
650a7af9c238
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@pidgin.im>
parents:
19859
diff
changeset
|
5 | |
|
650a7af9c238
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@pidgin.im>
parents:
19859
diff
changeset
|
6 | /* purple |
| 5437 | 7 | * |
| 15884 | 8 | * Purple is the legal property of its developers, whose names are too numerous |
| 8046 | 9 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 10 | * source distribution. | |
|
6465
bd201d637ff4
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
11 | * |
| 5437 | 12 | * This program is free software; you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU General Public License as published by | |
| 14 | * the Free Software Foundation; either version 2 of the License, or | |
| 15 | * (at your option) any later version. | |
| 16 | * | |
| 17 | * This program is distributed in the hope that it will be useful, | |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 20 | * GNU General Public License for more details. | |
| 21 | * | |
| 22 | * You should have received a copy of the GNU General Public License | |
| 23 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18976
diff
changeset
|
24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 5437 | 25 | */ |
|
17111
d7ecc0f69a5c
DBusify userinfo stuff.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16667
diff
changeset
|
26 | #include "internal.h" |
|
d7ecc0f69a5c
DBusify userinfo stuff.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16667
diff
changeset
|
27 | #include "dbus-maybe.h" |
| 5437 | 28 | #include "notify.h" |
| 29 | ||
| 15884 | 30 | static PurpleNotifyUiOps *notify_ui_ops = NULL; |
| 5437 | 31 | static GList *handles = NULL; |
| 32 | ||
| 33 | typedef struct | |
| 34 | { | |
| 15884 | 35 | PurpleNotifyType type; |
| 5437 | 36 | void *handle; |
|
5476
6f863ea68018
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
37 | void *ui_handle; |
| 15884 | 38 | PurpleNotifyCloseCallback cb; |
|
12242
e7fc1748eb56
[gaim-migrate @ 14544]
Richard Laager <rlaager@pidgin.im>
parents:
12220
diff
changeset
|
39 | gpointer cb_user_data; |
| 15884 | 40 | } PurpleNotifyInfo; |
| 5437 | 41 | |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
42 | /** |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
43 | * Definition of a user info entry |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
44 | */ |
| 15884 | 45 | struct _PurpleNotifyUserInfoEntry |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
46 | { |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
47 | char *label; |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
48 | char *value; |
| 15884 | 49 | PurpleNotifyUserInfoEntryType type; |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
50 | }; |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
51 | |
| 15884 | 52 | struct _PurpleNotifyUserInfo |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
53 | { |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
54 | GList *user_info_entries; |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
55 | }; |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
56 | |
| 5437 | 57 | void * |
| 15884 | 58 | purple_notify_message(void *handle, PurpleNotifyMsgType type, |
| 5437 | 59 | const char *title, const char *primary, |
| 15884 | 60 | const char *secondary, PurpleNotifyCloseCallback cb, gpointer user_data) |
| 5437 | 61 | { |
| 15884 | 62 | PurpleNotifyUiOps *ops; |
| 5437 | 63 | |
| 64 | g_return_val_if_fail(primary != NULL, NULL); | |
| 65 | ||
| 15884 | 66 | ops = purple_notify_get_ui_ops(); |
| 5437 | 67 | |
| 68 | if (ops != NULL && ops->notify_message != NULL) { | |
|
22968
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
69 | void *ui_handle = ops->notify_message(type, title, primary, |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
70 | secondary); |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
71 | if (ui_handle != NULL) { |
| 5437 | 72 | |
|
22968
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
73 | PurpleNotifyInfo *info = g_new0(PurpleNotifyInfo, 1); |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
74 | info->type = PURPLE_NOTIFY_MESSAGE; |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
75 | info->handle = handle; |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
76 | info->ui_handle = ui_handle; |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
77 | info->cb = cb; |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
78 | info->cb_user_data = user_data; |
| 5437 | 79 | |
|
14063
884ee51b28e9
[gaim-migrate @ 16586]
Evan Schoenberg <evands@pidgin.im>
parents:
14038
diff
changeset
|
80 | handles = g_list_append(handles, info); |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14064
diff
changeset
|
81 | |
|
14063
884ee51b28e9
[gaim-migrate @ 16586]
Evan Schoenberg <evands@pidgin.im>
parents:
14038
diff
changeset
|
82 | return info->ui_handle; |
|
14064
0d17cfaf530d
[gaim-migrate @ 16587]
Evan Schoenberg <evands@pidgin.im>
parents:
14063
diff
changeset
|
83 | } |
|
0d17cfaf530d
[gaim-migrate @ 16587]
Evan Schoenberg <evands@pidgin.im>
parents:
14063
diff
changeset
|
84 | |
| 5437 | 85 | } |
| 86 | ||
|
22968
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
87 | if (cb != NULL) |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
88 | cb(user_data); |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
89 | |
| 5437 | 90 | return NULL; |
| 91 | } | |
| 92 | ||
| 93 | void * | |
| 15884 | 94 | purple_notify_email(void *handle, const char *subject, const char *from, |
| 95 | const char *to, const char *url, PurpleNotifyCloseCallback cb, | |
| 12220 | 96 | gpointer user_data) |
| 5437 | 97 | { |
| 15884 | 98 | PurpleNotifyUiOps *ops; |
| 5437 | 99 | |
| 15884 | 100 | ops = purple_notify_get_ui_ops(); |
| 5437 | 101 | |
| 102 | if (ops != NULL && ops->notify_email != NULL) { | |
|
22968
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
103 | void *ui_handle; |
|
18976
fcf071533791
Email notification signals from charkins. Fixes #1324
Sean Egan <seanegan@pidgin.im>
parents:
18191
diff
changeset
|
104 | |
|
fcf071533791
Email notification signals from charkins. Fixes #1324
Sean Egan <seanegan@pidgin.im>
parents:
18191
diff
changeset
|
105 | purple_signal_emit(purple_notify_get_handle(), "displaying-email-notification", |
|
22968
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
106 | subject, from, to, url); |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
107 | |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
108 | ui_handle = ops->notify_email(handle, subject, from, to, url); |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
109 | |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
110 | if (ui_handle != NULL) { |
|
18976
fcf071533791
Email notification signals from charkins. Fixes #1324
Sean Egan <seanegan@pidgin.im>
parents:
18191
diff
changeset
|
111 | |
|
22968
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
112 | PurpleNotifyInfo *info = g_new0(PurpleNotifyInfo, 1); |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
113 | info->type = PURPLE_NOTIFY_EMAIL; |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
114 | info->handle = handle; |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
115 | info->ui_handle = ui_handle; |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
116 | info->cb = cb; |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
117 | info->cb_user_data = user_data; |
| 5437 | 118 | |
|
14063
884ee51b28e9
[gaim-migrate @ 16586]
Evan Schoenberg <evands@pidgin.im>
parents:
14038
diff
changeset
|
119 | handles = g_list_append(handles, info); |
|
884ee51b28e9
[gaim-migrate @ 16586]
Evan Schoenberg <evands@pidgin.im>
parents:
14038
diff
changeset
|
120 | |
|
884ee51b28e9
[gaim-migrate @ 16586]
Evan Schoenberg <evands@pidgin.im>
parents:
14038
diff
changeset
|
121 | return info->ui_handle; |
|
22968
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
122 | } |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
123 | } |
|
14063
884ee51b28e9
[gaim-migrate @ 16586]
Evan Schoenberg <evands@pidgin.im>
parents:
14038
diff
changeset
|
124 | |
|
22968
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
125 | if (cb != NULL) |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
126 | cb(user_data); |
| 5437 | 127 | |
| 128 | return NULL; | |
| 129 | } | |
| 130 | ||
| 131 | void * | |
| 15884 | 132 | purple_notify_emails(void *handle, size_t count, gboolean detailed, |
|
5522
faa69c8f503d
[gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
133 | const char **subjects, const char **froms, |
|
faa69c8f503d
[gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
134 | const char **tos, const char **urls, |
| 15884 | 135 | PurpleNotifyCloseCallback cb, gpointer user_data) |
| 5437 | 136 | { |
| 15884 | 137 | PurpleNotifyUiOps *ops; |
| 5437 | 138 | |
|
5522
faa69c8f503d
[gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
139 | if (count == 1) { |
| 15884 | 140 | return purple_notify_email(handle, |
|
5522
faa69c8f503d
[gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
141 | (subjects == NULL ? NULL : *subjects), |
|
faa69c8f503d
[gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
142 | (froms == NULL ? NULL : *froms), |
|
faa69c8f503d
[gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
143 | (tos == NULL ? NULL : *tos), |
|
faa69c8f503d
[gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
144 | (urls == NULL ? NULL : *urls), |
|
faa69c8f503d
[gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
145 | cb, user_data); |
|
faa69c8f503d
[gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
146 | } |
|
faa69c8f503d
[gaim-migrate @ 5922]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
147 | |
| 15884 | 148 | ops = purple_notify_get_ui_ops(); |
| 5437 | 149 | |
| 150 | if (ops != NULL && ops->notify_emails != NULL) { | |
|
22968
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
151 | void *ui_handle; |
|
18976
fcf071533791
Email notification signals from charkins. Fixes #1324
Sean Egan <seanegan@pidgin.im>
parents:
18191
diff
changeset
|
152 | |
|
fcf071533791
Email notification signals from charkins. Fixes #1324
Sean Egan <seanegan@pidgin.im>
parents:
18191
diff
changeset
|
153 | purple_signal_emit(purple_notify_get_handle(), "displaying-emails-notification", |
|
fcf071533791
Email notification signals from charkins. Fixes #1324
Sean Egan <seanegan@pidgin.im>
parents:
18191
diff
changeset
|
154 | subjects, froms, tos, urls, count); |
|
fcf071533791
Email notification signals from charkins. Fixes #1324
Sean Egan <seanegan@pidgin.im>
parents:
18191
diff
changeset
|
155 | |
|
22968
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
156 | ui_handle = ops->notify_emails(handle, count, detailed, subjects, |
|
12242
e7fc1748eb56
[gaim-migrate @ 14544]
Richard Laager <rlaager@pidgin.im>
parents:
12220
diff
changeset
|
157 | froms, tos, urls); |
| 5437 | 158 | |
|
22968
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
159 | if (ui_handle != NULL) { |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
160 | PurpleNotifyInfo *info = g_new0(PurpleNotifyInfo, 1); |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
161 | info->type = PURPLE_NOTIFY_EMAILS; |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
162 | info->handle = handle; |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
163 | info->ui_handle = ui_handle; |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
164 | info->cb = cb; |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
165 | info->cb_user_data = user_data; |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
166 | |
|
14063
884ee51b28e9
[gaim-migrate @ 16586]
Evan Schoenberg <evands@pidgin.im>
parents:
14038
diff
changeset
|
167 | handles = g_list_append(handles, info); |
|
884ee51b28e9
[gaim-migrate @ 16586]
Evan Schoenberg <evands@pidgin.im>
parents:
14038
diff
changeset
|
168 | |
|
884ee51b28e9
[gaim-migrate @ 16586]
Evan Schoenberg <evands@pidgin.im>
parents:
14038
diff
changeset
|
169 | return info->ui_handle; |
|
884ee51b28e9
[gaim-migrate @ 16586]
Evan Schoenberg <evands@pidgin.im>
parents:
14038
diff
changeset
|
170 | } |
|
14064
0d17cfaf530d
[gaim-migrate @ 16587]
Evan Schoenberg <evands@pidgin.im>
parents:
14063
diff
changeset
|
171 | |
| 5437 | 172 | } |
| 173 | ||
|
22968
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
174 | if (cb != NULL) |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
175 | cb(user_data); |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
176 | |
| 5437 | 177 | return NULL; |
| 178 | } | |
| 179 | ||
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
180 | void * |
| 15884 | 181 | purple_notify_formatted(void *handle, const char *title, const char *primary, |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
182 | const char *secondary, const char *text, |
| 15884 | 183 | PurpleNotifyCloseCallback cb, gpointer user_data) |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
184 | { |
| 15884 | 185 | PurpleNotifyUiOps *ops; |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
186 | |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
187 | g_return_val_if_fail(primary != NULL, NULL); |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
188 | |
| 15884 | 189 | ops = purple_notify_get_ui_ops(); |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
190 | |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
191 | if (ops != NULL && ops->notify_formatted != NULL) { |
|
22968
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
192 | void *ui_handle = ops->notify_formatted(title, primary, secondary, text); |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
193 | |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
194 | if (ui_handle != NULL) { |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
195 | |
|
22968
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
196 | PurpleNotifyInfo *info = g_new0(PurpleNotifyInfo, 1); |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
197 | info->type = PURPLE_NOTIFY_FORMATTED; |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
198 | info->handle = handle; |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
199 | info->ui_handle = ui_handle; |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
200 | info->cb = cb; |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
201 | info->cb_user_data = user_data; |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
202 | |
|
14063
884ee51b28e9
[gaim-migrate @ 16586]
Evan Schoenberg <evands@pidgin.im>
parents:
14038
diff
changeset
|
203 | handles = g_list_append(handles, info); |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14064
diff
changeset
|
204 | |
|
14063
884ee51b28e9
[gaim-migrate @ 16586]
Evan Schoenberg <evands@pidgin.im>
parents:
14038
diff
changeset
|
205 | return info->ui_handle; |
|
884ee51b28e9
[gaim-migrate @ 16586]
Evan Schoenberg <evands@pidgin.im>
parents:
14038
diff
changeset
|
206 | } |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
207 | } |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
208 | |
|
22968
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
209 | if (cb != NULL) |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
210 | cb(user_data); |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
211 | return NULL; |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
212 | } |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6356
diff
changeset
|
213 | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10240
diff
changeset
|
214 | void * |
| 15884 | 215 | purple_notify_searchresults(PurpleConnection *gc, const char *title, |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10240
diff
changeset
|
216 | const char *primary, const char *secondary, |
| 15884 | 217 | PurpleNotifySearchResults *results, PurpleNotifyCloseCallback cb, |
| 13641 | 218 | gpointer user_data) |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10240
diff
changeset
|
219 | { |
| 15884 | 220 | PurpleNotifyUiOps *ops; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10240
diff
changeset
|
221 | |
| 15884 | 222 | ops = purple_notify_get_ui_ops(); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10240
diff
changeset
|
223 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10240
diff
changeset
|
224 | if (ops != NULL && ops->notify_searchresults != NULL) { |
|
22968
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
225 | void *ui_handle = ops->notify_searchresults(gc, title, primary, |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
226 | secondary, results, user_data); |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
227 | if (ui_handle != NULL) { |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10240
diff
changeset
|
228 | |
|
22968
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
229 | PurpleNotifyInfo *info = g_new0(PurpleNotifyInfo, 1); |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
230 | info->type = PURPLE_NOTIFY_SEARCHRESULTS; |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
231 | info->handle = gc; |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
232 | info->ui_handle = ui_handle; |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
233 | info->cb = cb; |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
234 | info->cb_user_data = user_data; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10240
diff
changeset
|
235 | |
|
14063
884ee51b28e9
[gaim-migrate @ 16586]
Evan Schoenberg <evands@pidgin.im>
parents:
14038
diff
changeset
|
236 | handles = g_list_append(handles, info); |
|
884ee51b28e9
[gaim-migrate @ 16586]
Evan Schoenberg <evands@pidgin.im>
parents:
14038
diff
changeset
|
237 | |
|
884ee51b28e9
[gaim-migrate @ 16586]
Evan Schoenberg <evands@pidgin.im>
parents:
14038
diff
changeset
|
238 | return info->ui_handle; |
|
22968
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
239 | } |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
240 | } |
|
14063
884ee51b28e9
[gaim-migrate @ 16586]
Evan Schoenberg <evands@pidgin.im>
parents:
14038
diff
changeset
|
241 | |
|
22968
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
242 | if (cb != NULL) |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
243 | cb(user_data); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10240
diff
changeset
|
244 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10240
diff
changeset
|
245 | return NULL; |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10240
diff
changeset
|
246 | } |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10240
diff
changeset
|
247 | |
| 11359 | 248 | void |
| 15884 | 249 | purple_notify_searchresults_free(PurpleNotifySearchResults *results) |
| 11359 | 250 | { |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12257
diff
changeset
|
251 | GList *l; |
| 11359 | 252 | |
| 253 | g_return_if_fail(results != NULL); | |
| 254 | ||
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12257
diff
changeset
|
255 | for (l = results->buttons; l; l = g_list_delete_link(l, l)) { |
| 15884 | 256 | PurpleNotifySearchButton *button = l->data; |
|
14038
3b7740b778ad
[gaim-migrate @ 16534]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13641
diff
changeset
|
257 | g_free(button->label); |
| 11359 | 258 | g_free(button); |
| 259 | } | |
| 260 | ||
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12257
diff
changeset
|
261 | for (l = results->rows; l; l = g_list_delete_link(l, l)) { |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12257
diff
changeset
|
262 | GList *row = l->data; |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14064
diff
changeset
|
263 | g_list_foreach(row, (GFunc)g_free, NULL); |
|
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14064
diff
changeset
|
264 | g_list_free(row); |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12257
diff
changeset
|
265 | } |
| 11359 | 266 | |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12257
diff
changeset
|
267 | for (l = results->columns; l; l = g_list_delete_link(l, l)) { |
| 15884 | 268 | PurpleNotifySearchColumn *column = l->data; |
| 11359 | 269 | g_free(column->title); |
| 270 | g_free(column); | |
| 271 | } | |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12257
diff
changeset
|
272 | |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12257
diff
changeset
|
273 | g_free(results); |
| 11359 | 274 | } |
| 275 | ||
| 276 | void | |
| 15884 | 277 | purple_notify_searchresults_new_rows(PurpleConnection *gc, |
| 278 | PurpleNotifySearchResults *results, | |
| 13641 | 279 | void *data) |
| 11359 | 280 | { |
| 15884 | 281 | PurpleNotifyUiOps *ops; |
| 11359 | 282 | |
| 15884 | 283 | ops = purple_notify_get_ui_ops(); |
| 11359 | 284 | |
| 285 | if (ops != NULL && ops->notify_searchresults != NULL) { | |
| 13641 | 286 | ops->notify_searchresults_new_rows(gc, results, data); |
| 11359 | 287 | } |
| 288 | } | |
| 289 | ||
| 290 | void | |
| 15884 | 291 | purple_notify_searchresults_button_add(PurpleNotifySearchResults *results, |
| 292 | PurpleNotifySearchButtonType type, | |
| 293 | PurpleNotifySearchResultsCallback cb) | |
| 11359 | 294 | { |
| 15884 | 295 | PurpleNotifySearchButton *button; |
| 11359 | 296 | |
| 297 | g_return_if_fail(results != NULL); | |
| 298 | g_return_if_fail(cb != NULL); | |
| 299 | ||
| 15884 | 300 | button = g_new0(PurpleNotifySearchButton, 1); |
| 11359 | 301 | button->callback = cb; |
| 302 | button->type = type; | |
| 303 | ||
| 304 | results->buttons = g_list_append(results->buttons, button); | |
| 305 | } | |
| 306 | ||
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12257
diff
changeset
|
307 | |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12257
diff
changeset
|
308 | void |
| 15884 | 309 | purple_notify_searchresults_button_add_labeled(PurpleNotifySearchResults *results, |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12257
diff
changeset
|
310 | const char *label, |
| 15884 | 311 | PurpleNotifySearchResultsCallback cb) { |
| 312 | PurpleNotifySearchButton *button; | |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12257
diff
changeset
|
313 | |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12257
diff
changeset
|
314 | g_return_if_fail(results != NULL); |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12257
diff
changeset
|
315 | g_return_if_fail(cb != NULL); |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12257
diff
changeset
|
316 | g_return_if_fail(label != NULL); |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12257
diff
changeset
|
317 | g_return_if_fail(*label != '\0'); |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12257
diff
changeset
|
318 | |
| 15884 | 319 | button = g_new0(PurpleNotifySearchButton, 1); |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12257
diff
changeset
|
320 | button->callback = cb; |
| 15884 | 321 | button->type = PURPLE_NOTIFY_BUTTON_LABELED; |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12257
diff
changeset
|
322 | button->label = g_strdup(label); |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12257
diff
changeset
|
323 | |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12257
diff
changeset
|
324 | results->buttons = g_list_append(results->buttons, button); |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12257
diff
changeset
|
325 | } |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12257
diff
changeset
|
326 | |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12257
diff
changeset
|
327 | |
| 15884 | 328 | PurpleNotifySearchResults * |
| 329 | purple_notify_searchresults_new() | |
| 11359 | 330 | { |
| 15884 | 331 | PurpleNotifySearchResults *rs = g_new0(PurpleNotifySearchResults, 1); |
| 11359 | 332 | |
| 333 | return rs; | |
| 334 | } | |
| 335 | ||
| 336 | void | |
| 15884 | 337 | purple_notify_searchresults_column_add(PurpleNotifySearchResults *results, |
| 338 | PurpleNotifySearchColumn *column) | |
| 11359 | 339 | { |
| 340 | g_return_if_fail(results != NULL); | |
| 341 | g_return_if_fail(column != NULL); | |
| 342 | ||
| 343 | results->columns = g_list_append(results->columns, column); | |
| 344 | } | |
| 345 | ||
| 15884 | 346 | void purple_notify_searchresults_row_add(PurpleNotifySearchResults *results, |
| 11359 | 347 | GList *row) |
| 348 | { | |
| 349 | g_return_if_fail(results != NULL); | |
| 350 | g_return_if_fail(row != NULL); | |
| 351 | ||
| 352 | results->rows = g_list_append(results->rows, row); | |
| 353 | } | |
| 354 | ||
| 15884 | 355 | PurpleNotifySearchColumn * |
| 356 | purple_notify_searchresults_column_new(const char *title) | |
| 11359 | 357 | { |
| 15884 | 358 | PurpleNotifySearchColumn *sc; |
| 11359 | 359 | |
| 360 | g_return_val_if_fail(title != NULL, NULL); | |
| 361 | ||
| 15884 | 362 | sc = g_new0(PurpleNotifySearchColumn, 1); |
| 11359 | 363 | sc->title = g_strdup(title); |
| 364 | ||
| 365 | return sc; | |
| 366 | } | |
| 367 | ||
| 12257 | 368 | guint |
| 15884 | 369 | purple_notify_searchresults_get_columns_count(PurpleNotifySearchResults *results) |
| 11359 | 370 | { |
| 12257 | 371 | g_return_val_if_fail(results != NULL, 0); |
| 11359 | 372 | |
| 373 | return g_list_length(results->columns); | |
| 374 | } | |
| 375 | ||
| 12257 | 376 | guint |
| 15884 | 377 | purple_notify_searchresults_get_rows_count(PurpleNotifySearchResults *results) |
| 11359 | 378 | { |
| 12257 | 379 | g_return_val_if_fail(results != NULL, 0); |
| 11359 | 380 | |
| 381 | return g_list_length(results->rows); | |
| 382 | } | |
| 383 | ||
| 384 | char * | |
| 15884 | 385 | purple_notify_searchresults_column_get_title(PurpleNotifySearchResults *results, |
| 11359 | 386 | unsigned int column_id) |
| 387 | { | |
| 388 | g_return_val_if_fail(results != NULL, NULL); | |
| 389 | ||
| 15884 | 390 | return ((PurpleNotifySearchColumn *)g_list_nth_data(results->columns, column_id))->title; |
| 11359 | 391 | } |
| 392 | ||
| 393 | GList * | |
| 15884 | 394 | purple_notify_searchresults_row_get(PurpleNotifySearchResults *results, |
| 11359 | 395 | unsigned int row_id) |
| 396 | { | |
| 397 | g_return_val_if_fail(results != NULL, NULL); | |
| 398 | ||
| 399 | return g_list_nth_data(results->rows, row_id); | |
| 400 | } | |
| 401 | ||
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10240
diff
changeset
|
402 | void * |
| 15884 | 403 | purple_notify_userinfo(PurpleConnection *gc, const char *who, |
| 404 | PurpleNotifyUserInfo *user_info, PurpleNotifyCloseCallback cb, gpointer user_data) | |
| 9797 | 405 | { |
| 15884 | 406 | PurpleNotifyUiOps *ops; |
|
11531
63c017cfd8d2
[gaim-migrate @ 13780]
Luke Schierer <lschiere@pidgin.im>
parents:
11359
diff
changeset
|
407 | |
|
11533
f58436975d44
[gaim-migrate @ 13782]
Richard Laager <rlaager@pidgin.im>
parents:
11531
diff
changeset
|
408 | g_return_val_if_fail(who != NULL, NULL); |
| 9797 | 409 | |
| 15884 | 410 | ops = purple_notify_get_ui_ops(); |
| 9797 | 411 | |
| 412 | if (ops != NULL && ops->notify_userinfo != NULL) { | |
|
22968
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
413 | void *ui_handle; |
| 12129 | 414 | |
| 15884 | 415 | purple_signal_emit(purple_notify_get_handle(), "displaying-userinfo", |
| 416 | purple_connection_get_account(gc), who, user_info); | |
| 12129 | 417 | |
|
22968
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
418 | ui_handle = ops->notify_userinfo(gc, who, user_info); |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
419 | |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
420 | if (ui_handle != NULL) { |
| 9797 | 421 | |
|
22968
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
422 | PurpleNotifyInfo *info = g_new0(PurpleNotifyInfo, 1); |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
423 | info->type = PURPLE_NOTIFY_USERINFO; |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
424 | info->handle = gc; |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
425 | info->ui_handle = ui_handle; |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
426 | info->cb = cb; |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
427 | info->cb_user_data = user_data; |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
428 | |
|
14063
884ee51b28e9
[gaim-migrate @ 16586]
Evan Schoenberg <evands@pidgin.im>
parents:
14038
diff
changeset
|
429 | handles = g_list_append(handles, info); |
|
884ee51b28e9
[gaim-migrate @ 16586]
Evan Schoenberg <evands@pidgin.im>
parents:
14038
diff
changeset
|
430 | |
|
884ee51b28e9
[gaim-migrate @ 16586]
Evan Schoenberg <evands@pidgin.im>
parents:
14038
diff
changeset
|
431 | return info->ui_handle; |
|
22968
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
432 | } |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
433 | } |
|
14063
884ee51b28e9
[gaim-migrate @ 16586]
Evan Schoenberg <evands@pidgin.im>
parents:
14038
diff
changeset
|
434 | |
|
22968
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
435 | if (cb != NULL) |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
436 | cb(user_data); |
| 9797 | 437 | |
| 438 | return NULL; | |
| 439 | } | |
| 440 | ||
| 15884 | 441 | PurpleNotifyUserInfoEntry * |
| 442 | purple_notify_user_info_entry_new(const char *label, const char *value) | |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
443 | { |
| 15884 | 444 | PurpleNotifyUserInfoEntry *user_info_entry; |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
445 | |
| 15884 | 446 | user_info_entry = g_new0(PurpleNotifyUserInfoEntry, 1); |
|
17111
d7ecc0f69a5c
DBusify userinfo stuff.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16667
diff
changeset
|
447 | PURPLE_DBUS_REGISTER_POINTER(user_info_entry, PurpleNotifyUserInfoEntry); |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
448 | user_info_entry->label = g_strdup(label); |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
449 | user_info_entry->value = g_strdup(value); |
| 15884 | 450 | user_info_entry->type = PURPLE_NOTIFY_USER_INFO_ENTRY_PAIR; |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
451 | |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
452 | return user_info_entry; |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
453 | } |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
454 | |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
455 | static void |
| 15884 | 456 | purple_notify_user_info_entry_destroy(PurpleNotifyUserInfoEntry *user_info_entry) |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
457 | { |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
458 | g_return_if_fail(user_info_entry != NULL); |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
459 | |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
460 | g_free(user_info_entry->label); |
|
20655
66f2dfd94949
Clear out the mail notifications for an account when we receive a notification of 0 emails.
Daniel Atallah <datallah@pidgin.im>
parents:
20330
diff
changeset
|
461 | g_free(user_info_entry->value); |
|
17111
d7ecc0f69a5c
DBusify userinfo stuff.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16667
diff
changeset
|
462 | PURPLE_DBUS_UNREGISTER_POINTER(user_info_entry); |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
463 | g_free(user_info_entry); |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
464 | } |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
465 | |
| 15884 | 466 | PurpleNotifyUserInfo * |
| 467 | purple_notify_user_info_new() | |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
468 | { |
| 15884 | 469 | PurpleNotifyUserInfo *user_info; |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
470 | |
| 15884 | 471 | user_info = g_new0(PurpleNotifyUserInfo, 1); |
|
17111
d7ecc0f69a5c
DBusify userinfo stuff.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16667
diff
changeset
|
472 | PURPLE_DBUS_REGISTER_POINTER(user_info, PurpleNotifyUserInfo); |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
473 | user_info->user_info_entries = NULL; |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
474 | |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
475 | return user_info; |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
476 | } |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
477 | |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
478 | void |
| 15884 | 479 | purple_notify_user_info_destroy(PurpleNotifyUserInfo *user_info) |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
480 | { |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
481 | GList *l; |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
482 | |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
483 | for (l = user_info->user_info_entries; l != NULL; l = l->next) { |
| 15884 | 484 | PurpleNotifyUserInfoEntry *user_info_entry = l->data; |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
485 | |
| 15884 | 486 | purple_notify_user_info_entry_destroy(user_info_entry); |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
487 | } |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
488 | |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
489 | g_list_free(user_info->user_info_entries); |
|
17111
d7ecc0f69a5c
DBusify userinfo stuff.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16667
diff
changeset
|
490 | PURPLE_DBUS_UNREGISTER_POINTER(user_info); |
| 16667 | 491 | g_free(user_info); |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
492 | } |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
493 | |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
494 | GList * |
| 15884 | 495 | purple_notify_user_info_get_entries(PurpleNotifyUserInfo *user_info) |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
496 | { |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
497 | g_return_val_if_fail(user_info != NULL, NULL); |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
498 | |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
499 | return user_info->user_info_entries; |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
500 | } |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
501 | |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
502 | char * |
| 15884 | 503 | purple_notify_user_info_get_text_with_newline(PurpleNotifyUserInfo *user_info, const char *newline) |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
504 | { |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
505 | GList *l; |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
506 | GString *text; |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
507 | |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
508 | text = g_string_new(""); |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
509 | |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
510 | for (l = user_info->user_info_entries; l != NULL; l = l->next) { |
| 15884 | 511 | PurpleNotifyUserInfoEntry *user_info_entry = l->data; |
|
15211
bb75b7bc10a8
[gaim-migrate @ 17935]
Evan Schoenberg <evands@pidgin.im>
parents:
15205
diff
changeset
|
512 | /* Add a newline before a section header */ |
| 15884 | 513 | if (user_info_entry->type == PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER) |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
514 | g_string_append(text, newline); |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
515 | |
|
15211
bb75b7bc10a8
[gaim-migrate @ 17935]
Evan Schoenberg <evands@pidgin.im>
parents:
15205
diff
changeset
|
516 | /* Handle the label/value pair itself */ |
|
bb75b7bc10a8
[gaim-migrate @ 17935]
Evan Schoenberg <evands@pidgin.im>
parents:
15205
diff
changeset
|
517 | /* XXX Todo: Use a larger size for a section header? */ |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
518 | if (user_info_entry->label) |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
519 | g_string_append_printf(text, "<b>%s</b>", user_info_entry->label); |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
520 | if (user_info_entry->label && user_info_entry->value) |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
521 | g_string_append(text, ": "); |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
522 | if (user_info_entry->value) |
|
20655
66f2dfd94949
Clear out the mail notifications for an account when we receive a notification of 0 emails.
Daniel Atallah <datallah@pidgin.im>
parents:
20330
diff
changeset
|
523 | g_string_append(text, user_info_entry->value); |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
524 | |
|
15211
bb75b7bc10a8
[gaim-migrate @ 17935]
Evan Schoenberg <evands@pidgin.im>
parents:
15205
diff
changeset
|
525 | /* Display a section break as a horizontal line */ |
| 15884 | 526 | if (user_info_entry->type == PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK) |
|
15211
bb75b7bc10a8
[gaim-migrate @ 17935]
Evan Schoenberg <evands@pidgin.im>
parents:
15205
diff
changeset
|
527 | g_string_append(text, "<HR>"); |
|
bb75b7bc10a8
[gaim-migrate @ 17935]
Evan Schoenberg <evands@pidgin.im>
parents:
15205
diff
changeset
|
528 | |
|
bb75b7bc10a8
[gaim-migrate @ 17935]
Evan Schoenberg <evands@pidgin.im>
parents:
15205
diff
changeset
|
529 | /* Don't insert a new line before or after a section break; <HR> does that for us */ |
| 15884 | 530 | if ((user_info_entry->type != PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK) && |
| 531 | (l->next && ((((PurpleNotifyUserInfoEntry *)(l->next->data))->type != PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK)))) | |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
532 | g_string_append(text, newline); |
|
15211
bb75b7bc10a8
[gaim-migrate @ 17935]
Evan Schoenberg <evands@pidgin.im>
parents:
15205
diff
changeset
|
533 | |
|
bb75b7bc10a8
[gaim-migrate @ 17935]
Evan Schoenberg <evands@pidgin.im>
parents:
15205
diff
changeset
|
534 | /* Add an extra newline after a section header */ |
| 15884 | 535 | if (user_info_entry->type == PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER) |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
536 | g_string_append(text, newline); |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
537 | } |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
538 | |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
539 | return g_string_free(text, FALSE); |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
540 | } |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
541 | |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
542 | |
|
22762
7f13bec07bad
constify the return value from purple_notify_user_info_entry_get_label
Mark Doliner <markdoliner@pidgin.im>
parents:
21076
diff
changeset
|
543 | const gchar * |
| 15884 | 544 | purple_notify_user_info_entry_get_label(PurpleNotifyUserInfoEntry *user_info_entry) |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
545 | { |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
546 | g_return_val_if_fail(user_info_entry != NULL, NULL); |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
547 | |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
548 | return user_info_entry->label; |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
549 | } |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
550 | |
|
15325
d1dcb41d845b
[gaim-migrate @ 18053]
Evan Schoenberg <evands@pidgin.im>
parents:
15211
diff
changeset
|
551 | void |
| 15884 | 552 | purple_notify_user_info_entry_set_label(PurpleNotifyUserInfoEntry *user_info_entry, const char *label) |
|
15325
d1dcb41d845b
[gaim-migrate @ 18053]
Evan Schoenberg <evands@pidgin.im>
parents:
15211
diff
changeset
|
553 | { |
|
d1dcb41d845b
[gaim-migrate @ 18053]
Evan Schoenberg <evands@pidgin.im>
parents:
15211
diff
changeset
|
554 | g_return_if_fail(user_info_entry != NULL); |
|
d1dcb41d845b
[gaim-migrate @ 18053]
Evan Schoenberg <evands@pidgin.im>
parents:
15211
diff
changeset
|
555 | |
|
15330
2a5ca291262f
[gaim-migrate @ 18058]
Evan Schoenberg <evands@pidgin.im>
parents:
15329
diff
changeset
|
556 | g_free(user_info_entry->label); |
|
2a5ca291262f
[gaim-migrate @ 18058]
Evan Schoenberg <evands@pidgin.im>
parents:
15329
diff
changeset
|
557 | user_info_entry->label = g_strdup(label); |
|
15325
d1dcb41d845b
[gaim-migrate @ 18053]
Evan Schoenberg <evands@pidgin.im>
parents:
15211
diff
changeset
|
558 | } |
|
d1dcb41d845b
[gaim-migrate @ 18053]
Evan Schoenberg <evands@pidgin.im>
parents:
15211
diff
changeset
|
559 | |
|
22762
7f13bec07bad
constify the return value from purple_notify_user_info_entry_get_label
Mark Doliner <markdoliner@pidgin.im>
parents:
21076
diff
changeset
|
560 | const gchar * |
| 15884 | 561 | purple_notify_user_info_entry_get_value(PurpleNotifyUserInfoEntry *user_info_entry) |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
562 | { |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
563 | g_return_val_if_fail(user_info_entry != NULL, NULL); |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
564 | |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
565 | return user_info_entry->value; |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
566 | } |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
567 | |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
568 | void |
| 15884 | 569 | purple_notify_user_info_entry_set_value(PurpleNotifyUserInfoEntry *user_info_entry, const char *value) |
|
15325
d1dcb41d845b
[gaim-migrate @ 18053]
Evan Schoenberg <evands@pidgin.im>
parents:
15211
diff
changeset
|
570 | { |
|
d1dcb41d845b
[gaim-migrate @ 18053]
Evan Schoenberg <evands@pidgin.im>
parents:
15211
diff
changeset
|
571 | g_return_if_fail(user_info_entry != NULL); |
|
d1dcb41d845b
[gaim-migrate @ 18053]
Evan Schoenberg <evands@pidgin.im>
parents:
15211
diff
changeset
|
572 | |
|
15330
2a5ca291262f
[gaim-migrate @ 18058]
Evan Schoenberg <evands@pidgin.im>
parents:
15329
diff
changeset
|
573 | g_free(user_info_entry->value); |
|
2a5ca291262f
[gaim-migrate @ 18058]
Evan Schoenberg <evands@pidgin.im>
parents:
15329
diff
changeset
|
574 | user_info_entry->value = g_strdup(value); |
|
15325
d1dcb41d845b
[gaim-migrate @ 18053]
Evan Schoenberg <evands@pidgin.im>
parents:
15211
diff
changeset
|
575 | } |
|
d1dcb41d845b
[gaim-migrate @ 18053]
Evan Schoenberg <evands@pidgin.im>
parents:
15211
diff
changeset
|
576 | |
| 15884 | 577 | PurpleNotifyUserInfoEntryType |
| 578 | purple_notify_user_info_entry_get_type(PurpleNotifyUserInfoEntry *user_info_entry) | |
|
15325
d1dcb41d845b
[gaim-migrate @ 18053]
Evan Schoenberg <evands@pidgin.im>
parents:
15211
diff
changeset
|
579 | { |
| 15884 | 580 | g_return_val_if_fail(user_info_entry != NULL, PURPLE_NOTIFY_USER_INFO_ENTRY_PAIR); |
|
15330
2a5ca291262f
[gaim-migrate @ 18058]
Evan Schoenberg <evands@pidgin.im>
parents:
15329
diff
changeset
|
581 | |
|
15325
d1dcb41d845b
[gaim-migrate @ 18053]
Evan Schoenberg <evands@pidgin.im>
parents:
15211
diff
changeset
|
582 | return user_info_entry->type; |
|
d1dcb41d845b
[gaim-migrate @ 18053]
Evan Schoenberg <evands@pidgin.im>
parents:
15211
diff
changeset
|
583 | } |
|
d1dcb41d845b
[gaim-migrate @ 18053]
Evan Schoenberg <evands@pidgin.im>
parents:
15211
diff
changeset
|
584 | |
|
d1dcb41d845b
[gaim-migrate @ 18053]
Evan Schoenberg <evands@pidgin.im>
parents:
15211
diff
changeset
|
585 | void |
| 15884 | 586 | purple_notify_user_info_entry_set_type(PurpleNotifyUserInfoEntry *user_info_entry, PurpleNotifyUserInfoEntryType type) |
|
15325
d1dcb41d845b
[gaim-migrate @ 18053]
Evan Schoenberg <evands@pidgin.im>
parents:
15211
diff
changeset
|
587 | { |
|
d1dcb41d845b
[gaim-migrate @ 18053]
Evan Schoenberg <evands@pidgin.im>
parents:
15211
diff
changeset
|
588 | g_return_if_fail(user_info_entry != NULL); |
|
d1dcb41d845b
[gaim-migrate @ 18053]
Evan Schoenberg <evands@pidgin.im>
parents:
15211
diff
changeset
|
589 | |
|
d1dcb41d845b
[gaim-migrate @ 18053]
Evan Schoenberg <evands@pidgin.im>
parents:
15211
diff
changeset
|
590 | user_info_entry->type = type; |
|
d1dcb41d845b
[gaim-migrate @ 18053]
Evan Schoenberg <evands@pidgin.im>
parents:
15211
diff
changeset
|
591 | } |
|
d1dcb41d845b
[gaim-migrate @ 18053]
Evan Schoenberg <evands@pidgin.im>
parents:
15211
diff
changeset
|
592 | |
|
d1dcb41d845b
[gaim-migrate @ 18053]
Evan Schoenberg <evands@pidgin.im>
parents:
15211
diff
changeset
|
593 | void |
| 15884 | 594 | purple_notify_user_info_add_pair(PurpleNotifyUserInfo *user_info, const char *label, const char *value) |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
595 | { |
| 15884 | 596 | PurpleNotifyUserInfoEntry *entry; |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
597 | |
| 15884 | 598 | entry = purple_notify_user_info_entry_new(label, value); |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
599 | user_info->user_info_entries = g_list_append(user_info->user_info_entries, entry); |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
600 | } |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
601 | |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
602 | void |
| 15884 | 603 | purple_notify_user_info_prepend_pair(PurpleNotifyUserInfo *user_info, const char *label, const char *value) |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
604 | { |
| 15884 | 605 | PurpleNotifyUserInfoEntry *entry; |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
606 | |
| 15884 | 607 | entry = purple_notify_user_info_entry_new(label, value); |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
608 | user_info->user_info_entries = g_list_prepend(user_info->user_info_entries, entry); |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
609 | } |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
610 | |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
611 | void |
| 15884 | 612 | purple_notify_user_info_remove_entry(PurpleNotifyUserInfo *user_info, PurpleNotifyUserInfoEntry *entry) |
|
15328
113b0b520010
[gaim-migrate @ 18056]
Evan Schoenberg <evands@pidgin.im>
parents:
15325
diff
changeset
|
613 | { |
|
113b0b520010
[gaim-migrate @ 18056]
Evan Schoenberg <evands@pidgin.im>
parents:
15325
diff
changeset
|
614 | g_return_if_fail(user_info != NULL); |
|
15329
52e77528c005
[gaim-migrate @ 18057]
Evan Schoenberg <evands@pidgin.im>
parents:
15328
diff
changeset
|
615 | g_return_if_fail(entry != NULL); |
|
15328
113b0b520010
[gaim-migrate @ 18056]
Evan Schoenberg <evands@pidgin.im>
parents:
15325
diff
changeset
|
616 | |
|
113b0b520010
[gaim-migrate @ 18056]
Evan Schoenberg <evands@pidgin.im>
parents:
15325
diff
changeset
|
617 | user_info->user_info_entries = g_list_remove(user_info->user_info_entries, entry); |
|
113b0b520010
[gaim-migrate @ 18056]
Evan Schoenberg <evands@pidgin.im>
parents:
15325
diff
changeset
|
618 | } |
|
113b0b520010
[gaim-migrate @ 18056]
Evan Schoenberg <evands@pidgin.im>
parents:
15325
diff
changeset
|
619 | |
|
113b0b520010
[gaim-migrate @ 18056]
Evan Schoenberg <evands@pidgin.im>
parents:
15325
diff
changeset
|
620 | void |
| 15884 | 621 | purple_notify_user_info_add_section_header(PurpleNotifyUserInfo *user_info, const char *label) |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
622 | { |
| 15884 | 623 | PurpleNotifyUserInfoEntry *entry; |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
624 | |
| 15884 | 625 | entry = purple_notify_user_info_entry_new(label, NULL); |
| 626 | entry->type = PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER; | |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
627 | |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
628 | user_info->user_info_entries = g_list_append(user_info->user_info_entries, entry); |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
629 | } |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
630 | |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
631 | void |
| 15884 | 632 | purple_notify_user_info_add_section_break(PurpleNotifyUserInfo *user_info) |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
633 | { |
| 15884 | 634 | PurpleNotifyUserInfoEntry *entry; |
|
15211
bb75b7bc10a8
[gaim-migrate @ 17935]
Evan Schoenberg <evands@pidgin.im>
parents:
15205
diff
changeset
|
635 | |
| 15884 | 636 | entry = purple_notify_user_info_entry_new(NULL, NULL); |
| 637 | entry->type = PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK; | |
|
15211
bb75b7bc10a8
[gaim-migrate @ 17935]
Evan Schoenberg <evands@pidgin.im>
parents:
15205
diff
changeset
|
638 | |
|
bb75b7bc10a8
[gaim-migrate @ 17935]
Evan Schoenberg <evands@pidgin.im>
parents:
15205
diff
changeset
|
639 | user_info->user_info_entries = g_list_append(user_info->user_info_entries, entry); |
|
bb75b7bc10a8
[gaim-migrate @ 17935]
Evan Schoenberg <evands@pidgin.im>
parents:
15205
diff
changeset
|
640 | } |
|
bb75b7bc10a8
[gaim-migrate @ 17935]
Evan Schoenberg <evands@pidgin.im>
parents:
15205
diff
changeset
|
641 | |
|
bb75b7bc10a8
[gaim-migrate @ 17935]
Evan Schoenberg <evands@pidgin.im>
parents:
15205
diff
changeset
|
642 | void |
| 15884 | 643 | purple_notify_user_info_remove_last_item(PurpleNotifyUserInfo *user_info) |
|
15211
bb75b7bc10a8
[gaim-migrate @ 17935]
Evan Schoenberg <evands@pidgin.im>
parents:
15205
diff
changeset
|
644 | { |
|
21025
fd255f80ec49
Clarify the documentation for purple_notify_user_info_remove_entry() to indicated that it doesn't free the removed entry. Make purple_notify_user_info_remove_last_item() free the entry it is removing as that is the only sensible thing to do (otherwise purple_notify_user_info_remove_entry() should have been used instead). This fixes leakage in the msn prpl.
Daniel Atallah <datallah@pidgin.im>
parents:
20655
diff
changeset
|
645 | GList *last = g_list_last(user_info->user_info_entries); |
|
fd255f80ec49
Clarify the documentation for purple_notify_user_info_remove_entry() to indicated that it doesn't free the removed entry. Make purple_notify_user_info_remove_last_item() free the entry it is removing as that is the only sensible thing to do (otherwise purple_notify_user_info_remove_entry() should have been used instead). This fixes leakage in the msn prpl.
Daniel Atallah <datallah@pidgin.im>
parents:
20655
diff
changeset
|
646 | if (last) { |
|
fd255f80ec49
Clarify the documentation for purple_notify_user_info_remove_entry() to indicated that it doesn't free the removed entry. Make purple_notify_user_info_remove_last_item() free the entry it is removing as that is the only sensible thing to do (otherwise purple_notify_user_info_remove_entry() should have been used instead). This fixes leakage in the msn prpl.
Daniel Atallah <datallah@pidgin.im>
parents:
20655
diff
changeset
|
647 | purple_notify_user_info_entry_destroy(last->data); |
|
21063
911e85f207c7
Fix some leaks caused by misuse of g_list_remove_link() instead of g_list_delete_link().
Daniel Atallah <datallah@pidgin.im>
parents:
21025
diff
changeset
|
648 | user_info->user_info_entries = g_list_delete_link(user_info->user_info_entries, last); |
|
21025
fd255f80ec49
Clarify the documentation for purple_notify_user_info_remove_entry() to indicated that it doesn't free the removed entry. Make purple_notify_user_info_remove_last_item() free the entry it is removing as that is the only sensible thing to do (otherwise purple_notify_user_info_remove_entry() should have been used instead). This fixes leakage in the msn prpl.
Daniel Atallah <datallah@pidgin.im>
parents:
20655
diff
changeset
|
649 | } |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
650 | } |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
14254
diff
changeset
|
651 | |
|
6465
bd201d637ff4
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
652 | void * |
| 15884 | 653 | purple_notify_uri(void *handle, const char *uri) |
|
6465
bd201d637ff4
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
654 | { |
| 15884 | 655 | PurpleNotifyUiOps *ops; |
|
6465
bd201d637ff4
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
656 | |
|
bd201d637ff4
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
657 | g_return_val_if_fail(uri != NULL, NULL); |
|
bd201d637ff4
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
658 | |
| 15884 | 659 | ops = purple_notify_get_ui_ops(); |
|
6465
bd201d637ff4
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
660 | |
|
bd201d637ff4
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
661 | if (ops != NULL && ops->notify_uri != NULL) { |
|
22968
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
662 | |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
663 | void *ui_handle = ops->notify_uri(uri); |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
664 | |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
665 | if (ui_handle != NULL) { |
|
6465
bd201d637ff4
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
666 | |
|
22968
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
667 | PurpleNotifyInfo *info = g_new0(PurpleNotifyInfo, 1); |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
668 | info->type = PURPLE_NOTIFY_URI; |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
669 | info->handle = handle; |
|
06b1d79e09f6
Cleanup and avoid unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
22762
diff
changeset
|
670 | info->ui_handle = ui_handle; |
|
6465
bd201d637ff4
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
671 | |
|
14063
884ee51b28e9
[gaim-migrate @ 16586]
Evan Schoenberg <evands@pidgin.im>
parents:
14038
diff
changeset
|
672 | handles = g_list_append(handles, info); |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14064
diff
changeset
|
673 | |
|
14063
884ee51b28e9
[gaim-migrate @ 16586]
Evan Schoenberg <evands@pidgin.im>
parents:
14038
diff
changeset
|
674 | return info->ui_handle; |
|
884ee51b28e9
[gaim-migrate @ 16586]
Evan Schoenberg <evands@pidgin.im>
parents:
14038
diff
changeset
|
675 | } |
|
6465
bd201d637ff4
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
676 | } |
|
bd201d637ff4
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
677 | |
|
bd201d637ff4
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
678 | return NULL; |
|
bd201d637ff4
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
679 | } |
|
bd201d637ff4
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
680 | |
| 5437 | 681 | void |
| 15884 | 682 | purple_notify_close(PurpleNotifyType type, void *ui_handle) |
| 5437 | 683 | { |
| 684 | GList *l; | |
| 15884 | 685 | PurpleNotifyUiOps *ops; |
| 5437 | 686 | |
|
5476
6f863ea68018
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
687 | g_return_if_fail(ui_handle != NULL); |
| 5437 | 688 | |
| 15884 | 689 | ops = purple_notify_get_ui_ops(); |
| 5437 | 690 | |
| 691 | for (l = handles; l != NULL; l = l->next) { | |
| 15884 | 692 | PurpleNotifyInfo *info = l->data; |
| 5437 | 693 | |
|
5476
6f863ea68018
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
694 | if (info->ui_handle == ui_handle) { |
| 5437 | 695 | handles = g_list_remove(handles, info); |
| 696 | ||
| 697 | if (ops != NULL && ops->close_notify != NULL) | |
|
5476
6f863ea68018
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
698 | ops->close_notify(info->type, ui_handle); |
| 5437 | 699 | |
|
12242
e7fc1748eb56
[gaim-migrate @ 14544]
Richard Laager <rlaager@pidgin.im>
parents:
12220
diff
changeset
|
700 | if (info->cb != NULL) |
|
e7fc1748eb56
[gaim-migrate @ 14544]
Richard Laager <rlaager@pidgin.im>
parents:
12220
diff
changeset
|
701 | info->cb(info->cb_user_data); |
|
e7fc1748eb56
[gaim-migrate @ 14544]
Richard Laager <rlaager@pidgin.im>
parents:
12220
diff
changeset
|
702 | |
| 5437 | 703 | g_free(info); |
| 704 | ||
| 705 | break; | |
| 706 | } | |
| 707 | } | |
| 708 | } | |
| 709 | ||
| 710 | void | |
| 15884 | 711 | purple_notify_close_with_handle(void *handle) |
| 5437 | 712 | { |
|
17728
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17111
diff
changeset
|
713 | GList *l, *prev = NULL; |
| 15884 | 714 | PurpleNotifyUiOps *ops; |
| 5437 | 715 | |
| 716 | g_return_if_fail(handle != NULL); | |
| 717 | ||
| 15884 | 718 | ops = purple_notify_get_ui_ops(); |
| 5437 | 719 | |
|
17728
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17111
diff
changeset
|
720 | for (l = handles; l != NULL; l = prev ? prev->next : handles) { |
| 15884 | 721 | PurpleNotifyInfo *info = l->data; |
| 5437 | 722 | |
| 723 | if (info->handle == handle) { | |
| 724 | handles = g_list_remove(handles, info); | |
| 725 | ||
| 726 | if (ops != NULL && ops->close_notify != NULL) | |
|
5476
6f863ea68018
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
727 | ops->close_notify(info->type, info->ui_handle); |
| 5437 | 728 | |
|
12242
e7fc1748eb56
[gaim-migrate @ 14544]
Richard Laager <rlaager@pidgin.im>
parents:
12220
diff
changeset
|
729 | if (info->cb != NULL) |
|
e7fc1748eb56
[gaim-migrate @ 14544]
Richard Laager <rlaager@pidgin.im>
parents:
12220
diff
changeset
|
730 | info->cb(info->cb_user_data); |
|
e7fc1748eb56
[gaim-migrate @ 14544]
Richard Laager <rlaager@pidgin.im>
parents:
12220
diff
changeset
|
731 | |
| 5437 | 732 | g_free(info); |
|
17728
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17111
diff
changeset
|
733 | } else |
|
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17111
diff
changeset
|
734 | prev = l; |
| 5437 | 735 | } |
| 736 | } | |
| 737 | ||
| 738 | void | |
| 15884 | 739 | purple_notify_set_ui_ops(PurpleNotifyUiOps *ops) |
| 5437 | 740 | { |
| 741 | notify_ui_ops = ops; | |
| 742 | } | |
| 743 | ||
| 15884 | 744 | PurpleNotifyUiOps * |
| 745 | purple_notify_get_ui_ops(void) | |
| 5437 | 746 | { |
| 747 | return notify_ui_ops; | |
| 748 | } | |
| 12129 | 749 | |
| 750 | void * | |
| 15884 | 751 | purple_notify_get_handle(void) |
| 12129 | 752 | { |
| 753 | static int handle; | |
| 754 | ||
| 755 | return &handle; | |
| 756 | } | |
| 757 | ||
| 758 | void | |
| 15884 | 759 | purple_notify_init(void) |
| 12129 | 760 | { |
| 15884 | 761 | gpointer handle = purple_notify_get_handle(); |
| 12129 | 762 | |
|
18976
fcf071533791
Email notification signals from charkins. Fixes #1324
Sean Egan <seanegan@pidgin.im>
parents:
18191
diff
changeset
|
763 | purple_signal_register(handle, "displaying-email-notification", |
|
fcf071533791
Email notification signals from charkins. Fixes #1324
Sean Egan <seanegan@pidgin.im>
parents:
18191
diff
changeset
|
764 | purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER, NULL, 4, |
|
fcf071533791
Email notification signals from charkins. Fixes #1324
Sean Egan <seanegan@pidgin.im>
parents:
18191
diff
changeset
|
765 | purple_value_new(PURPLE_TYPE_STRING), |
|
fcf071533791
Email notification signals from charkins. Fixes #1324
Sean Egan <seanegan@pidgin.im>
parents:
18191
diff
changeset
|
766 | purple_value_new(PURPLE_TYPE_STRING), |
|
fcf071533791
Email notification signals from charkins. Fixes #1324
Sean Egan <seanegan@pidgin.im>
parents:
18191
diff
changeset
|
767 | purple_value_new(PURPLE_TYPE_STRING), |
|
fcf071533791
Email notification signals from charkins. Fixes #1324
Sean Egan <seanegan@pidgin.im>
parents:
18191
diff
changeset
|
768 | purple_value_new(PURPLE_TYPE_STRING)); |
|
fcf071533791
Email notification signals from charkins. Fixes #1324
Sean Egan <seanegan@pidgin.im>
parents:
18191
diff
changeset
|
769 | |
|
fcf071533791
Email notification signals from charkins. Fixes #1324
Sean Egan <seanegan@pidgin.im>
parents:
18191
diff
changeset
|
770 | purple_signal_register(handle, "displaying-emails-notification", |
|
fcf071533791
Email notification signals from charkins. Fixes #1324
Sean Egan <seanegan@pidgin.im>
parents:
18191
diff
changeset
|
771 | purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT, NULL, 5, |
|
fcf071533791
Email notification signals from charkins. Fixes #1324
Sean Egan <seanegan@pidgin.im>
parents:
18191
diff
changeset
|
772 | purple_value_new(PURPLE_TYPE_POINTER), |
|
fcf071533791
Email notification signals from charkins. Fixes #1324
Sean Egan <seanegan@pidgin.im>
parents:
18191
diff
changeset
|
773 | purple_value_new(PURPLE_TYPE_POINTER), |
|
fcf071533791
Email notification signals from charkins. Fixes #1324
Sean Egan <seanegan@pidgin.im>
parents:
18191
diff
changeset
|
774 | purple_value_new(PURPLE_TYPE_POINTER), |
|
fcf071533791
Email notification signals from charkins. Fixes #1324
Sean Egan <seanegan@pidgin.im>
parents:
18191
diff
changeset
|
775 | purple_value_new(PURPLE_TYPE_POINTER), |
|
fcf071533791
Email notification signals from charkins. Fixes #1324
Sean Egan <seanegan@pidgin.im>
parents:
18191
diff
changeset
|
776 | purple_value_new(PURPLE_TYPE_UINT)); |
|
fcf071533791
Email notification signals from charkins. Fixes #1324
Sean Egan <seanegan@pidgin.im>
parents:
18191
diff
changeset
|
777 | |
| 15884 | 778 | purple_signal_register(handle, "displaying-userinfo", |
| 779 | purple_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3, | |
| 780 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 781 | PURPLE_SUBTYPE_ACCOUNT), | |
| 782 | purple_value_new(PURPLE_TYPE_STRING), | |
| 783 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 784 | PURPLE_SUBTYPE_USERINFO)); | |
| 12129 | 785 | } |
| 786 | ||
| 787 | void | |
| 15884 | 788 | purple_notify_uninit(void) |
| 12129 | 789 | { |
| 15884 | 790 | purple_signals_unregister_by_instance(purple_notify_get_handle()); |
| 12129 | 791 | } |