[evolution-patches] Please review my patch for bug #47990 and #47988



Hello All,

Could you review my patch for bug #47990 and #47988?

I use g_filename_from_uri to get the real path of the image file, that could fix bug #47990, and I use HTML_IS_PLAIN_PAINTER to judge html edit model to fix bug #47988.

Bug Summary:Drag image into composer window failed when image file's path include space
Bug URL:http://bugzilla.ximian.com/show_bug.cgi?id=47990

Bug Summary:Drag image into composer window shouldn't allow as plain text edit model
Bug URL:http://bugzilla.ximian.com/show_bug.cgi?id=47988


Thanks
Antonio Xu









Index: src/gtkhtml.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/gtkhtml.c,v
retrieving revision 1.520.2.5
diff -p -u -r1.520.2.5 gtkhtml.c
--- src/gtkhtml.c	15 Aug 2003 07:47:04 -0000	1.520.2.5
+++ src/gtkhtml.c	28 Aug 2003 09:19:07 -0000
@@ -2208,16 +2208,21 @@ new_obj_from_uri (HTMLEngine *e, gchar *
 	gint i;
 
 	if (!strncmp (uri, "file:", 5)) {
-		GdkPixbuf *pixbuf;
-
-		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);
-		 } 
+		if (!HTML_IS_PLAIN_PAINTER(e->painter)) {
+			GdkPixbuf *pixbuf;
+			char *img_path = g_filename_from_uri (uri, NULL, NULL);
+			if (img_path) {
+				pixbuf = gdk_pixbuf_new_from_file(img_path, NULL);
+				g_free(img_path);
+			}
+			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++) {
Index: components/html-editor/editor-control-factory.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/components/html-editor/editor-control-factory.c,v
retrieving revision 1.132.2.1
diff -p -u -r1.132.2.1 editor-control-factory.c
--- components/html-editor/editor-control-factory.c	1 Jul 2003 10:34:34 -0000	1.132.2.1
+++ components/html-editor/editor-control-factory.c	28 Aug 2003 09:20:08 -0000
@@ -254,9 +254,14 @@ load_from_file (GtkHTML *html,
         const char *path;
 
         if (strncmp (url, "file:", 5) == 0)
-		path = url + 5; 
+		path = g_filename_from_uri(url, NULL, NULL);
+	else
+		path = g_strdup(url);
 
-	if ((fd = open (path, O_RDONLY)) == -1) {
+	fd = open (path, O_RDONLY);
+	g_free(path);
+
+	if (fd == -1) {
 		g_warning ("%s", g_strerror (errno));
 		return FALSE;
 	}
Index: src/ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/ChangeLog,v
retrieving revision 1.1814.2.8
diff -p -u -r1.1814.2.8 ChangeLog
--- src/ChangeLog	15 Aug 2003 07:47:04 -0000	1.1814.2.8
+++ src/ChangeLog	28 Aug 2003 13:44:26 -0000
@@ -1,3 +1,9 @@
+2003-08-28  Antonio Xu  <antonio xu sun com>
+
+	* gtkhtml.c (new_obj_from_uri): Use HTML_IS_PLAIN_PAINTER to judge
+	html edit model, and use g_filename_from_uri to get the image file's
+	real path, fix bug #47988 #47990.
+ 
 2003-08-15  Antonio Xu  <antonio xu sun com>
 
 	* htmlengine-edit-movement.c (html_engine_jump_at): add
Index: components/html-editor/ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/components/html-editor/ChangeLog,v
retrieving revision 1.410.2.4
diff -p -u -r1.410.2.4 ChangeLog
--- components/html-editor/ChangeLog	8 Aug 2003 04:20:26 -0000	1.410.2.4
+++ components/html-editor/ChangeLog	28 Aug 2003 13:48:40 -0000
@@ -1,3 +1,9 @@
+2003-08-28  Antonio Xu  <antonio xu sun com>
+
+	* editor-control-factory.c (load_from_file): use
+	g_filename_from_uri to get image file's real path, bug fix
+	#47990.
+
 2003-08-08  Yuedong Du  <yuedong du sun com>
                                                                                 
         * menubar.c: fix a typo cause bullet list not work. See bug


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