[Commits] utils.c 1.13 1.14 utils.h 1.11 1.12

miras at claws-mail.org miras at claws-mail.org
Mon Mar 26 00:55:15 CEST 2012


Update of /home/claws-mail/contacts/src
In directory srv:/tmp/cvs-serv12090/src

Modified Files:
	utils.c utils.h 
Log Message:
2012-03-25 [mir]	0.6.0cvs80

	* extensions/vcard/src/vcard-extension.c
	* libversit/Makefile.am
	* libversit/vcard-utils.c
	* libversit/vcard-utils.h
	* src/utils.c
	* src/utils.h
	* src/dbus/Makefile.am
	* src/dbus/claws-contacts.xml
	* src/dbus/server-object.c
	* src/dbus/server-object.h
	* xmllib/parser.c
	A bunch of changes and enhancements. Also added feature
	to allow users to create a vCard for each account which
	is to be used for optionally added a vCard to every
	send email. 

Index: utils.c
===================================================================
RCS file: /home/claws-mail/contacts/src/utils.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- utils.c	21 Dec 2011 22:02:52 -0000	1.13
+++ utils.c	25 Mar 2012 22:55:13 -0000	1.14
@@ -2067,6 +2067,35 @@
 	return dn;
 }
 
+#define PHOTO_WIDTH 140
+#define PHOTO_HEIGHT 140
+GdkPixbuf* contact_load_image(GtkWidget* parent, gchar* photo) {
+	GdkPixbufLoader* pl;
+	GdkPixbuf* pixbuf;
+	GError *err = NULL;
+	guchar* image_buf;
+	gsize length; 
+	
+	image_buf = g_base64_decode(photo, &length);
+	
+	pl = gdk_pixbuf_loader_new();
+	gdk_pixbuf_loader_set_size(pl, PHOTO_WIDTH, PHOTO_HEIGHT); 
+	gdk_pixbuf_loader_write(pl, image_buf, length, &err); 
+	g_free(image_buf);
+
+	if (err) {
+		show_message(parent, GTK_UTIL_MESSAGE_WARNING, "%s", err->message);
+		g_clear_error(&err); 
+		return NULL; 
+	} 
+	gdk_pixbuf_loader_close(pl, NULL);
+	
+	pixbuf = gdk_pixbuf_copy(gdk_pixbuf_loader_get_pixbuf(pl)); 
+	g_object_unref(pl);
+	
+	return pixbuf;
+}
+
 gchar* base64_pixbuf_to_jpeg(gchar* base64_png, gsize* length) {
 	gchar *picture = NULL, *buffer;
 	GdkPixbufLoader* pl;

Index: utils.h
===================================================================
RCS file: /home/claws-mail/contacts/src/utils.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- utils.h	17 Dec 2011 02:52:22 -0000	1.11
+++ utils.h	25 Mar 2012 22:55:13 -0000	1.12
@@ -223,6 +223,7 @@
 gchar* get_domain_name(void);
 gchar* base64_pixbuf_to_jpeg(gchar* base64_png, gsize* length);
 gchar* jpeg_to_png_base64(guchar* jpeg, gsize length);
+GdkPixbuf* contact_load_image(GtkWidget* parent, gchar* photo);
 const gchar* native2ldap(const gchar* attr);
 const gchar* ldap2native(const gchar* attr);
 



More information about the Commits mailing list