aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mail-remote/mail-remote.c
blob: 369a38da2b057a62fa76d9e62e1ab34f8f31322b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

#include "evolution-mail-session.h"
#include <bonobo/bonobo-main.h>

#define MAIL_SESSION_ID  "OAFIID:GNOME_Evolution_Mail_Session:" BASE_VERSION

init()
{
    static EvolutionMailSession *sess;
    /* placeholder for EvolutionMailSession registration, this must use a different poa */
    if (sess == NULL) {
        static PortableServer_POA poa = NULL;
        int res;
        CORBA_Object existing;

        if (poa == NULL)
            poa = bonobo_poa_get_threaded (ORBIT_THREAD_HINT_PER_REQUEST, NULL);

        sess = g_object_new(evolution_mail_session_get_type(), NULL); //"poa", poa, NULL);

        if ((res = bonobo_activation_register_active_server_ext(MAIL_SESSION_ID, bonobo_object_corba_objref((BonoboObject *)sess), NULL,
                                    Bonobo_REGISTRATION_FLAG_NO_SERVERINFO, &existing, NULL)) != Bonobo_ACTIVATION_REG_SUCCESS) {
            g_warning("Could not register Mail EDS Interface: %d", res);
            g_object_unref(sess);
            sess = NULL;
        }

        if (existing != CORBA_OBJECT_NIL)
            CORBA_Object_release(existing, NULL);
    }
}