diff src/gtkimhtmltoolbar.c @ 8962:4ff4c34b7500

[gaim-migrate @ 9736] IM Image, WYSIWYG. It's still somewhat buggy, although the worse problems are with oscar's direct connect. We could always yank oscar's im image flag if we think it will cause too many bug reports. I made the GaimImgstore struct opque. I modified oscar's sending function to parse im images better, and everything seems to work. I made it write some errors to the conversation if you try to send an image and you aren't direct connected. That's just a hack until you can set formatting flags on a per conversation bases. There's a scrolling bug I haven't tracked down. I think it may exist normally and this just causes it better. It's worth noting jabber also uses this for pics in profiles, although I never did find a test case. Hopefully some other stuff can use this soon too, maybe Yahoo! pics in profiles or something. committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Mon, 17 May 2004 06:47:20 +0000
parents ed62fb44aa30
children b24967757d46
line wrap: on
line diff
--- a/src/gtkimhtmltoolbar.c	Mon May 17 04:39:14 2004 +0000
+++ b/src/gtkimhtmltoolbar.c	Mon May 17 06:47:20 2004 +0000
@@ -413,6 +413,8 @@
 	size_t size;
 	GError *error = NULL;
 	int id;
+	GtkTextIter iter;
+	GtkTextMark *ins;
 
 	if (resp != GTK_RESPONSE_OK) {
 		//set_toggle(toolbar->image, FALSE);
@@ -461,12 +463,12 @@
 		return;
 	}
 
-	//im->images = g_slist_append(im->images, GINT_TO_POINTER(id));
-
-	/*buf = g_strdup_printf("<IMG ID=\"%d\" SRC=\"file://%s\">", id, filename);
-	gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(gtkconv->entry_buffer), buf, -1);
-	g_free(buf);
-	*/
+	ins = gtk_text_buffer_get_insert(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->imhtml)));
+	gtk_text_buffer_get_iter_at_mark(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->imhtml)),
+	                                 &iter, ins);
+	gtk_imhtml_insert_image_at_iter(GTK_IMHTML(toolbar->imhtml), id, &iter);
+	gaim_imgstore_unref(id);
+	
 	g_free(name);
 }
 
@@ -986,9 +988,6 @@
 	gtk_widget_show(sep);
 	toolbar->sml = NULL;
 	gtk_widget_show_all(hbox);
-
-	/* XXX - IMIMAGE - Fix IM images then remove the following line */
-	gtk_widget_hide(toolbar->image);
 }
 
 GtkWidget *gtk_imhtmltoolbar_new()