2007-10-10 [claws] 3.0.2cvs49

* src/summaryview.c
	* src/messageview.c
		Fix crash on Add sender to addressbook when
		From is null
	* src/addressadd.c
	* src/addrindex.c
	* src/editaddress.c
	* src/editaddress_other_attributes_ldap.h
		Fix leaks
		Rename images to .png in addrbook/
	* src/headerview.c
	* src/textview.c
		Fix Face/X-Face being used if adding another
		address than sender to addressbook
		Thanks to Colin
This commit is contained in:
Colin Leroy 2007-10-10 09:48:41 +00:00
parent a4d610a7fb
commit 35706689ff
11 changed files with 78 additions and 41 deletions

View file

@ -1,3 +1,21 @@
2007-10-10 [claws] 3.0.2cvs49
* src/summaryview.c
* src/messageview.c
Fix crash on Add sender to addressbook when
From is null
* src/addressadd.c
* src/addrindex.c
* src/editaddress.c
* src/editaddress_other_attributes_ldap.h
Fix leaks
Rename images to .png in addrbook/
* src/headerview.c
* src/textview.c
Fix Face/X-Face being used if adding another
address than sender to addressbook
Thanks to Colin
2007-10-10 [holger] 3.0.2cvs48
* src/addrduplicates.c

View file

@ -2961,3 +2961,4 @@
( cvs diff -u -r 1.94.2.156 -r 1.94.2.157 src/messageview.c; cvs diff -u -r 1.395.2.328 -r 1.395.2.329 src/summaryview.c; cvs diff -u -r 1.96.2.184 -r 1.96.2.185 src/textview.c; ) > 3.0.2cvs46.patchset
( cvs diff -u -r 1.28.2.34 -r 1.28.2.35 src/addrindex.c; ) > 3.0.2cvs47.patchset
( cvs diff -u -r 1.1.2.3 -r 1.1.2.4 src/addrduplicates.c; cvs diff -u -r 1.14.2.32 -r 1.14.2.33 src/editaddress.c; ) > 3.0.2cvs48.patchset
( cvs diff -u -r 1.9.2.17 -r 1.9.2.18 src/addressadd.c; cvs diff -u -r 1.28.2.35 -r 1.28.2.36 src/addrindex.c; cvs diff -u -r 1.14.2.33 -r 1.14.2.34 src/editaddress.c; cvs diff -u -r 1.1.2.5 -r 1.1.2.6 src/editaddress_other_attributes_ldap.h; cvs diff -u -r 1.8.2.24 -r 1.8.2.25 src/headerview.c; cvs diff -u -r 1.94.2.157 -r 1.94.2.158 src/messageview.c; cvs diff -u -r 1.395.2.329 -r 1.395.2.330 src/summaryview.c; cvs diff -u -r 1.96.2.185 -r 1.96.2.186 src/textview.c; ) > 3.0.2cvs49.patchset

View file

@ -11,7 +11,7 @@ MINOR_VERSION=0
MICRO_VERSION=2
INTERFACE_AGE=0
BINARY_AGE=0
EXTRA_VERSION=48
EXTRA_VERSION=49
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=

View file

@ -439,7 +439,7 @@ gboolean addressadd_selection( AddressIndex *addrIndex, const gchar *name,
if (picture) {
GError *error = NULL;
gchar *name = g_strconcat( get_rc_dir(), G_DIR_SEPARATOR_S, ADDRBOOK_DIR, G_DIR_SEPARATOR_S,
ADDRITEM_ID(person), NULL );
ADDRITEM_ID(person), NULL, ".png" );
gdk_pixbuf_save(picture, name, "png", &error, NULL);
addritem_person_set_picture( person, ADDRITEM_ID(person) ) ;
g_free( name );

View file

@ -3220,7 +3220,7 @@ gchar *addrindex_get_picture_file(const gchar *emailaddr)
found = TRUE;
filename = g_strconcat( get_rc_dir(), G_DIR_SEPARATOR_S,
ADDRBOOK_DIR, G_DIR_SEPARATOR_S,
person->picture, NULL );
person->picture, NULL, ".png" );
break;
}
nodeM = nodeM->next;

View file

