aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
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
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')
-rw-r--r--plugins/mail-remote/ChangeLog12
-rw-r--r--plugins/mail-remote/Evolution.idl6
-rw-r--r--plugins/mail-remote/Makefile.am12
-rw-r--r--plugins/mail-remote/client.c62
-rw-r--r--plugins/mail-remote/mail-remote.c35
5 files changed, 93 insertions, 34 deletions
diff --git a/plugins/mail-remote/ChangeLog b/plugins/mail-remote/ChangeLog
index 2e687b633a..c47b53a862 100644
--- a/plugins/mail-remote/ChangeLog
+++ b/plugins/mail-remote/ChangeLog
@@ -1,3 +1,15 @@
+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.
+
2005-05-27 Not Zed <NotZed@Ximian.com>
* em-message-stream.[ch]: A camel-stream to wrap
diff --git a/plugins/mail-remote/Evolution.idl b/plugins/mail-remote/Evolution.idl
new file mode 100644
index 0000000000..c5385d5800
--- /dev/null
+++ b/plugins/mail-remote/Evolution.idl
@@ -0,0 +1,6 @@
+
+/* All external interfaces should go here, so we only create a single skels file */
+
+#include <Bonobo.idl>
+#include <shell/Evolution.idl>
+#include <mail/Evolution-Mail.idl>
diff --git a/plugins/mail-remote/Makefile.am b/plugins/mail-remote/Makefile.am
index 80fb0fcc97..800cf71dc6 100644
--- a/plugins/mail-remote/Makefile.am
+++ b/plugins/mail-remote/Makefile.am
@@ -49,7 +49,9 @@ client_LDADD = \
evolution-mail-messagestream.o \
Evolution-DataServer-Mail-common.o \
Evolution-DataServer-Mail-stubs.o \
- Evolution-DataServer-Mail-skels.o
+ Evolution-DataServer-Mail-skels.o \
+ Evolution-common.o \
+ Evolution-stubs.o
noinst_PROGRAMS = \
client
@@ -66,9 +68,14 @@ IDL_GENERATED_C = \
Evolution-DataServer-Mail-skels.c \
Evolution-DataServer-Mail-stubs.c
+EVO_GENERATED = Evolution.h Evolution-common.c Evolution-stubs.c Evolution-skels.c
+
$(IDL_GENERATED_H) $(IDL_GENERATED_C): $(IDL)
$(ORBIT_IDL) -I $(srcdir) -I $(datadir)/idl $(IDL_INCLUDES) $^
+$(EVO_GENERATED): $(srcdir)/Evolution.idl
+ $(ORBIT_IDL) -I $(top_srcdir) -I $(top_srcdir)/shell -I $(datadir)/idl $(IDL_INCLUDES) $^
+
# installed idls
#idl_DATA = $(IDL)
@@ -79,7 +86,8 @@ MARSHAL_GENERATED = evolution-mail-marshal.c evolution-mail-marshal.h
EXTRA_DIST = \
$(IDL) \
+ Evolution.idl \
evolution-mail-marshal.list
-BUILT_SOURCES = $(IDL_GENERATED_H) $(IDL_GENERATED_C) $(MARSHAL_GENERATED)
+BUILT_SOURCES = $(IDL_GENERATED_H) $(IDL_GENERATED_C) $(MARSHAL_GENERATED) $(SHELL_GENERATED)
CLEANFILES = $(BUILT_SOURCES)
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;
diff --git a/plugins/mail-remote/mail-remote.c b/plugins/mail-remote/mail-remote.c
index dedbb03596..7d082d3465 100644
--- a/plugins/mail-remote/mail-remote.c
+++ b/plugins/mail-remote/mail-remote.c
@@ -23,35 +23,34 @@ int e_plugin_lib_enable(int enable)
if (enable) {
static PortableServer_POA poa = NULL;
- CORBA_string ior;
- CORBA_Environment ev = { 0 };
+ void *component;
if (sess != NULL)
return 0;
+ component = mail_component_peek();
+ if (component == NULL) {
+ g_warning("Unable to find mail component, cannot instantiate mail remote api");
+ return -1;
+ }
+
if (poa == NULL)
poa = bonobo_poa_get_threaded (ORBIT_THREAD_HINT_PER_REQUEST, NULL);
sess = g_object_new(evolution_mail_session_get_type(), "poa", poa, NULL);
- ior = CORBA_ORB_object_to_string(bonobo_orb(), bonobo_object_corba_objref((BonoboObject *)sess), &ev);
- path = g_build_filename(g_get_home_dir(), ".evolution-mail-remote.ior", NULL);
- fp = fopen(path, "w");
- fprintf(fp, "%s", ior);
- fclose(fp);
- g_free(path);
+ /*
+ NB: This only works if this is done early enough in the process ...
+ I guess it will be. But i'm not entirely sure ...
- printf("Enable mail-remote: IOR=%s\n", ior);
- } else {
- if (sess == NULL)
- return 0;
+ If this wrong, then we have to add a mechanism to the mailcomponent directly
+ to retrieve it */
- path = g_build_filename(g_get_home_dir(), ".evolution-mail-remote.ior", NULL);
- unlink(path);
- g_free(path);
-
- g_object_unref(sess);
- sess = NULL;
+ bonobo_object_add_interface((BonoboObject *)component, (BonoboObject *)sess);
+ printf(" ** Added mail interface to mail component\n");
+ } else {
+ /* can't easily disable this until restart? */
+ /* can we just destroy it? */
}
return 0;