Mercurial > pidgin
changeset 23118:4044655e5615
Add a purple_buddy_icons_node_set_custom_icon_from_file convenience function.
author | Etan Reisner <pidgin@unreliablesource.net> |
---|---|
date | Thu, 15 May 2008 02:35:53 +0000 |
parents | 21636ef92dbb |
children | 2498242c7af7 |
files | ChangeLog.API libpurple/buddyicon.c libpurple/buddyicon.h |
diffstat | 3 files changed, 40 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog.API Tue May 13 04:40:04 2008 +0000 +++ b/ChangeLog.API Thu May 15 02:35:53 2008 +0000 @@ -9,6 +9,7 @@ * purple_buddy_icons_node_has_custom_icon * purple_buddy_icons_node_find_custom_icon * purple_buddy_icons_node_set_custom_icon + * purple_buddy_icons_node_set_custom_icon_from_file Deprecated: * purple_blist_update_buddy_icon
--- a/libpurple/buddyicon.c Tue May 13 04:40:04 2008 +0000 +++ b/libpurple/buddyicon.c Thu May 15 02:35:53 2008 +0000 @@ -930,6 +930,28 @@ return img; } +PurpleStoredImage * +purple_buddy_icons_node_set_custom_icon_from_file(PurpleBlistNode *node, + const gchar *filename) +{ + size_t len; + guchar *data; + + g_return_val_if_fail(node != NULL, NULL); + + if (!PURPLE_BLIST_NODE_IS_CONTACT(node) && + !PURPLE_BLIST_NODE_IS_CHAT(node) && + !PURPLE_BLIST_NODE_IS_GROUP(node)) { + return NULL; + } + + if (!read_icon_file(filename, &data, &len)) { + return NULL; + } + + return purple_buddy_icons_node_set_custom_icon(node, data, len); +} + #ifndef PURPLE_DISABLE_DEPRECATED gboolean purple_buddy_icons_has_custom_icon(PurpleContact *contact)
--- a/libpurple/buddyicon.h Tue May 13 04:40:04 2008 +0000 +++ b/libpurple/buddyicon.h Thu May 15 02:35:53 2008 +0000 @@ -314,6 +314,23 @@ purple_buddy_icons_node_set_custom_icon(PurpleBlistNode *node, guchar *icon_data, size_t icon_len); +/** + * Sets a custom buddy icon for a blist node. + * + * Convenience wrapper around purple_buddy_icons_node_set_custom_icon. + * @see purple_buddy_icons_node_set_custom_icon() + * + * @param node The blist node for which to set a custom icon. + * @param filename The path to the icon to set for the blist node. + * + * @return The icon that was set. The caller does NOT own a reference to this, + * and must call purple_imgstore_ref() if it wants one. + * @since 2.5.0 + */ +PurpleStoredImage * +purple_buddy_icons_node_set_custom_icon_from_file(PurpleBlistNode *node, + const gchar *filename); + #ifndef PURPLE_DISABLE_DEPRECATED /** * PurpleContact version of purple_buddy_icons_node_has_custom_icon.