[Galago-commits] r2494 - in trunk/eds-feed: . src

galago-commits at freedesktop.org galago-commits at freedesktop.org
Tue Jan 24 22:57:05 PST 2006


Author: chipx86
Date: 2006-01-24 22:57:00 -0800 (Tue, 24 Jan 2006)
New Revision: 2494

Modified:
   trunk/eds-feed/ChangeLog
   trunk/eds-feed/configure.ac
   trunk/eds-feed/src/main.c
Log:
Patch by Jorn Baayen to work against the D-BUS port of evolution-data-server. Mainly, this just removes a bunch of stuff we don't need to do. It also improves the photo support, and solves a memory leak. This closes bug #6.


Modified: trunk/eds-feed/ChangeLog
===================================================================
--- trunk/eds-feed/ChangeLog	2006-01-24 08:19:10 UTC (rev 2493)
+++ trunk/eds-feed/ChangeLog	2006-01-25 06:57:00 UTC (rev 2494)
@@ -1,3 +1,12 @@
+Tue Jan 24 22:55:42 PST 2006  Christian Hammond <chipx86 at chipx86.com>
+
+	* src/main.c:
+	* configure.ac:
+	  - Patch by Jorn Baayen to work against the D-BUS port of
+	    evolution-data-server. Mainly, this just removes a bunch of stuff we
+	    don't need to do. It also improves the photo support, and solves a
+	    memory leak. This closes bug #6.
+
 Wed Dec 14 00:28:14 PST 2005  Christian Hammond <chipx86 at chipx86.com>
 
 	* src/main.c:

Modified: trunk/eds-feed/configure.ac
===================================================================
--- trunk/eds-feed/configure.ac	2006-01-24 08:19:10 UTC (rev 2493)
+++ trunk/eds-feed/configure.ac	2006-01-25 06:57:00 UTC (rev 2494)
@@ -65,11 +65,21 @@
 	libxml-2.0)
 
 # Check which version of eds we're using
-PKG_CHECK_MODULES(EDS, libebook-1.2 >= 1.1.4 libedata-book-1.2 >= 1.1.4)
+PKG_CHECK_MODULES(EDS, libebook-1.2 >= 1.1.4)
 
 PACKAGE_CFLAGS="$PACKAGE_CFLAGS $EDS_CFLAGS"
 PACKAGE_LIBS="$PACKAGE_LIBS $EDS_LIBS"
 
+# Check for EContactPhotoType
+old_cflags=$CFLAGS
+CFLAGS=$EDS_CFLAGS
+AC_CHECK_TYPE(EContactPhotoType, [], [], [#include <libebook/e-book.h>])
+CFLAGS=$old_cflags
+
+if test $ac_cv_type_EContactPhotoType = yes; then
+	AC_DEFINE(HAVE_PHOTO_TYPE, 1, [Defined if EContactPhotoType exists])
+fi
+
 AC_SUBST(PACKAGE_CFLAGS)
 AC_SUBST(PACKAGE_LIBS)
 

Modified: trunk/eds-feed/src/main.c
===================================================================
--- trunk/eds-feed/src/main.c	2006-01-24 08:19:10 UTC (rev 2493)
+++ trunk/eds-feed/src/main.c	2006-01-25 06:57:00 UTC (rev 2494)
@@ -18,19 +18,13 @@
  * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  * MA  02111-1307  USA
  */
-#include <glib.h>
-#include <libgalago/galago.h>
-#include <libedata-book/Evolution-DataServer-Addressbook.h>
+#include "config.h"
 
 #include <libebook/e-book.h>
-#include <libedata-book/e-data-book-factory.h>
-#include <bonobo/bonobo-main.h>
-
+#include <libgalago/galago.h>
+#include <glib.h>
 #include <string.h>
 
-#define E_DATA_BOOK_FACTORY_OAF_ID \
-    "OAFIID:GNOME_Evolution_DataServer_BookFactory"
-
 static EBookView *book_view = NULL;
 static EBook *book = NULL;
 static gulong book_view_tag = 0;
@@ -127,7 +121,7 @@
 set_attributes(GalagoPerson *person, EContact *contact)
 {
 	EContactName *contact_name;
-	const EContactPhoto *ephoto;
+	EContactPhoto *ephoto;
 	GalagoImage *photo = NULL;
 
 	galago_object_set_attr_string(GALAGO_OBJECT(person),
@@ -159,8 +153,34 @@
 
 	if (ephoto != NULL)
 	{
+#ifdef HAVE_PHOTO_TYPE
+		switch (ephoto->type)
+		{
+			case E_CONTACT_PHOTO_TYPE_INLINED:
+				photo = galago_image_new_from_data(
+					(guchar *)ephoto->inlined.data, ephoto->inlined.length);
+				break;
+
+			case E_CONTACT_PHOTO_TYPE_URI:
+				if (g_str_has_prefix(ephoto->uri, "file://"))
+					photo = galago_image_new_from_file(ephoto->uri + 7);
+				else
+				{
+					/* TODO: use gnome-vfs? */
+					g_warning("Cannot handle remote photos");
+				}
+				break;
+
+			default:
+				g_warning("Unhandled photo type %d\n", ephoto->type);
+				break;
+		}
+#else /* !HAVE_PHOTO_TYPE */
 		photo = galago_image_new_from_data((guchar *)ephoto->data,
 										   ephoto->length);
+#endif
+
+		e_contact_photo_free(ephoto);
 	}
 
 	galago_person_set_photo(person, photo);
@@ -292,6 +312,8 @@
 
 	loop = g_main_loop_new(NULL, FALSE);
 
+    g_type_init ();
+
 	if (!galago_init("eds-feed", TRUE))
 	{
 		g_error("Unable to initialize Galago.");
@@ -300,15 +322,6 @@
 
 	galago_set_exit_with_daemon(TRUE);
 
-	if (!bonobo_init_full(NULL, NULL, bonobo_activation_orb_get(),
-						  CORBA_OBJECT_NIL, CORBA_OBJECT_NIL))
-	{
-		g_error("Unable to initialize bonobo.");
-		exit(1);
-	}
-
-	bonobo_activate();
-
 	setup_book_view();
 	setup_services();
 



More information about the galago-commits mailing list