gtkhtml r9067 - trunk/components/editor



Author: mcrha
Date: Tue Dec 16 12:55:51 2008
New Revision: 9067
URL: http://svn.gnome.org/viewvc/gtkhtml?rev=9067&view=rev

Log:
2008-12-16  Milan Crha  <mcrha redhat com>

	** Part of fix for bug #564248

	* gtkhtml-editor.h: (gtkhtml_editor_insert_image):
	* gtkhtml-editor.c: (gtkhtml_editor_insert_image):
	New API to insert images inline to the message body.
	* gtkhtml-editor-actions.c: (insert_image_response_cb):
	Use the above function.



Modified:
   trunk/components/editor/ChangeLog
   trunk/components/editor/gtkhtml-editor-actions.c
   trunk/components/editor/gtkhtml-editor.c
   trunk/components/editor/gtkhtml-editor.h

Modified: trunk/components/editor/gtkhtml-editor-actions.c
==============================================================================
--- trunk/components/editor/gtkhtml-editor-actions.c	(original)
+++ trunk/components/editor/gtkhtml-editor-actions.c	Tue Dec 16 12:55:51 2008
@@ -141,19 +141,13 @@
                           gint response,
                           GtkhtmlEditor *editor)
 {
-	HTMLObject *image;
-	GtkHTML *html;
 	gchar *uri;
 
 	if (response != GTK_RESPONSE_OK)
 		return;
 
-	html = gtkhtml_editor_get_html (editor);
 	uri = gtk_file_chooser_get_uri (file_chooser);
-	image = html_image_new (
-		html_engine_get_image_factory (html->engine), uri,
-		NULL, NULL, 0, 0, 0, 0, 0, NULL, HTML_VALIGN_NONE, FALSE);
-	html_engine_paste_object (html->engine, image, 1);
+	gtkhtml_editor_insert_image (editor, uri);
 	g_free (uri);
 }
 

Modified: trunk/components/editor/gtkhtml-editor.c
==============================================================================
--- trunk/components/editor/gtkhtml-editor.c	(original)
+++ trunk/components/editor/gtkhtml-editor.c	Tue Dec 16 12:55:51 2008
@@ -1554,6 +1554,28 @@
 	gtk_html_insert_html (html, html_text);
 }
 
+/* inserts local files only, as inlined */
+void
+gtkhtml_editor_insert_image	(GtkhtmlEditor *editor,
+				 const gchar *filename_uri)
+{
+	GtkHTML *html;
+
+	g_return_if_fail (GTKHTML_IS_EDITOR (editor));
+	g_return_if_fail (filename_uri != NULL);
+
+	html = gtkhtml_editor_get_html (editor);
+
+	if (html) {
+		HTMLObject *image;
+		
+		image = html_image_new (
+			html_engine_get_image_factory (html->engine), filename_uri,
+			NULL, NULL, 0, 0, 0, 0, 0, NULL, HTML_VALIGN_NONE, FALSE);
+		html_engine_paste_object (html->engine, image, 1);
+	}
+}
+
 gboolean
 gtkhtml_editor_search_by_data (GtkhtmlEditor *editor,
                                glong level,

Modified: trunk/components/editor/gtkhtml-editor.h
==============================================================================
--- trunk/components/editor/gtkhtml-editor.h	(original)
+++ trunk/components/editor/gtkhtml-editor.h	Tue Dec 16 12:55:51 2008
@@ -163,6 +163,8 @@
 						(GtkhtmlEditor *editor);
 void		gtkhtml_editor_insert_html	(GtkhtmlEditor *editor,
 						 const gchar *html_text);
+void		gtkhtml_editor_insert_image	(GtkhtmlEditor *editor,
+						 const gchar *filename_uri);
 gboolean	gtkhtml_editor_search_by_data	(GtkhtmlEditor *editor,
 						 glong level,
 						 const gchar *klass,



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