changeset 7008:ecce6b23ea25

[gaim-migrate @ 7565] plug a big memleak, and simplify some code in the process committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Mon, 29 Sep 2003 04:30:35 +0000
parents da1430478acf
children d77e99c55b40
files src/gtkconv.c
diffstat 1 files changed, 15 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkconv.c	Mon Sep 29 03:54:08 2003 +0000
+++ b/src/gtkconv.c	Mon Sep 29 04:30:35 2003 +0000
@@ -4960,6 +4960,7 @@
 	GaimAccount *account;
 	const char *name;
 	GaimBuddy *b;
+	GdkPixbuf *status = NULL;
 
 	gtkconv = GAIM_GTK_CONVERSATION(conv);
 	name = gaim_conversation_get_name(conv);
@@ -4968,46 +4969,27 @@
 	if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) {
 		b = gaim_find_buddy(account, name);
 		if (b != NULL) {
-			gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->icon),
-					gaim_gtk_blist_get_status_icon((GaimBlistNode *)b,
-						GAIM_STATUS_ICON_SMALL));
-			gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->menu_icon),
-					gaim_gtk_blist_get_status_icon((GaimBlistNode *)b,
-						GAIM_STATUS_ICON_SMALL));
-		} else {
-			GdkPixbuf *pixbuf, *scale;
-			pixbuf = create_prpl_icon(account);
-
-			if (pixbuf) {
-				scale = gdk_pixbuf_scale_simple(pixbuf, 15, 15, GDK_INTERP_BILINEAR);
-
-				gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->icon), scale);
-				gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->menu_icon), scale);
-
-				g_object_unref(pixbuf);
-				g_object_unref(scale);
-			} else {
-				gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->icon), NULL);
-				gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->menu_icon), NULL);
-			}
+			status = gaim_gtk_blist_get_status_icon((GaimBlistNode*)b,
+					GAIM_STATUS_ICON_SMALL);
 		}
-	} else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) {
-		GdkPixbuf *pixbuf, *scale;
+	}
+
+	if (!status) {
+		GdkPixbuf *pixbuf;
 		pixbuf = create_prpl_icon(account);
 
 		if (pixbuf) {
-			scale = gdk_pixbuf_scale_simple(pixbuf, 15, 15, GDK_INTERP_BILINEAR);
-
-			gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->icon), scale);
-			gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->menu_icon), scale);
-
+			status = gdk_pixbuf_scale_simple(pixbuf, 15, 15,
+					GDK_INTERP_BILINEAR);
 			g_object_unref(pixbuf);
-			g_object_unref(scale);
-		} else {
-			gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->icon), NULL);
-			gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->menu_icon), NULL);
 		}
 	}
+
+	gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->icon), status);
+	gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->menu_icon), status);
+
+	if(status)
+		g_object_unref(status);
 }
 
 static void