changeset 27141:f55455c7ae27

Draw the user's buddy icon (in the status box) with curves, to match the buddy list icons. I fixed the ref-counting to not leak. Refs #8691 (waiting for the name to put in COPYRIGHT).
author Paul Aurich <paul@darkrain42.org>
date Mon, 22 Jun 2009 04:17:03 +0000
parents e4421eaae7dd
children c51fc4daf81b 267451c2d4fe
files ChangeLog pidgin/gtkstatusbox.c
diffstat 2 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Jun 22 03:41:21 2009 +0000
+++ b/ChangeLog	Mon Jun 22 04:17:03 2009 +0000
@@ -96,6 +96,9 @@
 	* Support for keyboard navigation on the status icon. (Li Yuan)
 	* IMG tags without 'id' attributes are turned into links to the image URL.
 	  (Dmitry Petroff)
+	* Draw the user's buddy icon at the bottom of the Buddy List with rounded
+	  corners for visual consistency with the actual icons in the Buddy List.
+	  (kostaa)
 
 	Finch:
 	* The hardware cursor is updated correctly. This will be useful
--- a/pidgin/gtkstatusbox.c	Mon Jun 22 03:41:21 2009 +0000
+++ b/pidgin/gtkstatusbox.c	Mon Jun 22 04:17:03 2009 +0000
@@ -2258,14 +2258,22 @@
 
 	if (status_box->buddy_icon_img != NULL)
 	{
+		GdkPixbuf *buf, *scale;
+		int scale_width, scale_height;
 		GdkPixbufLoader *loader = gdk_pixbuf_loader_new();
 		g_signal_connect(G_OBJECT(loader), "size-prepared", G_CALLBACK(pixbuf_size_prepared_cb), NULL);
 		gdk_pixbuf_loader_write(loader, purple_imgstore_get_data(status_box->buddy_icon_img),
 		                        purple_imgstore_get_size(status_box->buddy_icon_img), NULL);
 		gdk_pixbuf_loader_close(loader, NULL);
-		status_box->buddy_icon = gdk_pixbuf_loader_get_pixbuf(loader);
-		if (status_box->buddy_icon)
-			g_object_ref(status_box->buddy_icon);
+		buf = gdk_pixbuf_loader_get_pixbuf(loader);
+		scale_width = gdk_pixbuf_get_width(buf);
+		scale_height = gdk_pixbuf_get_height(buf);
+		scale = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, scale_width, scale_height);
+		gdk_pixbuf_fill(scale, 0x00000000);
+		gdk_pixbuf_copy_area(buf, 0, 0, scale_width, scale_height, scale, 0, 0);
+		if (pidgin_gdk_pixbuf_is_opaque(scale))
+			pidgin_gdk_pixbuf_make_round(scale);
+		status_box->buddy_icon = scale;
 		g_object_unref(loader);
 	}