aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mail-remote/client.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2005-06-02 13:51:16 +0800
committerMichael Zucci <zucchi@src.gnome.org>2005-06-02 13:51:16 +0800
commit79086a141808831e3d7e49969f507678d08e6bec (patch)
treeeb902b70042566058ba2d8a0c78b32221e419085 /plugins/mail-remote/client.c
parent84dd2e3f792d59dadacb9eb3bea0ad719002643a (diff)
downloadgsoc2013-evolution-79086a141808831e3d7e49969f507678d08e6bec.tar
gsoc2013-evolution-79086a141808831e3d7e49969f507678d08e6bec.tar.gz
gsoc2013-evolution-79086a141808831e3d7e49969f507678d08e6bec.tar.bz2
gsoc2013-evolution-79086a141808831e3d7e49969f507678d08e6bec.tar.lz
gsoc2013-evolution-79086a141808831e3d7e49969f507678d08e6bec.tar.xz
gsoc2013-evolution-79086a141808831e3d7e49969f507678d08e6bec.tar.zst
gsoc2013-evolution-79086a141808831e3d7e49969f507678d08e6bec.zip
seutp an idl file so we only need to generate one set of skels/stubs for
2005-06-02 Not Zed <NotZed@Ximian.com> * Evolution.idl: seutp an idl file so we only need to generate one set of skels/stubs for all imported. * mail-remote.c (e_plugin_lib_enable): instead of writing ior to a file, just add the Session interface to the mail component. * client.c (get_session): use the new shell interface to find the mail compnent and retrieve the session interface using bonobo-activation, so the mailer starts if we try to access it. svn path=/trunk/; revision=29445
Diffstat (limited to 'plugins/mail-remote/client.c')
-rw-r--r--plugins/mail-remote/client.c62
1 files changed, 48 insertions, 14 deletions
diff --git a/plugins/mail-remote/client.c b/plugins/mail-remote/client.c
index 8e97a1c618..5740d526c6 100644
--- a/plugins/mail-remote/client.c
+++ b/plugins/mail-remote/client.c
@@ -11,6 +11,8 @@
#include "evolution-mail-folderlistener.h"
#include "evolution-mail-messagestream.h"
+#include "shell/e-shell.h"
+
#include <camel/camel-folder.h>
static EvolutionMailSessionListener *listener_sess;
@@ -86,26 +88,58 @@ static void e_mail_exception_dump(CORBA_Environment *ev, char *what)
static Evolution_Mail_Session
get_session(void)
{
- char *path, *ior;
Evolution_Mail_Session sess = NULL;
CORBA_Environment ev = { 0 };
+ GNOME_Evolution_Component mail;
+ GNOME_Evolution_Shell shell;
- /* The new-improved bonobo-activation ... */
+ shell = bonobo_activation_activate_from_id("OAFIID:GNOME_Evolution_Shell:2.4", 0, NULL, &ev);
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ e_mail_exception_dump(&ev, "activating shell");
+ return NULL;
+ }
- path = g_build_filename(g_get_home_dir(), ".evolution-mail-remote.ior", NULL);
- if (g_file_get_contents(path, &ior, NULL, NULL)) {
- sess = CORBA_ORB_string_to_object(bonobo_orb(), ior, &ev);
- g_free(ior);
+ do {
+ mail = GNOME_Evolution_Shell_findComponent(shell, "mail", &ev);
+ if (ev._major == CORBA_USER_EXCEPTION
+ && !strcmp(ev._id, ex_GNOME_Evolution_Shell_NotReady)) {
+ CORBA_exception_free(&ev);
+ printf("Shell not ready yet, waiting\n");
+ sleep(1);
+ } else if (ev._major != CORBA_NO_EXCEPTION) {
+ e_mail_exception_dump(&ev, "finding mail component");
+ CORBA_Object_release(shell, NULL);
+ return NULL;
+ } else
+ break;
+ } while (1);
+
+ printf("got mail interface\n");
+ GNOME_Evolution_MailComponent_test(mail, &ev);
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ e_mail_exception_dump(&ev, "testing mail interface?");
}
- if (sess != CORBA_OBJECT_NIL) {
- listener_sess = evolution_mail_sessionlistener_new();
- listener_store = evolution_mail_storelistener_new();
- listener_folder = evolution_mail_folderlistener_new();
- Evolution_Mail_Session_addListener(sess, bonobo_object_corba_objref((BonoboObject *)listener_sess), &ev);
- if (ev._major != CORBA_NO_EXCEPTION) {
- e_mail_exception_dump(&ev, "adding store listener");
- }
+ sess = Bonobo_Unknown_queryInterface(mail, "IDL:Evolution/Mail/Session:1.0", &ev);
+ if (sess == NULL || ev._major != CORBA_NO_EXCEPTION) {
+ if (ev._major != CORBA_NO_EXCEPTION)
+ e_mail_exception_dump(&ev, "querying for session interface");
+ else
+ printf("can't find session interface?\n");
+ CORBA_Object_release(shell, NULL);
+ CORBA_Object_release(mail, NULL);
+ return NULL;
+ }
+
+ printf("got session interface: %p\n", sess);
+
+ listener_sess = evolution_mail_sessionlistener_new();
+ listener_store = evolution_mail_storelistener_new();
+ listener_folder = evolution_mail_folderlistener_new();
+ Evolution_Mail_Session_addListener(sess, bonobo_object_corba_objref((BonoboObject *)listener_sess), &ev);
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ e_mail_exception_dump(&ev, "adding store listener");
+ return NULL;
}
return sess;