[evolution-patches] Please review my patch for bug #45908



Hello All,
Could you review my patch for bug #45908? My patch can solve this problem. In my patch, I add gdk_pixbuf_loader_close to close pixbuf loader, that can fix the issue which is tiff attachment cannot display. then I add some code to enhance icons loading of attachment. I think we should load icon according theme at the first. So I used gnome_icon_theme_lookup_icon to look for theme's icon.


Bug Summary: Unable to view attached tif image when composing
Bug Link:http://bugzilla.ximian.com/show_bug.cgi?id=45908
Thanks
Antonio Xu





Index: composer/e-msg-composer-attachment-bar.c
===================================================================
RCS file: /cvs/gnome/evolution/composer/e-msg-composer-attachment-bar.c,v
retrieving revision 1.67.4.2
diff -u -r1.67.4.2 e-msg-composer-attachment-bar.c
--- composer/e-msg-composer-attachment-bar.c	17 Jul 2003 05:32:56 -0000	1.67.4.2
+++ composer/e-msg-composer-attachment-bar.c	24 Jul 2003 09:15:05 -0000
@@ -32,6 +32,7 @@
 #include <gconf/gconf.h>
 #include <gconf/gconf-client.h>
 #include <libgnome/gnome-util.h>
+#include <libgnomeui/libgnomeui.h>
 #include <libgnomeui/gnome-app.h>
 #include <libgnomeui/gnome-app-helper.h>
 #include <libgnomeui/gnome-popup-menu.h>
@@ -209,6 +210,7 @@
 	const char *icon_name;
 	char *filename = NULL;
 	GdkPixbuf *pixbuf;
+	GnomeIconTheme *icon_theme;
 
 	/* Special-case these two since GNOME VFS doesn't know about them and
 	   they are used every time the user forwards one or more messages
@@ -233,8 +235,14 @@
 			if (pixbuf)
 				return pixbuf;
 		}
-		
-		filename = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP, icon_name, TRUE, NULL);
+
+		icon_theme = gnome_icon_theme_new ();
+		filename = gnome_icon_theme_lookup_icon (icon_theme, icon_name, 48, NULL, NULL);
+		g_object_unref (icon_theme);
+
+		if (!filename)
+			filename = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP, icon_name, TRUE, NULL);
+
 		if (!filename) {
 			char *fm_icon;
 			
@@ -253,13 +261,17 @@
 		g_free (filename);
 		return pixbuf;
 	}
-	
-	g_free (filename);
-	filename = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP, "gnome-unknown.png", TRUE, NULL);
-	
+
+	icon_theme = gnome_icon_theme_new ();
+	filename = gnome_icon_theme_lookup_icon (icon_theme, "gnome-unknown.png", 48, NULL, NULL);
+	g_object_unref (icon_theme);
+
+	if (!filename)
+		filename = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP, "gnome-unknown.png", TRUE, NULL);
+
 	pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
+
 	g_free (filename);
-	
 	return pixbuf;
 }
 
@@ -327,7 +339,9 @@
 			
 			if (!error) {
 				int ratio, width, height;
-				
+
+				gdk_pixbuf_loader_close (loader, NULL);
+
 				/* Shrink pixbuf */
 				pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
 				width = gdk_pixbuf_get_width (pixbuf);
Index: composer/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/composer/ChangeLog,v
retrieving revision 1.544.2.6
diff -u -r1.544.2.6 ChangeLog
--- composer/ChangeLog	18 Jul 2003 13:49:22 -0000	1.544.2.6
+++ composer/ChangeLog	24 Jul 2003 09:26:15 -0000
@@ -1,3 +1,11 @@
+2003-07-24  Antonio Xu <antonio xu sun com>
+
+	* e-msg-composer-attachment-bar.c (pixbuf_for_mime_type): use 
+	gnome_icon_theme_lookup_icon to do some enhancements for attachments
+	icon loading.
+	(update): add gdk_pixbuf_loader_close to close pix buffer loading.
+	[#45908]
+
 2003-07-17  Maxx Cao  <maxx cao sun com>
 
 	** For bug #46013


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]