cpw.malu.ft_thumbnails: f7a917c6: Hide the thumbnail-related stuff from th...
malu at pidgin.im
malu at pidgin.im
Thu Mar 18 18:15:47 EDT 2010
-----------------------------------------------------------------
Revision: f7a917c6041411a0428726f88f9200290adde6de
Ancestor: d4a668fc64166df2856ce7a0b4dced035fb98fa5
Author: malu at pidgin.im
Date: 2010-03-18T22:12:08
Branch: im.pidgin.cpw.malu.ft_thumbnails
URL: http://d.pidgin.im/viewmtn/revision/info/f7a917c6041411a0428726f88f9200290adde6de
Modified files:
libpurple/ft.c libpurple/ft.h
ChangeLog:
Hide the thumbnail-related stuff from the PurpleXfer struct to
PurpleXferPrivData
-------------- next part --------------
============================================================
--- libpurple/ft.c c1dffbd12251206be74ea25aba800fdfbb952659
+++ libpurple/ft.c 6db2d9d979752a315cd7eed5c660eb3a7ed42117
@@ -58,6 +58,10 @@ typedef struct _PurpleXferPrivData {
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 @@ purple_xfer_priv_data_destroy(gpointer d
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 @@ purple_xfer_destroy(PurpleXfer *xfer)
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 @@ purple_xfer_get_thumbnail_data(const Pur
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);
}
}
============================================================
--- libpurple/ft.h c22e24544c7cc023d99b0f4236d875305d963e74
+++ libpurple/ft.h 323cd6efd2e3f5a72db3079250bbef03c52f3d70
@@ -186,10 +186,6 @@ struct _PurpleXfer
void *ui_data; /**< UI-specific data. */
void *data; /**< prpl-specific data. */
-
- gpointer thumbnail_data; /**< thumbnail image */
- gsize thumbnail_size;
- gchar *thumbnail_mimetype;
};
#ifdef __cplusplus
More information about the Commits
mailing list