# HG changeset patch
# Node ID ced2446a2560
# Parent  68480ea5f144
diff --git a/libpurple/meson.build b/libpurple/meson.build
--- a/libpurple/meson.build
+++ b/libpurple/meson.build
@@ -100,6 +100,7 @@ purple_coresources = [
 	'request/purplerequestfieldaccount.c',
 	'request/purplerequestfieldbool.c',
 	'request/purplerequestfieldchoice.c',
+	'request/purplerequestfieldimage.c',
 	'request/purplerequestfieldint.c',
 	'request/purplerequestfieldlabel.c',
 	'request/purplerequestfieldlist.c',
@@ -230,6 +231,7 @@ purple_request_headers = [
 	'request/purplerequestfieldaccount.h',
 	'request/purplerequestfieldbool.h',
 	'request/purplerequestfieldchoice.h',
+	'request/purplerequestfieldimage.h',
 	'request/purplerequestfieldint.h',
 	'request/purplerequestfieldlabel.h',
 	'request/purplerequestfieldlist.h',
diff --git a/libpurple/purplerequestfield.h b/libpurple/purplerequestfield.h
--- a/libpurple/purplerequestfield.h
+++ b/libpurple/purplerequestfield.h
@@ -64,7 +64,6 @@ struct _PurpleRequestFieldClass {
 /**
  * PurpleRequestFieldType:
  * @PURPLE_REQUEST_FIELD_NONE: No field.
- * @PURPLE_REQUEST_FIELD_IMAGE: Image field.
  * @PURPLE_REQUEST_FIELD_DATASHEET: Datasheet field.
  *
  * A type of field.
@@ -72,7 +71,6 @@ struct _PurpleRequestFieldClass {
 typedef enum
 {
 	PURPLE_REQUEST_FIELD_NONE,
-	PURPLE_REQUEST_FIELD_IMAGE,
 	PURPLE_REQUEST_FIELD_DATASHEET
 
 } PurpleRequestFieldType;
@@ -307,74 +305,6 @@ void purple_request_field_set_sensitive(
 gboolean purple_request_field_is_sensitive(PurpleRequestField *field);
 
 /**************************************************************************/
-/* Image Field API                                                        */
-/**************************************************************************/
-
-/**
- * purple_request_field_image_new:
- * @id:   The field ID.
- * @text: The label of the field.
- * @buf:  The image data.
- * @size: The size of the data in @buf.
- *
- * Creates an image field.
- *
- * Returns: (transfer full): The new field.
- */
-PurpleRequestField *purple_request_field_image_new(const char *id, const char *text,
-											   const char *buf, gsize size);
-
-/**
- * purple_request_field_image_set_scale:
- * @field: The image field.
- * @x:     The x scale factor.
- * @y:     The y scale factor.
- *
- * Sets the scale factors of an image field.
- */
-void purple_request_field_image_set_scale(PurpleRequestField *field, unsigned int x, unsigned int y);
-
-/**
- * purple_request_field_image_get_buffer:
- * @field: The image field.
- *
- * Returns pointer to the image.
- *
- * Returns: Pointer to the image.
- */
-const char *purple_request_field_image_get_buffer(PurpleRequestField *field);
-
-/**
- * purple_request_field_image_get_size:
- * @field: The image field.
- *
- * Returns size (in bytes) of the image.
- *
- * Returns: Size of the image.
- */
-gsize purple_request_field_image_get_size(PurpleRequestField *field);
-
-/**
- * purple_request_field_image_get_scale_x:
- * @field: The image field.
- *
- * Returns X scale coefficient of the image.
- *
- * Returns: X scale coefficient of the image.
- */
-unsigned int purple_request_field_image_get_scale_x(PurpleRequestField *field);
-
-/**
- * purple_request_field_image_get_scale_y:
- * @field: The image field.
- *
- * Returns Y scale coefficient of the image.
- *
- * Returns: Y scale coefficient of the image.
- */
-unsigned int purple_request_field_image_get_scale_y(PurpleRequestField *field);
-
-/**************************************************************************/
 /* Datasheet Field API                                                    */
 /**************************************************************************/
 
diff --git a/libpurple/purplerequestfield.h b/libpurple/request/purplerequestfieldimage.h
copy from libpurple/purplerequestfield.h
copy to libpurple/request/purplerequestfieldimage.h
--- a/libpurple/purplerequestfield.h
+++ b/libpurple/request/purplerequestfieldimage.h
@@ -24,8 +24,8 @@
 # error "only <purple.h> may be included directly"
 #endif
 
-#ifndef PURPLE_REQUEST_FIELD_H
-#define PURPLE_REQUEST_FIELD_H
+#ifndef PURPLE_REQUEST_FIELD_IMAGE_H
+#define PURPLE_REQUEST_FIELD_IMAGE_H
 
 #include <stdlib.h>
 
@@ -33,282 +33,19 @@
 #include <glib-object.h>
 
 /**
- * PurpleRequestField:
+ * PurpleRequestFieldImage:
  *
- * A request field.
+ * An image request field.
  */
-typedef struct _PurpleRequestField PurpleRequestField;
-
-#include "request.h"
-#include "request-datasheet.h"
-
-#define PURPLE_DEFAULT_ACTION_NONE	-1
-
-/**
- * PurpleRequestFieldClass:
- *
- * #PurpleRequestFieldClass defines the interface for a request field.
- *
- * Since: 3.0.0
- */
-struct _PurpleRequestFieldClass {
-	/*< private >*/
-	GObjectClass parent_class;
+typedef struct _PurpleRequestFieldImage PurpleRequestFieldImage;
 
-	/*< public >*/
-
-	/*< private >*/
-	gpointer reserved[4];
-};
-
-/**
- * PurpleRequestFieldType:
- * @PURPLE_REQUEST_FIELD_NONE: No field.
- * @PURPLE_REQUEST_FIELD_IMAGE: Image field.
- * @PURPLE_REQUEST_FIELD_DATASHEET: Datasheet field.
- *
- * A type of field.
- */
-typedef enum
-{
-	PURPLE_REQUEST_FIELD_NONE,
-	PURPLE_REQUEST_FIELD_IMAGE,
-	PURPLE_REQUEST_FIELD_DATASHEET
-
-} PurpleRequestFieldType;
-
-typedef gboolean (*PurpleRequestFieldValidator)(PurpleRequestField *field,
-	gchar **errmsg, gpointer user_data);
+#include "purplerequestfield.h"
 
 G_BEGIN_DECLS
 
-/**************************************************************************/
-/* Field API                                                              */
-/**************************************************************************/
-
-#define PURPLE_TYPE_REQUEST_FIELD (purple_request_field_get_type())
-G_DECLARE_DERIVABLE_TYPE(PurpleRequestField, purple_request_field,
-                         PURPLE, REQUEST_FIELD, GObject)
-
-/**
- * purple_request_field_new:
- * @id:   The field ID.
- * @text: The text label of the field.
- * @type: The type of field.
- *
- * Creates a field of the specified type.
- *
- * Returns: (transfer full): The new field.
- */
-PurpleRequestField *purple_request_field_new(const char *id, const char *text,
-										 PurpleRequestFieldType type);
-
-/**
- * purple_request_field_set_label:
- * @field: The field.
- * @label: The text label.
- *
- * Sets the label text of a field.
- */
-void purple_request_field_set_label(PurpleRequestField *field, const char *label);
-
-/**
- * purple_request_field_set_visible:
- * @field:   The field.
- * @visible: TRUE if visible, or FALSE if not.
- *
- * Sets whether or not a field is visible.
- */
-void purple_request_field_set_visible(PurpleRequestField *field, gboolean visible);
-
-/**
- * purple_request_field_set_type_hint:
- * @field:     The field.
- * @type_hint: The type hint.
- *
- * Sets the type hint for the field.
- *
- * This is optionally used by the UIs to provide such features as
- * auto-completion for type hints like "account" and "screenname".
- */
-void purple_request_field_set_type_hint(PurpleRequestField *field,
-									  const char *type_hint);
-
-/**
- * purple_request_field_set_tooltip:
- * @field:     The field.
- * @tooltip:   The tooltip text.
- *
- * Sets the tooltip for the field.
- *
- * This is optionally used by the UIs to provide a tooltip for
- * the field.
- */
-void purple_request_field_set_tooltip(PurpleRequestField *field,
-									const char *tooltip);
-
-/**
- * purple_request_field_set_required:
- * @field:    The field.
- * @required: TRUE if required, or FALSE.
- *
- * Sets whether or not a field is required.
- */
-void purple_request_field_set_required(PurpleRequestField *field,
-									 gboolean required);
-
-/**
- * purple_request_field_get_field_type:
- * @field: The field.
- *
- * Returns the type of a field.
- *
- * Returns: The field's type.
- */
-PurpleRequestFieldType purple_request_field_get_field_type(PurpleRequestField *field);
-
-/**
- * purple_request_field_get_group:
- * @field: The field.
- *
- * Returns the group for the field.
- *
- * Returns: (transfer none): The UI data.
- */
-PurpleRequestGroup *purple_request_field_get_group(PurpleRequestField *field);
-
-/**
- * purple_request_field_get_id:
- * @field: The field.
- *
- * Returns the ID of a field.
- *
- * Returns: The ID
- */
-const char *purple_request_field_get_id(PurpleRequestField *field);
-
-/**
- * purple_request_field_get_label:
- * @field: The field.
- *
- * Returns the label text of a field.
- *
- * Returns: The label text.
- */
-const char *purple_request_field_get_label(PurpleRequestField *field);
-
-/**
- * purple_request_field_is_visible:
- * @field: The field.
- *
- * Returns whether or not a field is visible.
- *
- * Returns: TRUE if the field is visible. FALSE otherwise.
- */
-gboolean purple_request_field_is_visible(PurpleRequestField *field);
-
-/**
- * purple_request_field_get_type_hint:
- * @field: The field.
- *
- * Returns the field's type hint.
- *
- * Returns: The field's type hint.
- */
-const char *purple_request_field_get_type_hint(PurpleRequestField *field);
-
-/**
- * purple_request_field_get_tooltip:
- * @field: The field.
- *
- * Returns the field's tooltip.
- *
- * Returns: The field's tooltip.
- */
-const char *purple_request_field_get_tooltip(PurpleRequestField *field);
-
-/**
- * purple_request_field_is_required:
- * @field: The field.
- *
- * Returns whether or not a field is required.
- *
- * Returns: TRUE if the field is required, or FALSE.
- */
-gboolean purple_request_field_is_required(PurpleRequestField *field);
-
-/**
- * purple_request_field_is_filled:
- * @field: The field.
- *
- * Checks, if specified field has value.
- *
- * Returns: TRUE if the field has value, or FALSE.
- */
-gboolean purple_request_field_is_filled(PurpleRequestField *field);
-
-/**
- * purple_request_field_set_validator:
- * @field:     The field.
- * @validator: (scope notified): The validator callback, NULL to disable validation.
- * @user_data: The data to pass to the callback.
- *
- * Sets validator for a single field.
- */
-void purple_request_field_set_validator(PurpleRequestField *field,
-	PurpleRequestFieldValidator validator, void *user_data);
-
-/**
- * purple_request_field_is_validatable:
- * @field: The field.
- *
- * Returns whether or not field has validator set.
- *
- * Returns: TRUE if the field has validator, or FALSE.
- */
-gboolean purple_request_field_is_validatable(PurpleRequestField *field);
-
-/**
- * purple_request_field_is_valid:
- * @field:  The field.
- * @errmsg: If non-NULL, the memory area, where the pointer to validation
- *         failure message will be set.
- *
- * Checks, if specified field is valid.
- *
- * If detailed message about failure reason is needed, there is an option to
- * return (via errmsg argument) pointer to newly allocated error message.
- * It must be freed with g_free after use.
- *
- * Note: empty, not required fields are valid.
- *
- * Returns: TRUE, if the field is valid, FALSE otherwise.
- */
-gboolean purple_request_field_is_valid(PurpleRequestField *field, gchar **errmsg);
-
-/**
- * purple_request_field_set_sensitive:
- * @field:     The field.
- * @sensitive: TRUE if the field should be sensitive for user input.
- *
- * Sets field editable.
- */
-void purple_request_field_set_sensitive(PurpleRequestField *field,
-	gboolean sensitive);
-
-/**
- * purple_request_field_is_sensitive:
- * @field: The field.
- *
- * Checks, if field is editable.
- *
- * Returns: TRUE, if the field is sensitive for user input.
- */
-gboolean purple_request_field_is_sensitive(PurpleRequestField *field);
-
-/**************************************************************************/
-/* Image Field API                                                        */
-/**************************************************************************/
+#define PURPLE_TYPE_REQUEST_FIELD_IMAGE (purple_request_field_image_get_type())
+G_DECLARE_FINAL_TYPE(PurpleRequestFieldImage, purple_request_field_image,
+                     PURPLE, REQUEST_FIELD_IMAGE, PurpleRequestField)
 
 /**
  * purple_request_field_image_new:
@@ -321,8 +58,7 @@ gboolean purple_request_field_is_sensiti
  *
  * Returns: (transfer full): The new field.
  */
-PurpleRequestField *purple_request_field_image_new(const char *id, const char *text,
-											   const char *buf, gsize size);
+PurpleRequestField *purple_request_field_image_new(const char *id, const char *text, const char *buf, gsize size);
 
 /**
  * purple_request_field_image_set_scale:
@@ -332,7 +68,7 @@ PurpleRequestField *purple_request_field
  *
  * Sets the scale factors of an image field.
  */
-void purple_request_field_image_set_scale(PurpleRequestField *field, unsigned int x, unsigned int y);
+void purple_request_field_image_set_scale(PurpleRequestFieldImage *field, unsigned int x, unsigned int y);
 
 /**
  * purple_request_field_image_get_buffer:
@@ -342,7 +78,7 @@ void purple_request_field_image_set_scal
  *
  * Returns: Pointer to the image.
  */
-const char *purple_request_field_image_get_buffer(PurpleRequestField *field);
+const char *purple_request_field_image_get_buffer(PurpleRequestFieldImage *field);
 
 /**
  * purple_request_field_image_get_size:
@@ -352,7 +88,7 @@ const char *purple_request_field_image_g
  *
  * Returns: Size of the image.
  */
-gsize purple_request_field_image_get_size(PurpleRequestField *field);
+gsize purple_request_field_image_get_size(PurpleRequestFieldImage *field);
 
 /**
  * purple_request_field_image_get_scale_x:
@@ -362,7 +98,7 @@ gsize purple_request_field_image_get_siz
  *
  * Returns: X scale coefficient of the image.
  */
-unsigned int purple_request_field_image_get_scale_x(PurpleRequestField *field);
+unsigned int purple_request_field_image_get_scale_x(PurpleRequestFieldImage *field);
 
 /**
  * purple_request_field_image_get_scale_y:
@@ -372,71 +108,8 @@ unsigned int purple_request_field_image_
  *
  * Returns: Y scale coefficient of the image.
  */
-unsigned int purple_request_field_image_get_scale_y(PurpleRequestField *field);
-
-/**************************************************************************/
-/* Datasheet Field API                                                    */
-/**************************************************************************/
-
-/**
- * purple_request_field_datasheet_new:
- * @id:    The field ID.
- * @text:  The label of the field, may be %NULL.
- * @sheet: The datasheet.
- *
- * Creates a datasheet item field.
- *
- * Returns: (transfer full): The new field.
- */
-PurpleRequestField *purple_request_field_datasheet_new(const char *id,
-	const gchar *text, PurpleRequestDatasheet *sheet);
-
-/**
- * purple_request_field_datasheet_get_sheet:
- * @field: The field.
- *
- * Returns a datasheet for a field.
- *
- * Returns: (transfer none): The datasheet object.
- */
-PurpleRequestDatasheet *purple_request_field_datasheet_get_sheet(
-	PurpleRequestField *field);
-
-/**************************************************************************/
-/* Validators for request fields.                                         */
-/**************************************************************************/
-
-/**
- * purple_request_field_email_validator:
- * @field: The field.
- * @errmsg: (out) (optional): destination for error message.
- * @user_data: Ignored.
- *
- * Validates a field which should contain an email address.
- *
- * See purple_request_field_set_validator().
- *
- * Returns: TRUE, if field contains valid email address.
- */
-gboolean purple_request_field_email_validator(PurpleRequestField *field,
-	gchar **errmsg, void *user_data);
-
-/**
- * purple_request_field_alphanumeric_validator:
- * @field: The field.
- * @errmsg: (allow-none): destination for error message.
- * @allowed_characters: (allow-none): allowed character list
- *                      (NULL-terminated string).
- *
- * Validates a field which should contain alphanumeric content.
- *
- * See purple_request_field_set_validator().
- *
- * Returns: TRUE, if field contains only alphanumeric characters.
- */
-gboolean purple_request_field_alphanumeric_validator(PurpleRequestField *field,
-	gchar **errmsg, void *allowed_characters);
+unsigned int purple_request_field_image_get_scale_y(PurpleRequestFieldImage *field);
 
 G_END_DECLS
 
-#endif /* PURPLE_REQUEST_FIELD_H */
+#endif /* PURPLE_REQUEST_FIELD_IMAGE_H */
diff --git a/libpurple/purplerequestfield.c b/libpurple/purplerequestfield.c
--- a/libpurple/purplerequestfield.c
+++ b/libpurple/purplerequestfield.c
@@ -42,13 +42,6 @@ typedef struct {
 
 	union {
 		struct {
-			unsigned int scale_x;
-			unsigned int scale_y;
-			char *buffer;
-			gsize size;
-		} image;
-
-		struct {
 			PurpleRequestDatasheet *sheet;
 		} datasheet;
 	} u;
@@ -198,8 +191,6 @@ purple_request_field_finalize(GObject *o
 
 	if(priv->type == PURPLE_REQUEST_FIELD_DATASHEET) {
 		purple_request_datasheet_free(priv->u.datasheet.sheet);
-	} else if(priv->type == PURPLE_REQUEST_FIELD_IMAGE) {
-		g_free(priv->u.image.buffer);
 	}
 
 	G_OBJECT_CLASS(purple_request_field_parent_class)->finalize(obj);
@@ -635,95 +626,6 @@ purple_request_field_is_sensitive(Purple
 }
 
 PurpleRequestField *
-purple_request_field_image_new(const char *id, const char *text, const char *buf, gsize size)
-{
-	PurpleRequestField *field;
-
-	PurpleRequestFieldPrivate *priv = NULL;
-
-	g_return_val_if_fail(id   != NULL, NULL);
-	g_return_val_if_fail(text != NULL, NULL);
-	g_return_val_if_fail(buf  != NULL, NULL);
-	g_return_val_if_fail(size > 0, NULL);
-
-	field = purple_request_field_new(id, text, PURPLE_REQUEST_FIELD_IMAGE);
-	priv = purple_request_field_get_instance_private(field);
-
-	priv->u.image.buffer = g_memdup2(buf, size);
-	priv->u.image.size = size;
-	priv->u.image.scale_x = 1;
-	priv->u.image.scale_y = 1;
-
-	return field;
-}
-
-void
-purple_request_field_image_set_scale(PurpleRequestField *field, unsigned int x, unsigned int y)
-{
-	PurpleRequestFieldPrivate *priv = NULL;
-
-	g_return_if_fail(PURPLE_IS_REQUEST_FIELD(field));
-
-	priv = purple_request_field_get_instance_private(field);
-	g_return_if_fail(priv->type == PURPLE_REQUEST_FIELD_IMAGE);
-
-	priv->u.image.scale_x = x;
-	priv->u.image.scale_y = y;
-}
-
-const char *
-purple_request_field_image_get_buffer(PurpleRequestField *field)
-{
-	PurpleRequestFieldPrivate *priv = NULL;
-
-	g_return_val_if_fail(PURPLE_IS_REQUEST_FIELD(field), NULL);
-
-	priv = purple_request_field_get_instance_private(field);
-	g_return_val_if_fail(priv->type == PURPLE_REQUEST_FIELD_IMAGE, NULL);
-
-	return priv->u.image.buffer;
-}
-
-gsize
-purple_request_field_image_get_size(PurpleRequestField *field)
-{
-	PurpleRequestFieldPrivate *priv = NULL;
-
-	g_return_val_if_fail(PURPLE_IS_REQUEST_FIELD(field), 0);
-
-	priv = purple_request_field_get_instance_private(field);
-	g_return_val_if_fail(priv->type == PURPLE_REQUEST_FIELD_IMAGE, 0);
-
-	return priv->u.image.size;
-}
-
-unsigned int
-purple_request_field_image_get_scale_x(PurpleRequestField *field)
-{
-	PurpleRequestFieldPrivate *priv = NULL;
-
-	g_return_val_if_fail(PURPLE_IS_REQUEST_FIELD(field), 0);
-
-	priv = purple_request_field_get_instance_private(field);
-	g_return_val_if_fail(priv->type == PURPLE_REQUEST_FIELD_IMAGE, 0);
-
-	return priv->u.image.scale_x;
-}
-
-unsigned int
-purple_request_field_image_get_scale_y(PurpleRequestField *field)
-{
-	PurpleRequestFieldPrivate *priv = NULL;
-
-	g_return_val_if_fail(PURPLE_IS_REQUEST_FIELD(field), 0);
-
-	priv = purple_request_field_get_instance_private(field);
-	g_return_val_if_fail(priv->type == PURPLE_REQUEST_FIELD_IMAGE, 0);
-
-	return priv->u.image.scale_y;
-}
-
-PurpleRequestField *
 purple_request_field_datasheet_new(const char *id,
 	const gchar *text, PurpleRequestDatasheet *sheet)
 {
diff --git a/libpurple/purplerequestfield.c b/libpurple/request/purplerequestfieldimage.c
copy from libpurple/purplerequestfield.c
copy to libpurple/request/purplerequestfieldimage.c
--- a/libpurple/purplerequestfield.c
+++ b/libpurple/request/purplerequestfieldimage.c
@@ -22,123 +22,56 @@
 #include <glib/gi18n-lib.h>
 
 #include "glibcompat.h"
-#include "request.h"
-#include "request/purplerequestfieldstring.h"
-#include "debug.h"
-#include "purplekeyvaluepair.h"
-#include "purpleprivate.h"
+#include "purplerequestfield.h"
+#include "purplerequestfieldimage.h"
 
-typedef struct {
-	PurpleRequestFieldType type;
-	PurpleRequestGroup *group;
-
-	char *id;
-	char *label;
-	char *type_hint;
-
-	gboolean visible;
-	gboolean required;
-	gboolean sensitive;
+struct _PurpleRequestFieldImage {
+	PurpleRequestField parent;
 
-	union {
-		struct {
-			unsigned int scale_x;
-			unsigned int scale_y;
-			char *buffer;
-			gsize size;
-		} image;
-
-		struct {
-			PurpleRequestDatasheet *sheet;
-		} datasheet;
-	} u;
-
-	void *ui_data;
-	char *tooltip;
-
-	PurpleRequestFieldValidator validator;
-	void *validator_data;
-} PurpleRequestFieldPrivate;
+	unsigned int scale_x;
+	unsigned int scale_y;
+	char *buffer;
+	gsize size;
+};
 
 enum {
 	PROP_0,
-	PROP_ID,
-	PROP_LABEL,
-	PROP_VISIBLE,
-	PROP_SENSITIVE,
-	PROP_TYPE_HINT,
-	PROP_TOOLTIP,
-	PROP_REQUIRED,
-	PROP_IS_VALIDATABLE,
+	PROP_SCALE_X,
+	PROP_SCALE_Y,
+	PROP_BUFFER,
+	PROP_SIZE,
 	N_PROPERTIES,
 };
 static GParamSpec *properties[N_PROPERTIES] = {NULL, };
 
-G_DEFINE_TYPE_WITH_PRIVATE(PurpleRequestField, purple_request_field, G_TYPE_OBJECT)
-
-/******************************************************************************
- * Helpers
- *****************************************************************************/
-static void
-purple_request_field_set_id(PurpleRequestField *field, const char *id) {
-	PurpleRequestFieldPrivate *priv = NULL;
-
-	priv = purple_request_field_get_instance_private(field);
-
-	g_free(priv->id);
-	priv->id = g_strdup(id);
-
-	g_object_notify_by_pspec(G_OBJECT(field), properties[PROP_ID]);
-}
-
-static void
-purple_request_field_set_field_type(PurpleRequestField *field,
-                                    PurpleRequestFieldType type)
-{
-	PurpleRequestFieldPrivate *priv = NULL;
-
-	priv = purple_request_field_get_instance_private(field);
-
-	priv->type = type;
-}
+G_DEFINE_TYPE(PurpleRequestFieldImage, purple_request_field_image,
+              PURPLE_TYPE_REQUEST_FIELD)
 
 /******************************************************************************
  * GObject Implementation
  *****************************************************************************/
 static void
-purple_request_field_get_property(GObject *obj, guint param_id, GValue *value,
-                                  GParamSpec *pspec)
+purple_request_field_image_get_property(GObject *obj, guint param_id,
+                                        GValue *value, GParamSpec *pspec)
 {
-	PurpleRequestField *field = PURPLE_REQUEST_FIELD(obj);
+	PurpleRequestFieldImage *field = PURPLE_REQUEST_FIELD_IMAGE(obj);
 
 	switch(param_id) {
-		case PROP_ID:
-			g_value_set_string(value, purple_request_field_get_id(field));
-			break;
-		case PROP_LABEL:
-			g_value_set_string(value, purple_request_field_get_label(field));
+		case PROP_SCALE_X:
+			g_value_set_uint(value,
+			                 purple_request_field_image_get_scale_x(field));
 			break;
-		case PROP_VISIBLE:
-			g_value_set_boolean(value, purple_request_field_is_visible(field));
-			break;
-		case PROP_SENSITIVE:
-			g_value_set_boolean(value,
-			                    purple_request_field_is_sensitive(field));
+		case PROP_SCALE_Y:
+			g_value_set_uint(value,
+			                 purple_request_field_image_get_scale_y(field));
 			break;
-		case PROP_TYPE_HINT:
-			g_value_set_string(value,
-			                   purple_request_field_get_type_hint(field));
-			break;
-		case PROP_TOOLTIP:
-			g_value_set_string(value, purple_request_field_get_tooltip(field));
+		case PROP_BUFFER:
+			g_value_set_pointer(value,
+			                    (gpointer)purple_request_field_image_get_buffer(field));
 			break;
-		case PROP_REQUIRED:
-			g_value_set_boolean(value,
-			                    purple_request_field_is_required(field));
-			break;
-		case PROP_IS_VALIDATABLE:
-			g_value_set_boolean(value,
-			                    purple_request_field_is_validatable(field));
+		case PROP_SIZE:
+			g_value_set_uint64(value,
+			                   purple_request_field_image_get_size(field));
 			break;
 		default:
 			G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
@@ -147,36 +80,20 @@ purple_request_field_get_property(GObjec
 }
 
 static void
-purple_request_field_set_property(GObject *obj, guint param_id,
-                                  const GValue *value, GParamSpec *pspec)
+purple_request_field_image_set_property(GObject *obj, guint param_id,
+                                        const GValue *value, GParamSpec *pspec)
 {
-	PurpleRequestField *field = PURPLE_REQUEST_FIELD(obj);
+	PurpleRequestFieldImage *field = PURPLE_REQUEST_FIELD_IMAGE(obj);
 
 	switch(param_id) {
-		case PROP_ID:
-			purple_request_field_set_id(field, g_value_get_string(value));
-			break;
-		case PROP_LABEL:
-			purple_request_field_set_label(field, g_value_get_string(value));
-			break;
-		case PROP_VISIBLE:
-			purple_request_field_set_visible(field,
-			                                 g_value_get_boolean(value));
+		case PROP_SCALE_X:
+			purple_request_field_image_set_scale(field,
+			                                     g_value_get_uint(value),
+			                                     field->scale_y);
 			break;
-		case PROP_SENSITIVE:
-			purple_request_field_set_sensitive(field,
-			                                   g_value_get_boolean(value));
-			break;
-		case PROP_TYPE_HINT:
-			purple_request_field_set_type_hint(field,
-			                                   g_value_get_string(value));
-			break;
-		case PROP_TOOLTIP:
-			purple_request_field_set_tooltip(field, g_value_get_string(value));
-			break;
-		case PROP_REQUIRED:
-			purple_request_field_set_required(field,
-			                                  g_value_get_boolean(value));
+		case PROP_SCALE_Y:
+			purple_request_field_image_set_scale(field, field->scale_x,
+			                                     g_value_get_uint(value));
 			break;
 		default:
 			G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
@@ -185,146 +102,77 @@ purple_request_field_set_property(GObjec
 }
 
 static void
-purple_request_field_finalize(GObject *obj) {
-	PurpleRequestField *field = PURPLE_REQUEST_FIELD(obj);
-	PurpleRequestFieldPrivate *priv = NULL;
-
-	priv = purple_request_field_get_instance_private(field);
+purple_request_field_image_finalize(GObject *obj) {
+	PurpleRequestFieldImage *field = PURPLE_REQUEST_FIELD_IMAGE(obj);
 
-	g_free(priv->id);
-	g_free(priv->label);
-	g_free(priv->type_hint);
-	g_free(priv->tooltip);
+	g_free(field->buffer);
 
-	if(priv->type == PURPLE_REQUEST_FIELD_DATASHEET) {
-		purple_request_datasheet_free(priv->u.datasheet.sheet);
-	} else if(priv->type == PURPLE_REQUEST_FIELD_IMAGE) {
-		g_free(priv->u.image.buffer);
-	}
-
-	G_OBJECT_CLASS(purple_request_field_parent_class)->finalize(obj);
+	G_OBJECT_CLASS(purple_request_field_image_parent_class)->finalize(obj);
 }
 
 static void
-purple_request_field_init(PurpleRequestField *field) {
-	PurpleRequestFieldPrivate *priv = NULL;
-
-	priv = purple_request_field_get_instance_private(field);
-
-	priv->visible = TRUE;
-	priv->sensitive = TRUE;
+purple_request_field_image_init(PurpleRequestFieldImage *field) {
+	field->scale_x = 1;
+	field->scale_y = 1;
 }
 
 static void
-purple_request_field_class_init(PurpleRequestFieldClass *klass) {
+purple_request_field_image_class_init(PurpleRequestFieldImageClass *klass) {
 	GObjectClass *obj_class = G_OBJECT_CLASS(klass);
 
-	obj_class->finalize = purple_request_field_finalize;
-	obj_class->get_property = purple_request_field_get_property;
-	obj_class->set_property = purple_request_field_set_property;
+	obj_class->finalize = purple_request_field_image_finalize;
+	obj_class->get_property = purple_request_field_image_get_property;
+	obj_class->set_property = purple_request_field_image_set_property;
 
 	/**
-	 * PurpleRequestField:id:
+	 * PurpleRequestFieldImage:scale-x:
 	 *
-	 * The ID of the field.
+	 * The X scale coefficient of the image.
 	 *
 	 * Since: 3.0.0
 	 */
-	properties[PROP_ID] = g_param_spec_string(
-		"id", "id",
-		"The ID of the field.",
-		NULL,
-		G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
-
-	/**
-	 * PurpleRequestField:label:
-	 *
-	 * The label of the field.
-	 *
-	 * Since: 3.0.0
-	 */
-	properties[PROP_LABEL] = g_param_spec_string(
-		"label", "label",
-		"The label of the field.",
-		NULL,
+	properties[PROP_SCALE_X] = g_param_spec_uint(
+		"scale-x", "scale-x",
+		"The X scale coefficient of the image.",
+		1, G_MAXUINT, 1,
 		G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
 
 	/**
-	 * PurpleRequestField:visible:
-	 *
-	 * Whether the field should be visible.
-	 *
-	 * Since: 3.0.0
-	 */
-	properties[PROP_VISIBLE] = g_param_spec_boolean(
-		"visible", "visible",
-		"Whether the field should be visible.",
-		TRUE,
-		G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
-	/**
-	 * PurpleRequestField:sensitive:
+	 * PurpleRequestFieldImage:scale-y:
 	 *
-	 * Whether the field should be sensitive.
-	 *
-	 * Since: 3.0.0
-	 */
-	properties[PROP_SENSITIVE] = g_param_spec_boolean(
-		"sensitive", "sensitive",
-		"Whether the field should be sensitive.",
-		TRUE,
-		G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
-	/**
-	 * PurpleRequestField:type-hint:
-	 *
-	 * The type hint of the field.
+	 * The Y scale coefficient of the image.
 	 *
 	 * Since: 3.0.0
 	 */
-	properties[PROP_TYPE_HINT] = g_param_spec_string(
-		"type-hint", "type-hint",
-		"The type hint of the field.",
-		NULL,
-		G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
-	/**
-	 * PurpleRequestField:tooltip:
-	 *
-	 * The tooltip of the field.
-	 *
-	 * Since: 3.0.0
-	 */
-	properties[PROP_TOOLTIP] = g_param_spec_string(
-		"tooltip", "tooltip",
-		"The tooltip of the field.",
-		NULL,
+	properties[PROP_SCALE_Y] = g_param_spec_uint(
+		"scale-y", "scale-y",
+		"The Y scale coefficient of the image.",
+		1, G_MAXUINT, 1,
 		G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
 
 	/**
-	 * PurpleRequestField:required:
+	 * PurpleRequestFieldImage:buffer:
 	 *
-	 * Whether the field is required to complete the request.
+	 * The contents of the image.
 	 *
 	 * Since: 3.0.0
 	 */
-	properties[PROP_REQUIRED] = g_param_spec_boolean(
-		"required", "required",
-		"Whether the field is required to complete the request.",
-		FALSE,
-		G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+	properties[PROP_BUFFER] = g_param_spec_pointer(
+		"buffer", "buffer",
+		"The contents of the image.",
+		G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
 
 	/**
-	 * PurpleRequestField:is-validatable:
+	 * PurpleRequestFieldImage:size:
 	 *
-	 * Whether the field can be validated by the requestor.
+	 * The size in bytes of the image.
 	 *
 	 * Since: 3.0.0
 	 */
-	properties[PROP_IS_VALIDATABLE] = g_param_spec_boolean(
-		"is-validatable", "is-validatable",
-		"Whether the field can be validated by the requestor.",
-		FALSE,
+	properties[PROP_SIZE] = g_param_spec_uint64(
+		"size", "size",
+		"The size in bytes of the image.",
+		0, G_MAXSIZE, 0,
 		G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
 
 	g_object_class_install_properties(obj_class, N_PROPERTIES, properties);
@@ -334,422 +182,74 @@ purple_request_field_class_init(PurpleRe
  * Public API
  *****************************************************************************/
 PurpleRequestField *
-purple_request_field_new(const char *id, const char *text,
-                         PurpleRequestFieldType type)
-{
-	PurpleRequestField *field;
-
-	g_return_val_if_fail(id != NULL, NULL);
-	g_return_val_if_fail(type != PURPLE_REQUEST_FIELD_NONE, NULL);
-
-	field = g_object_new(PURPLE_TYPE_REQUEST_FIELD,
-	                     "id", id,
-	                     "label", text,
-	                     NULL);
-	purple_request_field_set_field_type(field, type);
-
-	return field;
-}
-
-void
-_purple_request_field_set_group(PurpleRequestField *field,
-                                PurpleRequestGroup *group)
-{
-	PurpleRequestFieldPrivate *priv = NULL;
-
-	g_return_if_fail(PURPLE_IS_REQUEST_FIELD(field));
-
-	priv = purple_request_field_get_instance_private(field);
-
-	priv->group = group;
-}
-
-void
-purple_request_field_set_label(PurpleRequestField *field, const char *label)
-{
-	PurpleRequestFieldPrivate *priv = NULL;
-
-	g_return_if_fail(PURPLE_IS_REQUEST_FIELD(field));
-
-	priv = purple_request_field_get_instance_private(field);
-
-	g_free(priv->label);
-	priv->label = g_strdup(label);
-
-	g_object_notify_by_pspec(G_OBJECT(field), properties[PROP_LABEL]);
-}
-
-void
-purple_request_field_set_visible(PurpleRequestField *field, gboolean visible)
-{
-	PurpleRequestFieldPrivate *priv = NULL;
-
-	g_return_if_fail(PURPLE_IS_REQUEST_FIELD(field));
-
-	priv = purple_request_field_get_instance_private(field);
-
-	priv->visible = visible;
-
-	g_object_notify_by_pspec(G_OBJECT(field), properties[PROP_VISIBLE]);
-}
-
-void
-purple_request_field_set_type_hint(PurpleRequestField *field,
-								 const char *type_hint)
-{
-	PurpleRequestFieldPrivate *priv = NULL;
-
-	g_return_if_fail(PURPLE_IS_REQUEST_FIELD(field));
-
-	priv = purple_request_field_get_instance_private(field);
-
-	g_free(priv->type_hint);
-	priv->type_hint = g_strdup(type_hint);
-
-	g_object_notify_by_pspec(G_OBJECT(field), properties[PROP_TYPE_HINT]);
-}
-
-void
-purple_request_field_set_tooltip(PurpleRequestField *field, const char *tooltip)
-{
-	PurpleRequestFieldPrivate *priv = NULL;
-
-	g_return_if_fail(PURPLE_IS_REQUEST_FIELD(field));
-
-	priv = purple_request_field_get_instance_private(field);
-
-	g_free(priv->tooltip);
-	priv->tooltip = g_strdup(tooltip);
-
-	g_object_notify_by_pspec(G_OBJECT(field), properties[PROP_TOOLTIP]);
-}
-
-void
-purple_request_field_set_required(PurpleRequestField *field, gboolean required)
+purple_request_field_image_new(const char *id, const char *text,
+                               const char *buf, gsize size)
 {
-	PurpleRequestFieldPrivate *priv = NULL;
-
-	g_return_if_fail(PURPLE_IS_REQUEST_FIELD(field));
-
-	priv = purple_request_field_get_instance_private(field);
-
-	if(priv->required == required) {
-		return;
-	}
-
-	priv->required = required;
-
-	if(PURPLE_IS_REQUEST_GROUP(priv->group)) {
-		_purple_request_group_set_field_required(priv->group, field,
-		                                         required);
-	}
-
-	g_object_notify_by_pspec(G_OBJECT(field), properties[PROP_REQUIRED]);
-}
-
-PurpleRequestFieldType
-purple_request_field_get_field_type(PurpleRequestField *field) {
-	PurpleRequestFieldPrivate *priv = NULL;
-
-	g_return_val_if_fail(PURPLE_IS_REQUEST_FIELD(field),
-	                     PURPLE_REQUEST_FIELD_NONE);
-
-	priv = purple_request_field_get_instance_private(field);
-
-	return priv->type;
-}
-
-PurpleRequestGroup *
-purple_request_field_get_group(PurpleRequestField *field) {
-	PurpleRequestFieldPrivate *priv = NULL;
-
-	g_return_val_if_fail(PURPLE_IS_REQUEST_FIELD(field), NULL);
-
-	priv = purple_request_field_get_instance_private(field);
-
-	return priv->group;
-}
-
-const char *
-purple_request_field_get_id(PurpleRequestField *field) {
-	PurpleRequestFieldPrivate *priv = NULL;
-
-	g_return_val_if_fail(PURPLE_IS_REQUEST_FIELD(field), NULL);
-
-	priv = purple_request_field_get_instance_private(field);
-
-	return priv->id;
-}
-
-const char *
-purple_request_field_get_label(PurpleRequestField *field) {
-	PurpleRequestFieldPrivate *priv = NULL;
-
-	g_return_val_if_fail(PURPLE_IS_REQUEST_FIELD(field), NULL);
-
-	priv = purple_request_field_get_instance_private(field);
-
-	return priv->label;
-}
-
-gboolean
-purple_request_field_is_visible(PurpleRequestField *field) {
-	PurpleRequestFieldPrivate *priv = NULL;
-
-	g_return_val_if_fail(PURPLE_IS_REQUEST_FIELD(field), FALSE);
-
-	priv = purple_request_field_get_instance_private(field);
-
-	return priv->visible;
-}
-
-const char *
-purple_request_field_get_type_hint(PurpleRequestField *field) {
-	PurpleRequestFieldPrivate *priv = NULL;
-
-	g_return_val_if_fail(PURPLE_IS_REQUEST_FIELD(field), NULL);
-
-	priv = purple_request_field_get_instance_private(field);
-
-	return priv->type_hint;
-}
-
-const char *
-purple_request_field_get_tooltip(PurpleRequestField *field) {
-	PurpleRequestFieldPrivate *priv = NULL;
-
-	g_return_val_if_fail(PURPLE_IS_REQUEST_FIELD(field), NULL);
-
-	priv = purple_request_field_get_instance_private(field);
-
-	return priv->tooltip;
-}
-
-gboolean
-purple_request_field_is_required(PurpleRequestField *field) {
-	PurpleRequestFieldPrivate *priv = NULL;
-
-	g_return_val_if_fail(PURPLE_IS_REQUEST_FIELD(field), FALSE);
-
-	priv = purple_request_field_get_instance_private(field);
-
-	return priv->required;
-}
-
-gboolean
-purple_request_field_is_filled(PurpleRequestField *field) {
-	g_return_val_if_fail(PURPLE_IS_REQUEST_FIELD(field), FALSE);
-
-	if(PURPLE_IS_REQUEST_FIELD_STRING(field)) {
-		PurpleRequestFieldString *sfield = PURPLE_REQUEST_FIELD_STRING(field);
-		return !purple_strempty(purple_request_field_string_get_value(sfield));
-	}
-
-	return TRUE;
-}
-
-void
-purple_request_field_set_validator(PurpleRequestField *field,
-	PurpleRequestFieldValidator validator, void *user_data)
-{
-	PurpleRequestFieldPrivate *priv = NULL;
-
-	g_return_if_fail(PURPLE_IS_REQUEST_FIELD(field));
-
-	priv = purple_request_field_get_instance_private(field);
-
-	priv->validator = validator;
-	priv->validator_data = validator ? user_data : NULL;
-
-	if(PURPLE_IS_REQUEST_GROUP(priv->group)) {
-		_purple_request_group_set_field_validator(priv->group, field,
-		                                          validator != NULL);
-	}
-
-	g_object_notify_by_pspec(G_OBJECT(field), properties[PROP_IS_VALIDATABLE]);
-}
-
-gboolean
-purple_request_field_is_validatable(PurpleRequestField *field)
-{
-	PurpleRequestFieldPrivate *priv = NULL;
-
-	g_return_val_if_fail(PURPLE_IS_REQUEST_FIELD(field), FALSE);
-
-	priv = purple_request_field_get_instance_private(field);
-
-	return priv->validator != NULL;
-}
-
-gboolean
-purple_request_field_is_valid(PurpleRequestField *field, gchar **errmsg)
-{
-	PurpleRequestFieldPrivate *priv = NULL;
-	gboolean valid;
-
-	g_return_val_if_fail(PURPLE_IS_REQUEST_FIELD(field), FALSE);
-
-	priv = purple_request_field_get_instance_private(field);
-
-	if(!priv->validator) {
-		return TRUE;
-	}
-
-	if (!purple_request_field_is_required(field) &&
-		!purple_request_field_is_filled(field))
-		return TRUE;
-
-	valid = priv->validator(field, errmsg, priv->validator_data);
-
-	if (valid && errmsg)
-		*errmsg = NULL;
-
-	return valid;
-}
-
-void
-purple_request_field_set_sensitive(PurpleRequestField *field,
-	gboolean sensitive)
-{
-	PurpleRequestFieldPrivate *priv = NULL;
-
-	g_return_if_fail(PURPLE_IS_REQUEST_FIELD(field));
-
-	priv = purple_request_field_get_instance_private(field);
-
-	priv->sensitive = sensitive;
-
-	g_object_notify_by_pspec(G_OBJECT(field), properties[PROP_SENSITIVE]);
-}
-
-gboolean
-purple_request_field_is_sensitive(PurpleRequestField *field)
-{
-	PurpleRequestFieldPrivate *priv = NULL;
-
-	g_return_val_if_fail(PURPLE_IS_REQUEST_FIELD(field), FALSE);
-
-	priv = purple_request_field_get_instance_private(field);
-
-	return priv->sensitive;
-}
-
-PurpleRequestField *
-purple_request_field_image_new(const char *id, const char *text, const char *buf, gsize size)
-{
-	PurpleRequestField *field;
-
-	PurpleRequestFieldPrivate *priv = NULL;
+	PurpleRequestFieldImage *field;
 
 	g_return_val_if_fail(id   != NULL, NULL);
 	g_return_val_if_fail(text != NULL, NULL);
 	g_return_val_if_fail(buf  != NULL, NULL);
 	g_return_val_if_fail(size > 0, NULL);
 
-	field = purple_request_field_new(id, text, PURPLE_REQUEST_FIELD_IMAGE);
-	priv = purple_request_field_get_instance_private(field);
+	field = g_object_new(PURPLE_TYPE_REQUEST_FIELD_IMAGE,
+	                     "id", id,
+	                     "label", text,
+	                     NULL);
 
-	priv->u.image.buffer = g_memdup2(buf, size);
-	priv->u.image.size = size;
-	priv->u.image.scale_x = 1;
-	priv->u.image.scale_y = 1;
+	field->buffer = g_memdup2(buf, size);
+	field->size = size;
 
-	return field;
+	return PURPLE_REQUEST_FIELD(field);
 }
 
 void
-purple_request_field_image_set_scale(PurpleRequestField *field, unsigned int x, unsigned int y)
+purple_request_field_image_set_scale(PurpleRequestFieldImage *field,
+                                     unsigned int x, unsigned int y)
 {
-	PurpleRequestFieldPrivate *priv = NULL;
-
-	g_return_if_fail(PURPLE_IS_REQUEST_FIELD(field));
+	g_return_if_fail(PURPLE_IS_REQUEST_FIELD_IMAGE(field));
 
-	priv = purple_request_field_get_instance_private(field);
-	g_return_if_fail(priv->type == PURPLE_REQUEST_FIELD_IMAGE);
+	if(field->scale_x == x && field->scale_y == y) {
+		return;
+	}
 
-	priv->u.image.scale_x = x;
-	priv->u.image.scale_y = y;
+	field->scale_x = x;
+	field->scale_y = y;
+
+	g_object_freeze_notify(G_OBJECT(field));
+	g_object_notify_by_pspec(G_OBJECT(field), properties[PROP_SCALE_X]);
+	g_object_notify_by_pspec(G_OBJECT(field), properties[PROP_SCALE_Y]);
+	g_object_thaw_notify(G_OBJECT(field));
 }
 
 const char *
-purple_request_field_image_get_buffer(PurpleRequestField *field)
+purple_request_field_image_get_buffer(PurpleRequestFieldImage *field)
 {
-	PurpleRequestFieldPrivate *priv = NULL;
+	g_return_val_if_fail(PURPLE_IS_REQUEST_FIELD_IMAGE(field), NULL);
 
-	g_return_val_if_fail(PURPLE_IS_REQUEST_FIELD(field), NULL);
-
-	priv = purple_request_field_get_instance_private(field);
-	g_return_val_if_fail(priv->type == PURPLE_REQUEST_FIELD_IMAGE, NULL);
-
-	return priv->u.image.buffer;
+	return field->buffer;
 }
 
 gsize
-purple_request_field_image_get_size(PurpleRequestField *field)
+purple_request_field_image_get_size(PurpleRequestFieldImage *field)
 {
-	PurpleRequestFieldPrivate *priv = NULL;
+	g_return_val_if_fail(PURPLE_IS_REQUEST_FIELD_IMAGE(field), 0);
 
-	g_return_val_if_fail(PURPLE_IS_REQUEST_FIELD(field), 0);
-
-	priv = purple_request_field_get_instance_private(field);
-	g_return_val_if_fail(priv->type == PURPLE_REQUEST_FIELD_IMAGE, 0);
-
-	return priv->u.image.size;
+	return field->size;
 }
 
 unsigned int
-purple_request_field_image_get_scale_x(PurpleRequestField *field)
+purple_request_field_image_get_scale_x(PurpleRequestFieldImage *field)
 {
-	PurpleRequestFieldPrivate *priv = NULL;
+	g_return_val_if_fail(PURPLE_IS_REQUEST_FIELD_IMAGE(field), 0);
 
-	g_return_val_if_fail(PURPLE_IS_REQUEST_FIELD(field), 0);
-
-	priv = purple_request_field_get_instance_private(field);
-	g_return_val_if_fail(priv->type == PURPLE_REQUEST_FIELD_IMAGE, 0);
-
-	return priv->u.image.scale_x;
+	return field->scale_x;
 }
 
 unsigned int
-purple_request_field_image_get_scale_y(PurpleRequestField *field)
+purple_request_field_image_get_scale_y(PurpleRequestFieldImage *field)
 {
-	PurpleRequestFieldPrivate *priv = NULL;
-
-	g_return_val_if_fail(PURPLE_IS_REQUEST_FIELD(field), 0);
-
-	priv = purple_request_field_get_instance_private(field);
-	g_return_val_if_fail(priv->type == PURPLE_REQUEST_FIELD_IMAGE, 0);
-
-	return priv->u.image.scale_y;
-}
-
-PurpleRequestField *
-purple_request_field_datasheet_new(const char *id,
-	const gchar *text, PurpleRequestDatasheet *sheet)
-{
-	PurpleRequestField *field;
-	PurpleRequestFieldPrivate *priv = NULL;
+	g_return_val_if_fail(PURPLE_IS_REQUEST_FIELD_IMAGE(field), 0);
 
-	g_return_val_if_fail(id != NULL, NULL);
-	g_return_val_if_fail(sheet != NULL, NULL);
-
-	field = purple_request_field_new(id, text, PURPLE_REQUEST_FIELD_DATASHEET);
-	priv = purple_request_field_get_instance_private(field);
-
-	priv->u.datasheet.sheet = sheet;
-
-	return field;
+	return field->scale_y;
 }
-
-PurpleRequestDatasheet *
-purple_request_field_datasheet_get_sheet(PurpleRequestField *field)
-{
-	PurpleRequestFieldPrivate *priv = NULL;
-
-	g_return_val_if_fail(PURPLE_IS_REQUEST_FIELD(field), NULL);
-
-	priv = purple_request_field_get_instance_private(field);
-	g_return_val_if_fail(priv->type == PURPLE_REQUEST_FIELD_DATASHEET, NULL);
-
-	return priv->u.datasheet.sheet;
-}
diff --git a/pidgin/gtkrequest.c b/pidgin/gtkrequest.c
--- a/pidgin/gtkrequest.c
+++ b/pidgin/gtkrequest.c
@@ -1293,16 +1293,17 @@ create_choice_field(PurpleRequestField *
 static GtkWidget *
 create_image_field(PurpleRequestField *field)
 {
+	PurpleRequestFieldImage *ifield = PURPLE_REQUEST_FIELD_IMAGE(field);
 	GtkWidget *widget;
 	GdkPixbuf *buf, *scale;
 
 	buf = purple_gdk_pixbuf_from_data(
-			(const guchar *)purple_request_field_image_get_buffer(field),
-			purple_request_field_image_get_size(field));
+			(const guchar *)purple_request_field_image_get_buffer(ifield),
+			purple_request_field_image_get_size(ifield));
 
 	scale = gdk_pixbuf_scale_simple(buf,
-			purple_request_field_image_get_scale_x(field) * gdk_pixbuf_get_width(buf),
-			purple_request_field_image_get_scale_y(field) * gdk_pixbuf_get_height(buf),
+			purple_request_field_image_get_scale_x(ifield) * gdk_pixbuf_get_width(buf),
+			purple_request_field_image_get_scale_y(ifield) * gdk_pixbuf_get_height(buf),
 			GDK_INTERP_BILINEAR);
 	widget = gtk_image_new_from_pixbuf(scale);
 	g_object_unref(G_OBJECT(buf));
@@ -2155,9 +2156,9 @@ pidgin_request_fields(const char *title,
 						widget = create_choice_field(field);
 					} else if(PURPLE_IS_REQUEST_FIELD_LIST(field)) {
 						widget = create_list_field(field);
-					} else if (type == PURPLE_REQUEST_FIELD_IMAGE)
+					} else if(PURPLE_IS_REQUEST_FIELD_IMAGE(field)) {
 						widget = create_image_field(field);
-					else if(PURPLE_IS_REQUEST_FIELD_ACCOUNT(field)) {
+					} else if(PURPLE_IS_REQUEST_FIELD_ACCOUNT(field)) {
 						widget = create_account_field(field);
 					} else if (type == PURPLE_REQUEST_FIELD_DATASHEET)
 						widget = create_datasheet_field(field, datasheet_buttons_sg);
