Re: [Evolution-hackers] Getting libebook working (1.4.5)



Thank you much!  I finally am crash free.  The
following code works.  Is there some documentatin
somewhere that relates the various initializers that
need to be called and the order they need to come in?

Now that I'm not crashing, it seems my callback
function isn't getting called back.  Do I need to
sleep (I tried sleeping to no avail) or enter this
into a glib main loop or something?

Thanks a bunch!
John

---snip (non-crashing code)
    EBook*  book;
                                                      
                                                      
    
    g_type_init();
    printf("gtype inited\n");
                                                      
                                                      
    
    if (!g_thread_supported ()) g_thread_init (NULL);
    printf("gthread inited\n");
                                                      
                                                      
    
    bonobo_activation_init(argc, argv);
    printf("bonobo activated\n");
                                                      
                                                      
    
    if (bonobo_is_initialized()) {
        printf("bonobo already initialized\n");
    } else {
        bonobo_init(argc, argv);
        printf("bonobo initialized\n");
    }
                                                      
                                                      
        book = e_book_new();
    printf("Got an ebook\n");
                                                      
                                                      
    
    char* localPath = g_strdup_printf (
           
"file://%s/evolution/local/Contacts/addressbook.db",
g_get_home_dir());
    printf("|%s|\n", localPath);
                                                      
                                                      
    
    printf("|%s|\n", e_book_get_uri(book) );
    e_book_load_uri(book, localPath, loaded_cb, NULL);
    printf("|%s|\n", e_book_get_uri(book) );
---snip


--- JP Rosevear <jpr ximian com> wrote:
> On Thu, 2004-01-22 at 00:30, John Spiegel wrote:
> > I have the following code:
> > 
> > // Initialize cables and ports and calcs and all
> > void initialize()
> > {
> >     char*   mythin = malloc(sizeof(int));
> >     if (initialized)
> >         return;
> > 
> >     g_type_init();
> >     book = e_book_new();
> >     char* localPath = g_strdup_printf (
> >            
> "file://%s/evolution/local/Contacts/addressbook.db",
> g_get_home_dir());
> >     e_book_load_uri(book, localPath, loaded_cb,
> mythin);
> > 
> >     g_free(localPath);
> > 
> >     initialized = 1;
> >     return;
> > }
> > 
> > when run, it gives the following error and
> segfaults:
> >  
> > ** (process:13781): CRITICAL **: file
> bonobo-activation-activate.c: line 276
> (bonobo_activation_query): assertion `ac != NULL'
> failed
> > Segmentation fault
> > 
> > 
> > The error goes away when I comment out the
> e_book_load_uri() call.
> > Any pointers?  Do I need to initialize something? 
> And does anyone know
> > what that last gpointer "closure" argument is to
> e_book_load_uri()?
> 
> Try bonobo_init.


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/



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