aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--addressbook/ChangeLog8
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c17
-rw-r--r--addressbook/gui/contact-list-editor/e-contact-list-editor.c10
-rw-r--r--addressbook/gui/widgets/eab-contact-display.c7
-rw-r--r--plugins/bbdb/ChangeLog6
-rw-r--r--plugins/bbdb/gaimbuddies.c3
6 files changed, 35 insertions, 16 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 268a910ea2..6d1eb078fc 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,11 @@
+2006-07-18 Ross Burton <ross@openedhand.com>
+
+ * addressbook/gui/contact-editor/e-contact-editor.c:
+ * addressbook/gui/contact-list-editor/e-contact-list-editor.c:
+ * addressbook/gui/widgets/eab-contact-display.c:
+ Fix for EContactPhoto changes. Partially fixed by Hiroyuki Ikezoe
+ <poincare@ikezoe.net>, finished by myself. (#347870).
+
2006-07-18 Andre Klapper <a9016009@gmx.de>
* gui/contact-editor/contact-editor.glade:
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index 0e0e9c0ce1..0a385da616 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -2192,10 +2192,10 @@ fill_in_simple_field (EContactEditor *editor, GtkWidget *widget, gint field_id)
}
else if (E_IS_IMAGE_CHOOSER (widget)) {
EContactPhoto *photo = e_contact_get (contact, field_id);
- if (photo) {
+ if (photo && photo->type == E_CONTACT_PHOTO_TYPE_INLINED) {
e_image_chooser_set_image_data (E_IMAGE_CHOOSER (widget),
- photo->data,
- photo->length);
+ photo->data.inlined.data,
+ photo->data.inlined.length);
editor->image_set = TRUE;
}
else {
@@ -2259,15 +2259,16 @@ extract_simple_field (EContactEditor *editor, GtkWidget *widget, gint field_id)
}
else if (E_IS_IMAGE_CHOOSER (widget)) {
EContactPhoto photo;
+ photo.type = E_CONTACT_PHOTO_TYPE_INLINED;
if (editor->image_changed)
{
if (editor->image_set &&
e_image_chooser_get_image_data (E_IMAGE_CHOOSER (widget),
- &photo.data, &photo.length)) {
+ &photo.data.inlined.data, &photo.data.inlined.length)) {
GdkPixbuf *pixbuf, *new;
GdkPixbufLoader *loader = gdk_pixbuf_loader_new();
- gdk_pixbuf_loader_write (loader, photo.data, photo.length, NULL);
+ gdk_pixbuf_loader_write (loader, photo.data.inlined.data, photo.data.inlined.length, NULL);
gdk_pixbuf_loader_close (loader, NULL);
pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
@@ -2291,8 +2292,8 @@ extract_simple_field (EContactEditor *editor, GtkWidget *widget, gint field_id)
new = gdk_pixbuf_scale_simple (pixbuf, width, height, GDK_INTERP_BILINEAR);
if (new) {
- g_free(photo.data);
- gdk_pixbuf_save_to_buffer (new, &photo.data, &photo.length, "jpeg", NULL, "quality", "100", NULL);
+ g_free(photo.data.inlined.data);
+ gdk_pixbuf_save_to_buffer (new, &photo.data.inlined.data, &photo.data.inlined.length, "jpeg", NULL, "quality", "100", NULL);
g_object_unref (new);
}
@@ -2305,7 +2306,7 @@ extract_simple_field (EContactEditor *editor, GtkWidget *widget, gint field_id)
e_contact_set (contact, field_id, &photo);
- g_free (photo.data);
+ g_free (photo.data.inlined.data);
}
else {
diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.c b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
index 5674ffb7db..9b0f6043bb 100644
--- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c
+++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
@@ -1088,8 +1088,10 @@ extract_info(EContactListEditor *editor)
&image_data_len)) {
EContactPhoto photo;
- photo.data = image_data;
- photo.length = image_data_len;
+ photo.type = E_CONTACT_PHOTO_TYPE_INLINED;
+ photo.data.inlined.mime_type = NULL;
+ photo.data.inlined.data = image_data;
+ photo.data.inlined.length = image_data_len;
e_contact_set (contact, E_CONTACT_LOGO, &photo);
g_free (image_data);
@@ -1177,8 +1179,8 @@ fill_in_info(EContactListEditor *editor)
g_list_free (email_list);
photo = e_contact_get (editor->contact, E_CONTACT_LOGO);
- if (photo) {
- e_image_chooser_set_image_data (E_IMAGE_CHOOSER (editor->list_image), photo->data, photo->length);
+ if (photo && photo->type == E_CONTACT_PHOTO_TYPE_INLINED) {
+ e_image_chooser_set_image_data (E_IMAGE_CHOOSER (editor->list_image), photo->data.inlined.data, photo->data.inlined.length);
e_contact_photo_free (photo);
}
}
diff --git a/addressbook/gui/widgets/eab-contact-display.c b/addressbook/gui/widgets/eab-contact-display.c
index 082b537e2e..0ce9f346d3 100644
--- a/addressbook/gui/widgets/eab-contact-display.c
+++ b/addressbook/gui/widgets/eab-contact-display.c
@@ -227,7 +227,7 @@ on_url_requested (GtkHTML *html, const char *url, GtkHTMLStream *handle,
if (!photo)
photo = e_contact_get (display->priv->contact, E_CONTACT_LOGO);
- gtk_html_stream_write (handle, photo->data, photo->length);
+ gtk_html_stream_write (handle, photo->data.inlined.data, photo->data.inlined.length);
gtk_html_end (html, handle, GTK_HTML_STREAM_OK);
@@ -575,7 +575,8 @@ eab_contact_display_render_normal (EABContactDisplay *display, EContact *contact
photo = e_contact_get (contact, E_CONTACT_PHOTO);
if (!photo)
photo = e_contact_get (contact, E_CONTACT_LOGO);
- if (photo) {
+ /* Only handle inlined photos for now */
+ if (photo && photo->type == E_CONTACT_PHOTO_TYPE_INLINED) {
gtk_html_stream_printf (html_stream, "<img border=\"1\" src=\"internal-contact-photo:\">");
e_contact_photo_free (photo);
}
@@ -645,7 +646,7 @@ eab_contact_display_render_compact (EABContactDisplay *display, EContact *contac
image here. we don't scale the pixbuf
itself, just insert width/height tags in
the html */
- gdk_pixbuf_loader_write (loader, photo->data, photo->length, NULL);
+ gdk_pixbuf_loader_write (loader, photo->data.inlined.data, photo->data.inlined.length, NULL);
gdk_pixbuf_loader_close (loader, NULL);
pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
if (pixbuf)
diff --git a/plugins/bbdb/ChangeLog b/plugins/bbdb/ChangeLog
index c4df7281a4..92a5b377e7 100644
--- a/plugins/bbdb/ChangeLog
+++ b/plugins/bbdb/ChangeLog
@@ -1,3 +1,9 @@
+2006-07-18 Ross Burton <ross@openedhand.com>
+
+ * gaimbuddies.c:
+ Fix for EContactPhoto change. Partially fixed by Hiroyuki Ikezoe
+ <poincare@ikezoe.net>, rest by me. (#347870)
+
2006-07-12 Andre Klapper <a9016009@gmx.de>
* bbdb.c: Marking two strings for translation that were accidentally
diff --git a/plugins/bbdb/gaimbuddies.c b/plugins/bbdb/gaimbuddies.c
index d4d104bbf1..76ef1a0f2c 100644
--- a/plugins/bbdb/gaimbuddies.c
+++ b/plugins/bbdb/gaimbuddies.c
@@ -245,8 +245,9 @@ bbdb_merge_buddy_to_contact (EBook *book, GaimBuddy *b, EContact *c)
if (photo == NULL) {
photo = g_new0 (EContactPhoto, 1);
+ photo->type = E_CONTACT_PHOTO_TYPE_INLINED;
- if (! g_file_get_contents (b->icon, &photo->data, &photo->length, &error)) {
+ if (! g_file_get_contents (b->icon, &photo->data.inlined.data, &photo->data.inlined.length, &error)) {
g_warning ("bbdb: Could not read buddy icon: %s\n", error->message);
g_error_free (error);
for (l = ims; l != NULL; l = l->next)