changeset 7901:4344f7fad009

[gaim-migrate @ 8561] A function for setting the list of items currently selected would also be nifty. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sun, 21 Dec 2003 08:30:53 +0000
parents 365d8a67972d
children 3ca501305ac5
files src/request.c src/request.h
diffstat 2 files changed, 25 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/request.c	Sun Dec 21 08:16:43 2003 +0000
+++ b/src/request.c	Sun Dec 21 08:30:53 2003 +0000
@@ -691,6 +691,22 @@
 	field->u.list.items = g_list_append(field->u.list.items, g_strdup(item));
 }
 
+void
+gaim_request_field_list_set_selected(GaimRequestField *field, GList *items)
+{
+	g_return_if_fail(field != NULL);
+	g_return_if_fail(items != NULL);
+	g_return_if_fail(field->type == GAIM_REQUEST_FIELD_LIST);
+
+	if (field->u.list.selected != NULL)
+	{
+		g_list_foreach(field->u.list.selected, (GFunc)g_free, NULL);
+		g_list_free(field->u.list.selected);
+	}
+
+	field->u.list.selected = items;
+}
+
 const GList *
 gaim_request_field_list_get_selected(const GaimRequestField *field)
 {
--- a/src/request.h	Sun Dec 21 08:16:43 2003 +0000
+++ b/src/request.h	Sun Dec 21 08:30:53 2003 +0000
@@ -733,6 +733,15 @@
 void gaim_request_field_list_add(GaimRequestField *field, const char *item);
 
 /**
+ * Sets a list of selected items in a list field.
+ *
+ * @param field The field.
+ * @param items The list of selected items.
+ */
+void gaim_request_field_list_set_selected(GaimRequestField *field,
+										  GList *items);
+
+/**
  * Returns a list of selected items in a list field.
  *
  * @param field The field.