[Evolution-hackers] Access to the EBook from client apps.



Hi,
  Firstly please CC me as I'm not on the list at current. Appoligies if
this is the incorrect forum for this type of msg, please just send where
I should redirect future mail if this is the case.

  I've been looking for a while now to add support for mounting
evolution's contacts and mailboxes with libferris. I've recently
installed evolution 1.5.3 from fedora1.90. If this is a fairly buggy
install or I should update does anyone know where rpms for a rh9 base or
src.rpms can be found for a latter evolution (or just rpmbuild the
tarball?).

  I started by creating a little toy to run though the contacts spitting
out a little data to cerr but this toy app works sometimes and hangs
others. Its a C++ app and designed to use STLPort (so basically its a
little testbed to get the hand of e-d-s before I start hacking in
support to libferris).

There doesn't seem to be any ebook_init() call that I found. Also I
noticed that it wanted libxml-2.0 and libbonobo-2.0 in order to compile,
to gtk-2.0 is just me being lazy in gtk_init().

$ cat Makefile
all:
        g++ `stlport-config --cflags --libs` contactsls.cpp -o
contactsls `pkg-config libebook-1.0 libxml-2.0 libbonobo-2.0 gtk+-2.0 --
cflags --libs`


extern "C" {
#include <libebook/e-book.h>
#include <gtk/gtk.h>
#include <libbonobo.h>
};

#include <iostream>

using namespace std;


int main( int argc, char** argv )
{
    EBook*   book  = 0;
    GError*  error = 0;

    /* init threads */	
    g_thread_init(NULL);
    gdk_threads_init();
  
    gtk_init( &argc, &argv );
    bonobo_init( &argc, argv );
    
    
    if( e_book_get_default_addressbook( &book, &error ) )
    {
        EBookQuery* query    = e_book_query_field_exists
( E_CONTACT_FULL_NAME );
        GList*      contacts = 0;
        
        if( e_book_get_contacts( book, query, &contacts, &error ))
        {
            GList* giter = g_list_first( contacts );
            for( ; giter; giter = g_list_next( giter ) )
            {
                EContact* c = (EContact*)giter->data;
            
                const gpointer d = e_contact_get_const( c,
E_CONTACT_FULL_NAME );
                cerr << "name:" << (const char*)d << endl;
            }
        }
    }
    
    return 0;
}

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]