aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog17
-rw-r--r--mail/GNOME_Evolution_Mail.oaf.in18
-rw-r--r--mail/Mail.idl11
-rw-r--r--mail/Makefile.am18
-rw-r--r--mail/component-factory.c15
-rw-r--r--mail/folder-info.c229
6 files changed, 279 insertions, 29 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 0bee194cc6..b81d924a29 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,20 @@
+2001-06-07 Iain Holmes <iain@ximian.com>
+
+ * GNOME_Evolution_Mail.oaf.in: Add server info for FolderInfo
+ Remove server info for the Summary server
+
+ * Mail.idl: Add a FolderInfo interface to retreive information about
+ a mail folder.
+
+ * Makefile.am: Remove the executive summary stuff. Add the folder-info
+ files.
+
+ * component-factory.c: Remove the mail-summary.h include.
+ Remove summary_factory.
+ (summary_fn): Remove.
+ (component_factory_init): Remove the summary_factory creation.
+ Initialise the info_factory.
+
2001-06-08 Jon Trowbridge <trow@ximian.com>
* mail-ops.c (mail_send_message): Reattach X-Evolution-Account
diff --git a/mail/GNOME_Evolution_Mail.oaf.in b/mail/GNOME_Evolution_Mail.oaf.in
index 58a32dcfaa..1777903fc3 100644
--- a/mail/GNOME_Evolution_Mail.oaf.in
+++ b/mail/GNOME_Evolution_Mail.oaf.in
@@ -123,4 +123,22 @@
_value="Mail configuration interface"/>
</oaf_server>
+<oaf_server iid="OAFIID:GNOME_Evolution_FolderInfo_Factory"
+ type="exe"
+ location="evolution-mail">
+
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:GNOME/GenericFactory:1.0"/>
+ </oaf_attribute>
+</oaf_server>
+
+<oaf_server iid="OAFIID:GNOME_Evolution_FolderInfo"
+ type="factory"
+ location="OAFIID:GNOME_Evolution_FolderInfo_Factory">
+
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:GNOME/Evolution/FolderInfo:1.0"/>
+ </oaf_attribute>
+</oaf_server>
+
</oaf_info>
diff --git a/mail/Mail.idl b/mail/Mail.idl
index 09a625e4b0..429ed118ab 100644
--- a/mail/Mail.idl
+++ b/mail/Mail.idl
@@ -28,6 +28,17 @@ module Evolution {
MessageList getMessageList ();
};
+ interface FolderInfo : Bonobo::Unknown {
+ struct MessageCount {
+ string path;
+ long count;
+ long unread;
+ };
+
+ void getInfo (in string foldername,
+ in Bonobo::Listener listener);
+ };
+
interface MailConfig : Bonobo::Unknown {
struct Identity {
diff --git a/mail/Makefile.am b/mail/Makefile.am
index f3931514ea..b59fc1a9f0 100644
--- a/mail/Makefile.am
+++ b/mail/Makefile.am
@@ -17,8 +17,6 @@ INCLUDES = \
-I$(top_builddir)/composer \
-I$(top_builddir)/shell \
-I$(top_srcdir)/shell \
- -I$(top_builddir)/executive-summary \
- -I$(top_srcdir)/executive-summary \
-I$(top_srcdir)/shell/importer \
-I$(top_builddir)/shell/importer \
$(MAILER_CFLAGS) \
@@ -47,6 +45,8 @@ evolution_mail_SOURCES = \
folder-browser.h \
folder-browser-factory.c \
folder-browser-factory.h \
+ folder-info.c \
+ folder-info.h \
mail-accounts.c \
mail-accounts.h \
mail-account-editor.c \
@@ -85,8 +85,6 @@ evolution_mail_SOURCES = \
mail-send-recv.h \
mail-session.c \
mail-session.h \
- mail-summary.c \
- mail-summary.h \
mail-tools.c \
mail-tools.h \
mail-types.h \
@@ -113,7 +111,6 @@ evolution_mail_LDADD = \
$(top_builddir)/e-util/ename/libename.la \
$(top_builddir)/libibex/libibex.la \
$(top_builddir)/filter/libfilter.la \
- $(top_builddir)/executive-summary/evolution-services/libevolution-services.la \
$(top_builddir)/shell/importer/libevolution-importer.la \
$(top_builddir)/widgets/menus/libmenus.la \
$(MAILER_LIBS)
@@ -121,17 +118,6 @@ evolution_mail_LDADD = \
evolution_mail_LDFLAGS = \
-export-dynamic
-#evolution_outlook_importer_SOURCES = \
-# evolution-outlook-importer.c
-
-#evolution_outlook_importer_LDADD = \
-# $(BONOBO_GNOME_LIBS) \
-# $(EXTRA_GNOME_LIBS) \
-# $(top_builddir)/e-util/libeutil.la \
-# $(top_builddir)/shell/importer/libevolution-importer.la \
-# $(CAMEL_OBJS_EXTRA) \
-# $(top_builddir)/camel/libcamel.la
-
test_mail_SOURCES = \
test-mail.c
diff --git a/mail/component-factory.c b/mail/component-factory.c
index 0cbaaf3c41..ed8f8707c0 100644
--- a/mail/component-factory.c
+++ b/mail/component-factory.c
@@ -49,7 +49,6 @@
#include "component-factory.h"
-#include "mail-summary.h"
#include "mail-send-recv.h"
char *default_drafts_folder_uri;
@@ -64,7 +63,6 @@ char *evolution_dir;
#define SUMMARY_FACTORY_ID "OAFIID:GNOME_Evolution_Mail_ExecutiveSummaryComponentFactory"
static BonoboGenericFactory *component_factory = NULL;
-static BonoboGenericFactory *summary_factory = NULL;
static GHashTable *storages_hash;
/* EvolutionShellComponent methods and signals. */
@@ -326,7 +324,6 @@ idle_quit (gpointer user_data)
if (e_list_length (folder_browser_factory_get_control_list ()))
return TRUE;
- bonobo_object_unref (BONOBO_OBJECT (summary_factory));
bonobo_object_unref (BONOBO_OBJECT (component_factory));
g_hash_table_foreach (storages_hash, free_storage, NULL);
g_hash_table_destroy (storages_hash);
@@ -390,24 +387,16 @@ component_fn (BonoboGenericFactory *factory, void *closure)
return BONOBO_OBJECT (shell_component);
}
-static BonoboObject *
-summary_fn (BonoboGenericFactory *factory, void *closure)
-{
- return executive_summary_component_factory_new (create_summary_view,
- NULL);
-}
-
void
component_factory_init (void)
{
component_factory = bonobo_generic_factory_new (COMPONENT_FACTORY_ID,
component_fn, NULL);
- summary_factory = bonobo_generic_factory_new (SUMMARY_FACTORY_ID,
- summary_fn, NULL);
evolution_mail_config_factory_init ();
+ evolution_folder_info_factory_init ();
- if (component_factory == NULL || summary_factory == NULL) {
+ if (component_factory == NULL) {
e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
_("Cannot initialize Evolution's mail component."));
exit (1);
diff --git a/mail/folder-info.c b/mail/folder-info.c
new file mode 100644
index 0000000000..e5b84b60cb
--- /dev/null
+++ b/mail/folder-info.c
@@ -0,0 +1,229 @@
+/*
+ * folder-info.c: Implementation of GNOME_Evolution_FolderInfo
+ *
+ * Copyright (C) 2001 Ximian, Inc.
+ *
+ * Authors: Iain Holmes <iain@ximian.com>
+ */
+
+#include "Mail.h"
+
+#include <glib.h>
+#include <libgnome/gnome-defs.h>
+
+#include <bonobo/bonobo-xobject.h>
+#include <bonobo/bonobo-generic-factory.h>
+#include <bonobo/bonobo-context.h>
+#include <bonobo/bonobo-exception.h>
+
+#include "mail-mt.h"
+#include <camel/camel-exception.h>
+
+#define FOLDER_INFO_IID "OAFIID:GNOME_Evolution_FolderInfo_Factory"
+
+#define PARENT_TYPE BONOBO_X_OBJECT_TYPE
+static BonoboObjectClass *parent_class = NULL;
+
+typedef struct _EvolutionFolderInfo EvolutionFolderInfo;
+typedef struct _EvolutionFolderInfoClass EvolutionFolderInfoClass;
+
+struct _EvolutionFolderInfo {
+ BonoboXObject parent;
+};
+
+struct _EvolutionFolderInfoClass {
+ BonoboXObjectClass parent_class;
+
+ POA_GNOME_Evolution_FolderInfo__epv epv;
+};
+
+/* MT stuff */
+struct _folder_info_msg {
+ struct _mail_msg msg;
+
+ Bonobo_Listener listener;
+ char *foldername;
+
+ int read;
+ int unread;
+};
+
+static void
+do_get_info (struct _mail_msg *mm)
+{
+ struct _folder_info_msg *m = (struct _folder_info_msg *) mm;
+ char *uri_dup;
+ char *foldername, *start, *end;
+ char *storage, *protocol, *uri;
+ CamelFolder *folder;
+ CamelException *ex;
+#if 0
+ /* Fixme: Do other stuff. Different stuff to the stuff below */
+ uri_dup = g_strdup (m->foldername);
+ start = uri_dup + 11;
+ g_warning ("Start: %s", start);
+
+ end = strrchr (start, '/');
+ if (end == NULL) {
+ g_warning ("Bugger");
+ return;
+ }
+
+ storage = g_strndup (start, end - start);
+ start = end + 1;
+ foldername = g_strdup (start);
+
+ g_free (uri_dup);
+
+ /* Work out the protocol.
+ The storage is going to start as local, or vfolder, or an imap
+ server. */
+ g_warning ("Storage: %s", storage);
+ if (strncmp (storage, "local", 5) == 0) {
+ char *evolution_dir;
+ char *proto;
+
+ evolution_dir = gnome_util_prepend_user_home ("evolution/local");
+ proto = g_strconcat ("file://", evolution_dir, NULL);
+ uri = e_path_to_physical (proto, foldername);
+ g_free (evolution_dir);
+ g_free (proto);
+
+ } else if (strncmp (storage, "vfolder", 7) == 0) {
+ uri = g_strconcat ("vfolder://", foldername, NULL);
+ } else {
+ uri = g_strconcat ("imap://", storage, foldername, NULL);
+ }
+#endif
+
+ ex = camel_exception_new ();
+ folder = mail_tool_uri_to_folder (m->foldername, ex);
+ if (camel_exception_is_set (ex)) {
+ g_warning ("Camel exception: %s", camel_exception_get_description (ex));
+ }
+
+ camel_exception_free (ex);
+
+ m->read = camel_folder_get_message_count (folder);
+ m->unread = camel_folder_get_unread_message_count (folder);
+}
+
+static void
+do_got_info (struct _mail_msg *mm)
+{
+ struct _folder_info_msg *m = (struct _folder_info_msg *) mm;
+ CORBA_Environment ev;
+ CORBA_any a;
+ GNOME_Evolution_FolderInfo_MessageCount count;
+
+ g_print ("You've got mail: %d, %d\n", m->read, m->unread);
+
+ count.path = m->foldername;
+ count.count = m->read;
+ count.unread = m->unread;
+
+ a._type = (CORBA_TypeCode) TC_GNOME_Evolution_FolderInfo_MessageCount;
+ a._value = &count;
+
+ CORBA_exception_init (&ev);
+ Bonobo_Listener_event (m->listener, "youve-got-mail", &a, &ev);
+ if (BONOBO_EX (&ev)) {
+ g_warning ("Got exception on listener: %s", CORBA_exception_id (&ev));
+ }
+ CORBA_exception_free (&ev);
+}
+
+static void
+do_free_info (struct _mail_msg *mm)
+{
+ struct _folder_info_msg *m = (struct _folder_info_msg *) mm;
+
+ g_free (m->foldername);
+}
+
+struct _mail_msg_op get_info_op = {
+ NULL,
+ do_get_info,
+ do_got_info,
+ do_free_info,
+};
+
+typedef struct {
+ int read;
+ int unread;
+} MailFolderInfo;
+
+/* Returns a MailFolderInfo struct or NULL on error */
+static void
+mail_get_info (const char *foldername,
+ Bonobo_Listener listener)
+{
+ CORBA_Environment ev;
+ struct _folder_info_msg *m;
+
+ m = mail_msg_new (&get_info_op, NULL, sizeof (*m));
+
+ g_print ("Folder: %s", foldername);
+ m->foldername = g_strdup (foldername);
+
+ CORBA_exception_init (&ev);
+ m->listener = bonobo_object_dup_ref (listener, &ev);
+ CORBA_exception_free (&ev);
+
+ e_thread_put (mail_thread_new, (EMsg *) m);
+}
+
+static void
+impl_GNOME_Evolution_FolderInfo_getInfo (PortableServer_Servant servant,
+ const CORBA_char *foldername,
+ const Bonobo_Listener listener,
+ CORBA_Environment *ev)
+{
+ mail_get_info (foldername, listener);
+}
+
+static void
+evolution_folder_info_class_init (EvolutionFolderInfoClass *klass)
+{
+ POA_GNOME_Evolution_FolderInfo__epv *epv = &klass->epv;
+
+ parent_class = gtk_type_class (PARENT_TYPE);
+ epv->getInfo = impl_GNOME_Evolution_FolderInfo_getInfo;
+}
+
+static void
+evolution_folder_info_init (EvolutionFolderInfo *info)
+{
+}
+
+BONOBO_X_TYPE_FUNC_FULL (EvolutionFolderInfo,
+ GNOME_Evolution_FolderInfo,
+ PARENT_TYPE,
+ evolution_folder_info);
+
+static BonoboObject *
+evolution_folder_info_factory_fn (BonoboGenericFactory *factory,
+ void *closure)
+{
+ EvolutionFolderInfo *info;
+
+ info = gtk_type_new (evolution_folder_info_get_type ());
+ return BONOBO_OBJECT (info);
+}
+
+void
+evolution_folder_info_factory_init (void)
+{
+ BonoboGenericFactory *factory;
+
+ factory = bonobo_generic_factory_new (FOLDER_INFO_IID,
+ evolution_folder_info_factory_fn,
+ NULL);
+
+ if (factory == NULL) {
+ g_warning ("Error starting FolderInfo");
+ return;
+ }
+
+ bonobo_running_context_auto_exit_unref (BONOBO_OBJECT (factory));
+}