diff src/gtknotify.c @ 13090:0aa231ebbfd5

[gaim-migrate @ 15452] Changes to some pixbuf stuff. I added a 'gaim_gtk_create_gaim_icon_with_status()' function to util.c, and changed 'gaim_gtk_create_prpl_icon_with_status()' to accept a scale factor because almost everywhere this function was used we would scale the pixbuf to a smaller size as soon as we got it. So there's a bit less code duplication. Also, I think I added some g_object_unref()'s in one or two places where it was missing. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Wed, 01 Feb 2006 22:38:34 +0000
parents 14a103c0e4d5
children 3de53fe8345f
line wrap: on
line diff
--- a/src/gtknotify.c	Wed Feb 01 06:07:53 2006 +0000
+++ b/src/gtknotify.c	Wed Feb 01 22:38:34 2006 +0000
@@ -392,7 +392,7 @@
 			gtk_tree_view_column_pack_start(column, rend, TRUE);
 			gtk_tree_view_column_set_attributes(column, rend, "markup", GAIM_MAIL_SUBJECT, NULL);
 			gtk_tree_view_append_column(GTK_TREE_VIEW(mail_dialog->treeview), column);
-			
+
 			gtk_container_add(GTK_CONTAINER(sw), mail_dialog->treeview);
 
 			label = gtk_label_new(NULL);
@@ -410,7 +410,7 @@
 		while (count--)
 		{
 			char *from_text = NULL, *subject_text = NULL;
-			GdkPixbuf *pixbuf, *scale = NULL;
+			GdkPixbuf *pixbuf;
 
 			if (froms != NULL)
 				from_text = g_markup_escape_text(*froms, -1);
@@ -421,22 +421,18 @@
 			data = g_new0(GaimNotifyMailData, 1);
 			data->url = g_strdup(*urls);
 
-			pixbuf = gaim_gtk_create_prpl_icon(account);
-			if (pixbuf != NULL)
-			{
-				scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16,
-												GDK_INTERP_BILINEAR);
-				g_object_unref(pixbuf);
-			}
+			pixbuf = gaim_gtk_create_prpl_icon(account, 0.5);
 
 			gtk_tree_store_append(mail_dialog->treemodel, &iter, NULL);
 			gtk_tree_store_set(mail_dialog->treemodel, &iter,
-									GAIM_MAIL_ICON, scale,
+									GAIM_MAIL_ICON, pixbuf,
 									GAIM_MAIL_TO, *tos,
 									GAIM_MAIL_FROM, from_text,
 									GAIM_MAIL_SUBJECT, subject_text,
 									GAIM_MAIL_DATA, data,
 									-1);
+			if (pixbuf != NULL)
+				g_object_unref(pixbuf);
 			data->iter = iter;
 			urls++;
 			froms++;
@@ -581,15 +577,14 @@
 	GaimNotifySearchResultsData *data = data_;
 	GtkListStore *model = data->model;
 	GtkTreeIter iter;
-	GdkPixbuf *icon, *scaled;
+	GdkPixbuf *pixbuf;
 	guint col_num;
 	guint i;
 	guint j;
-	
+
 	gtk_list_store_clear(data->model);
 
-	icon = gaim_gtk_create_prpl_icon(gaim_connection_get_account(gc));
-	scaled = gdk_pixbuf_scale_simple(icon, 16, 16, GDK_INTERP_BILINEAR);
+	pixbuf = gaim_gtk_create_prpl_icon(gaim_connection_get_account(gc), 0.5);
 
 	/* +1 is for the automagically created Status column. */
 	col_num = gaim_notify_searchresults_get_columns_count(results) + 1;
@@ -598,7 +593,7 @@
 		GList *row = gaim_notify_searchresults_row_get(results, i);
 
 		gtk_list_store_append(model, &iter);
-		gtk_list_store_set(model, &iter, 0, scaled, -1);
+		gtk_list_store_set(model, &iter, 0, pixbuf, -1);
 
 		for (j = 1; j < col_num; j++) {
 			GValue v;
@@ -611,6 +606,9 @@
 			g_free(escaped);
 		}
 	}
+
+	if (pixbuf != NULL)
+		g_object_unref(pixbuf);
 }
 
 static void *