diff 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
line wrap: on
line diff
--- a/src/notify.c	Thu Dec 22 16:06:41 2005 +0000
+++ b/src/notify.c	Thu Dec 22 17:16:57 2005 +0000
@@ -193,41 +193,33 @@
 void
 gaim_notify_searchresults_free(GaimNotifySearchResults *results)
 {
-	GList *l, *m;
+	GList *l;
 
 	g_return_if_fail(results != NULL);
 
-	for (l = results->buttons; l != NULL; l = l->next) {
+	for (l = results->buttons; l; l = g_list_delete_link(l, l)) {
 		GaimNotifySearchButton *button = l->data;
-
-		results->buttons = g_list_remove(results->buttons, button);
 		g_free(button);
 	}
-	g_list_free(results->buttons);
-
-	for (l = results->rows; l != NULL; l = l->next) {
-		GList *row = l->data;
+	results->buttons = NULL;
 
-		for (m = row; m != NULL; m = m->next) {
-			gchar *str = m->data;
-
-			m = g_list_remove(m, str);
+	for (l = results->rows; l; l = g_list_delete_link(l, l)) {
+		GList *row = l->data;
+		for (; row; row = g_list_delete_link(row, row)) {
+			gchar *str = row->data;
 			g_free(str);
 		}
+	}
+	results->rows = NULL;
 
-		results->rows = g_list_remove(results->rows, row);
-		g_list_free(row);
-	}
-	g_list_free(results->rows);
-
-	for (l = results->columns; l != NULL; l = l->next) {
+	for (l = results->columns; l; l = g_list_delete_link(l, l)) {
 		GaimNotifySearchColumn *column = l->data;
-
-		results->columns = g_list_remove(results->columns, column);
 		g_free(column->title);
 		g_free(column);
 	}
-	g_list_free(results->columns);
+	results->columns = NULL;
+
+	g_free(results);
 }
 
 void
@@ -261,6 +253,27 @@
 	results->buttons = g_list_append(results->buttons, button);
 }
 
+
+void
+gaim_notify_searchresults_button_add_labeled(GaimNotifySearchResults *results,
+                                             const char *label,
+                                             GaimNotifySearchResultsCallback cb) {
+	GaimNotifySearchButton *button;
+
+	g_return_if_fail(results != NULL);
+	g_return_if_fail(cb != NULL);
+	g_return_if_fail(label != NULL);
+	g_return_if_fail(*label != '\0');
+
+	button = g_new0(GaimNotifySearchButton, 1);
+	button->callback = cb;
+	button->type = GAIM_NOTIFY_BUTTON_LABELED;
+	button->label = g_strdup(label);
+
+	results->buttons = g_list_append(results->buttons, button);
+}
+
+
 GaimNotifySearchResults *
 gaim_notify_searchresults_new()
 {