Mercurial > pidgin.yaz
comparison src/gtkutils.c @ 7078:acd2a66e59ed
[gaim-migrate @ 7643]
robot101 gave us images in notify_formatted windows. very cool. This lets what I committed earlier (which was support for images in jabber vcards) to work.
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Tue, 30 Sep 2003 18:41:28 +0000 |
parents | 9946001989a3 |
children | c4faffdc0862 |
comparison
equal
deleted
inserted
replaced
7077:6d10bf28be0e | 7078:acd2a66e59ed |
---|---|
31 #endif /*_WIN32*/ | 31 #endif /*_WIN32*/ |
32 | 32 |
33 #include <gdk/gdkkeysyms.h> | 33 #include <gdk/gdkkeysyms.h> |
34 | 34 |
35 #include "debug.h" | 35 #include "debug.h" |
36 #include "imgstore.h" | |
36 #include "notify.h" | 37 #include "notify.h" |
37 #include "prefs.h" | 38 #include "prefs.h" |
38 #include "prpl.h" | 39 #include "prpl.h" |
39 #include "signals.h" | 40 #include "signals.h" |
40 #include "util.h" | 41 #include "util.h" |
1047 case 1: /* short message */ | 1048 case 1: /* short message */ |
1048 printf(_("Gaim %s. Try `%s -h' for more information.\n"), VERSION, name); | 1049 printf(_("Gaim %s. Try `%s -h' for more information.\n"), VERSION, name); |
1049 break; | 1050 break; |
1050 } | 1051 } |
1051 } | 1052 } |
1053 | |
1054 void gaim_gtk_find_images(const char *message, GSList **list) { | |
1055 GData *attribs; | |
1056 const char *tmp, *start, *end; | |
1057 | |
1058 tmp = message; | |
1059 while (gaim_markup_find_tag("img", tmp, &start, &end, &attribs)) { | |
1060 GaimStoredImage *image = NULL; | |
1061 GdkPixbufLoader *loader = NULL; | |
1062 GdkPixbuf *pixbuf = NULL; | |
1063 GError *error = NULL; | |
1064 char *id = g_datalist_get_data(&attribs, "id"); | |
1065 | |
1066 tmp = end + 1; | |
1067 | |
1068 if (id) | |
1069 image = gaim_imgstore_get(atoi(id)); | |
1070 | |
1071 g_datalist_clear(&attribs); | |
1072 | |
1073 if (!image) { | |
1074 *list = g_slist_append(*list, NULL); | |
1075 continue; | |
1076 } | |
1077 | |
1078 loader = gdk_pixbuf_loader_new(); | |
1079 | |
1080 if (gdk_pixbuf_loader_write(loader, image->data, image->size, &error) | |
1081 && (pixbuf = gdk_pixbuf_loader_get_pixbuf(loader))) { | |
1082 | |
1083 if (image->filename) | |
1084 g_object_set_data_full(G_OBJECT(pixbuf), "filename", | |
1085 g_strdup(image->filename), g_free); | |
1086 g_object_ref(G_OBJECT(pixbuf)); | |
1087 *list = g_slist_append(*list, pixbuf); | |
1088 } else { | |
1089 if (error) { | |
1090 gaim_debug(GAIM_DEBUG_ERROR, "gtkutils", | |
1091 "Failed to make pixbuf from image store: %s\n", | |
1092 error->message); | |
1093 g_error_free(error); | |
1094 } else { | |
1095 gaim_debug(GAIM_DEBUG_ERROR, "gtkutils", | |
1096 "Failed to make pixbuf from image store: unknown reason\n"); | |
1097 } | |
1098 *list = g_slist_append(*list, NULL); | |
1099 } | |
1100 | |
1101 gdk_pixbuf_loader_close(loader, NULL); | |
1102 } | |
1103 } |