changeset 3380:d59394b4c5a6

[gaim-migrate @ 3399] Buddy icons don't blow up anymore. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Wed, 07 Aug 2002 19:52:31 +0000
parents b48b73ef172b
children 5df81b058690
files ChangeLog src/conversation.c
diffstat 2 files changed, 21 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Aug 06 03:02:18 2002 +0000
+++ b/ChangeLog	Wed Aug 07 19:52:31 2002 +0000
@@ -26,6 +26,7 @@
 		- Preferences dialog
 		- Plugins dialog (Ari Pollak)
 		- GtkIMHtml, sorta (Ari Pollak, Christian Hammond)
+		- Buddy Icons
 	* Notify.c plugin rewritten; check its configure dialog (Thanks,
 	  Etan Reisner)
 
--- a/src/conversation.c	Tue Aug 06 03:02:18 2002 +0000
+++ b/src/conversation.c	Wed Aug 07 19:52:31 2002 +0000
@@ -3351,9 +3351,10 @@
 	gdk_pixbuf_unref(scale);
 	gtk_pixmap_set(GTK_PIXMAP(c->icon), pm, bm);
 	gdk_pixmap_unref(pm);
+	gtk_widget_queue_draw(c->icon);
 	if (bm)
 		gdk_bitmap_unref(bm);
-	delay = MAX(gdk_pixbuf_animation_iter_get_delay_time(c->iter), 13);
+	delay = gdk_pixbuf_animation_iter_get_delay_time(c->iter) / 10;
 #else
 	frames = gdk_pixbuf_animation_get_frames(c->anim);
 	frame = g_list_nth_data(frames, c->frame);
@@ -3441,7 +3442,7 @@
 	GdkPixbufFrame *frame;
 	int delay;
 #if GTK_CHECK_VERSION(1,3,0)
-	delay = gdk_pixbuf_animation_iter_get_delay_time(c->iter);
+	delay = gdk_pixbuf_animation_iter_get_delay_time(c->iter) / 10;
 #else
 	frames = gdk_pixbuf_animation_get_frames(c->anim);
 	frame = g_list_nth_data(frames, c->frame);
@@ -3616,7 +3617,7 @@
 	char filename[256];
 	FILE *file;
 #if GTK_CHECK_VERSION(1,3,0)
-	GError *err;
+	GError *err = NULL;
 #endif
 	void *data;
 	int len, delay;
@@ -3657,6 +3658,10 @@
 
 #if GTK_CHECK_VERSION(1,3,0)
 	c->anim = gdk_pixbuf_animation_new_from_file(filename, &err);
+	if (err) {
+		debug_printf("Buddy icon error: %s\n", err->message);
+		g_error_free(err);
+	}
 #else
 	c->anim = gdk_pixbuf_animation_new_from_file(filename);
 #endif
@@ -3667,15 +3672,24 @@
 		return;
 
 #if GTK_CHECK_VERSION(1,3,0)
+	if (gdk_pixbuf_animation_is_static_image(c->anim)) {
+		c->iter = NULL;
+		delay = 0;
+		buf = gdk_pixbuf_animation_get_static_image(c->anim);
+	} else {
 		c->iter = gdk_pixbuf_animation_get_iter(c->anim, NULL);
 		buf = gdk_pixbuf_animation_iter_get_pixbuf(c->iter);
+		delay = gdk_pixbuf_animation_iter_get_delay_time(c->iter);
+		delay = delay / 10;
+	}
+		sf = SCALE(c->anim);
 		scale = gdk_pixbuf_scale_simple(buf,
 						MAX(gdk_pixbuf_get_width(buf) * sf /
 						    gdk_pixbuf_animation_get_width(c->anim), 1),
 						MAX(gdk_pixbuf_get_height(buf) * sf /
 						    gdk_pixbuf_animation_get_height(c->anim), 1),
 						GDK_INTERP_NEAREST);
-		delay = gdk_pixbuf_animation_iter_get_delay_time(c->iter);
+	
 #else
 		c->frame = 1;
 		frames = gdk_pixbuf_animation_get_frames(c->anim);
@@ -3693,8 +3707,8 @@
 			delay = 0;
 		}
 #endif
-		if (delay)
-			c->icon_timer = gtk_timeout_add(delay * 10, redraw_icon, c);
+	if (delay)
+		c->icon_timer = gtk_timeout_add(delay * 10, redraw_icon, c);
 	
 
 	gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100);