pidgin.next.minor: c05448b8: Add a purple_buddy_icons_node_set_custom...

deryni at pidgin.im deryni at pidgin.im
Sat May 17 16:16:56 EDT 2008


-----------------------------------------------------------------
Revision: c05448b8ba5492b14d3dc0e20a07dac542d2b6ee
Ancestor: 025c7567cca7d5c034409f2a939d0550a299bec2
Author: deryni at pidgin.im
Date: 2008-05-15T02:35:53
Branch: im.pidgin.pidgin.next.minor
URL: http://d.pidgin.im/viewmtn/revision/info/c05448b8ba5492b14d3dc0e20a07dac542d2b6ee

Modified files:
        ChangeLog.API libpurple/buddyicon.c libpurple/buddyicon.h

ChangeLog: 

Add a purple_buddy_icons_node_set_custom_icon_from_file convenience function.

-------------- next part --------------
============================================================
--- ChangeLog.API	9db0e5bc298f9bd222fb658a3517b9d91c18db45
+++ ChangeLog.API	040faca49a2f792d861d57796a975e08daab3ae1
@@ -9,6 +9,7 @@ version 2.5.0:
 		* 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
============================================================
--- libpurple/buddyicon.c	2eeef300a584ed7337a96245b4d9d0727ae475a6
+++ libpurple/buddyicon.c	18d12d638239af5082ec913211ade4a888b74af2
@@ -930,6 +930,28 @@ purple_buddy_icons_node_set_custom_icon(
 	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)
============================================================
--- libpurple/buddyicon.h	38ede909d3bf83948fd4fd341c707f1beb667b53
+++ libpurple/buddyicon.h	f26e74502fc1777f3b7b12902dfa3d3270d1f24a
@@ -314,6 +314,23 @@ purple_buddy_icons_node_set_custom_icon(
 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.


More information about the Commits mailing list