Mercurial > pidgin.yaz
diff src/gtkutils.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 | b875f5d57b81 |
children | b24967757d46 |
line wrap: on
line diff
--- a/src/gtkutils.c Mon May 17 04:39:14 2004 +0000 +++ b/src/gtkutils.c Mon May 17 06:47:20 2004 +0000 @@ -70,6 +70,15 @@ g_idle_add(url_clicked_idle_cb, g_strdup(uri)); } +GtkIMHtmlFuncs gtkimhtml_cbs = { + (GtkIMHtmlGetImageFunc)gaim_imgstore_get, + (GtkIMHtmlGetImageDataFunc)gaim_imgstore_get_data, + (GtkIMHtmlGetImageSizeFunc)gaim_imgstore_get_size, + (GtkIMHtmlGetImageFilenameFunc)gaim_imgstore_get_filename, + gaim_imgstore_ref, + gaim_imgstore_unref, +}; + void gaim_setup_imhtml(GtkWidget *imhtml) { @@ -80,6 +89,8 @@ G_CALLBACK(url_clicked_cb), NULL); smiley_themeize(imhtml); + + gtk_imhtml_set_funcs(GTK_IMHTML(imhtml), >kimhtml_cbs); } void @@ -924,62 +935,6 @@ } void -gaim_gtk_find_images(const char *message, GSList **list) -{ - GData *attribs; - const char *tmp, *start, *end; - - g_return_if_fail(message != NULL); - g_return_if_fail( list != NULL); - - tmp = message; - while (gaim_markup_find_tag("img", tmp, &start, &end, &attribs)) { - GaimStoredImage *image = NULL; - GdkPixbufLoader *loader = NULL; - GdkPixbuf *pixbuf = NULL; - GError *error = NULL; - char *id = g_datalist_get_data(&attribs, "id"); - - tmp = end + 1; - - if (id) - image = gaim_imgstore_get(atoi(id)); - - g_datalist_clear(&attribs); - - if (!image) { - *list = g_slist_append(*list, NULL); - continue; - } - - loader = gdk_pixbuf_loader_new(); - - if (gdk_pixbuf_loader_write(loader, image->data, image->size, &error) - && (pixbuf = gdk_pixbuf_loader_get_pixbuf(loader))) { - - if (image->filename) - g_object_set_data_full(G_OBJECT(pixbuf), "filename", - g_strdup(image->filename), g_free); - g_object_ref(G_OBJECT(pixbuf)); - *list = g_slist_append(*list, pixbuf); - } else { - if (error) { - gaim_debug(GAIM_DEBUG_ERROR, "gtkutils", - "Failed to make pixbuf from image store: %s\n", - error->message); - g_error_free(error); - } else { - gaim_debug(GAIM_DEBUG_ERROR, "gtkutils", - "Failed to make pixbuf from image store: unknown reason\n"); - } - *list = g_slist_append(*list, NULL); - } - - gdk_pixbuf_loader_close(loader, NULL); - } -} - -void gaim_gtk_setup_gtkspell(GtkTextView *textview) { #ifdef USE_GTKSPELL