Mercurial > pidgin
comparison libpurple/ft.c @ 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 | 2ab17571bf42 |
comparison
equal
deleted
inserted
replaced
29823:79bb2804a19e | 29824:6671b5e92c28 |
---|---|
56 PURPLE_XFER_READY_NONE = 0x0, | 56 PURPLE_XFER_READY_NONE = 0x0, |
57 PURPLE_XFER_READY_UI = 0x1, | 57 PURPLE_XFER_READY_UI = 0x1, |
58 PURPLE_XFER_READY_PRPL = 0x2, | 58 PURPLE_XFER_READY_PRPL = 0x2, |
59 } ready; | 59 } ready; |
60 GByteArray *buffer; | 60 GByteArray *buffer; |
61 | |
62 gpointer thumbnail_data; /**< thumbnail image */ | |
63 gsize thumbnail_size; | |
64 gchar *thumbnail_mimetype; | |
61 } PurpleXferPrivData; | 65 } PurpleXferPrivData; |
62 | 66 |
63 static int purple_xfer_choose_file(PurpleXfer *xfer); | 67 static int purple_xfer_choose_file(PurpleXfer *xfer); |
64 | 68 |
65 static void | 69 static void |
67 { | 71 { |
68 PurpleXferPrivData *priv = data; | 72 PurpleXferPrivData *priv = data; |
69 | 73 |
70 if (priv->buffer) | 74 if (priv->buffer) |
71 g_byte_array_free(priv->buffer, TRUE); | 75 g_byte_array_free(priv->buffer, TRUE); |
76 | |
77 if (priv->thumbnail_data) | |
78 g_free(priv->thumbnail_data); | |
79 | |
80 if (priv->thumbnail_mimetype) | |
81 g_free(priv->thumbnail_mimetype); | |
72 | 82 |
73 g_free(priv); | 83 g_free(priv); |
74 } | 84 } |
75 | 85 |
76 static const gchar * | 86 static const gchar * |
176 g_free(xfer->filename); | 186 g_free(xfer->filename); |
177 g_free(xfer->remote_ip); | 187 g_free(xfer->remote_ip); |
178 g_free(xfer->local_filename); | 188 g_free(xfer->local_filename); |
179 | 189 |
180 g_hash_table_remove(xfers_data, xfer); | 190 g_hash_table_remove(xfers_data, xfer); |
181 g_free(xfer->thumbnail_data); | |
182 g_free(xfer->thumbnail_mimetype); | |
183 | 191 |
184 PURPLE_DBUS_UNREGISTER_POINTER(xfer); | 192 PURPLE_DBUS_UNREGISTER_POINTER(xfer); |
185 xfers = g_list_remove(xfers, xfer); | 193 xfers = g_list_remove(xfers, xfer); |
186 g_free(xfer); | 194 g_free(xfer); |
187 } | 195 } |
1620 } | 1628 } |
1621 | 1629 |
1622 const void * | 1630 const void * |
1623 purple_xfer_get_thumbnail_data(const PurpleXfer *xfer) | 1631 purple_xfer_get_thumbnail_data(const PurpleXfer *xfer) |
1624 { | 1632 { |
1625 return xfer->thumbnail_data; | 1633 PurpleXferPrivData *priv = g_hash_table_lookup(xfers_data, xfer); |
1634 | |
1635 return priv->thumbnail_data; | |
1626 } | 1636 } |
1627 | 1637 |
1628 gsize | 1638 gsize |
1629 purple_xfer_get_thumbnail_size(const PurpleXfer *xfer) | 1639 purple_xfer_get_thumbnail_size(const PurpleXfer *xfer) |
1630 { | 1640 { |
1631 return xfer->thumbnail_size; | 1641 PurpleXferPrivData *priv = g_hash_table_lookup(xfers_data, xfer); |
1642 | |
1643 return priv->thumbnail_size; | |
1632 } | 1644 } |
1633 | 1645 |
1634 const gchar * | 1646 const gchar * |
1635 purple_xfer_get_thumbnail_mimetype(const PurpleXfer *xfer) | 1647 purple_xfer_get_thumbnail_mimetype(const PurpleXfer *xfer) |
1636 { | 1648 { |
1637 return xfer->thumbnail_mimetype; | 1649 PurpleXferPrivData *priv = g_hash_table_lookup(xfers_data, xfer); |
1650 | |
1651 return priv->thumbnail_mimetype; | |
1638 } | 1652 } |
1639 | 1653 |
1640 void | 1654 void |
1641 purple_xfer_set_thumbnail(PurpleXfer *xfer, gconstpointer thumbnail, | 1655 purple_xfer_set_thumbnail(PurpleXfer *xfer, gconstpointer thumbnail, |
1642 gsize size, const gchar *mimetype) | 1656 gsize size, const gchar *mimetype) |
1643 { | 1657 { |
1658 PurpleXferPrivData *priv = g_hash_table_lookup(xfers_data, xfer); | |
1659 | |
1644 if (thumbnail && size > 0) { | 1660 if (thumbnail && size > 0) { |
1645 xfer->thumbnail_data = g_memdup(thumbnail, size); | 1661 priv->thumbnail_data = g_memdup(thumbnail, size); |
1646 xfer->thumbnail_size = size; | 1662 priv->thumbnail_size = size; |
1647 xfer->thumbnail_mimetype = g_strdup(mimetype); | 1663 priv->thumbnail_mimetype = g_strdup(mimetype); |
1648 } | 1664 } |
1649 } | 1665 } |
1650 | 1666 |
1651 void | 1667 void |
1652 purple_xfer_prepare_thumbnail(PurpleXfer *xfer, const gchar *formats) | 1668 purple_xfer_prepare_thumbnail(PurpleXfer *xfer, const gchar *formats) |