# HG changeset patch # User Sadrul Habib Chowdhury # Date 1199645627 0 # Node ID 829d054f4f1ac2efdd59c540cab076df4c9d6b98 # Parent f9dcdc0e89a55415510a4e64d5e2431ad5cca89c Add a function to get a widget for a request field. diff -r f9dcdc0e89a5 -r 829d054f4f1a ChangeLog.API --- a/ChangeLog.API Sun Jan 06 18:52:15 2008 +0000 +++ b/ChangeLog.API Sun Jan 06 18:53:47 2008 +0000 @@ -41,6 +41,9 @@ * PIDGIN_DIALOG Finch: + * finch_request_field_get_widget to get the widget for a request + field. + libgnt: * Added gnt_tree_set_row_color to set the color for a row in a tree. * Added gnt_style_get_string_list diff -r f9dcdc0e89a5 -r 829d054f4f1a finch/gntrequest.c --- a/finch/gntrequest.c Sun Jan 06 18:52:15 2008 +0000 +++ b/finch/gntrequest.c Sun Jan 06 18:53:47 2008 +0000 @@ -36,6 +36,7 @@ #include "finch.h" #include "gntrequest.h" +#include "debug.h" #include "util.h" typedef struct @@ -824,3 +825,32 @@ } } +GntWidget *finch_request_field_get_widget(PurpleRequestField *field) +{ + GntWidget *ret = NULL; + switch (purple_request_field_get_type(field)) { + case PURPLE_REQUEST_FIELD_BOOLEAN: + ret = create_boolean_field(field); + break; + case PURPLE_REQUEST_FIELD_STRING: + ret = create_string_field(field, NULL); + break; + case PURPLE_REQUEST_FIELD_INTEGER: + ret = create_integer_field(field); + break; + case PURPLE_REQUEST_FIELD_CHOICE: + ret = create_choice_field(field); + break; + case PURPLE_REQUEST_FIELD_LIST: + ret = create_list_field(field); + break; + case PURPLE_REQUEST_FIELD_ACCOUNT: + ret = create_account_field(field); + break; + default: + purple_debug_error("GntRequest", "Unimplemented request-field %d\n", purple_request_field_get_type(field)); + break; + } + return ret; +} + diff -r f9dcdc0e89a5 -r 829d054f4f1a finch/gntrequest.h --- a/finch/gntrequest.h Sun Jan 06 18:52:15 2008 +0000 +++ b/finch/gntrequest.h Sun Jan 06 18:53:47 2008 +0000 @@ -27,6 +27,7 @@ #define _GNT_REQUEST_H #include "request.h" +#include "gnt.h" /********************************************************************** * @name GNT Request API @@ -56,6 +57,15 @@ */ void finch_request_save_in_prefs(gpointer null, PurpleRequestFields *fields); +/** + * Create a widget field for a request-field. + * + * @param field The request field. + * + * @return A GntWidget for the request field. + * @since 2.4.0 + */ +GntWidget *finch_request_field_get_widget(PurpleRequestField *field); /*@}*/ #endif