comparison src/notify.c @ 12624:851b0bd7eb52

[gaim-migrate @ 14960] busy busy busy... * fixed some unused variable warnings in a few places * fixed memleak in the searchresults notify * added more button types to the searchresults notify (IM, Info, Invite, Join, and arbitrary labels) * added a conversation ui op to present a conversation, since there appears to be no way to actually initiate an IM without breaking the core/ui split. gaim_conversation_present now ends up calling gaim_gtkconv_present_conversation * changed sametime prpl to use the searchresults notify instead of the requests API for its "ambiguous user" dialog * it should be possible to use the searchresults notify for room listing, if anyone is thusly interested committer: Tailor Script <tailor@pidgin.im>
author Christopher O'Brien <siege@pidgin.im>
date Thu, 22 Dec 2005 17:16:57 +0000
parents ca27de274225
children 852df2d9d4f8
comparison
equal deleted inserted replaced
12623:70f18c73da9d 12624:851b0bd7eb52
191 } 191 }
192 192
193 void 193 void
194 gaim_notify_searchresults_free(GaimNotifySearchResults *results) 194 gaim_notify_searchresults_free(GaimNotifySearchResults *results)
195 { 195 {
196 GList *l, *m; 196 GList *l;
197 197
198 g_return_if_fail(results != NULL); 198 g_return_if_fail(results != NULL);
199 199
200 for (l = results->buttons; l != NULL; l = l->next) { 200 for (l = results->buttons; l; l = g_list_delete_link(l, l)) {
201 GaimNotifySearchButton *button = l->data; 201 GaimNotifySearchButton *button = l->data;
202
203 results->buttons = g_list_remove(results->buttons, button);
204 g_free(button); 202 g_free(button);
205 } 203 }
206 g_list_free(results->buttons); 204 results->buttons = NULL;
207 205
208 for (l = results->rows; l != NULL; l = l->next) { 206 for (l = results->rows; l; l = g_list_delete_link(l, l)) {
209 GList *row = l->data; 207 GList *row = l->data;
210 208 for (; row; row = g_list_delete_link(row, row)) {
211 for (m = row; m != NULL; m = m->next) { 209 gchar *str = row->data;
212 gchar *str = m->data;
213
214 m = g_list_remove(m, str);
215 g_free(str); 210 g_free(str);
216 } 211 }
217 212 }
218 results->rows = g_list_remove(results->rows, row); 213 results->rows = NULL;
219 g_list_free(row); 214
220 } 215 for (l = results->columns; l; l = g_list_delete_link(l, l)) {
221 g_list_free(results->rows);
222
223 for (l = results->columns; l != NULL; l = l->next) {
224 GaimNotifySearchColumn *column = l->data; 216 GaimNotifySearchColumn *column = l->data;
225
226 results->columns = g_list_remove(results->columns, column);
227 g_free(column->title); 217 g_free(column->title);
228 g_free(column); 218 g_free(column);
229 } 219 }
230 g_list_free(results->columns); 220 results->columns = NULL;
221
222 g_free(results);
231 } 223 }
232 224
233 void 225 void
234 gaim_notify_searchresults_new_rows(GaimConnection *gc, 226 gaim_notify_searchresults_new_rows(GaimConnection *gc,
235 GaimNotifySearchResults *results, 227 GaimNotifySearchResults *results,
258 button->callback = cb; 250 button->callback = cb;
259 button->type = type; 251 button->type = type;
260 252
261 results->buttons = g_list_append(results->buttons, button); 253 results->buttons = g_list_append(results->buttons, button);
262 } 254 }
255
256
257 void
258 gaim_notify_searchresults_button_add_labeled(GaimNotifySearchResults *results,
259 const char *label,
260 GaimNotifySearchResultsCallback cb) {
261 GaimNotifySearchButton *button;
262
263 g_return_if_fail(results != NULL);
264 g_return_if_fail(cb != NULL);
265 g_return_if_fail(label != NULL);
266 g_return_if_fail(*label != '\0');
267
268 button = g_new0(GaimNotifySearchButton, 1);
269 button->callback = cb;
270 button->type = GAIM_NOTIFY_BUTTON_LABELED;
271 button->label = g_strdup(label);
272
273 results->buttons = g_list_append(results->buttons, button);
274 }
275
263 276
264 GaimNotifySearchResults * 277 GaimNotifySearchResults *
265 gaim_notify_searchresults_new() 278 gaim_notify_searchresults_new()
266 { 279 {
267 GaimNotifySearchResults *rs = g_new0(GaimNotifySearchResults, 1); 280 GaimNotifySearchResults *rs = g_new0(GaimNotifySearchResults, 1);