From 65b4ea4c01aaba9d29c59d9f659f3ecbfacaf0b8 Mon Sep 17 00:00:00 2001
From: Ettore Perazzoli <ettore@src.gnome.org>
Date: Thu, 28 Jun 2001 05:28:22 +0000
Subject: Get the Mail Component to understand `mailto:'.

svn path=/trunk/; revision=10555
---
 mail/component-factory.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

(limited to 'mail/component-factory.c')

diff --git a/mail/component-factory.c b/mail/component-factory.c
index 40f14f908a..fc8ba49e46 100644
--- a/mail/component-factory.c
+++ b/mail/component-factory.c
@@ -96,6 +96,11 @@ static const EvolutionShellComponentFolderType folder_types[] = {
 	{ NULL, NULL, NULL, NULL }
 };
 
+static const char *schema_types[] = {
+	"mailto",
+	NULL
+};
+
 /* EvolutionShellComponent methods and signals.  */
 
 static EvolutionShellComponentResult
@@ -571,6 +576,23 @@ debug_cb (EvolutionShellComponent *shell_component, gpointer user_data)
 	camel_verbose_debug = 1;
 }
 
+static void
+handle_external_uri_cb (EvolutionShellComponent *shell_component,
+			const char *uri,
+			void *data)
+{
+	if (strncmp (uri, "mailto:", 7) != 0) {
+		/* FIXME: Exception?  The EvolutionShellComponent object should
+		   give me a chance to do so, but currently it doesn't.  */
+		g_warning ("Invalid URI requested to mail component -- %s", uri);
+		return;
+	}
+		
+	/* FIXME: Sigh.  This shouldn't be here.  But the code is messy, so
+	   I'll just put it here anyway.  */
+	send_to_url (uri);
+}
+
 static BonoboObject *
 component_fn (BonoboGenericFactory *factory, void *closure)
 {
@@ -578,7 +600,7 @@ component_fn (BonoboGenericFactory *factory, void *closure)
 	MailOfflineHandler *offline_handler;
 	
 	shell_component = evolution_shell_component_new (folder_types,
-							 NULL,
+							 schema_types,
 							 create_view,
 							 create_folder,
 							 remove_folder,
@@ -602,6 +624,8 @@ component_fn (BonoboGenericFactory *factory, void *closure)
 			    GTK_SIGNAL_FUNC (debug_cb), NULL);
 	gtk_signal_connect (GTK_OBJECT (shell_component), "destroy",
 			    GTK_SIGNAL_FUNC (owner_unset_cb), NULL);
+	gtk_signal_connect (GTK_OBJECT (shell_component), "handle_external_uri",
+			    GTK_SIGNAL_FUNC (handle_external_uri_cb), NULL);
 	
 	offline_handler = mail_offline_handler_new ();
 	bonobo_object_add_interface (BONOBO_OBJECT (shell_component), BONOBO_OBJECT (offline_handler));
-- 
cgit v1.2.3