changeset 29824:6671b5e92c28

Hide the thumbnail-related stuff from the PurpleXfer struct to PurpleXferPrivData
author Marcus Lundblad <ml@update.uu.se>
date Thu, 18 Mar 2010 22:12:08 +0000
parents 79bb2804a19e
children 885ceb384678
files libpurple/ft.c libpurple/ft.h
diffstat 2 files changed, 24 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/ft.c	Tue Mar 16 23:14:54 2010 +0000
+++ b/libpurple/ft.c	Thu Mar 18 22:12:08 2010 +0000
@@ -58,6 +58,10 @@
 		PURPLE_XFER_READY_PRPL = 0x2,
 	} ready;
 	GByteArray *buffer;
+
+	gpointer thumbnail_data;		/**< thumbnail image */
+	gsize thumbnail_size;
+	gchar *thumbnail_mimetype;
 } PurpleXferPrivData;
 
 static int purple_xfer_choose_file(PurpleXfer *xfer);
@@ -70,6 +74,12 @@
 	if (priv->buffer)
 		g_byte_array_free(priv->buffer, TRUE);
 
+	if (priv->thumbnail_data)
+		g_free(priv->thumbnail_data);
+
+	if (priv->thumbnail_mimetype)
+		g_free(priv->thumbnail_mimetype);
+
 	g_free(priv);
 }
 
@@ -178,8 +188,6 @@
 	g_free(xfer->local_filename);
 
 	g_hash_table_remove(xfers_data, xfer);
-	g_free(xfer->thumbnail_data);
-	g_free(xfer->thumbnail_mimetype);
 
 	PURPLE_DBUS_UNREGISTER_POINTER(xfer);
 	xfers = g_list_remove(xfers, xfer);
@@ -1622,29 +1630,37 @@
 const void *
 purple_xfer_get_thumbnail_data(const PurpleXfer *xfer)
 {
-	return xfer->thumbnail_data;
+	PurpleXferPrivData *priv = g_hash_table_lookup(xfers_data, xfer);
+
+	return priv->thumbnail_data;
 }
 
 gsize
 purple_xfer_get_thumbnail_size(const PurpleXfer *xfer)
 {
-	return xfer->thumbnail_size;
+	PurpleXferPrivData *priv = g_hash_table_lookup(xfers_data, xfer);
+
+	return priv->thumbnail_size;
 }
 
 const gchar *
 purple_xfer_get_thumbnail_mimetype(const PurpleXfer *xfer)
 {
-	return xfer->thumbnail_mimetype;
+	PurpleXferPrivData *priv = g_hash_table_lookup(xfers_data, xfer);
+
+	return priv->thumbnail_mimetype;
 }
 
 void
 purple_xfer_set_thumbnail(PurpleXfer *xfer, gconstpointer thumbnail,
 	gsize size, const gchar *mimetype)
 {
+	PurpleXferPrivData *priv = g_hash_table_lookup(xfers_data, xfer);
+
 	if (thumbnail && size > 0) {
-		xfer->thumbnail_data = g_memdup(thumbnail, size);
-		xfer->thumbnail_size = size;
-		xfer->thumbnail_mimetype = g_strdup(mimetype);
+		priv->thumbnail_data = g_memdup(thumbnail, size);
+		priv->thumbnail_size = size;
+		priv->thumbnail_mimetype = g_strdup(mimetype);
 	}
 }
 
--- a/libpurple/ft.h	Tue Mar 16 23:14:54 2010 +0000
+++ b/libpurple/ft.h	Thu Mar 18 22:12:08 2010 +0000
@@ -186,10 +186,6 @@
 	void *ui_data;                    /**< UI-specific data.       */
 
 	void *data;                       /**< prpl-specific data.     */
-
-	gpointer thumbnail_data;		/**< thumbnail image */
-	gsize thumbnail_size;
-	gchar *thumbnail_mimetype;
 };
 
 #ifdef __cplusplus