@ -700,10 +700,11 @@ void addressbook_edit_person_widgetset_hide( void )
static void addressbook_edit_person_unset_picture (void *obj, guint action, void *data)
{
personeditdlg.pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 48, 48);
gdk_pixbuf_fill(personeditdlg.pixbuf, 0xffffff00);
GdkPixbuf *pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 48, 48);
gdk_pixbuf_fill(pixbuf, 0xffffff00);
personeditdlg.picture_set = FALSE;
gtk_image_set_from_pixbuf(GTK_IMAGE(personeditdlg.image), personeditdlg.pixbuf);
gtk_image_set_from_pixbuf(GTK_IMAGE(personeditdlg.image), pixbuf);
g_object_unref(pixbuf);
}
static GtkItemFactoryEntry editaddr_popup_entries[] =
@ -720,16 +721,8 @@ static void addressbook_edit_person_set_picture(GtkWidget *widget,
if (event->button == 1) {
if ( (filename = filesel_select_file_open(_("Choose a picture"), NULL)) ) {
personeditdlg.pixbuf = gdk_pixbuf_new_from_file(filename, &error);
if (error) {
alertpanel_error(_("Failed to import image: \n%s"),
error->message);
g_error_free(error);
}
personeditdlg.picture_set = TRUE;
g_free(filename);
width = gdk_pixbuf_get_width(personeditdlg.pixbuf);
height = gdk_pixbuf_get_height(personeditdlg.pixbuf);
GdkPixbuf *pixbuf = NULL;
gdk_pixbuf_get_file_info(filename, &width, &height);
if ( width > 128 || height > 128 ) {
if (width > height) {
@ -740,9 +733,20 @@ static void addressbook_edit_person_set_picture(GtkWidget *widget,
scalewidth = (width * 128) / height;
scaleheight = 128;
}
personeditdlg.pixbuf = gdk_pixbuf_scale_simple(personeditdlg.pixbuf, scalewidth, scaleheight, GDK_INTERP_BILINEAR);
pixbuf = gdk_pixbuf_new_from_file_at_scale(filename,
scalewidth, scaleheight, TRUE, &error);
} else {
pixbuf = gdk_pixbuf_new_from_file(filename, &error);
}
gtk_image_set_from_pixbuf(GTK_IMAGE(personeditdlg.image), personeditdlg.pixbuf);
if (error) {
alertpanel_error(_("Failed to import image: \n%s"),
error->message);
g_error_free(error);
}
personeditdlg.picture_set = TRUE;
g_free(filename);
gtk_image_set_from_pixbuf(GTK_IMAGE(personeditdlg.image), pixbuf);
g_object_unref(pixbuf);
}
} else {
gtk_menu_popup(GTK_MENU(personeditdlg.editaddr_popupmenu),
@ -765,7 +769,7 @@ static void addressbook_edit_person_page_basic( gint pageNum, gchar *pageLbl ) {
const gchar *locale;
gint top = 0;
gint n_entries;
GdkPixbuf *pixbuf;
vbox = gtk_vbox_new( FALSE, 20 );
hbox = gtk_hbox_new( FALSE, 8 );
@ -776,11 +780,12 @@ static void addressbook_edit_person_page_basic( gint pageNum, gchar *pageLbl ) {
frame_picture = gtk_frame_new("Photo");
/* Room for a photo */
personeditdlg.pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 48, 48);
gdk_pixbuf_fill(personeditdlg.pixbuf, 0xffffff00);
pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 48, 48);
gdk_pixbuf_fill(pixbuf, 0xffffff00);
personeditdlg.picture_set = FALSE;
personeditdlg.image = gtk_image_new_from_pixbuf(personeditdlg.pixbuf);
personeditdlg.image = gtk_image_new_from_pixbuf(pixbuf);
g_object_unref(pixbuf);
gtk_container_add(GTK_CONTAINER(ebox_picture), personeditdlg.image);
gtk_container_add(GTK_CONTAINER(frame_picture), ebox_picture);
gtk_container_add(GTK_CONTAINER( personeditdlg.notebook ), hbox );
@ -1437,14 +1442,15 @@ static gboolean addressbook_edit_person_close( gboolean cancelled )
gchar *name;
addritem_person_set_common_name( current_person, cn );
if (personeditdlg.picture_set) {
GdkPixbuf * pixbuf = gtk_image_get_pixbuf(GTK_IMAGE(personeditdlg.image));
name = g_strconcat( get_rc_dir(), G_DIR_SEPARATOR_S, ADDRBOOK_DIR, G_DIR_SEPARATOR_S,
ADDRITEM_ID(current_person), NULL );
gdk_pixbuf_save(personeditdlg.pixbuf, name, "png", &error, NULL);
ADDRITEM_ID(current_person), NULL, ".png" );
gdk_pixbuf_save(pixbuf, name, "png", &error, NULL);
addritem_person_set_picture( current_person, ADDRITEM_ID(current_person) ) ;
g_free( name );
} else {
name = g_strconcat( get_rc_dir(), G_DIR_SEPARATOR_S, ADDRBOOK_DIR, G_DIR_SEPARATOR_S,
ADDRITEM_ID(current_person), NULL );
ADDRITEM_ID(current_person), NULL, ".png" );
g_unlink(name);
g_free(name);
}
@ -1485,7 +1491,7 @@ ItemPerson *addressbook_edit_person( AddressBookFile *abf, ItemFolder *parent_fo
gboolean get_focus) {
static gboolean cancelled;
GError *error = NULL;
GdkPixbuf *pixbuf;
/* set transient data */
current_abf = abf;
current_person = person;
@ -1533,9 +1539,9 @@ ItemPerson *addressbook_edit_person( AddressBookFile *abf, ItemFolder *parent_fo
if( current_person->picture ) {
gchar *filename = g_strconcat( get_rc_dir(), G_DIR_SEPARATOR_S, ADDRBOOK_DIR, G_DIR_SEPARATOR_S,
current_person->picture, NULL );
current_person->picture, NULL, ".png" );
if (is_file_exist(filename)) {
personeditdlg.pixbuf = gdk_pixbuf_new_from_file(filename, &error);
pixbuf = gdk_pixbuf_new_from_file(filename, &error);
if (error) {
debug_print("Failed to import image: \n%s",
error->message);
@ -1550,10 +1556,12 @@ ItemPerson *addressbook_edit_person( AddressBookFile *abf, ItemFolder *parent_fo
} else {
no_img:
personeditdlg.picture_set = FALSE;
personeditdlg.pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 48, 48);
gdk_pixbuf_fill(personeditdlg.pixbuf, 0xffffff00);
pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 48, 48);
gdk_pixbuf_fill(pixbuf, 0xffffff00);
}
gtk_image_set_from_pixbuf(GTK_IMAGE(personeditdlg.image), personeditdlg.pixbuf);
gtk_image_set_from_pixbuf(GTK_IMAGE(personeditdlg.image), pixbuf);
g_object_unref(pixbuf);
pixbuf = NULL;
if( current_person->firstName )
gtk_entry_set_text(GTK_ENTRY(personeditdlg.entry_first), current_person->firstName );

View file

@ -46,7 +46,6 @@ struct _PersonEdit_dlg {
gint status_cid;
/* User data tab */
GdkPixbuf *pixbuf;
GtkWidget *image;
gboolean picture_set;
GtkWidget *entry_name;

View file

@ -392,6 +392,7 @@ static gint headerview_show_contact_pic (HeaderView *headerview, MsgInfo *msginf
else
return -1;
g_object_unref(picture);
if (image) {
gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0);
gtk_widget_show(image);

View file

@ -2265,7 +2265,9 @@ static void add_address_cb(gpointer data, guint action, GtkWidget *widget)
GtkWidget *image = NULL;
GdkPixbuf *picture = NULL;
if (!messageview->msginfo) return;
if (!messageview->msginfo || !messageview->msginfo->from)
return;
msginfo = messageview->msginfo;
Xstrdup_a(from, msginfo->from, return);
eliminate_address_comment(from);

View file

@ -4314,7 +4314,8 @@ void summary_add_address(SummaryView *summaryview)
msginfo = gtk_ctree_node_get_row_data(GTK_CTREE(summaryview->ctree),
summaryview->selected);
if (!msginfo) return;
if (!msginfo || !msginfo->from)
return;
Xstrdup_a(from, msginfo->from, return);
eliminate_address_comment(from);

View file

@ -1971,9 +1971,10 @@ static void textview_show_contact_pic(TextView *textview)
}
g_free(filename);
if (picture)
if (picture) {
textview->image = gtk_image_new_from_pixbuf(picture);
g_object_unref(picture);
}
g_return_if_fail(textview->image != NULL);
gtk_widget_show(textview->image);
@ -2905,23 +2906,29 @@ static void add_uri_to_addrbook_cb (TextView *textview, guint action, void *data
"menu_button");
GtkWidget *image = NULL;
GdkPixbuf *picture = NULL;
gboolean use_picture = FALSE;
if (uri == NULL)
return;
/* extract url */
fromaddress = g_strdup(uri->uri + 7);
/* Hiroyuki: please put this function in utils.c! */
if (textview->messageview->msginfo &&
!strcmp2(fromaddress, textview->messageview->msginfo->from))
use_picture = TRUE;
fromname = procheader_get_fromname(fromaddress);
extract_address(fromaddress);
if (textview->messageview->msginfo &&
if (use_picture &&
textview->messageview->msginfo &&
textview->messageview->msginfo->extradata &&
textview->messageview->msginfo->extradata->face) {
image = face_get_from_header(textview->messageview->msginfo->extradata->face);
}
#if HAVE_LIBCOMPFACE
else if (textview->messageview->msginfo &&
else if (use_picture &&
textview->messageview->msginfo &&
textview->messageview->msginfo->extradata &&
textview->messageview->msginfo->extradata->xface) {
image = xface_get_from_header(textview->messageview->msginfo->extradata->xface,