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



Hello All,

Could you review my patch for bug #47349?
I used pixbuf to judge what kind of image being supported by gtkhtml.

Bug Summary:Dragging images into composer window does not work
Bug URL:http://bugzilla.ximian.com/show_bug.cgi?id=47543

Thanks
Antonio Xu






RCS file: /cvs/gnome/gtkhtml/src/ChangeLog,v
retrieving revision 1.1814.2.5
diff -u -r1.1814.2.5 ChangeLog
--- src/ChangeLog	28 Jul 2003 15:12:46 -0000	1.1814.2.5
+++ src/ChangeLog	12 Aug 2003 14:31:36 -0000
@@ -1,3 +1,8 @@
+2003-08-12  Antonio Xu  <antonio xu sun com>
+
+	* gtkhtml.c (new_obj_from_uri): Use pixbuf to judge what kind of
+	image type being supported by gtkhtml, fix bug #47543.
+
 2003-07-28  Radek Doulik  <rodo ximian com>
 
 	* htmltext.c (get_tags): fix color check to save color attribute
Index: src/gtkhtml.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/gtkhtml.c,v
retrieving revision 1.520.2.3
diff -u -r1.520.2.3 gtkhtml.c
--- src/gtkhtml.c	9 Jul 2003 10:35:19 -0000	1.520.2.3
+++ src/gtkhtml.c	12 Aug 2003 14:33:29 -0000
@@ -24,6 +24,7 @@
 
 #include <gdk/gdkkeysyms.h>
 #include <gdk/gdkprivate.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
 #include <gtk/gtk.h>
 #include <string.h>
 
@@ -2191,16 +2192,6 @@
 	return uri;
 }
 
-static gchar *pic_extensions [] = {
-	".png",
-	".gif",
-	".jpg",
-	".xbm",
-	".xpm",
-	".bmp",
-	NULL
-};
-
 static gchar *known_protocols [] = {
 	"http://";,
 	"ftp://";,
@@ -2217,15 +2208,16 @@
 	gint i;
 
 	if (!strncmp (uri, "file:", 5)) {
+		GdkPixbuf *pixbuf;
 
-		for (i = 0; pic_extensions [i]; i++) {
-			if (!strcmp (uri + len - strlen (pic_extensions [i]), pic_extensions [i])) {
-				return html_image_new (e->image_factory, uri,
-						       NULL, NULL, -1, -1, FALSE, FALSE, 0,
-						       html_colorset_get_color (e->settings->color_set, HTMLTextColor),
-						       HTML_VALIGN_BOTTOM, TRUE);
-			}
-		}
+		pixbuf = gdk_pixbuf_new_from_file(uri + 5, NULL);
+		if (pixbuf) {
+			g_object_unref (pixbuf);
+			return html_image_new (e->image_factory, uri,
+					       NULL, NULL, -1, -1, FALSE, FALSE, 0,
+					       html_colorset_get_color (e->settings->color_set, HTMLTextColor),
+					       HTML_VALIGN_BOTTOM, TRUE);
+		 } 
 	}
 
 	for (i = 0; known_protocols [i]; i++) {


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