im.pidgin.pidgin: 1747b5c05b60cf63e250387d0e434194dff061e2

sadrul at pidgin.im sadrul at pidgin.im
Sun Jan 6 14:00:43 EST 2008


-----------------------------------------------------------------
Revision: 1747b5c05b60cf63e250387d0e434194dff061e2
Ancestor: c202fe8ca9c6222af90eeea502fdad5e8123d06c
Author: sadrul at pidgin.im
Date: 2008-01-06T18:53:47
Branch: im.pidgin.pidgin

Modified files:
        ChangeLog.API finch/gntrequest.c finch/gntrequest.h

ChangeLog: 

Add a function to get a widget for a request field.

-------------- next part --------------
============================================================
--- ChangeLog.API	278b3d23289c0db227c989674612be204e58c60c
+++ ChangeLog.API	aad5c51f87b1f48e5713119a86a6a094a9a5e088
@@ -41,6 +41,9 @@ version 2.4.0 (??/??/????):
 		* 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
============================================================
--- finch/gntrequest.c	67e292bade081cd07b2653c0d3944cc5ba6e2833
+++ finch/gntrequest.c	4fcd23f36f693e7376b589f940c148a7f94636a7
@@ -36,6 +36,7 @@
 
 #include "finch.h"
 #include "gntrequest.h"
+#include "debug.h"
 #include "util.h"
 
 typedef struct
@@ -824,3 +825,32 @@ void finch_request_save_in_prefs(gpointe
 	}
 }
 
+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;
+}
+
============================================================
--- finch/gntrequest.h	ead4ffe0b2815bb5953e57ec5b132b0dfc23d90d
+++ finch/gntrequest.h	01f5edc69f49e248c5f4a35aff0960b31f6b5c20
@@ -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(gpointe
  */
 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


More information about the Commits mailing list