evolution r36782 - in branches/kill-bonobo: . a11y/addressbook addressbook/gui addressbook/gui/component addressbook/gui/contact-editor addressbook/gui/contact-list-editor addressbook/gui/merging addressbook/gui/widgets addressbook/util composer doc/reference/shell/tmpl mail shell ui



Author: mbarnes
Date: Fri Nov 14 03:56:01 2008
New Revision: 36782
URL: http://svn.gnome.org/viewvc/evolution?rev=36782&view=rev

Log:
Rearranged some of the addressbook code to try and eliminate some circular
dependencies in our libraries.  The circular dependency between the composer
and the mail module is still causing me headaches.  And it doesn't help that
the addressbook and calendar also want to link to the composer.


Added:
   branches/kill-bonobo/addressbook/gui/component/eab-composer-util.c   (contents, props changed)
      - copied, changed from r36729, /branches/kill-bonobo/addressbook/gui/widgets/eab-gui-util.c
   branches/kill-bonobo/addressbook/gui/component/eab-composer-util.h   (contents, props changed)
      - copied, changed from r36729, /branches/kill-bonobo/addressbook/gui/widgets/eab-gui-util.h
   branches/kill-bonobo/addressbook/util/addressbook.c   (props changed)
      - copied unchanged from r36729, /branches/kill-bonobo/addressbook/gui/component/addressbook.c
   branches/kill-bonobo/addressbook/util/addressbook.h   (props changed)
      - copied unchanged from r36729, /branches/kill-bonobo/addressbook/gui/component/addressbook.h
Removed:
   branches/kill-bonobo/addressbook/gui/component/addressbook.c
   branches/kill-bonobo/addressbook/gui/component/addressbook.h
Modified:
   branches/kill-bonobo/Makefile.am
   branches/kill-bonobo/a11y/addressbook/ea-minicard-view.c
   branches/kill-bonobo/addressbook/gui/Makefile.am
   branches/kill-bonobo/addressbook/gui/component/Makefile.am
   branches/kill-bonobo/addressbook/gui/component/e-book-shell-content.c
   branches/kill-bonobo/addressbook/gui/component/e-book-shell-content.h
   branches/kill-bonobo/addressbook/gui/component/e-book-shell-module.c
   branches/kill-bonobo/addressbook/gui/component/e-book-shell-view-actions.c
   branches/kill-bonobo/addressbook/gui/component/e-book-shell-view-private.c
   branches/kill-bonobo/addressbook/gui/component/e-book-shell-view-private.h
   branches/kill-bonobo/addressbook/gui/contact-editor/Makefile.am
   branches/kill-bonobo/addressbook/gui/contact-editor/e-contact-editor.c
   branches/kill-bonobo/addressbook/gui/contact-editor/e-contact-editor.h
   branches/kill-bonobo/addressbook/gui/contact-editor/e-contact-quick-add.c
   branches/kill-bonobo/addressbook/gui/contact-editor/eab-editor.c
   branches/kill-bonobo/addressbook/gui/contact-editor/eab-editor.h
   branches/kill-bonobo/addressbook/gui/contact-list-editor/e-contact-list-editor.c
   branches/kill-bonobo/addressbook/gui/contact-list-editor/e-contact-list-editor.h
   branches/kill-bonobo/addressbook/gui/merging/eab-contact-compare.c
   branches/kill-bonobo/addressbook/gui/widgets/Makefile.am
   branches/kill-bonobo/addressbook/gui/widgets/e-addressbook-reflow-adapter.c
   branches/kill-bonobo/addressbook/gui/widgets/e-addressbook-reflow-adapter.h
   branches/kill-bonobo/addressbook/gui/widgets/e-addressbook-view.c
   branches/kill-bonobo/addressbook/gui/widgets/e-addressbook-view.h
   branches/kill-bonobo/addressbook/gui/widgets/e-minicard-view-widget.c
   branches/kill-bonobo/addressbook/gui/widgets/e-minicard-view-widget.h
   branches/kill-bonobo/addressbook/gui/widgets/e-minicard-view.c
   branches/kill-bonobo/addressbook/gui/widgets/e-minicard-view.h
   branches/kill-bonobo/addressbook/gui/widgets/e-minicard.c
   branches/kill-bonobo/addressbook/gui/widgets/e-minicard.h
   branches/kill-bonobo/addressbook/gui/widgets/eab-contact-display.c
   branches/kill-bonobo/addressbook/gui/widgets/eab-contact-display.h
   branches/kill-bonobo/addressbook/gui/widgets/eab-gui-util.c
   branches/kill-bonobo/addressbook/gui/widgets/eab-gui-util.h
   branches/kill-bonobo/addressbook/util/Makefile.am
   branches/kill-bonobo/addressbook/util/eab-book-util.h
   branches/kill-bonobo/composer/Makefile.am
   branches/kill-bonobo/composer/e-msg-composer.c
   branches/kill-bonobo/composer/e-msg-composer.h
   branches/kill-bonobo/doc/reference/shell/tmpl/e-shell.sgml
   branches/kill-bonobo/doc/reference/shell/tmpl/eshell-unused.sgml
   branches/kill-bonobo/mail/Makefile.am
   branches/kill-bonobo/mail/e-mail-shell-module.c
   branches/kill-bonobo/mail/mail-folder-cache.c
   branches/kill-bonobo/shell/e-shell-window-actions.c
   branches/kill-bonobo/shell/e-shell.c
   branches/kill-bonobo/shell/e-shell.h
   branches/kill-bonobo/shell/main.c
   branches/kill-bonobo/ui/evolution-shell.ui

Modified: branches/kill-bonobo/Makefile.am
==============================================================================
--- branches/kill-bonobo/Makefile.am	(original)
+++ branches/kill-bonobo/Makefile.am	Fri Nov 14 03:56:01 2008
@@ -58,17 +58,18 @@
 
 SUBDIRS = 			\
 	win32			\
-        data                    \
-        e-util                  \
+	data			\
+	e-util			\
 	a11y			\
 	filter			\
-        widgets                 \
-        shell                   \
+	widgets			\
+	shell			\
 	$(SMIME_DIR)		\
 	composer		\
 	addressbook		\
 	calendar		\
-        art                     \
+	mail			\
+	art			\
 	plugins			\
 	doc			\
 	ui			\

Modified: branches/kill-bonobo/a11y/addressbook/ea-minicard-view.c
==============================================================================
--- branches/kill-bonobo/a11y/addressbook/ea-minicard-view.c	(original)
+++ branches/kill-bonobo/a11y/addressbook/ea-minicard-view.c	Fri Nov 14 03:56:01 2008
@@ -362,11 +362,9 @@
 {
 	gboolean return_value = TRUE;
 	EMinicardView *card_view;
-	EContact *contact = e_contact_new();
 
 	AtkGObjectAccessible *atk_gobj= NULL;
         EReflow *reflow = NULL;
-	EBook *book;
 
 	atk_gobj = ATK_GOBJECT_ACCESSIBLE (action);
 	reflow = E_REFLOW (atk_gobject_accessible_get_object (atk_gobj));
@@ -375,26 +373,21 @@
 		return FALSE;
 
 	card_view = E_MINICARD_VIEW (reflow);
-	g_object_get(card_view,
-		     "book", &book,
-		     NULL);
-	g_return_val_if_fail (E_IS_BOOK (book), FALSE);
 
 	switch (i) {
 		case 0:
 		/* New Contact */
-			eab_show_contact_editor (book, contact, TRUE, TRUE);
+			e_minicard_view_create_contact (card_view);
 			break;
 		case 1:
 		/* New Contact List */
-			eab_show_contact_list_editor (book, contact, TRUE, TRUE);
+			e_minicard_view_create_contact_list (card_view);
 			break;
 		default:
                 	return_value = FALSE;
 			break;
 	}
-	g_object_unref (book);
-	g_object_unref (contact);
+
 	return return_value;
 }
 

Modified: branches/kill-bonobo/addressbook/gui/Makefile.am
==============================================================================
--- branches/kill-bonobo/addressbook/gui/Makefile.am	(original)
+++ branches/kill-bonobo/addressbook/gui/Makefile.am	Fri Nov 14 03:56:01 2008
@@ -1 +1 @@
-SUBDIRS = merging contact-editor contact-list-editor widgets component
+SUBDIRS = merging widgets contact-editor contact-list-editor component

Modified: branches/kill-bonobo/addressbook/gui/component/Makefile.am
==============================================================================
--- branches/kill-bonobo/addressbook/gui/component/Makefile.am	(original)
+++ branches/kill-bonobo/addressbook/gui/component/Makefile.am	Fri Nov 14 03:56:01 2008
@@ -30,8 +30,8 @@
 	addressbook-config.h		\
 	autocompletion-config.c		\
 	autocompletion-config.h		\
-	addressbook.c			\
-	addressbook.h			\
+	eab-composer-util.c		\
+	eab-composer-util.h		\
 	e-book-shell-content.c		\
 	e-book-shell-content.h		\
 	e-book-shell-module.c		\
@@ -53,6 +53,7 @@
 libevolution_addressbook_la_LIBADD =							\
 	$(SMIME_LIB)									\
 	$(top_builddir)/e-util/libeutil.la						\
+	$(top_builddir)/composer/libcomposer.la					\
 	$(top_builddir)/addressbook/printing/libecontactprint.la			\
 	$(top_builddir)/shell/libeshell.la						\
 	$(top_builddir)/addressbook/gui/merging/libeabbookmerging.la			\

Modified: branches/kill-bonobo/addressbook/gui/component/e-book-shell-content.c
==============================================================================
--- branches/kill-bonobo/addressbook/gui/component/e-book-shell-content.c	(original)
+++ branches/kill-bonobo/addressbook/gui/component/e-book-shell-content.c	Fri Nov 14 03:56:01 2008
@@ -44,6 +44,16 @@
 static gpointer parent_class;
 
 static void
+book_shell_content_send_message_cb (EBookShellContent *book_shell_content,
+                                    EDestination *destination,
+                                    EABContactDisplay *display)
+{
+	GList node = { destination, NULL, NULL };
+
+	eab_send_message (&node, EAB_DISPOSITION_AS_TO);
+}
+
+static void
 book_shell_content_set_property (GObject *object,
                                  guint property_id,
                                  const GValue *value,
@@ -176,6 +186,10 @@
 	priv->preview = g_object_ref (widget);
 	gtk_widget_show (widget);
 
+	g_signal_connect_swapped (
+		priv->preview, "send-message",
+		book_shell_content_send_message_cb, object);
+
 	/* Bind GObject properties to GConf keys. */
 
 	bridge = gconf_bridge_get ();

Modified: branches/kill-bonobo/addressbook/gui/component/e-book-shell-content.h
==============================================================================
--- branches/kill-bonobo/addressbook/gui/component/e-book-shell-content.h	(original)
+++ branches/kill-bonobo/addressbook/gui/component/e-book-shell-content.h	Fri Nov 14 03:56:01 2008
@@ -24,10 +24,11 @@
 
 #include <libebook/e-contact.h>
 
-#include <e-shell-content.h>
-#include <e-shell-view.h>
+#include "shell/e-shell-content.h"
+#include "shell/e-shell-view.h"
 
-#include <e-addressbook-view.h>
+#include "addressbook/gui/component/eab-composer-util.h"
+#include "addressbook/gui/widgets/e-addressbook-view.h"
 
 /* Standard GObject macros */
 #define E_TYPE_BOOK_SHELL_CONTENT \

Modified: branches/kill-bonobo/addressbook/gui/component/e-book-shell-module.c
==============================================================================
--- branches/kill-bonobo/addressbook/gui/component/e-book-shell-module.c	(original)
+++ branches/kill-bonobo/addressbook/gui/component/e-book-shell-module.c	Fri Nov 14 03:56:01 2008
@@ -32,10 +32,12 @@
 #include "shell/e-shell-window.h"
 
 #include "e-util/e-import.h"
+#include "addressbook/gui/widgets/eab-gui-util.h"
+#include "addressbook/gui/contact-editor/e-contact-editor.h"
+#include "addressbook/gui/contact-list-editor/e-contact-list-editor.h"
 #include "addressbook/importers/evolution-addressbook-importers.h"
 
 #include <eab-config.h>
-#include <eab-gui-util.h>
 #include <addressbook-config.h>
 #include <autocompletion-config.h>
 
@@ -214,6 +216,7 @@
 {
 	EContact *contact;
 	GtkAction *action;
+	GtkWidget *editor;
 	const gchar *action_name;
 
 	/* XXX Handle errors better. */
@@ -225,10 +228,12 @@
 	action_name = gtk_action_get_name (action);
 
 	if (strcmp (action_name, "contact-new") == 0)
-		eab_show_contact_editor (book, contact, TRUE, TRUE);
+		editor = e_contact_editor_new (book, contact, TRUE, TRUE);
 
 	if (strcmp (action_name, "contact-new-list") == 0)
-		eab_show_contact_list_editor (book, contact, TRUE, TRUE);
+		editor = e_contact_list_editor_new (book, contact, TRUE, TRUE);
+
+	eab_editor_show (EAB_EDITOR (editor));
 
 	g_object_unref (contact);
 	g_object_unref (book);

Modified: branches/kill-bonobo/addressbook/gui/component/e-book-shell-view-actions.c
==============================================================================
--- branches/kill-bonobo/addressbook/gui/component/e-book-shell-view-actions.c	(original)
+++ branches/kill-bonobo/addressbook/gui/component/e-book-shell-view-actions.c	Fri Nov 14 03:56:01 2008
@@ -285,12 +285,30 @@
 {
 	EBookShellContent *book_shell_content;
 	EAddressbookView *view;
+	GList *list, *iter;
 
 	book_shell_content = book_shell_view->priv->book_shell_content;
 	view = e_book_shell_content_get_current_view (book_shell_content);
 	g_return_if_fail (view != NULL);
 
-	e_addressbook_view_send (view);
+	list = e_addressbook_view_get_selected (view);
+	g_return_if_fail (list != NULL);
+
+	/* Convert the list of contacts to a list of destinations. */
+	for (iter = list; iter != NULL; iter = iter->next) {
+		EContact *contact = iter->data;
+		EDestination *destination;
+
+		destination = e_destination_new ();
+		e_destination_set_contact (destination, contact, 0);
+		g_object_unref (contact);
+
+		iter->data = destination;
+	}
+
+	eab_send_message (list, EAB_DISPOSITION_AS_ATTACHMENT);
+	g_list_foreach (list, (GFunc) g_object_unref, NULL);
+	g_list_free (list);
 }
 
 static void
@@ -315,6 +333,7 @@
 	EAddressbookView *view;
 	EAddressbookModel *model;
 	EContact *contact;
+	GtkWidget *editor;
 	EBook *book;
 
 	book_shell_content = book_shell_view->priv->book_shell_content;
@@ -326,7 +345,8 @@
 	g_return_if_fail (book != NULL);
 
 	contact = e_contact_new ();
-	eab_show_contact_editor (book, contact, TRUE, TRUE);
+	editor = e_contact_editor_new (book, contact, TRUE, TRUE);
+	eab_editor_show (EAB_EDITOR (editor));
 	g_object_unref (contact);
 }
 
@@ -338,6 +358,7 @@
 	EAddressbookView *view;
 	EAddressbookModel *model;
 	EContact *contact;
+	GtkWidget *editor;
 	EBook *book;
 
 	book_shell_content = book_shell_view->priv->book_shell_content;
@@ -349,7 +370,8 @@
 	g_return_if_fail (book != NULL);
 
 	contact = e_contact_new ();
-	eab_show_contact_list_editor (book, contact, TRUE, TRUE);
+	editor = e_contact_list_editor_new (book, contact, TRUE, TRUE);
+	eab_editor_show (EAB_EDITOR (editor));
 	g_object_unref (contact);
 }
 
@@ -445,12 +467,30 @@
 {
 	EBookShellContent *book_shell_content;
 	EAddressbookView *view;
+	GList *list, *iter;
 
 	book_shell_content = book_shell_view->priv->book_shell_content;
 	view = e_book_shell_content_get_current_view (book_shell_content);
 	g_return_if_fail (view != NULL);
 
-	e_addressbook_view_send_to (view);
+	list = e_addressbook_view_get_selected (view);
+	g_return_if_fail (list != NULL);
+
+	/* Convert the list of contacts to a list of destinations. */
+	for (iter = list; iter != NULL; iter = iter->next) {
+		EContact *contact = iter->data;
+		EDestination *destination;
+
+		destination = e_destination_new ();
+		e_destination_set_contact (destination, contact, 0);
+		g_object_unref (contact);
+
+		iter->data = destination;
+	}
+
+	eab_send_message (list, EAB_DISPOSITION_AS_TO);
+	g_list_foreach (list, (GFunc) g_object_unref, NULL);
+	g_list_free (list);
 }
 
 static void

Modified: branches/kill-bonobo/addressbook/gui/component/e-book-shell-view-private.c
==============================================================================
--- branches/kill-bonobo/addressbook/gui/component/e-book-shell-view-private.c	(original)
+++ branches/kill-bonobo/addressbook/gui/component/e-book-shell-view-private.c	Fri Nov 14 03:56:01 2008
@@ -27,6 +27,31 @@
 #include <addressbook.h>
 
 static void
+open_contact (EBookShellView *book_shell_view,
+              EContact *contact,
+              gboolean is_new_contact,
+              EAddressbookView *view)
+{
+	EAddressbookModel *model;
+	GtkWidget *editor;
+	EBook *book;
+	gboolean editable;
+
+	model = e_addressbook_view_get_model (view);
+	book = e_addressbook_model_get_book (model);
+	editable = e_addressbook_model_get_editable (model);
+
+	if (e_contact_get (contact, E_CONTACT_IS_LIST))
+		editor = e_contact_list_editor_new (
+			book, contact, is_new_contact, editable);
+	else
+		editor = e_contact_editor_new (
+			book, contact, is_new_contact, editable);
+
+	eab_editor_show (EAB_EDITOR (editor));
+}
+
+static void
 popup_event (EBookShellView *book_shell_view,
              GdkEventButton *event)
 {
@@ -215,6 +240,10 @@
 			g_object_ref (widget));
 
 		g_signal_connect_swapped (
+			widget, "open-contact",
+			G_CALLBACK (open_contact), book_shell_view);
+
+		g_signal_connect_swapped (
 			widget, "popup-event",
 			G_CALLBACK (popup_event), book_shell_view);
 

Modified: branches/kill-bonobo/addressbook/gui/component/e-book-shell-view-private.h
==============================================================================
--- branches/kill-bonobo/addressbook/gui/component/e-book-shell-view-private.h	(original)
+++ branches/kill-bonobo/addressbook/gui/component/e-book-shell-view-private.h	Fri Nov 14 03:56:01 2008
@@ -32,15 +32,17 @@
 #include <libedataserver/e-sexp.h>
 #include <libedataserverui/e-source-selector.h>
 
-#include <e-util/gconf-bridge.h>
-#include <shell/e-shell-content.h>
-#include <shell/e-shell-sidebar.h>
+#include "e-util/gconf-bridge.h"
+#include "shell/e-shell-content.h"
+#include "shell/e-shell-sidebar.h"
+
+#include "addressbook/gui/contact-editor/e-contact-editor.h"
+#include "addressbook/gui/contact-list-editor/e-contact-list-editor.h"
+#include "addressbook/gui/widgets/eab-gui-util.h"
+#include "addressbook/gui/widgets/e-addressbook-view.h"
 
-#include <eab-gui-util.h>
-#include <e-addressbook-view.h>
 #include <e-book-shell-content.h>
 #include <e-book-shell-sidebar.h>
-
 #include <e-book-shell-view-actions.h>
 
 #define E_BOOK_SHELL_VIEW_GET_PRIVATE(obj) \

Copied: branches/kill-bonobo/addressbook/gui/component/eab-composer-util.c (from r36729, /branches/kill-bonobo/addressbook/gui/widgets/eab-gui-util.c)
==============================================================================
--- /branches/kill-bonobo/addressbook/gui/widgets/eab-gui-util.c	(original)
+++ branches/kill-bonobo/addressbook/gui/component/eab-composer-util.c	Fri Nov 14 03:56:01 2008
@@ -12,774 +12,23 @@
  * You should have received a copy of the GNU Lesser General Public
  * License along with the program; if not, see <http://www.gnu.org/licenses/>  
  *
- *
- * Authors:
- *		Chris Toshok <toshok ximian com>
- *
  * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
  *
  */
 
-#include <config.h>
+#include "eab-composer-util.h"
 
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-
-#include <gtk/gtk.h>
 #include <glib/gi18n.h>
-#include <libedataserver/e-data-server-util.h>
-#include <libedataserverui/e-source-selector.h>
-#include <e-util/e-util.h>
-#include "eab-gui-util.h"
-#include "util/eab-book-util.h"
+#include <libebook/e-contact.h>
 #include <libebook/e-destination.h>
-#include "e-util/e-error.h"
-#include "e-util/e-html-utils.h"
-#include "misc/e-image-chooser.h"
-#include <e-util/e-icon-factory.h>
-#include "eab-contact-merging.h"
-#include <composer/e-msg-composer.h>
-#include <mail/em-composer-utils.h>
-
-/* we link to camel for decoding quoted printable email addresses */
-#include <camel/camel-mime-utils.h>
-
-#include "addressbook/gui/contact-editor/eab-editor.h"
-#include "addressbook/gui/contact-editor/e-contact-editor.h"
-#include "addressbook/gui/contact-list-editor/e-contact-list-editor.h"
-#include "addressbook/gui/component/addressbook.h"
-
-/* the NULL's in this table correspond to the status codes
-   that should *never* be generated by a backend */
-static const char *status_to_string[] = {
-	/* E_BOOK_ERROR_OK */                        		N_("Success"),
-	/* E_BOOK_ERROR_INVALID_ARG */               		NULL,
-	/* E_BOOK_ERROR_BUSY */                      		N_("Backend busy"),
-	/* E_BOOK_ERROR_REPOSITORY_OFFLINE */        		N_("Repository offline"),
-	/* E_BOOK_ERROR_NO_SUCH_BOOK */              		N_("Address Book does not exist"),
-	/* E_BOOK_ERROR_NO_SELF_CONTACT */           		N_("No Self Contact defined"),
-	/* E_BOOK_ERROR_URI_NOT_LOADED */            		NULL,
-	/* E_BOOK_ERROR_URI_ALREADY_LOADED */        		NULL,
-	/* E_BOOK_ERROR_PERMISSION_DENIED */         		N_("Permission denied"),
-	/* E_BOOK_ERROR_CONTACT_NOT_FOUND */         		N_("Contact not found"),
-	/* E_BOOK_ERROR_CONTACT_ID_ALREADY_EXISTS */ 		N_("Contact ID already exists"),
-	/* E_BOOK_ERROR_PROTOCOL_NOT_SUPPORTED */    		N_("Protocol not supported"),
-	/* E_BOOK_ERROR_CANCELLED */                 		N_("Canceled"),
-	/* E_BOOK_ERROR_COULD_NOT_CANCEL */                     N_("Could not cancel"),
-	/* E_BOOK_ERROR_AUTHENTICATION_FAILED */                N_("Authentication Failed"),
-	/* E_BOOK_ERROR_AUTHENTICATION_REQUIRED */              N_("Authentication Required"),
-	/* E_BOOK_ERROR_TLS_NOT_AVAILABLE */                    N_("TLS not Available"),
-	/* E_BOOK_ERROR_CORBA_EXCEPTION */                      NULL,
-	/* E_BOOK_ERROR_NO_SUCH_SOURCE */                       N_("No such source"),
-	/* E_BOOK_ERROR_OFFLINE_UNAVAILABLE */			N_("Not available in offline mode"),
-	/* E_BOOK_ERROR_OTHER_ERROR */                          N_("Other error"),
-	/* E_BOOK_ERROR_INVALID_SERVER_VERSION */		N_("Invalid server version"),
-	/* E_BOOK_ERROR_UNSUPPORTED_AUTHENTICATION_METHOD */    N_("Unsupported authentication method")
-};
-
-void
-eab_error_dialog (const char *msg, EBookStatus status)
-{
-	const char *status_str;
-
-	if (status < 0 || status >= G_N_ELEMENTS (status_to_string))
-		status_str = "Other error";
-	else
-		status_str = status_to_string [status];
-
-	if (status_str)
-		e_error_run (NULL, "addressbook:generic-error", msg, _(status_str), NULL);
-}
-
-void
-eab_load_error_dialog (GtkWidget *parent, ESource *source, EBookStatus status)
-{
-	char *label_string, *label = NULL, *uri;
-	GtkWidget *dialog;
-	gboolean can_detail_error = TRUE;
-
-	g_return_if_fail (source != NULL);
-
-	uri = e_source_get_uri (source);
-
-	if (status == E_BOOK_ERROR_OFFLINE_UNAVAILABLE) {
-		can_detail_error = FALSE;
-		label_string = _("We were unable to open this address book. This either means "
-                                 "this book is not marked for offline usage or not yet downloaded "
-                                 "for offline usage. Please load the address book once in online mode "
-                                 "to download its contents");
-	}
-
-	else if (!strncmp (uri, "file:", 5)) {
-		char *path = g_filename_from_uri (uri, NULL, NULL);
-		label = g_strdup_printf (
-			_("We were unable to open this address book.  Please check that the "
-			  "path %s exists and that you have permission to access it."), path);
-		g_free (path);
-		label_string = label;
-	}
-	else if (!strncmp (uri, "ldap:", 5)) {
-		/* special case for ldap: contact folders so we can tell the user about openldap */
-#ifdef HAVE_LDAP
-		label_string =
-			_("We were unable to open this address book.  This either "
-			  "means you have entered an incorrect URI, or the LDAP server "
-			  "is unreachable.");
-#else
-		can_detail_error = FALSE;
-		label_string =
-			_("This version of Evolution does not have LDAP support "
-			  "compiled in to it.  If you want to use LDAP in Evolution, "
-			  "you must install an LDAP-enabled Evolution package.");
-#endif
-	} else {
-		/* other network folders */
-		label_string =
-			_("We were unable to open this address book.  This either "
-			  "means you have entered an incorrect URI, or the server "
-			  "is unreachable.");
-	}
-
-	if (can_detail_error) {
-		/* do not show repository offline message, it's kind of generic error */
-		if (status != E_BOOK_ERROR_REPOSITORY_OFFLINE && status > 0 && status < G_N_ELEMENTS (status_to_string) && status_to_string [status]) {
-			label = g_strconcat (label_string, "\n\n", _("Detailed error:"), " ", _(status_to_string [status]), NULL);
-			label_string = label;
-		}
-	}
-
-	dialog  = e_error_new ((GtkWindow *) parent, "addressbook:load-error", label_string, NULL);
-	g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
-
-	gtk_widget_show (dialog);
-	g_free (label);
-	g_free (uri);
-}
-
-void
-eab_search_result_dialog      (GtkWidget *parent,
-			       EBookViewStatus status)
-{
-	char *str = NULL;
-
-	switch (status) {
-	case E_BOOK_VIEW_STATUS_OK:
-		return;
-	case E_BOOK_VIEW_STATUS_SIZE_LIMIT_EXCEEDED:
-		str = _("More cards matched this query than either the server is \n"
-			"configured to return or Evolution is configured to display.\n"
-			"Please make your search more specific or raise the result limit in\n"
-			"the directory server preferences for this address book.");
-		break;
-	case E_BOOK_VIEW_STATUS_TIME_LIMIT_EXCEEDED:
-		str = _("The time to execute this query exceeded the server limit or the limit\n"
-			"you have configured for this address book.  Please make your search\n"
-			"more specific or raise the time limit in the directory server\n"
-			"preferences for this address book.");
-		break;
-	case E_BOOK_VIEW_ERROR_INVALID_QUERY:
-		str = _("The backend for this address book was unable to parse this query.");
-		break;
-	case E_BOOK_VIEW_ERROR_QUERY_REFUSED:
-		str = _("The backend for this address book refused to perform this query.");
-		break;
-	case E_BOOK_VIEW_ERROR_OTHER_ERROR:
-		str = _("This query did not complete successfully.");
-		break;
-	default:
-		g_return_if_reached ();
-	}
-
-	e_error_run ((GtkWindow *) parent, "addressbook:search-error", str, NULL);
-}
-
-gint
-eab_prompt_save_dialog (GtkWindow *parent)
-{
-	return e_error_run (parent, "addressbook:prompt-save", NULL);
-}
-
-static void
-added_cb (EBook* book, EBookStatus status, EContact *contact,
-	  gpointer data)
-{
-	gboolean is_list = GPOINTER_TO_INT (data);
-
-	if (status != E_BOOK_ERROR_OK && status != E_BOOK_ERROR_CANCELLED) {
-		eab_error_dialog (is_list ? _("Error adding list") : _("Error adding contact"), status);
-	}
-}
-
-static void
-modified_cb (EBook* book, EBookStatus status, EContact *contact,
-	     gpointer data)
-{
-	gboolean is_list = GPOINTER_TO_INT (data);
-
-	if (status != E_BOOK_ERROR_OK && status != E_BOOK_ERROR_CANCELLED) {
-		eab_error_dialog (is_list ? _("Error modifying list") : _("Error modifying contact"),
-				  status);
-	}
-}
-
-static void
-deleted_cb (EBook* book, EBookStatus status, EContact *contact,
-	    gpointer data)
-{
-	gboolean is_list = GPOINTER_TO_INT (data);
-
-	if (status != E_BOOK_ERROR_OK) {
-		eab_error_dialog (is_list ? _("Error removing list") : _("Error removing contact"),
-				  status);
-	}
-}
-
-static void
-editor_closed_cb (GtkObject *editor, gpointer data)
-{
-	g_object_unref (editor);
-}
-
-EContactEditor *
-eab_show_contact_editor (EBook *book, EContact *contact,
-			 gboolean is_new_contact,
-			 gboolean editable)
-{
-	EContactEditor *ce;
-
-	ce = e_contact_editor_new (book, contact, is_new_contact, editable);
-
-	g_signal_connect (ce, "contact_added",
-			  G_CALLBACK (added_cb), GINT_TO_POINTER (FALSE));
-	g_signal_connect (ce, "contact_modified",
-			  G_CALLBACK (modified_cb), GINT_TO_POINTER (FALSE));
-	g_signal_connect (ce, "contact_deleted",
-			  G_CALLBACK (deleted_cb), GINT_TO_POINTER (FALSE));
-	g_signal_connect (ce, "editor_closed",
-			  G_CALLBACK (editor_closed_cb), NULL);
-
-	return ce;
-}
-
-EContactListEditor *
-eab_show_contact_list_editor (EBook *book, EContact *contact,
-			      gboolean is_new_contact,
-			      gboolean editable)
-{
-	EContactListEditor *ce;
-
-	ce = e_contact_list_editor_new (book, contact, is_new_contact, editable);
-
-	g_signal_connect (ce, "contact_added",
-			  G_CALLBACK (added_cb), GINT_TO_POINTER (TRUE));
-	g_signal_connect (ce, "contact_modified",
-			  G_CALLBACK (modified_cb), GINT_TO_POINTER (TRUE));
-	g_signal_connect (ce, "contact_deleted",
-			  G_CALLBACK (deleted_cb), GINT_TO_POINTER (TRUE));
-	g_signal_connect (ce, "editor_closed",
-			  G_CALLBACK (editor_closed_cb), GINT_TO_POINTER (TRUE));
-
-	eab_editor_show (EAB_EDITOR (ce));
-
-	return ce;
-}
-
-static void
-view_contacts (EBook *book, GList *list, gboolean editable)
-{
-	for (; list; list = list->next) {
-		EContact *contact = list->data;
-		if (e_contact_get (contact, E_CONTACT_IS_LIST))
-			eab_show_contact_list_editor (book, contact, FALSE, editable);
-		else
-			eab_show_contact_editor (book, contact, FALSE, editable);
-	}
-}
-
-void
-eab_show_multiple_contacts (EBook *book,
-			    GList *list,
-			    gboolean editable)
-{
-	if (list) {
-		int length = g_list_length (list);
-		if (length > 5) {
-			GtkWidget *dialog;
-			gint response;
-
-			dialog = gtk_message_dialog_new (NULL,
-							 0,
-							 GTK_MESSAGE_QUESTION,
-							 GTK_BUTTONS_NONE,
-							 ngettext("Opening %d contact will open %d new window as well.\n"
-								  "Do you really want to display this contact?",
-								  "Opening %d contacts will open %d new windows as well.\n"
-								  "Do you really want to display all of these contacts?",
-								  length),
-							 length,
-							 length);
-			gtk_dialog_add_buttons (GTK_DIALOG (dialog),
-						_("_Don't Display"), GTK_RESPONSE_NO,
-						_("Display _All Contacts"), GTK_RESPONSE_YES,
-						NULL);
-			response = gtk_dialog_run (GTK_DIALOG (dialog));
-			gtk_widget_destroy (dialog);
-			if (response == GTK_RESPONSE_YES)
-				view_contacts (book, list, editable);
-		} else {
-			view_contacts (book, list, editable);
-		}
-	}
-}
-
-
-static gint
-file_exists(GtkWindow *window, const char *filename)
-{
-	GtkWidget *dialog;
-	gint response;
-	char * utf8_filename;
-
-	utf8_filename = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
-	dialog = gtk_message_dialog_new (window,
-					 0,
-					 GTK_MESSAGE_QUESTION,
-					 GTK_BUTTONS_NONE,
-					 /* For Translators only: "it" refers to the filename %s. */
-					 _("%s already exists\nDo you want to overwrite it?"), utf8_filename);
-	g_free (utf8_filename);
-	gtk_dialog_add_buttons (GTK_DIALOG (dialog),
-				GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-				_("Overwrite"), GTK_RESPONSE_ACCEPT,
-				NULL);
-
-	response = gtk_dialog_run (GTK_DIALOG (dialog));
-	gtk_widget_destroy (dialog);
-	return response;
-}
-
-typedef struct {
-	GtkWidget *filesel;
-	char *vcard;
-	gboolean has_multiple_contacts;
-} SaveAsInfo;
-
-static void
-save_it(GtkWidget *widget, SaveAsInfo *info)
-{
-	const char *filename;
-	char *uri;
-	gint response = 0;
-
-
-	filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (info->filesel));
-	uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (info->filesel));
-
-	if (filename && g_file_test (filename, G_FILE_TEST_EXISTS)) {
-		response = file_exists(GTK_WINDOW (info->filesel), filename);
-		switch (response) {
-			case GTK_RESPONSE_ACCEPT : /* Overwrite */
-				break;
-			case GTK_RESPONSE_CANCEL : /* cancel */
-				return;
-		}
-	}
-
-	if (!e_write_file_uri (uri, info->vcard)) {
-		char *err_str_ext;
-		if (info->has_multiple_contacts) {
-			/* more than one, finding the total number of contacts might
-			 * hit performance while saving large number of contacts
-			 */
-			err_str_ext = ngettext ("contact", "contacts", 2);
-		}
-		else {
-			err_str_ext = ngettext ("contact", "contacts", 1);
-		}
-
-		/* translators: Arguments, err_str_ext (item to be saved: "contact"/"contacts"),
-		 * destination file name, and error code will fill the placeholders
-		 * {0}, {1} and {2}, respectively in the error message formed
-		 */
-		e_error_run (GTK_WINDOW (info->filesel), "addressbook:save-error",
-					 err_str_ext, filename, g_strerror (errno), NULL);
-		gtk_widget_destroy(GTK_WIDGET(info->filesel));
-		return;
-	}
-
-	gtk_widget_destroy(GTK_WIDGET(info->filesel));
-}
-
-static void
-close_it(GtkWidget *widget, SaveAsInfo *info)
-{
-	gtk_widget_destroy (GTK_WIDGET (info->filesel));
-}
-
-static void
-destroy_it(void *data, GObject *where_the_object_was)
-{
-	SaveAsInfo *info = data;
-	g_free (info->vcard);
-	g_free (info);
-}
-
-static void
-filechooser_response (GtkWidget *widget, gint response_id, SaveAsInfo *info)
-{
-	if (response_id == GTK_RESPONSE_ACCEPT)
-		save_it  (widget, info);
-	else
-		close_it (widget, info);
-}
-
-static char *
-make_safe_filename (char *name)
-{
-	char *safe;
-
-	if (!name) {
-		/* This is a filename. Translators take note. */
-		name = _("card.vcf");
-	}
-
-	if (!g_strrstr (name, ".vcf"))
-		safe = g_strdup_printf ("%s%s", name, ".vcf");
-	else
-		safe = g_strdup (name);
-
-	e_filename_make_safe (safe);
-
-	return safe;
-}
-
-static void
-source_selection_changed_cb (GtkWidget *selector, GtkWidget *ok_button)
-{
-	gtk_widget_set_sensitive (ok_button,
-				  e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (selector)) ?
-				  TRUE : FALSE);
-}
-
-ESource *
-eab_select_source (const gchar *title, const gchar *message, const gchar *select_uid, GtkWindow *parent)
-{
-	ESource *source;
-	ESourceList *source_list;
-	GtkWidget *dialog;
-	GtkWidget *ok_button;
-	GtkWidget *cancel_button;
-	/* GtkWidget *label; */
-	GtkWidget *selector;
-	GtkWidget *scrolled_window;
-	gint response;
-
-	if (!e_book_get_addressbooks (&source_list, NULL))
-		return NULL;
-
-	dialog = gtk_dialog_new_with_buttons (_("Select Address Book"), parent,
-					      GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
-					      NULL);
-	gtk_window_set_default_size (GTK_WINDOW (dialog), 350, 300);
-
-	cancel_button = gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
-	ok_button = gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_OK, GTK_RESPONSE_ACCEPT);
-	gtk_widget_set_sensitive (ok_button, FALSE);
-
-	/* label = gtk_label_new (message); */
-
-	selector = e_source_selector_new (source_list);
-	e_source_selector_show_selection (E_SOURCE_SELECTOR (selector), FALSE);
-	g_signal_connect (selector, "primary_selection_changed",
-			  G_CALLBACK (source_selection_changed_cb), ok_button);
-
-	if (select_uid) {
-		source = e_source_list_peek_source_by_uid (source_list, select_uid);
-		if (source)
-			e_source_selector_set_primary_selection (E_SOURCE_SELECTOR (selector), source);
-	}
 
-	scrolled_window = gtk_scrolled_window_new (NULL, NULL);
-	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_IN);
-	gtk_container_add (GTK_CONTAINER (scrolled_window), selector);
-
-	/* gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), label, FALSE, FALSE, 4); */
-	gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), scrolled_window, TRUE, TRUE, 4);
-
-	gtk_widget_show_all (dialog);
-	response = gtk_dialog_run (GTK_DIALOG (dialog));
-
-	if (response == GTK_RESPONSE_ACCEPT)
-		source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (selector));
-	else
-		source = NULL;
-
-	gtk_widget_destroy (dialog);
-	return source;
-}
-
-void
-eab_contact_save (char *title, EContact *contact, GtkWindow *parent_window)
-{
-	GtkWidget *filesel;
-	char *file;
-	char *name;
-	SaveAsInfo *info = g_new(SaveAsInfo, 1);
-
-	name = e_contact_get (contact, E_CONTACT_FILE_AS);
-	file = make_safe_filename (name);
-
-	info->has_multiple_contacts = FALSE;
-
-	filesel = gtk_file_chooser_dialog_new (title,
-					       parent_window,
-					       GTK_FILE_CHOOSER_ACTION_SAVE,
-					       GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-					       GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
-					       NULL);
-	gtk_dialog_set_default_response (GTK_DIALOG (filesel), GTK_RESPONSE_ACCEPT);
-
-	gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (filesel), g_get_home_dir ());
-	gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (filesel), file);
-	gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (filesel), FALSE);
-
-	info->filesel = filesel;
-	info->vcard = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30);
-
-	g_signal_connect (G_OBJECT (filesel), "response",
-			  G_CALLBACK (filechooser_response), info);
-	g_object_weak_ref (G_OBJECT (filesel), destroy_it, info);
-
-	if (parent_window) {
-		gtk_window_set_transient_for (GTK_WINDOW (filesel),
-					      parent_window);
-		gtk_window_set_modal (GTK_WINDOW (filesel), TRUE);
-	}
-
-	gtk_widget_show(GTK_WIDGET(filesel));
-	g_free (file);
-}
-
-void
-eab_contact_list_save (char *title, GList *list, GtkWindow *parent_window)
-{
-	GtkWidget *filesel;
-	SaveAsInfo *info = g_new(SaveAsInfo, 1);
-	char *file;
-
-	filesel = gtk_file_chooser_dialog_new (title,
-					       parent_window,
-					       GTK_FILE_CHOOSER_ACTION_SAVE,
-					       GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-					       GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
-					       NULL);
-	gtk_dialog_set_default_response (GTK_DIALOG (filesel), GTK_RESPONSE_ACCEPT);
-	gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (filesel), FALSE);
-
-	/* Check if the list has more than one contact */
-	if (g_list_next (list))
-		info->has_multiple_contacts = TRUE;
-	else
-		info->has_multiple_contacts = FALSE;
-
-	/* This is a filename. Translators take note. */
-	if (list && list->data && list->next == NULL) {
-		char *name;
-		name = e_contact_get (E_CONTACT (list->data), E_CONTACT_FILE_AS);
-		if (!name)
-			name = e_contact_get (E_CONTACT (list->data), E_CONTACT_FULL_NAME);
-
-		file = make_safe_filename (name);
-	} else {
-		file = make_safe_filename (_("list"));
-	}
-
-	gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (filesel), g_get_home_dir ());
-	gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (filesel), file);
-
-	info->filesel = filesel;
-	info->vcard = eab_contact_list_to_string (list);
-
-	g_signal_connect (G_OBJECT (filesel), "response",
-			  G_CALLBACK (filechooser_response), info);
-	g_object_weak_ref (G_OBJECT (filesel), destroy_it, info);
-
-	if (parent_window) {
-		gtk_window_set_transient_for (GTK_WINDOW (filesel),
-					      parent_window);
-		gtk_window_set_modal (GTK_WINDOW (filesel), TRUE);
-	}
-
-	gtk_widget_show(GTK_WIDGET(filesel));
-	g_free (file);
-}
-
-typedef struct ContactCopyProcess_ ContactCopyProcess;
-
-typedef void (*ContactCopyDone) (ContactCopyProcess *process);
-
-struct ContactCopyProcess_ {
-	int count;
-	gboolean book_status;
-	GList *contacts;
-	EBook *source;
-	EBook *destination;
-	ContactCopyDone done_cb;
-};
-
-static void
-do_delete (gpointer data, gpointer user_data)
-{
-	EBook *book = user_data;
-	EContact *contact = data;
-	const char *id;
-
-	id = e_contact_get_const (contact, E_CONTACT_UID);
-	e_book_remove_contact(book, id, NULL);
-}
-
-static void
-delete_contacts (ContactCopyProcess *process)
-{
-	if (process->book_status == TRUE) {
-		g_list_foreach (process->contacts,
-				do_delete,
-				process->source);
-	}
-}
-
-static void
-process_unref (ContactCopyProcess *process)
-{
-	process->count --;
-	if (process->count == 0) {
-		if (process->done_cb)
-			process->done_cb (process);
-		g_list_foreach (
-			process->contacts,
-			(GFunc) g_object_unref, NULL);
-		g_list_free (process->contacts);
-		g_object_unref (process->source);
-		g_object_unref (process->destination);
-		g_free (process);
-	}
-}
-
-static void
-contact_added_cb (EBook* book, EBookStatus status, const char *id, gpointer user_data)
-{
-	ContactCopyProcess *process = user_data;
-
-	if (status != E_BOOK_ERROR_OK && status != E_BOOK_ERROR_CANCELLED) {
-		process->book_status = FALSE;
-		eab_error_dialog (_("Error adding contact"), status);
-	}
-	else if (status == E_BOOK_ERROR_CANCELLED) {
-		process->book_status = FALSE;
-	}
-	else {
-		/* success */
-		process->book_status = TRUE;
-	}
-	process_unref (process);
-}
-
-static void
-do_copy (gpointer data, gpointer user_data)
-{
-	EBook *book;
-	EContact *contact;
-	ContactCopyProcess *process;
-
-	process = user_data;
-	contact = data;
-
-	book = process->destination;
-
-	process->count ++;
-	eab_merging_book_add_contact(book, contact, contact_added_cb, process);
-}
+#include "mail/em-composer-utils.h"
+#include "composer/e-msg-composer.h"
+#include "addressbook/util/eab-book-util.h"
+#include "addressbook/gui/widgets/eab-gui-util.h"
 
 static void
-got_book_cb (EBook *book, EBookStatus status, gpointer closure)
-{
-	ContactCopyProcess *process;
-	process = closure;
-	if (status == E_BOOK_ERROR_OK) {
-		process->destination = book;
-		process->book_status = TRUE;
-		g_object_ref (book);
-		g_list_foreach (process->contacts,
-				do_copy,
-				process);
-	}
-	process_unref (process);
-}
-
-void
-eab_transfer_contacts (EBook *source, GList *contacts /* adopted */, gboolean delete_from_source, GtkWindow *parent_window)
-{
-	EBook *dest;
-	ESource *destination_source;
-	static char *last_uid = NULL;
-	ContactCopyProcess *process;
-	char *desc;
-
-	if (contacts == NULL)
-		return;
-
-	if (last_uid == NULL)
-		last_uid = g_strdup ("");
-
-	if (contacts->next == NULL) {
-		if (delete_from_source)
-			desc = _("Move contact to");
-		else
-			desc = _("Copy contact to");
-	} else {
-		if (delete_from_source)
-			desc = _("Move contacts to");
-		else
-			desc = _("Copy contacts to");
-	}
-
-	destination_source = eab_select_source (desc, NULL,
-						last_uid, parent_window);
-
-	if (!destination_source)
-		return;
-
-	if (strcmp (last_uid, e_source_peek_uid (destination_source)) != 0) {
-		g_free (last_uid);
-		last_uid = g_strdup (e_source_peek_uid (destination_source));
-	}
-
-	process = g_new (ContactCopyProcess, 1);
-	process->count = 1;
-	process->book_status = FALSE;
-	process->source = source;
-	g_object_ref (source);
-	process->contacts = contacts;
-	process->destination = NULL;
-
-	if (delete_from_source)
-		process->done_cb = delete_contacts;
-	else
-		process->done_cb = NULL;
-
-	dest = e_book_new (destination_source, NULL);
-	addressbook_load (dest, got_book_cb, process);
-}
-
-typedef struct {
-	EContact *contact;
-	int email_num; /* if the contact is a person (not a list), the email address to use */
-} ContactAndEmailNum;
-
-static void
-eab_send_to_contact_and_email_num_list (GList *contact_list)
+eab_send_as_to (GList *destinations)
 {
 	EMsgComposer *composer;
 	EComposerHeaderTable *table;
@@ -791,7 +40,7 @@
 		EDestination **destinations;
 	} convert;
 
-	if (contact_list == NULL)
+	if (destinations == NULL)
 		return;
 
 	composer = e_msg_composer_new ();
@@ -802,13 +51,8 @@
 	bcc_array = g_ptr_array_new ();
 
 	/* Sort contacts into "To" and "Bcc" destinations. */
-	while (contact_list != NULL) {
-		ContactAndEmailNum *ce = contact_list->data;
-		EContact *contact = ce->contact;
-		EDestination *destination;
-
-		destination = e_destination_new ();
-		e_destination_set_contact (destination, contact, 0);
+	while (destinations != NULL) {
+		EDestination *destination = destinations->data;
 
 		if (e_destination_is_evolution_list (destination)) {
 			if (e_destination_list_show_addresses (destination))
@@ -818,7 +62,7 @@
 		} else
 			g_ptr_array_add (to_array, destination);
 
-		contact_list = g_list_next (contact_list);
+		destinations = g_list_next (destinations);
 	}
 
 	/* Add sentinels to each array. */
@@ -866,11 +110,12 @@
 }
 
 static void
-eab_send_contact_list_as_attachment (GList *contacts)
+eab_send_as_attachment (GList *destinations)
 {
 	EMsgComposer *composer;
 	EComposerHeaderTable *table;
 	CamelMimePart *attachment;
+	GList *contacts, *iter;
 	gchar *data;
 
 	if (contacts == NULL)
@@ -881,19 +126,25 @@
 	em_composer_utils_setup_default_callbacks (composer);
 
 	attachment = camel_mime_part_new ();
+
+	contacts = g_list_copy (destinations);
+	for (iter = contacts; iter != NULL; iter = iter->next)
+		iter->data = e_destination_get_contact (iter->data);
 	data = eab_contact_list_to_string (contacts);
+	g_list_free (contacts);
 
 	camel_mime_part_set_content (
 		attachment, data, strlen (data), "text/x-vcard");
 
-	if (contacts->next != NULL)
+	if (destinations->next != NULL)
 		camel_mime_part_set_description (
 			attachment, _("Multiple vCards"));
 	else {
-		EContact *contact = contacts->data;
+		EContact *contact;
 		const gchar *file_as;
 		gchar *description;
 
+		contact = e_destination_get_contact (destinations->data);
 		file_as = e_contact_get_const (contact, E_CONTACT_FILE_AS);
 		description = g_strdup_printf (_("vCard for %s"), file_as);
 		camel_mime_part_set_description (attachment, description);
@@ -905,15 +156,16 @@
 	e_msg_composer_attach (composer, attachment);
 	camel_object_unref (attachment);
 
-	if (contacts->next != NULL)
+	if (destinations->next != NULL)
 		e_composer_header_table_set_subject (
 			table, _("Contact information"));
 	else {
-		EContact *contact = contacts->data;
+		EContact *contact;
 		gchar *tempstr;
 		const gchar *tempstr2;
 		gchar *tempfree = NULL;
 
+		contact = e_destination_get_contact (destinations->data);
 		tempstr2 = e_contact_get_const (contact, E_CONTACT_FILE_AS);
 		if (!tempstr2 || !*tempstr2)
 			tempstr2 = e_contact_get_const (contact, E_CONTACT_FULL_NAME);
@@ -947,130 +199,16 @@
 }
 
 void
-eab_send_contact_list (GList *contacts, EABDisposition disposition)
-{
-	switch (disposition) {
-	case EAB_DISPOSITION_AS_TO: {
-		GList *list = NULL, *l;
-
-		for (l = contacts; l; l = l->next) {
-			ContactAndEmailNum *ce = g_new (ContactAndEmailNum, 1);
-			ce->contact = l->data;
-			ce->email_num = 0; /* hardcode this */
-
-			list = g_list_append (list, ce);
-		}
-
-		eab_send_to_contact_and_email_num_list (list);
-
-		g_list_foreach (list, (GFunc)g_free, NULL);
-		g_list_free (list);
-		break;
-	}
-	case EAB_DISPOSITION_AS_ATTACHMENT:
-		eab_send_contact_list_as_attachment (contacts);
-		break;
-	}
-}
-
-void
-eab_send_contact (EContact *contact, int email_num, EABDisposition disposition)
+eab_send_message (GList *destinations,
+                  EABDisposition disposition)
 {
-	GList *list = NULL;
-
 	switch (disposition) {
-	case EAB_DISPOSITION_AS_TO: {
-		ContactAndEmailNum ce;
-
-		ce.contact = contact;
-		ce.email_num = email_num;
-
-		list = g_list_prepend (NULL, &ce);
-		eab_send_to_contact_and_email_num_list (list);
-		break;
-	}
-	case EAB_DISPOSITION_AS_ATTACHMENT: {
-		list = g_list_prepend (NULL, contact);
-		eab_send_contact_list_as_attachment (list);
-		break;
-	}
+		case EAB_DISPOSITION_AS_TO:
+			eab_send_as_to (destinations);
+			break;
+
+		case EAB_DISPOSITION_AS_ATTACHMENT:
+			eab_send_as_attachment (destinations);
+			break;
 	}
-
-	g_list_free (list);
-}
-
-GtkWidget *
-eab_create_image_chooser_widget(gchar *name,
-				gchar *string1, gchar *string2,
-				gint int1, gint int2)
-{
-	char *filename;
-	GtkWidget *w = NULL;
-
-	w = e_image_chooser_new ();
-	gtk_widget_show_all (w);
-
-	if (string1) {
-		filename = e_icon_factory_get_icon_filename (string1, E_ICON_SIZE_DIALOG);
-
-		e_image_chooser_set_from_file (E_IMAGE_CHOOSER (w), filename);
-
-		g_free (filename);
-	}
-
-	return w;
-}
-
-/* To parse something like...
-=?UTF-8?Q?=E0=A4=95=E0=A4=95=E0=A4=AC=E0=A5=82=E0=A5=8B=E0=A5=87?=\t\n=?UTF-8?Q?=E0=A4=B0?=\t\n<aa aa ccom>
-and return the decoded representation of name & email parts.
-*/
-gboolean
-eab_parse_qp_email (const gchar *string, gchar **name, gchar **email)
-{
-	struct _camel_header_address *address;
-	gboolean res = FALSE;
-
-	address = camel_header_address_decode (string, "UTF-8");
-
-	if (!address)
-		return FALSE;
-
-	/* report success only when we have filled both name and email address */
-	if (address->type == CAMEL_HEADER_ADDRESS_NAME  && address->name && *address->name && address->v.addr && *address->v.addr) {
-		*name = g_strdup (address->name);
-		*email = g_strdup (address->v.addr);
-		res = TRUE;
-	}
-
-	camel_header_address_unref (address);
-
-	return res;
-}
-
-/* This is only wrapper to parse_qp_mail, it decodes string and if returned TRUE,
-   then makes one string and returns it, otherwise returns NULL.
-   Returned string is usable to place directly into GtkHtml stream.
-   Returned value should be freed with g_free. */
-char *
-eab_parse_qp_email_to_html (const gchar *string)
-{
-	char *name = NULL, *mail = NULL;
-	char *html_name, *html_mail;
-	char *value;
-
-	if (!eab_parse_qp_email (string, &name, &mail))
-		return NULL;
-
-	html_name = e_text_to_html (name, 0);
-	html_mail = e_text_to_html (mail, E_TEXT_TO_HTML_CONVERT_ADDRESSES);
-
-	value = g_strdup_printf ("%s &lt;%s&gt;", html_name, html_mail);
-
-	g_free (html_name);
-	g_free (html_mail);
-	g_free (name);
-	g_free (mail);
-
-	return value;
 }

Copied: branches/kill-bonobo/addressbook/gui/component/eab-composer-util.h (from r36729, /branches/kill-bonobo/addressbook/gui/widgets/eab-gui-util.h)
==============================================================================
--- /branches/kill-bonobo/addressbook/gui/widgets/eab-gui-util.h	(original)
+++ branches/kill-bonobo/addressbook/gui/component/eab-composer-util.h	Fri Nov 14 03:56:01 2008
@@ -1,5 +1,4 @@
 /*
- *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
@@ -13,78 +12,25 @@
  * You should have received a copy of the GNU Lesser General Public
  * License along with the program; if not, see <http://www.gnu.org/licenses/>  
  *
- *
- * Authors:
- *		Chris Toshok <toshok ximian com>
- *
  * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
  *
  */
 
-#ifndef __E_ADDRESSBOOK_UTIL_H__
-#define __E_ADDRESSBOOK_UTIL_H__
+#ifndef EAB_COMPOSER_UTIL_H
+#define EAB_COMPOSER_UTIL_H
 
 #include <gtk/gtk.h>
-#include <libebook/e-book.h>
-#include "addressbook/gui/contact-editor/e-contact-editor.h"
-#include "addressbook/gui/contact-list-editor/e-contact-list-editor.h"
 
 G_BEGIN_DECLS
 
-void                eab_error_dialog              (const gchar *msg,
-						   EBookStatus  status);
-void                eab_load_error_dialog         (GtkWidget *parent,
-						   ESource *source,
-						   EBookStatus status);
-void                eab_search_result_dialog      (GtkWidget *parent,
-						   EBookViewStatus status);
-gint                eab_prompt_save_dialog        (GtkWindow   *parent);
-
-EContactEditor     *eab_show_contact_editor       (EBook       *book,
-						   EContact    *contact,
-						   gboolean     is_new_contact,
-						   gboolean     editable);
-EContactListEditor *eab_show_contact_list_editor  (EBook       *book,
-						   EContact    *contact,
-						   gboolean     is_new_contact,
-						   gboolean     editable);
-void                eab_show_multiple_contacts    (EBook       *book,
-						   GList       *list,
-						   gboolean     editable);
-void                eab_transfer_contacts         (EBook       *source,
-						   GList       *contacts, /* adopted */
-						   gboolean     delete_from_source,
-						   GtkWindow   *parent_window);
-
-void                eab_contact_save              (char *title,
-						   EContact *contact,
-						   GtkWindow *parent_window);
-
-void                eab_contact_list_save         (char *title,
-						   GList *list,
-						   GtkWindow *parent_window);
-
 typedef enum {
 	EAB_DISPOSITION_AS_ATTACHMENT,
 	EAB_DISPOSITION_AS_TO,
 } EABDisposition;
 
-void                eab_send_contact              (EContact       *contact,
-						   int             email_num,
-						   EABDisposition  disposition);
-void                eab_send_contact_list         (GList          *contacts,
-						   EABDisposition  disposition);
-
-GtkWidget *eab_create_image_chooser_widget (gchar *name, gchar *string1, gchar *string2, gint int1, gint int2);
-
-
-ESource            *eab_select_source             (const gchar *title, const gchar *message,
-						   const gchar *select_uid, GtkWindow *parent);
-
-/* To parse quoted printable address & return email & name fields */						
-gboolean eab_parse_qp_email (const gchar *string, gchar **name, gchar **email);
-char *eab_parse_qp_email_to_html (const gchar *string);
+void		eab_send_message		(GList *destinations,
+						 EABDisposition  disposition);
 
 G_END_DECLS
 
-#endif /* __E_ADDRESSBOOK_UTIL_H__ */
+#endif /* EAB_COMPOSER_UTIL_H */

Modified: branches/kill-bonobo/addressbook/gui/contact-editor/Makefile.am
==============================================================================
--- branches/kill-bonobo/addressbook/gui/contact-editor/Makefile.am	(original)
+++ branches/kill-bonobo/addressbook/gui/contact-editor/Makefile.am	Fri Nov 14 03:56:01 2008
@@ -33,10 +33,14 @@
 
 libecontacteditor_la_LDFLAGS = $(NO_UNDEFINED)
 
-libecontacteditor_la_LIBADD =				\
-	$(WIN32_BOOTSTRAP_LIBS)				\
-	$(top_builddir)/widgets/misc/libemiscwidgets.la	\
-	$(top_builddir)/e-util/libeutil.la		\
+libecontacteditor_la_LIBADD =						\
+	$(WIN32_BOOTSTRAP_LIBS)						\
+	$(top_builddir)/e-util/libeutil.la				\
+	$(top_builddir)/widgets/misc/libemiscwidgets.la			\
+	$(top_builddir)/addressbook/util/libeabutil.la			\
+	$(top_builddir)/addressbook/gui/widgets/libeabwidgets.la	\
+	$(top_builddir)/addressbook/gui/merging/libeabbookmerging.la	\
+	$(top_builddir)/addressbook/printing/libecontactprint.la	\
 	$(EVOLUTION_ADDRESSBOOK_LIBS)
 
 glade_DATA = 				\

Modified: branches/kill-bonobo/addressbook/gui/contact-editor/e-contact-editor.c
==============================================================================
--- branches/kill-bonobo/addressbook/gui/contact-editor/e-contact-editor.c	(original)
+++ branches/kill-bonobo/addressbook/gui/contact-editor/e-contact-editor.c	Fri Nov 14 03:56:01 2008
@@ -40,7 +40,7 @@
 
 #include <camel/camel.h>
 
-#include "addressbook/gui/component/addressbook.h"
+#include "addressbook/util/addressbook.h"
 #include "addressbook/printing/e-contact-print.h"
 #include "addressbook/gui/widgets/eab-gui-util.h"
 #include "e-util/e-util.h"
@@ -199,6 +199,54 @@
 #define STRING_IS_EMPTY(x)      (!(x) || !(*(x)))
 #define STRING_MAKE_NON_NULL(x) ((x) ? (x) : "")
 
+static void
+e_contact_editor_contact_added (EABEditor *editor,
+                                EBookStatus status,
+                                EContact *contact)
+{
+	if (status == E_BOOK_ERROR_OK)
+		return;
+
+	if (status == E_BOOK_ERROR_CANCELLED)
+		return;
+
+	eab_error_dialog (_("Error adding contact"), status);
+}
+
+static void
+e_contact_editor_contact_modified (EABEditor *editor,
+                                   EBookStatus status,
+                                   EContact *contact)
+{
+	if (status == E_BOOK_ERROR_OK)
+		return;
+
+	if (status == E_BOOK_ERROR_CANCELLED)
+		return;
+
+	eab_error_dialog (_("Error modifying contact"), status);
+}
+
+static void
+e_contact_editor_contact_deleted (EABEditor *editor,
+                                  EBookStatus status,
+                                  EContact *contact)
+{
+	if (status == E_BOOK_ERROR_OK)
+		return;
+
+	if (status == E_BOOK_ERROR_CANCELLED)
+		return;
+
+	eab_error_dialog (_("Error removing contact"), status);
+}
+
+static void
+e_contact_editor_closed (EABEditor *editor)
+{
+	g_object_unref (editor);
+}
+
 GType
 e_contact_editor_get_type (void)
 {
@@ -242,6 +290,10 @@
 	editor_class->save_contact = e_contact_editor_save_contact;
 	editor_class->is_changed = e_contact_editor_is_changed;
 	editor_class->get_window = e_contact_editor_get_window;
+	editor_class->contact_added = e_contact_editor_contact_added;
+	editor_class->contact_modified = e_contact_editor_contact_modified;
+	editor_class->contact_deleted = e_contact_editor_contact_deleted;
+	editor_class->editor_closed = e_contact_editor_closed;
 
 	g_object_class_install_property (object_class, PROP_SOURCE_BOOK,
 					 g_param_spec_object ("source_book",
@@ -3470,7 +3522,7 @@
 	eab_editor_remove (EAB_EDITOR (data));
 }
 
-EContactEditor *
+GtkWidget *
 e_contact_editor_new (EBook *book,
 		      EContact *contact,
 		      gboolean is_new_contact,
@@ -3496,7 +3548,7 @@
 	if (book)
 		e_book_async_get_supported_fields (book, (EBookEListCallback)supported_fields_cb, ce);
 
-	return ce;
+	return GTK_WIDGET (ce);
 }
 
 static void

Modified: branches/kill-bonobo/addressbook/gui/contact-editor/e-contact-editor.h
==============================================================================
--- branches/kill-bonobo/addressbook/gui/contact-editor/e-contact-editor.h	(original)
+++ branches/kill-bonobo/addressbook/gui/contact-editor/e-contact-editor.h	Fri Nov 14 03:56:01 2008
@@ -109,11 +109,11 @@
 	EABEditorClass parent_class;
 };
 
-EContactEditor *e_contact_editor_new                (EBook          *book,
-						     EContact       *contact,
-						     gboolean        is_new_contact,
-						     gboolean        editable);
-GType           e_contact_editor_get_type           (void);
+GType		e_contact_editor_get_type	(void);
+GtkWidget	*e_contact_editor_new		(EBook *book,
+						 EContact *contact,
+						 gboolean is_new_contact,
+						 gboolean editable);
 
 G_END_DECLS
 

Modified: branches/kill-bonobo/addressbook/gui/contact-editor/e-contact-quick-add.c
==============================================================================
--- branches/kill-bonobo/addressbook/gui/contact-editor/e-contact-quick-add.c	(original)
+++ branches/kill-bonobo/addressbook/gui/contact-editor/e-contact-quick-add.c	Fri Nov 14 03:56:01 2008
@@ -29,7 +29,7 @@
 #include <libebook/e-book.h>
 #include <libebook/e-contact.h>
 #include <libedataserverui/e-source-combo-box.h>
-#include <addressbook/gui/component/addressbook.h>
+#include <addressbook/util/addressbook.h>
 #include <addressbook/util/eab-book-util.h>
 #include "e-contact-editor.h"
 #include "e-contact-quick-add.h"
@@ -195,7 +195,7 @@
 		g_warning ("Couldn't open local address book.");
 		quick_add_unref (qa);
 	} else {
-		EContactEditor *contact_editor = e_contact_editor_new (book, qa->contact, TRUE, TRUE /* XXX */);
+		GtkWidget *contact_editor = e_contact_editor_new (book, qa->contact, TRUE, TRUE /* XXX */);
 
 		/* mark it as changed so the Save buttons are enabled when we bring up the dialog. */
 		g_object_set (contact_editor,

Modified: branches/kill-bonobo/addressbook/gui/contact-editor/eab-editor.c
==============================================================================
--- branches/kill-bonobo/addressbook/gui/contact-editor/eab-editor.c	(original)
+++ branches/kill-bonobo/addressbook/gui/contact-editor/eab-editor.c	Fri Nov 14 03:56:01 2008
@@ -310,51 +310,6 @@
 	return all_editors;
 }
 
-gboolean
-eab_editor_confirm_delete (GtkWindow *parent, gboolean plural, gboolean is_list, char *name)
-{
-	GtkWidget *dialog;
-	gint result;
-	char *msg;
-
-	if (is_list) {
-		/* contact list(s) */
-		if (!plural)
-			msg = g_strdup_printf (_("Are you sure you want\nto delete contact list (%s)?"),
-						name?name:"");
-		else
-			msg = g_strdup (_("Are you sure you want\nto delete these contact lists?"));
-	}
-	else {
-		/* contact(s) */
-		if (!plural)
-			msg = g_strdup_printf (_("Are you sure you want\nto delete contact (%s)?"),
-						name?name:"");
-		else
-			msg = g_strdup (_("Are you sure you want\nto delete these contacts?"));
-	}
-
-	dialog = gtk_message_dialog_new (parent,
-					 0,
-					 GTK_MESSAGE_QUESTION,
-					 GTK_BUTTONS_NONE,
-					 "%s",
-					 msg);
-	g_free (msg);
-
-	gtk_dialog_add_buttons (GTK_DIALOG (dialog),
-				GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-				GTK_STOCK_DELETE, GTK_RESPONSE_ACCEPT,
-				NULL);
-
-	result = gtk_dialog_run(GTK_DIALOG (dialog));
-
-	gtk_widget_destroy (dialog);
-
-	return (result == GTK_RESPONSE_ACCEPT);
-}
-
-
 void
 eab_editor_contact_added (EABEditor *editor, EBookStatus status, EContact *contact)
 {

Modified: branches/kill-bonobo/addressbook/gui/contact-editor/eab-editor.h
==============================================================================
--- branches/kill-bonobo/addressbook/gui/contact-editor/eab-editor.h	(original)
+++ branches/kill-bonobo/addressbook/gui/contact-editor/eab-editor.h	Fri Nov 14 03:56:01 2008
@@ -92,7 +92,6 @@
 GtkWindow*      eab_editor_get_window        (EABEditor *editor);
 
 gboolean        eab_editor_prompt_to_save_changes (EABEditor *editor, GtkWindow *window);
-gboolean	eab_editor_confirm_delete    (GtkWindow *parent, gboolean plural, gboolean is_list, char *name);
 
 /* these four generate EABEditor signals */
 void 		eab_editor_contact_added     (EABEditor *editor, EBookStatus status, EContact *contact);

Modified: branches/kill-bonobo/addressbook/gui/contact-list-editor/e-contact-list-editor.c
==============================================================================
--- branches/kill-bonobo/addressbook/gui/contact-list-editor/e-contact-list-editor.c	(original)
+++ branches/kill-bonobo/addressbook/gui/contact-list-editor/e-contact-list-editor.c	Fri Nov 14 03:56:01 2008
@@ -34,8 +34,8 @@
 
 #include <libedataserverui/e-source-combo-box.h>
 
-#include "addressbook/gui/component/addressbook.h"
 #include "addressbook/gui/widgets/eab-gui-util.h"
+#include "addressbook/util/addressbook.h"
 #include "addressbook/util/eab-book-util.h"
 
 #include "eab-editor.h"
@@ -922,87 +922,6 @@
 	return GTK_WIDGET (name_selector_entry);
 }
 
-/**************************** EABEditor Callbacks ****************************/
-
-static void
-contact_list_editor_show (EABEditor *editor)
-{
-	gtk_widget_show (WIDGET (DIALOG));
-}
-
-static void
-contact_list_editor_close (EABEditor *editor)
-{
-	gtk_widget_destroy (WIDGET (DIALOG));
-	eab_editor_closed (editor);
-}
-
-static void
-contact_list_editor_raise (EABEditor *editor)
-{
-	gdk_window_raise (WIDGET (DIALOG)->window);
-}
-
-static void
-contact_list_editor_save_contact (EABEditor *eab_editor,
-                                  gboolean should_close)
-{
-	EContactListEditor *editor = E_CONTACT_LIST_EDITOR (eab_editor);
-	EContactListEditorPrivate *priv = editor->priv;
-	EditorCloseStruct *ecs;
-	EContact *contact;
-
-	contact = e_contact_list_editor_get_contact (editor);
-
-	if (priv->book == NULL)
-		return;
-
-	ecs = g_new (EditorCloseStruct, 1);
-	ecs->editor = g_object_ref (editor);
-	ecs->should_close = should_close;
-
-	gtk_widget_set_sensitive (WIDGET (DIALOG), FALSE);
-	priv->in_async_call = TRUE;
-
-	if (priv->is_new_list)
-		eab_merging_book_add_contact (
-			priv->book, contact, (EBookIdCallback)
-			contact_list_editor_list_added_cb, ecs);
-	else
-		eab_merging_book_commit_contact (
-			priv->book, contact, (EBookCallback)
-			contact_list_editor_list_modified_cb, ecs);
-
-	priv->changed = FALSE;
-}
-
-static gboolean
-contact_list_editor_is_valid (EABEditor *editor)
-{
-	GtkEditable *editable;
-	gboolean valid;
-	gchar *chars;
-
-	editable = GTK_EDITABLE (WIDGET (LIST_NAME_ENTRY));
-	chars = gtk_editable_get_chars (editable, 0, -1);
-	valid = (chars != NULL && *chars != '\0');
-	g_free (chars);
-
-	return valid;
-}
-
-static gboolean
-contact_list_editor_is_changed (EABEditor *editor)
-{
-	return E_CONTACT_LIST_EDITOR_GET_PRIVATE (editor)->changed;
-}
-
-static GtkWindow*
-contact_list_editor_get_window (EABEditor *editor)
-{
-	return GTK_WINDOW (WIDGET (DIALOG));
-}
-
 /***************************** GObject Callbacks *****************************/
 
 static GObject *
@@ -1112,6 +1031,135 @@
 	G_OBJECT_CLASS (parent_class)->dispose (object);
 }
 
+/**************************** EABEditor Callbacks ****************************/
+
+static void
+contact_list_editor_show (EABEditor *editor)
+{
+	gtk_widget_show (WIDGET (DIALOG));
+}
+
+static void
+contact_list_editor_close (EABEditor *editor)
+{
+	gtk_widget_destroy (WIDGET (DIALOG));
+	eab_editor_closed (editor);
+}
+
+static void
+contact_list_editor_raise (EABEditor *editor)
+{
+	gdk_window_raise (WIDGET (DIALOG)->window);
+}
+
+static void
+contact_list_editor_save_contact (EABEditor *eab_editor,
+                                  gboolean should_close)
+{
+	EContactListEditor *editor = E_CONTACT_LIST_EDITOR (eab_editor);
+	EContactListEditorPrivate *priv = editor->priv;
+	EditorCloseStruct *ecs;
+	EContact *contact;
+
+	contact = e_contact_list_editor_get_contact (editor);
+
+	if (priv->book == NULL)
+		return;
+
+	ecs = g_new (EditorCloseStruct, 1);
+	ecs->editor = g_object_ref (editor);
+	ecs->should_close = should_close;
+
+	gtk_widget_set_sensitive (WIDGET (DIALOG), FALSE);
+	priv->in_async_call = TRUE;
+
+	if (priv->is_new_list)
+		eab_merging_book_add_contact (
+			priv->book, contact, (EBookIdCallback)
+			contact_list_editor_list_added_cb, ecs);
+	else
+		eab_merging_book_commit_contact (
+			priv->book, contact, (EBookCallback)
+			contact_list_editor_list_modified_cb, ecs);
+
+	priv->changed = FALSE;
+}
+
+static gboolean
+contact_list_editor_is_valid (EABEditor *editor)
+{
+	GtkEditable *editable;
+	gboolean valid;
+	gchar *chars;
+
+	editable = GTK_EDITABLE (WIDGET (LIST_NAME_ENTRY));
+	chars = gtk_editable_get_chars (editable, 0, -1);
+	valid = (chars != NULL && *chars != '\0');
+	g_free (chars);
+
+	return valid;
+}
+
+static gboolean
+contact_list_editor_is_changed (EABEditor *editor)
+{
+	return E_CONTACT_LIST_EDITOR_GET_PRIVATE (editor)->changed;
+}
+
+static GtkWindow *
+contact_list_editor_get_window (EABEditor *editor)
+{
+	return GTK_WINDOW (WIDGET (DIALOG));
+}
+
+static void
+contact_list_editor_contact_added (EABEditor *editor,
+                                   EBookStatus status,
+                                   EContact *contact)
+{
+	if (status == E_BOOK_ERROR_OK)
+		return;
+
+	if (status == E_BOOK_ERROR_CANCELLED)
+		return;
+
+	eab_error_dialog (_("Error adding list"), status);
+}
+
+static void
+contact_list_editor_contact_modified (EABEditor *editor,
+                                      EBookStatus status,
+                                      EContact *contact)
+{
+	if (status == E_BOOK_ERROR_OK)
+		return;
+
+	if (status == E_BOOK_ERROR_CANCELLED)
+		return;
+
+	eab_error_dialog (_("Error modifying list"), status);
+}
+
+static void
+contact_list_editor_contact_deleted (EABEditor *editor,
+                                     EBookStatus status,
+                                     EContact *contact)
+{
+	if (status == E_BOOK_ERROR_OK)
+		return;
+
+	if (status == E_BOOK_ERROR_CANCELLED)
+		return;
+
+	eab_error_dialog (_("Error removing list"), status);
+}
+
+static void
+contact_list_editor_closed (EABEditor *editor)
+{
+	g_object_unref (editor);
+}
+
 /****************************** GType Callbacks ******************************/
 
 static void
@@ -1137,6 +1185,10 @@
 	editor_class->is_valid = contact_list_editor_is_valid;
 	editor_class->is_changed = contact_list_editor_is_changed;
 	editor_class->get_window = contact_list_editor_get_window;
+	editor_class->contact_added = contact_list_editor_contact_added;
+	editor_class->contact_modified = contact_list_editor_contact_modified;
+	editor_class->contact_deleted = contact_list_editor_contact_deleted;
+	editor_class->editor_closed = contact_list_editor_closed;
 
 	g_object_class_install_property (
 		object_class,
@@ -1274,7 +1326,7 @@
 	eab_editor_remove (EAB_EDITOR (data));
 }
 
-EContactListEditor *
+GtkWidget *
 e_contact_list_editor_new (EBook *book,
 			   EContact *list_contact,
 			   gboolean is_new_list,
@@ -1295,7 +1347,7 @@
 		      "editable", editable,
 		      NULL);
 
-	return editor;
+	return GTK_WIDGET (editor);
 }
 
 EBook *

Modified: branches/kill-bonobo/addressbook/gui/contact-list-editor/e-contact-list-editor.h
==============================================================================
--- branches/kill-bonobo/addressbook/gui/contact-list-editor/e-contact-list-editor.h	(original)
+++ branches/kill-bonobo/addressbook/gui/contact-list-editor/e-contact-list-editor.h	Fri Nov 14 03:56:01 2008
@@ -70,7 +70,7 @@
 };
 
 GType		e_contact_list_editor_get_type	(void);
-EContactListEditor * e_contact_list_editor_new	(EBook *book,
+GtkWidget *	e_contact_list_editor_new	(EBook *book,
 						 EContact *list_contact,
 						 gboolean is_new_list,
 						 gboolean editable);

Modified: branches/kill-bonobo/addressbook/gui/merging/eab-contact-compare.c
==============================================================================
--- branches/kill-bonobo/addressbook/gui/merging/eab-contact-compare.c	(original)
+++ branches/kill-bonobo/addressbook/gui/merging/eab-contact-compare.c	Fri Nov 14 03:56:01 2008
@@ -24,8 +24,8 @@
 #include <config.h>
 #include <ctype.h>
 #include <string.h>
-#include "util/eab-book-util.h"
-#include "../component/addressbook.h"
+#include "addressbook/util/addressbook.h"
+#include "addressbook/util/eab-book-util.h"
 #include "eab-contact-compare.h"
 
 /* This is an "optimistic" combiner: the best of the two outcomes is

Modified: branches/kill-bonobo/addressbook/gui/widgets/Makefile.am
==============================================================================
--- branches/kill-bonobo/addressbook/gui/widgets/Makefile.am	(original)
+++ branches/kill-bonobo/addressbook/gui/widgets/Makefile.am	Fri Nov 14 03:56:01 2008
@@ -10,9 +10,7 @@
 	-I$(top_srcdir)/filter				\
 	-I$(top_srcdir)/widgets				\
 	-I$(top_srcdir)/addressbook			\
-	-I$(top_srcdir)/addressbook/gui/contact-editor	\
 	-I$(top_srcdir)/addressbook/gui/merging		\
-	-I$(top_srcdir)/addressbook/gui/component	\
 	-I$(top_srcdir)/addressbook/util		\
 	-I$(top_srcdir)/widgets/misc			\
 	-I$(top_builddir)/shell				\
@@ -56,8 +54,8 @@
 	gal-view-factory-minicard.h
 
 libeabwidgets_la_LIBADD =					\
-	$(top_builddir)/composer/libcomposer.la			\
-	$(top_builddir)/widgets/misc/libemiscwidgets.la
+	$(top_builddir)/widgets/misc/libemiscwidgets.la		\
+	$(top_builddir)/a11y/addressbook/libevolution-addressbook-a11y.la
 
 CLEANFILES = $(BUILT_SOURCES)
 

Modified: branches/kill-bonobo/addressbook/gui/widgets/e-addressbook-reflow-adapter.c
==============================================================================
--- branches/kill-bonobo/addressbook/gui/widgets/e-addressbook-reflow-adapter.c	(original)
+++ branches/kill-bonobo/addressbook/gui/widgets/e-addressbook-reflow-adapter.c	Fri Nov 14 03:56:01 2008
@@ -54,10 +54,11 @@
 
 enum {
 	DRAG_BEGIN,
+	OPEN_CONTACT,
 	LAST_SIGNAL
 };
 
-static guint e_addressbook_reflow_adapter_signals [LAST_SIGNAL] = {0, };
+static guint signals [LAST_SIGNAL] = {0, };
 
 static void
 unlink_model(EAddressbookReflowAdapter *adapter)
@@ -227,12 +228,20 @@
 	gint ret_val = 0;
 
 	g_signal_emit (adapter,
-		       e_addressbook_reflow_adapter_signals[DRAG_BEGIN], 0,
+		       signals[DRAG_BEGIN], 0,
 		       event, &ret_val);
 
 	return ret_val;
 }
 
+static void
+adapter_open_contact (EMinicard *card,
+                      EContact *contact,
+                      EAddressbookReflowAdapter *adapter)
+{
+	g_signal_emit (adapter, signals[OPEN_CONTACT], 0, contact);
+}
+
 static GnomeCanvasItem *
 addressbook_incarnate (EReflowModel *erm, int i, GnomeCanvasGroup *parent)
 {
@@ -252,7 +261,10 @@
 #endif
 
 	g_signal_connect (item, "drag_begin",
-			  G_CALLBACK(adapter_drag_begin), adapter);
+			  G_CALLBACK (adapter_drag_begin), adapter);
+
+	g_signal_connect (item, "open-contact",
+			  G_CALLBACK (adapter_open_contact), adapter);
 
 	return item;
 }
@@ -427,7 +439,7 @@
 							      E_TYPE_ADDRESSBOOK_MODEL,
 							      G_PARAM_READABLE));
 
-	e_addressbook_reflow_adapter_signals [DRAG_BEGIN] =
+	signals [DRAG_BEGIN] =
 		g_signal_new ("drag_begin",
 			      G_OBJECT_CLASS_TYPE(object_class),
 			      G_SIGNAL_RUN_LAST,
@@ -436,6 +448,16 @@
 			      e_marshal_INT__POINTER,
 			      G_TYPE_INT, 1, G_TYPE_POINTER);
 
+	signals [OPEN_CONTACT] =
+		g_signal_new ("open-contact",
+			      G_OBJECT_CLASS_TYPE (object_class),
+			      G_SIGNAL_RUN_LAST,
+			      G_STRUCT_OFFSET (EAddressbookReflowAdapterClass, open_contact),
+			      NULL, NULL,
+			      g_cclosure_marshal_VOID__OBJECT,
+			      G_TYPE_NONE, 1,
+			      E_TYPE_CONTACT);
+
 	model_class->set_width = addressbook_set_width;
 	model_class->count = addressbook_count;
 	model_class->height = addressbook_height;

Modified: branches/kill-bonobo/addressbook/gui/widgets/e-addressbook-reflow-adapter.h
==============================================================================
--- branches/kill-bonobo/addressbook/gui/widgets/e-addressbook-reflow-adapter.h	(original)
+++ branches/kill-bonobo/addressbook/gui/widgets/e-addressbook-reflow-adapter.h	Fri Nov 14 03:56:01 2008
@@ -48,7 +48,10 @@
 	/*
 	 * Signals
 	 */
-	gint (* drag_begin) (EAddressbookReflowAdapter *adapter, GdkEvent *event);
+	gint		(*drag_begin)		(EAddressbookReflowAdapter *adapter,
+						 GdkEvent *event);
+	void		(*open_contact)		(EAddressbookReflowAdapter *adapter,
+						 EContact *contact);
 };
 
 

Modified: branches/kill-bonobo/addressbook/gui/widgets/e-addressbook-view.c
==============================================================================
--- branches/kill-bonobo/addressbook/gui/widgets/e-addressbook-view.c	(original)
+++ branches/kill-bonobo/addressbook/gui/widgets/e-addressbook-view.c	Fri Nov 14 03:56:01 2008
@@ -53,7 +53,6 @@
 #include "e-util/e-error.h"
 #include "e-util/e-util-private.h"
 
-#include "e-contact-editor.h"
 #include <gdk/gdkkeysyms.h>
 #include <ctype.h>
 #include <string.h>
@@ -69,7 +68,6 @@
 static void folder_bar_message (EAddressbookView *view, const gchar *status);
 static void stop_state_changed (GtkObject *object, EAddressbookView *view);
 static void backend_died       (EAddressbookView *view);
-static GList *get_selected_contacts (EAddressbookView *view);
 
 static void command_state_change (EAddressbookView *view);
 
@@ -98,6 +96,7 @@
 };
 
 enum {
+	OPEN_CONTACT,
 	POPUP_EVENT,
 	COMMAND_STATE_CHANGE,
 	SELECTION_CHANGE,
@@ -119,6 +118,14 @@
 static GdkAtom clipboard_atom = GDK_NONE;
 
 static void
+addressbook_view_emit_open_contact (EAddressbookView *view,
+                                    EContact *contact,
+                                    gboolean is_new_contact)
+{
+	g_signal_emit (view, signals[OPEN_CONTACT], 0, contact, is_new_contact);
+}
+
+static void
 addressbook_view_emit_popup_event (EAddressbookView *view,
                                    GdkEvent *event)
 {
@@ -132,6 +139,34 @@
 }
 
 static void
+addressbook_view_open_contact (EAddressbookView *view,
+                               EContact *contact)
+{
+	addressbook_view_emit_open_contact (view, contact, FALSE);
+}
+
+static void
+addressbook_view_create_contact (EAddressbookView *view)
+{
+	EContact *contact;
+
+	contact = e_contact_new ();
+	addressbook_view_emit_open_contact (view, contact, TRUE);
+	g_object_unref (contact);
+}
+
+static void
+addressbook_view_create_contact_list (EAddressbookView *view)
+{
+	EContact *contact;
+
+	contact = e_contact_new ();
+	e_contact_set (contact, E_CONTACT_IS_LIST, GINT_TO_POINTER (TRUE));
+	addressbook_view_emit_open_contact (view, contact, TRUE);
+	g_object_unref (contact);
+}
+
+static void
 table_double_click (ETableScrolled *table,
                     gint row,
                     gint col,
@@ -140,23 +175,13 @@
 {
 	EAddressbookModel *model;
 	EContact *contact;
-	EBook *book;
-	gboolean editable;
 
 	if (!E_IS_ADDRESSBOOK_TABLE_ADAPTER (view->priv->object))
 		return;
 
-	model = view->priv->model;
+	model = e_addressbook_view_get_model (view);
 	contact = e_addressbook_model_get_contact (model, row);
-	editable = e_addressbook_model_get_editable (model);
-	book = e_addressbook_model_get_book (model);
-	g_return_if_fail (E_IS_BOOK (book));
-
-	if (e_contact_get (contact, E_CONTACT_IS_LIST))
-		eab_show_contact_list_editor (book, contact, FALSE, editable);
-	else
-		eab_show_contact_editor (book, contact, FALSE, editable);
-
+	addressbook_view_emit_open_contact (view, contact, FALSE);
 	g_object_unref (contact);
 }
 
@@ -209,7 +234,7 @@
 	model = e_addressbook_view_get_model (view);
 	book = e_addressbook_model_get_book (model);
 
-	contact_list = get_selected_contacts (view);
+	contact_list = e_addressbook_view_get_selected (view);
 
 	switch (info) {
 		case DND_TARGET_TYPE_VCARD:
@@ -300,6 +325,18 @@
 	minicard_view = e_minicard_view_widget_new (adapter);
 
 	g_signal_connect_swapped (
+		adapter, "open-contact",
+		G_CALLBACK (addressbook_view_open_contact), view);
+
+	g_signal_connect_swapped (
+		minicard_view, "create-contact",
+		G_CALLBACK (addressbook_view_create_contact), view);
+
+	g_signal_connect_swapped (
+		minicard_view, "create-contact-list",
+		G_CALLBACK (addressbook_view_create_contact_list), view);
+
+	g_signal_connect_swapped (
 		minicard_view, "selection_change",
 		G_CALLBACK (addressbook_view_emit_selection_change), view);
 
@@ -644,6 +681,16 @@
 			G_PARAM_READWRITE |
 			G_PARAM_CONSTRUCT_ONLY));
 
+	signals[OPEN_CONTACT] = g_signal_new (
+		"open-contact",
+		G_TYPE_FROM_CLASS (class),
+		G_SIGNAL_RUN_LAST,
+		G_STRUCT_OFFSET (EAddressbookViewClass, open_contact),
+		NULL, NULL,
+		g_cclosure_marshal_VOID__OBJECT,
+		G_TYPE_NONE, 1,
+		E_TYPE_CONTACT);
+
 	signals[POPUP_EVENT] = g_signal_new (
 		"popup-event",
 		G_TYPE_FROM_CLASS (class),
@@ -801,6 +848,34 @@
 	return view->priv->widget;
 }
 
+/* Helper for e_addressbook_view_get_selected() */
+static void
+add_to_list (gint model_row, gpointer closure)
+{
+	GList **list = closure;
+	*list = g_list_prepend (*list, GINT_TO_POINTER (model_row));
+}
+
+GList *
+e_addressbook_view_get_selected (EAddressbookView *view)
+{
+	GList *list, *iter;
+	ESelectionModel *selection;
+
+	g_return_val_if_fail (E_IS_ADDRESSBOOK_VIEW (view), NULL);
+
+	list = NULL;
+	selection = e_addressbook_view_get_selection_model (view);
+	e_selection_model_foreach (selection, add_to_list, &list);
+
+	for (iter = list; iter != NULL; iter = iter->next)
+		iter->data = e_addressbook_model_get_contact (
+			view->priv->model, GPOINTER_TO_INT (iter->data));
+	list = g_list_reverse (list);
+
+	return list;
+}
+
 ESelectionModel *
 e_addressbook_view_get_selection_model (EAddressbookView *view)
 {
@@ -1011,7 +1086,7 @@
 			query = NULL;
 		g_free (query_string);
 
-		contact_list = get_selected_contacts (view);
+		contact_list = e_addressbook_view_get_selected (view);
 		e_contact_print (book, query, contact_list, action);
 		g_list_foreach (contact_list, (GFunc) g_object_unref, NULL);
 		g_list_free (contact_list);
@@ -1054,6 +1129,62 @@
 	}
 }
 
+static gboolean
+addressbook_view_confirm_delete (GtkWindow *parent,
+                                 gboolean plural,
+                                 gboolean is_list,
+                                 const gchar *name)
+{
+	GtkWidget *dialog;
+	gchar *message;
+	gint response;
+
+	if (is_list) {
+		if (plural) {
+			message = g_strdup (
+				_("Are you sure you want to "
+				  "delete these contact lists?"));
+		} else if (name == NULL) {
+			message = g_strdup (
+				_("Are you sure you want to "
+				  "delete this contact list?"));
+		} else {
+			message = g_strdup_printf (
+				_("Are you sure you want to delete "
+				  "this contact list (%s)?"), name);
+		}
+	} else {
+		if (plural) {
+			message = g_strdup (
+				_("Are you sure you want to "
+				  "delete these contacts?"));
+		} else if (name == NULL) {
+			message = g_strdup (
+				_("Are you sure you want to "
+				  "delete this contact?"));
+		} else {
+			message = g_strdup_printf (
+				_("Are you sure you want to delete "
+				  "this contact (%s)?"), name);
+		}
+	}
+
+	dialog = gtk_message_dialog_new (
+		parent, 0, GTK_MESSAGE_QUESTION,
+		GTK_BUTTONS_NONE, "%s", message);
+	gtk_dialog_add_buttons (
+		GTK_DIALOG (dialog),
+		GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+		GTK_STOCK_DELETE, GTK_RESPONSE_ACCEPT,
+		NULL);
+	response = gtk_dialog_run (GTK_DIALOG (dialog));
+	gtk_widget_destroy (dialog);
+
+	g_free (message);
+
+	return (response == GTK_RESPONSE_ACCEPT);
+}
+
 void
 e_addressbook_view_delete_selection(EAddressbookView *view, gboolean is_delete)
 {
@@ -1076,7 +1207,7 @@
 	view_instance = e_addressbook_view_get_view_instance (view);
 	gal_view = gal_view_instance_get_current_view (view_instance);
 
-	list = get_selected_contacts (view);
+	list = e_addressbook_view_get_selected (view);
 	contact = list->data;
 
 	if (g_list_next(list))
@@ -1100,9 +1231,9 @@
 	}
 
 	/* confirm delete */
-	if (is_delete &&
-	    !eab_editor_confirm_delete(GTK_WINDOW(gtk_widget_get_toplevel(view->priv->widget)),
-				       plural, is_list, name)) {
+	if (is_delete && !addressbook_view_confirm_delete (
+			GTK_WINDOW (gtk_widget_get_toplevel (
+			view->priv->widget)), plural, is_list, name)) {
 		g_free (name);
 		g_list_foreach (list, (GFunc) g_object_unref, NULL);
 		g_list_free (list);
@@ -1168,30 +1299,6 @@
 	g_list_free (list);
 }
 
-static void
-add_to_list (int model_row, gpointer closure)
-{
-	GList **list = closure;
-	*list = g_list_prepend (*list, GINT_TO_POINTER (model_row));
-}
-
-static GList *
-get_selected_contacts (EAddressbookView *view)
-{
-	GList *list;
-	GList *iterator;
-	ESelectionModel *selection = e_addressbook_view_get_selection_model (view);
-
-	list = NULL;
-	e_selection_model_foreach (selection, add_to_list, &list);
-
-	for (iterator = list; iterator; iterator = iterator->next) {
-		iterator->data = e_addressbook_model_get_contact (view->priv->model, GPOINTER_TO_INT (iterator->data));
-	}
-	list = g_list_reverse (list);
-	return list;
-}
-
 void
 e_addressbook_view_save_as (EAddressbookView *view,
                             gboolean all)
@@ -1210,7 +1317,7 @@
 		e_book_get_contacts (book, query, &list, NULL);
 	        e_book_query_unref (query);
 	} else
-		list = get_selected_contacts (view);
+		list = e_addressbook_view_get_selected (view);
 
 	if (list != NULL) {
 		eab_contact_list_save (_("Save as vCard..."), list, NULL);
@@ -1224,8 +1331,10 @@
 {
 	EAddressbookModel *model;
 	EBook *book;
-	GList *list;
+	GList *list, *iter;
 	gboolean editable;
+	gint response;
+	guint length;
 
 	g_return_if_fail (E_IS_ADDRESSBOOK_VIEW (view));
 
@@ -1233,45 +1342,39 @@
 	book = e_addressbook_model_get_book (model);
 	editable = e_addressbook_model_get_editable (model);
 
-	list = get_selected_contacts (view);
-	eab_show_multiple_contacts (book, list, editable);
+	list = e_addressbook_view_get_selected (view);
+	length = g_list_length (list);
+	response = GTK_RESPONSE_YES;
+
+	if (length > 5) {
+		GtkWidget *dialog;
+
+		/* XXX Use e_error_new(). */
+		/* XXX Provide a parent window. */
+		dialog = gtk_message_dialog_new (
+			NULL, 0, GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE,
+			_("Opening %d contacts will open %d new windows as "
+			  "well.\nDo you really want to display all of these "
+			  "contacts?"), length, length);
+		gtk_dialog_add_buttons (
+			GTK_DIALOG (dialog),
+			_("_Don't Display"), GTK_RESPONSE_NO,
+			_("Display _All Contacts"), GTK_RESPONSE_YES,
+			NULL);
+		response = gtk_dialog_run (GTK_DIALOG (dialog));
+		gtk_widget_destroy (dialog);
+	}
+
+	if (response == GTK_RESPONSE_YES)
+		for (iter = list; iter != NULL; iter = iter->next)
+			addressbook_view_emit_open_contact (
+				view, iter->data, FALSE);
+
 	g_list_foreach (list, (GFunc) g_object_unref, NULL);
 	g_list_free (list);
 }
 
 void
-e_addressbook_view_send (EAddressbookView *view)
-{
-	GList *list;
-
-	g_return_if_fail (E_IS_ADDRESSBOOK_VIEW (view));
-
-	list = get_selected_contacts (view);
-
-	if (list != NULL) {
-		eab_send_contact_list (list, EAB_DISPOSITION_AS_ATTACHMENT);
-		g_list_foreach (list, (GFunc) g_object_unref, NULL);
-		g_list_free (list);
-	}
-}
-
-void
-e_addressbook_view_send_to (EAddressbookView *view)
-{
-	GList *list;
-
-	g_return_if_fail (E_IS_ADDRESSBOOK_VIEW (view));
-
-	list = get_selected_contacts (view);
-
-	if (list != NULL) {
-		eab_send_contact_list (list, EAB_DISPOSITION_AS_TO);
-		g_list_foreach (list, (GFunc) g_object_unref, NULL);
-		g_list_free (list);
-	}
-}
-
-void
 e_addressbook_view_cut (EAddressbookView *view)
 {
 	g_return_if_fail (E_IS_ADDRESSBOOK_VIEW (view));
@@ -1285,7 +1388,7 @@
 {
 	g_return_if_fail (E_IS_ADDRESSBOOK_VIEW (view));
 
-	view->priv->clipboard_contacts = get_selected_contacts (view);
+	view->priv->clipboard_contacts = e_addressbook_view_get_selected (view);
 
 	gtk_selection_owner_set (
 		view->priv->invisible,
@@ -1346,7 +1449,7 @@
 	        e_book_query_unref(query);
 	}
 	else {
-		contacts = get_selected_contacts (view);
+		contacts = e_addressbook_view_get_selected (view);
 	}
 	parent_window = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (view)));
 

Modified: branches/kill-bonobo/addressbook/gui/widgets/e-addressbook-view.h
==============================================================================
--- branches/kill-bonobo/addressbook/gui/widgets/e-addressbook-view.h	(original)
+++ branches/kill-bonobo/addressbook/gui/widgets/e-addressbook-view.h	Fri Nov 14 03:56:01 2008
@@ -25,6 +25,7 @@
 
 #include <e-shell-view.h>
 #include <libebook/e-book.h>
+#include <libebook/e-contact.h>
 #include <widgets/menus/gal-view-instance.h>
 #include <widgets/misc/e-selection-model.h>
 
@@ -65,6 +66,9 @@
 	GtkVBoxClass parent_class;
 
 	/* Signals */
+	void	(*open_contact)			(EAddressbookView *view,
+						 EContact *contact,
+						 gboolean is_new_contact);
 	void	(*popup_event)			(EAddressbookView *view,
 						 GdkEvent *event);
 	void	(*status_message)		(EAddressbookView *view,
@@ -85,6 +89,7 @@
 						(EAddressbookView *view);
 GtkWidget *	e_addressbook_view_get_view_widget
 						(EAddressbookView *view);
+GList *		e_addressbook_view_get_selected	(EAddressbookView *view);
 ESelectionModel *
 		e_addressbook_view_get_selection_model
 						(EAddressbookView *view);
@@ -94,8 +99,6 @@
 void		e_addressbook_view_save_as	(EAddressbookView *view,
 						 gboolean all);
 void		e_addressbook_view_view		(EAddressbookView *view);
-void		e_addressbook_view_send		(EAddressbookView *view);
-void		e_addressbook_view_send_to	(EAddressbookView *view);
 void		e_addressbook_view_print	(EAddressbookView *view,
 						 GtkPrintOperationAction action);
 void		e_addressbook_view_delete_selection

Modified: branches/kill-bonobo/addressbook/gui/widgets/e-minicard-view-widget.c
==============================================================================
--- branches/kill-bonobo/addressbook/gui/widgets/e-minicard-view-widget.c	(original)
+++ branches/kill-bonobo/addressbook/gui/widgets/e-minicard-view-widget.c	Fri Nov 14 03:56:01 2008
@@ -53,6 +53,8 @@
 };
 
 enum {
+	CREATE_CONTACT,
+	CREATE_CONTACT_LIST,
 	SELECTION_CHANGE,
 	COLUMN_WIDTH_CHANGED,
 	RIGHT_CLICK,
@@ -140,6 +142,24 @@
 							      0.0, G_MAXDOUBLE, 150.0,
 							      G_PARAM_READWRITE));
 
+	signals [CREATE_CONTACT] =
+		g_signal_new ("create-contact",
+			      G_OBJECT_CLASS_TYPE (object_class),
+			      G_SIGNAL_RUN_LAST,
+			      G_STRUCT_OFFSET (EMinicardViewWidgetClass, create_contact),
+			      NULL, NULL,
+			      g_cclosure_marshal_VOID__VOID,
+			      G_TYPE_NONE, 0);
+
+	signals [CREATE_CONTACT_LIST] =
+		g_signal_new ("create-contact-list",
+			      G_OBJECT_CLASS_TYPE (object_class),
+			      G_SIGNAL_RUN_LAST,
+			      G_STRUCT_OFFSET (EMinicardViewWidgetClass, create_contact_list),
+			      NULL, NULL,
+			      g_cclosure_marshal_VOID__VOID,
+			      G_TYPE_NONE, 0);
+
 	signals [SELECTION_CHANGE] =
 		g_signal_new ("selection_change",
 			      G_OBJECT_CLASS_TYPE (object_class),
@@ -315,6 +335,18 @@
 		       signals [COLUMN_WIDTH_CHANGED], 0, width);
 }
 
+static void
+create_contact (EMinicardView *view, EMinicardViewWidget *widget)
+{
+	g_signal_emit (widget, signals[CREATE_CONTACT], 0);
+}
+
+static void
+create_contact_list (EMinicardView *view, EMinicardViewWidget *widget)
+{
+	g_signal_emit (widget, signals[CREATE_CONTACT_LIST], 0);
+}
+
 static guint
 right_click (EMinicardView *view, GdkEvent *event, EMinicardViewWidget *widget)
 {
@@ -370,6 +402,12 @@
 			  "column_width_changed",
 			  G_CALLBACK (column_width_changed), view);
 	g_signal_connect (view->emv,
+			  "create-contact",
+			  G_CALLBACK (create_contact), view);
+	g_signal_connect (view->emv,
+			  "create-contact-list",
+			  G_CALLBACK (create_contact_list), view);
+	g_signal_connect (view->emv,
 			  "right_click",
 			  G_CALLBACK (right_click), view);
 

Modified: branches/kill-bonobo/addressbook/gui/widgets/e-minicard-view-widget.h
==============================================================================
--- branches/kill-bonobo/addressbook/gui/widgets/e-minicard-view-widget.h	(original)
+++ branches/kill-bonobo/addressbook/gui/widgets/e-minicard-view-widget.h	Fri Nov 14 03:56:01 2008
@@ -58,6 +58,8 @@
 struct _EMinicardViewWidgetClass
 {
 	ECanvasClass parent_class;
+	void         (*create_contact)       (EMinicardViewWidget *emvw);
+	void         (*create_contact_list)  (EMinicardViewWidget *emvw);
 	void         (*selection_change)     (EMinicardViewWidget *emvw);
 	void         (*column_width_changed) (EMinicardViewWidget *emvw, double width);
 	guint        (*right_click)          (EMinicardViewWidget *emvw);

Modified: branches/kill-bonobo/addressbook/gui/widgets/e-minicard-view.c
==============================================================================
--- branches/kill-bonobo/addressbook/gui/widgets/e-minicard-view.c	(original)
+++ branches/kill-bonobo/addressbook/gui/widgets/e-minicard-view.c	Fri Nov 14 03:56:01 2008
@@ -56,6 +56,8 @@
 
 
 enum {
+	CREATE_CONTACT,
+	CREATE_CONTACT_LIST,
 	RIGHT_CLICK,
 	LAST_SIGNAL
 };
@@ -383,13 +385,8 @@
 
 			g_object_get(view->adapter, "editable", &editable, NULL);
 
-			if (editable) {
-				EBook *book;
-				g_object_get(view, "book", &book, NULL);
-
-				if (book && E_IS_BOOK (book))
-					eab_show_contact_editor (book, e_contact_new(), TRUE, editable);
-			}
+			if (editable)
+				e_minicard_view_create_contact (view);
 			return TRUE;
 		}
 	case GDK_BUTTON_PRESS:
@@ -547,6 +544,22 @@
 							       FALSE,
 							       G_PARAM_READWRITE));
 
+	signals [CREATE_CONTACT] =
+		g_signal_new ("create-contact",
+			      G_OBJECT_CLASS_TYPE (object_class),
+			      G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+			      0, NULL, NULL,
+			      g_cclosure_marshal_VOID__VOID,
+			      G_TYPE_NONE, 0);
+
+	signals [CREATE_CONTACT_LIST] =
+		g_signal_new ("create-contact-list",
+			      G_OBJECT_CLASS_TYPE (object_class),
+			      G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+			      0, NULL, NULL,
+			      g_cclosure_marshal_VOID__VOID,
+			      G_TYPE_NONE, 0);
+
 	signals [RIGHT_CLICK] =
 		g_signal_new ("right_click",
 			      G_OBJECT_CLASS_TYPE (object_class),
@@ -655,3 +668,19 @@
 	mal.list = g_list_reverse (mal.list);
 	return mal.list;
 }
+
+void
+e_minicard_view_create_contact (EMinicardView *view)
+{
+	g_return_if_fail (E_IS_MINICARD_VIEW (view));
+
+	g_signal_emit (view, signals[CREATE_CONTACT], 0);
+}
+
+void
+e_minicard_view_create_contact_list (EMinicardView *view)
+{
+	g_return_if_fail (E_IS_MINICARD_VIEW (view));
+
+	g_signal_emit (view, signals[CREATE_CONTACT_LIST], 0);
+}

Modified: branches/kill-bonobo/addressbook/gui/widgets/e-minicard-view.h
==============================================================================
--- branches/kill-bonobo/addressbook/gui/widgets/e-minicard-view.h	(original)
+++ branches/kill-bonobo/addressbook/gui/widgets/e-minicard-view.h	Fri Nov 14 03:56:01 2008
@@ -91,6 +91,8 @@
 void     e_minicard_view_jump_to_letter    (EMinicardView *view,
 					    gunichar       letter);
 GList   *e_minicard_view_get_card_list     (EMinicardView *view);
+void     e_minicard_view_create_contact    (EMinicardView *view);
+void     e_minicard_view_create_contact_list (EMinicardView *view);
 
 
 G_END_DECLS

Modified: branches/kill-bonobo/addressbook/gui/widgets/e-minicard.c
==============================================================================
--- branches/kill-bonobo/addressbook/gui/widgets/e-minicard.c	(original)
+++ branches/kill-bonobo/addressbook/gui/widgets/e-minicard.c	Fri Nov 14 03:56:01 2008
@@ -35,7 +35,6 @@
 #include "e-minicard.h"
 #include "e-minicard-label.h"
 #include "e-minicard-view.h"
-#include "e-contact-editor.h"
 #include <e-util/e-html-utils.h>
 #include <e-util/e-icon-factory.h>
 #include <libebook/e-destination.h>
@@ -86,6 +85,7 @@
 enum {
 	SELECTED,
 	DRAG_BEGIN,
+	OPEN_CONTACT,
 	STYLE_SET,
 	LAST_SIGNAL
 };
@@ -101,7 +101,7 @@
 	{ "OTHER", N_ ("Other Email") }
 };
 
-static guint e_minicard_signals [LAST_SIGNAL] = {0, };
+static guint signals [LAST_SIGNAL] = {0, };
 
 GType
 e_minicard_get_type (void)
@@ -200,7 +200,7 @@
 							      E_TYPE_CONTACT,
 							      G_PARAM_READWRITE));
 
-	e_minicard_signals [SELECTED] =
+	signals [SELECTED] =
 		g_signal_new ("selected",
 			      G_OBJECT_CLASS_TYPE (object_class),
 			      G_SIGNAL_RUN_LAST,
@@ -209,7 +209,7 @@
 			      e_marshal_INT__POINTER,
 			      G_TYPE_INT, 1, G_TYPE_POINTER);
 
-	e_minicard_signals [DRAG_BEGIN] =
+	signals [DRAG_BEGIN] =
 		g_signal_new ("drag_begin",
 			      G_OBJECT_CLASS_TYPE (object_class),
 			      G_SIGNAL_RUN_LAST,
@@ -218,7 +218,17 @@
 			      e_marshal_INT__POINTER,
 			      G_TYPE_INT, 1, G_TYPE_POINTER);
 
-	e_minicard_signals [STYLE_SET] =
+	signals [OPEN_CONTACT] =
+		g_signal_new ("open-contact",
+			      G_OBJECT_CLASS_TYPE (object_class),
+			      G_SIGNAL_RUN_LAST,
+			      G_STRUCT_OFFSET (EMinicardClass, open_contact),
+			      NULL, NULL,
+			      g_cclosure_marshal_VOID__OBJECT,
+			      G_TYPE_NONE, 1,
+			      E_TYPE_CONTACT);
+
+	signals [STYLE_SET] =
 		g_signal_new ("style_set",
 			      G_TYPE_FROM_CLASS (object_class),
 			      G_SIGNAL_RUN_FIRST,
@@ -249,8 +259,6 @@
 	minicard->list_icon_pixbuf = e_icon_factory_get_icon (LIST_ICON_NAME, E_ICON_SIZE_MENU);
 	minicard->list_icon_size   = gdk_pixbuf_get_height (minicard->list_icon_pixbuf);
 
-	minicard->editor           = NULL;
-
 	minicard->changed          = FALSE;
 
 	e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(minicard), e_minicard_reflow);
@@ -528,50 +536,12 @@
 		(* GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize) (item);
 }
 
-/* Callback used when the contact editor is closed */
-static void
-editor_closed_cb (GtkObject *editor, gpointer data)
-{
-	EMinicard *minicard = data;
-	g_object_unref (editor);
-	minicard->editor = NULL;
-}
-
-gboolean
-e_minicard_activate_editor(EMinicard *minicard)
+void
+e_minicard_activate_editor (EMinicard *minicard)
 {
-	GnomeCanvasItem *item = (GnomeCanvasItem *)minicard;
-
-	if (minicard->editor) {
-		eab_editor_raise (minicard->editor);
-	}
-	else {
-		EBook *book = NULL;
-		if (E_IS_MINICARD_VIEW(item->parent)) {
-			g_object_get(item->parent, "book", &book, NULL);
-		}
-
-		if (book != NULL) {
-			if (e_contact_get (minicard->contact, E_CONTACT_IS_LIST)) {
-				EContactListEditor *editor = eab_show_contact_list_editor (book, minicard->contact,
-											   FALSE, e_book_is_writable (book));
-				minicard->editor = EAB_EDITOR (editor);
-			}
-			else {
-				EContactEditor *editor = eab_show_contact_editor (book, minicard->contact,
-										  FALSE, e_book_is_writable (book));
-				minicard->editor = EAB_EDITOR (editor);
-			}
-
-			g_object_ref (minicard->editor);
-			g_signal_connect (minicard->editor, "editor_closed",
-							G_CALLBACK (editor_closed_cb), minicard);
-
-			g_object_unref (book);
-		}
-	}
+	g_return_if_fail (E_IS_MINICARD (minicard));
 
-	return TRUE;
+	g_signal_emit (minicard, signals[OPEN_CONTACT], 0, minicard->contact);
 }
 
 static gboolean
@@ -655,7 +625,8 @@
 		break;
 	case GDK_2BUTTON_PRESS:
 		if (event->button.button == 1 && E_IS_MINICARD_VIEW (item->parent)) {
-			return e_minicard_activate_editor (e_minicard);
+			e_minicard_activate_editor (e_minicard);
+			return TRUE;
 		}
 		break;
 	case GDK_KEY_PRESS:
@@ -725,7 +696,8 @@
 		}
 		else if (event->key.keyval == GDK_Return ||
 				event->key.keyval == GDK_KP_Enter) {
-				return e_minicard_activate_editor (e_minicard);
+			e_minicard_activate_editor (e_minicard);
+			return TRUE;
 		}
 		break;
 	default:
@@ -1154,7 +1126,7 @@
 	gint ret_val = 0;
 	GnomeCanvasItem *parent;
 	g_signal_emit (minicard,
-		       e_minicard_signals[DRAG_BEGIN], 0,
+		       signals[DRAG_BEGIN], 0,
 		       event, &ret_val);
 
 	parent = GNOME_CANVAS_ITEM (minicard)->parent;

Modified: branches/kill-bonobo/addressbook/gui/widgets/e-minicard.h
==============================================================================
--- branches/kill-bonobo/addressbook/gui/widgets/e-minicard.h	(original)
+++ branches/kill-bonobo/addressbook/gui/widgets/e-minicard.h	Fri Nov 14 03:56:01 2008
@@ -24,7 +24,6 @@
 #define __E_MINICARD_H__
 
 #include <gtk/gtk.h>
-#include "addressbook/gui/contact-editor/eab-editor.h"
 #include <libgnomecanvas/gnome-canvas.h>
 #include <libebook/e-contact.h>
 
@@ -75,8 +74,6 @@
 	GdkPixbuf *list_icon_pixbuf;
 	double list_icon_size;
 
-	EABEditor *editor;
-
 	GList *fields; /* Of type EMinicardField */
 	guint needs_remodeling : 1;
 
@@ -105,6 +102,7 @@
 
 	gint (* selected) (EMinicard *minicard, GdkEvent *event);
 	gint (* drag_begin) (EMinicard *minicard, GdkEvent *event);
+	void (* open_contact) (EMinicard *minicard, EContact *contact);
 
 	void (* style_set) (EMinicard *minicard, GtkStyle *previous_style);
 };
@@ -125,7 +123,7 @@
 
 int         e_minicard_selected     (EMinicard *minicard,
 				     GdkEvent  *event);
-gboolean    e_minicard_activate_editor	(EMinicard *minicard);
+void        e_minicard_activate_editor	(EMinicard *minicard);
 
 #ifdef __cplusplus
 }

Modified: branches/kill-bonobo/addressbook/gui/widgets/eab-contact-display.c
==============================================================================
--- branches/kill-bonobo/addressbook/gui/widgets/eab-contact-display.c	(original)
+++ branches/kill-bonobo/addressbook/gui/widgets/eab-contact-display.c	Fri Nov 14 03:56:01 2008
@@ -62,6 +62,11 @@
 	PROP_MODE
 };
 
+enum {
+	SEND_MESSAGE,
+	LAST_SIGNAL
+};
+
 static struct {
 	gchar *name;
 	gchar *pretty_name;
@@ -101,6 +106,7 @@
 "</ui>";
 
 static gpointer parent_class;
+static guint signals[LAST_SIGNAL];
 
 static void
 action_copy_address_cb (GtkAction *action,
@@ -169,6 +175,7 @@
 action_send_message_cb (GtkAction *action,
                         EABContactDisplay *display)
 {
+	EDestination *destination;
 	EContact *contact;
 	const gchar *uri;
 	gint row;
@@ -177,8 +184,11 @@
 	row = atoi (uri + strlen ("internal-mailto:";));
 	g_return_if_fail (row >= 0);
 
+	destination = e_destination_new ();
 	contact = eab_contact_display_get_contact (display);
-	eab_send_contact (contact, row, EAB_DISPOSITION_AS_TO);
+	e_destination_set_contact (destination, contact, row);
+	g_signal_emit (display, signals[SEND_MESSAGE], 0, destination);
+	g_object_unref (destination);
 }
 
 static GtkActionEntry email_entries[] = {
@@ -283,12 +293,19 @@
 
 #ifdef HANDLE_MAILTO_INTERNALLY
 	if (!strncmp (url, "internal-mailto:";, strlen ("internal-mailto:";))) {
-		int mail_num = atoi (url + strlen ("internal-mailto:";));
+		EDestination *destination;
+		EContact *contact;
+		gint email_num;
 
-		if (mail_num == -1)
+		email_num = atoi (url + strlen ("internal-mailto:";));
+		if (email_num == -1)
 			return;
 
-		eab_send_contact (display->priv->contact, mail_num, EAB_DISPOSITION_AS_TO);
+		destination = e_destination_new ();
+		contact = eab_contact_display_get_contact (display);
+		e_destination_set_contact (destination, contact, email_num);
+		g_signal_emit (display, signals[SEND_MESSAGE], 0, destination);
+		g_object_unref (destination);
 
 		return;
 	}
@@ -1067,6 +1084,16 @@
 			EAB_CONTACT_DISPLAY_RENDER_COMPACT,
 			EAB_CONTACT_DISPLAY_RENDER_NORMAL,
 			G_PARAM_READWRITE));
+
+	signals[SEND_MESSAGE] = g_signal_new (
+		"send-message",
+		G_OBJECT_CLASS_TYPE (class),
+		G_SIGNAL_RUN_FIRST,
+		G_STRUCT_OFFSET (EABContactDisplayClass, send_message),
+		NULL, NULL,
+		g_cclosure_marshal_VOID__OBJECT,
+		G_TYPE_NONE, 1,
+		E_TYPE_DESTINATION);
 }
 
 static void

Modified: branches/kill-bonobo/addressbook/gui/widgets/eab-contact-display.h
==============================================================================
--- branches/kill-bonobo/addressbook/gui/widgets/eab-contact-display.h	(original)
+++ branches/kill-bonobo/addressbook/gui/widgets/eab-contact-display.h	Fri Nov 14 03:56:01 2008
@@ -25,6 +25,7 @@
 
 #include <gtkhtml/gtkhtml.h>
 #include <libebook/e-contact.h>
+#include <libebook/e-destination.h>
 
 /* Standard GObject macros */
 #define EAB_TYPE_CONTACT_DISPLAY \
@@ -63,6 +64,10 @@
 
 struct _EABContactDisplayClass {
 	GtkHTMLClass parent_class;
+
+	/* Signals */
+	void	(*send_message)			(EABContactDisplay *display,
+						 EDestination *destination);
 };
 
 GType		eab_contact_display_get_type	(void);

Modified: branches/kill-bonobo/addressbook/gui/widgets/eab-gui-util.c
==============================================================================
--- branches/kill-bonobo/addressbook/gui/widgets/eab-gui-util.c	(original)
+++ branches/kill-bonobo/addressbook/gui/widgets/eab-gui-util.c	Fri Nov 14 03:56:01 2008
@@ -40,16 +40,11 @@
 #include "misc/e-image-chooser.h"
 #include <e-util/e-icon-factory.h>
 #include "eab-contact-merging.h"
-#include <composer/e-msg-composer.h>
-#include <mail/em-composer-utils.h>
 
 /* we link to camel for decoding quoted printable email addresses */
 #include <camel/camel-mime-utils.h>
 
-#include "addressbook/gui/contact-editor/eab-editor.h"
-#include "addressbook/gui/contact-editor/e-contact-editor.h"
-#include "addressbook/gui/contact-list-editor/e-contact-list-editor.h"
-#include "addressbook/gui/component/addressbook.h"
+#include "addressbook/util/addressbook.h"
 
 /* the NULL's in this table correspond to the status codes
    that should *never* be generated by a backend */
@@ -201,140 +196,6 @@
 	return e_error_run (parent, "addressbook:prompt-save", NULL);
 }
 
-static void
-added_cb (EBook* book, EBookStatus status, EContact *contact,
-	  gpointer data)
-{
-	gboolean is_list = GPOINTER_TO_INT (data);
-
-	if (status != E_BOOK_ERROR_OK && status != E_BOOK_ERROR_CANCELLED) {
-		eab_error_dialog (is_list ? _("Error adding list") : _("Error adding contact"), status);
-	}
-}
-
-static void
-modified_cb (EBook* book, EBookStatus status, EContact *contact,
-	     gpointer data)
-{
-	gboolean is_list = GPOINTER_TO_INT (data);
-
-	if (status != E_BOOK_ERROR_OK && status != E_BOOK_ERROR_CANCELLED) {
-		eab_error_dialog (is_list ? _("Error modifying list") : _("Error modifying contact"),
-				  status);
-	}
-}
-
-static void
-deleted_cb (EBook* book, EBookStatus status, EContact *contact,
-	    gpointer data)
-{
-	gboolean is_list = GPOINTER_TO_INT (data);
-
-	if (status != E_BOOK_ERROR_OK) {
-		eab_error_dialog (is_list ? _("Error removing list") : _("Error removing contact"),
-				  status);
-	}
-}
-
-static void
-editor_closed_cb (GtkObject *editor, gpointer data)
-{
-	g_object_unref (editor);
-}
-
-EContactEditor *
-eab_show_contact_editor (EBook *book, EContact *contact,
-			 gboolean is_new_contact,
-			 gboolean editable)
-{
-	EContactEditor *ce;
-
-	ce = e_contact_editor_new (book, contact, is_new_contact, editable);
-
-	g_signal_connect (ce, "contact_added",
-			  G_CALLBACK (added_cb), GINT_TO_POINTER (FALSE));
-	g_signal_connect (ce, "contact_modified",
-			  G_CALLBACK (modified_cb), GINT_TO_POINTER (FALSE));
-	g_signal_connect (ce, "contact_deleted",
-			  G_CALLBACK (deleted_cb), GINT_TO_POINTER (FALSE));
-	g_signal_connect (ce, "editor_closed",
-			  G_CALLBACK (editor_closed_cb), NULL);
-
-	return ce;
-}
-
-EContactListEditor *
-eab_show_contact_list_editor (EBook *book, EContact *contact,
-			      gboolean is_new_contact,
-			      gboolean editable)
-{
-	EContactListEditor *ce;
-
-	ce = e_contact_list_editor_new (book, contact, is_new_contact, editable);
-
-	g_signal_connect (ce, "contact_added",
-			  G_CALLBACK (added_cb), GINT_TO_POINTER (TRUE));
-	g_signal_connect (ce, "contact_modified",
-			  G_CALLBACK (modified_cb), GINT_TO_POINTER (TRUE));
-	g_signal_connect (ce, "contact_deleted",
-			  G_CALLBACK (deleted_cb), GINT_TO_POINTER (TRUE));
-	g_signal_connect (ce, "editor_closed",
-			  G_CALLBACK (editor_closed_cb), GINT_TO_POINTER (TRUE));
-
-	eab_editor_show (EAB_EDITOR (ce));
-
-	return ce;
-}
-
-static void
-view_contacts (EBook *book, GList *list, gboolean editable)
-{
-	for (; list; list = list->next) {
-		EContact *contact = list->data;
-		if (e_contact_get (contact, E_CONTACT_IS_LIST))
-			eab_show_contact_list_editor (book, contact, FALSE, editable);
-		else
-			eab_show_contact_editor (book, contact, FALSE, editable);
-	}
-}
-
-void
-eab_show_multiple_contacts (EBook *book,
-			    GList *list,
-			    gboolean editable)
-{
-	if (list) {
-		int length = g_list_length (list);
-		if (length > 5) {
-			GtkWidget *dialog;
-			gint response;
-
-			dialog = gtk_message_dialog_new (NULL,
-							 0,
-							 GTK_MESSAGE_QUESTION,
-							 GTK_BUTTONS_NONE,
-							 ngettext("Opening %d contact will open %d new window as well.\n"
-								  "Do you really want to display this contact?",
-								  "Opening %d contacts will open %d new windows as well.\n"
-								  "Do you really want to display all of these contacts?",
-								  length),
-							 length,
-							 length);
-			gtk_dialog_add_buttons (GTK_DIALOG (dialog),
-						_("_Don't Display"), GTK_RESPONSE_NO,
-						_("Display _All Contacts"), GTK_RESPONSE_YES,
-						NULL);
-			response = gtk_dialog_run (GTK_DIALOG (dialog));
-			gtk_widget_destroy (dialog);
-			if (response == GTK_RESPONSE_YES)
-				view_contacts (book, list, editable);
-		} else {
-			view_contacts (book, list, editable);
-		}
-	}
-}
-
-
 static gint
 file_exists(GtkWindow *window, const char *filename)
 {
@@ -773,232 +634,6 @@
 	addressbook_load (dest, got_book_cb, process);
 }
 
-typedef struct {
-	EContact *contact;
-	int email_num; /* if the contact is a person (not a list), the email address to use */
-} ContactAndEmailNum;
-
-static void
-eab_send_to_contact_and_email_num_list (GList *contact_list)
-{
-	EMsgComposer *composer;
-	EComposerHeaderTable *table;
-	GPtrArray *to_array;
-	GPtrArray *bcc_array;
-
-	union {
-		gpointer *pdata;
-		EDestination **destinations;
-	} convert;
-
-	if (contact_list == NULL)
-		return;
-
-	composer = e_msg_composer_new ();
-	table = e_msg_composer_get_header_table (composer);
-	em_composer_utils_setup_default_callbacks (composer);
-
-	to_array = g_ptr_array_new ();
-	bcc_array = g_ptr_array_new ();
-
-	/* Sort contacts into "To" and "Bcc" destinations. */
-	while (contact_list != NULL) {
-		ContactAndEmailNum *ce = contact_list->data;
-		EContact *contact = ce->contact;
-		EDestination *destination;
-
-		destination = e_destination_new ();
-		e_destination_set_contact (destination, contact, 0);
-
-		if (e_destination_is_evolution_list (destination)) {
-			if (e_destination_list_show_addresses (destination))
-				g_ptr_array_add (to_array, destination);
-			else
-				g_ptr_array_add (bcc_array, destination);
-		} else
-			g_ptr_array_add (to_array, destination);
-
-		contact_list = g_list_next (contact_list);
-	}
-
-	/* Add sentinels to each array. */
-	g_ptr_array_add (to_array, NULL);
-	g_ptr_array_add (bcc_array, NULL);
-
-	/* XXX Acrobatics like this make me question whether NULL-terminated
-	 *     arrays are really the best argument type for passing a list of
-	 *     destinations to the header table. */
-
-	/* Add "To" destinations. */
-	convert.pdata = to_array->pdata;
-	e_composer_header_table_set_destinations_to (
-		table, convert.destinations);
-	g_ptr_array_free (to_array, FALSE);
-	e_destination_freev (convert.destinations);
-
-	/* Add "Bcc" destinations. */
-	convert.pdata = bcc_array->pdata;
-	e_composer_header_table_set_destinations_bcc (
-		table, convert.destinations);
-	g_ptr_array_free (bcc_array, FALSE);
-	e_destination_freev (convert.destinations);
-
-	gtk_widget_show (GTK_WIDGET (composer));
-}
-
-static const char *
-get_email (EContact *contact, EContactField field_id, gchar **to_free)
-{
-	char *name = NULL, *mail = NULL;
-	const char *value = e_contact_get_const (contact, field_id);
-
-	*to_free = NULL;
-
-	if (eab_parse_qp_email (value, &name, &mail)) {
-		*to_free = g_strdup_printf ("%s <%s>", name, mail);
-		value = *to_free;
-	}
-
-	g_free (name);
-	g_free (mail);
-
-	return value;
-}
-
-static void
-eab_send_contact_list_as_attachment (GList *contacts)
-{
-	EMsgComposer *composer;
-	EComposerHeaderTable *table;
-	CamelMimePart *attachment;
-	gchar *data;
-
-	if (contacts == NULL)
-		return;
-
-	composer = e_msg_composer_new ();
-	table = e_msg_composer_get_header_table (composer);
-	em_composer_utils_setup_default_callbacks (composer);
-
-	attachment = camel_mime_part_new ();
-	data = eab_contact_list_to_string (contacts);
-
-	camel_mime_part_set_content (
-		attachment, data, strlen (data), "text/x-vcard");
-
-	if (contacts->next != NULL)
-		camel_mime_part_set_description (
-			attachment, _("Multiple vCards"));
-	else {
-		EContact *contact = contacts->data;
-		const gchar *file_as;
-		gchar *description;
-
-		file_as = e_contact_get_const (contact, E_CONTACT_FILE_AS);
-		description = g_strdup_printf (_("vCard for %s"), file_as);
-		camel_mime_part_set_description (attachment, description);
-		g_free (description);
-	}
-
-	camel_mime_part_set_disposition (attachment, "attachment");
-
-	e_msg_composer_attach (composer, attachment);
-	camel_object_unref (attachment);
-
-	if (contacts->next != NULL)
-		e_composer_header_table_set_subject (
-			table, _("Contact information"));
-	else {
-		EContact *contact = contacts->data;
-		gchar *tempstr;
-		const gchar *tempstr2;
-		gchar *tempfree = NULL;
-
-		tempstr2 = e_contact_get_const (contact, E_CONTACT_FILE_AS);
-		if (!tempstr2 || !*tempstr2)
-			tempstr2 = e_contact_get_const (contact, E_CONTACT_FULL_NAME);
-		if (!tempstr2 || !*tempstr2)
-			tempstr2 = e_contact_get_const (contact, E_CONTACT_ORG);
-		if (!tempstr2 || !*tempstr2) {
-			g_free (tempfree);
-			tempstr2 = get_email (contact, E_CONTACT_EMAIL_1, &tempfree);
-		}
-		if (!tempstr2 || !*tempstr2) {
-			g_free (tempfree);
-			tempstr2 = get_email (contact, E_CONTACT_EMAIL_2, &tempfree);
-		}
-		if (!tempstr2 || !*tempstr2) {
-			g_free (tempfree);
-			tempstr2 = get_email (contact, E_CONTACT_EMAIL_3, &tempfree);
-		}
-
-		if (!tempstr2 || !*tempstr2)
-			tempstr = g_strdup_printf (_("Contact information"));
-		else
-			tempstr = g_strdup_printf (_("Contact information for %s"), tempstr2);
-
-		e_composer_header_table_set_subject (table, tempstr);
-
-		g_free (tempstr);
-		g_free (tempfree);
-	}
-
-	gtk_widget_show (GTK_WIDGET (composer));
-}
-
-void
-eab_send_contact_list (GList *contacts, EABDisposition disposition)
-{
-	switch (disposition) {
-	case EAB_DISPOSITION_AS_TO: {
-		GList *list = NULL, *l;
-
-		for (l = contacts; l; l = l->next) {
-			ContactAndEmailNum *ce = g_new (ContactAndEmailNum, 1);
-			ce->contact = l->data;
-			ce->email_num = 0; /* hardcode this */
-
-			list = g_list_append (list, ce);
-		}
-
-		eab_send_to_contact_and_email_num_list (list);
-
-		g_list_foreach (list, (GFunc)g_free, NULL);
-		g_list_free (list);
-		break;
-	}
-	case EAB_DISPOSITION_AS_ATTACHMENT:
-		eab_send_contact_list_as_attachment (contacts);
-		break;
-	}
-}
-
-void
-eab_send_contact (EContact *contact, int email_num, EABDisposition disposition)
-{
-	GList *list = NULL;
-
-	switch (disposition) {
-	case EAB_DISPOSITION_AS_TO: {
-		ContactAndEmailNum ce;
-
-		ce.contact = contact;
-		ce.email_num = email_num;
-
-		list = g_list_prepend (NULL, &ce);
-		eab_send_to_contact_and_email_num_list (list);
-		break;
-	}
-	case EAB_DISPOSITION_AS_ATTACHMENT: {
-		list = g_list_prepend (NULL, contact);
-		eab_send_contact_list_as_attachment (list);
-		break;
-	}
-	}
-
-	g_list_free (list);
-}
-
 GtkWidget *
 eab_create_image_chooser_widget(gchar *name,
 				gchar *string1, gchar *string2,

Modified: branches/kill-bonobo/addressbook/gui/widgets/eab-gui-util.h
==============================================================================
--- branches/kill-bonobo/addressbook/gui/widgets/eab-gui-util.h	(original)
+++ branches/kill-bonobo/addressbook/gui/widgets/eab-gui-util.h	Fri Nov 14 03:56:01 2008
@@ -26,8 +26,6 @@
 
 #include <gtk/gtk.h>
 #include <libebook/e-book.h>
-#include "addressbook/gui/contact-editor/e-contact-editor.h"
-#include "addressbook/gui/contact-list-editor/e-contact-list-editor.h"
 
 G_BEGIN_DECLS
 
@@ -40,17 +38,6 @@
 						   EBookViewStatus status);
 gint                eab_prompt_save_dialog        (GtkWindow   *parent);
 
-EContactEditor     *eab_show_contact_editor       (EBook       *book,
-						   EContact    *contact,
-						   gboolean     is_new_contact,
-						   gboolean     editable);
-EContactListEditor *eab_show_contact_list_editor  (EBook       *book,
-						   EContact    *contact,
-						   gboolean     is_new_contact,
-						   gboolean     editable);
-void                eab_show_multiple_contacts    (EBook       *book,
-						   GList       *list,
-						   gboolean     editable);
 void                eab_transfer_contacts         (EBook       *source,
 						   GList       *contacts, /* adopted */
 						   gboolean     delete_from_source,
@@ -64,26 +51,17 @@
 						   GList *list,
 						   GtkWindow *parent_window);
 
-typedef enum {
-	EAB_DISPOSITION_AS_ATTACHMENT,
-	EAB_DISPOSITION_AS_TO,
-} EABDisposition;
-
-void                eab_send_contact              (EContact       *contact,
-						   int             email_num,
-						   EABDisposition  disposition);
-void                eab_send_contact_list         (GList          *contacts,
-						   EABDisposition  disposition);
-
 GtkWidget *eab_create_image_chooser_widget (gchar *name, gchar *string1, gchar *string2, gint int1, gint int2);
 
 
 ESource            *eab_select_source             (const gchar *title, const gchar *message,
 						   const gchar *select_uid, GtkWindow *parent);
 
-/* To parse quoted printable address & return email & name fields */						
-gboolean eab_parse_qp_email (const gchar *string, gchar **name, gchar **email);
-char *eab_parse_qp_email_to_html (const gchar *string);
+/* To parse quoted printable address & return email & name fields */
+gboolean	eab_parse_qp_email		(const gchar *string,
+						 gchar **name,
+						 gchar **email);
+gchar *		eab_parse_qp_email_to_html	(const gchar *string);
 
 G_END_DECLS
 

Modified: branches/kill-bonobo/addressbook/util/Makefile.am
==============================================================================
--- branches/kill-bonobo/addressbook/util/Makefile.am	(original)
+++ branches/kill-bonobo/addressbook/util/Makefile.am	Fri Nov 14 03:56:01 2008
@@ -13,6 +13,8 @@
 privsolib_LTLIBRARIES = libeabutil.la
 
 libeabutil_la_SOURCES =					\
+	addressbook.c					\
+	addressbook.h					\
 	eab-book-util.c					\
 	eab-book-util.h
 

Modified: branches/kill-bonobo/addressbook/util/eab-book-util.h
==============================================================================
--- branches/kill-bonobo/addressbook/util/eab-book-util.h	(original)
+++ branches/kill-bonobo/addressbook/util/eab-book-util.h	Fri Nov 14 03:56:01 2008
@@ -24,8 +24,6 @@
 #ifndef __EAB_UTIL_H__
 #define __EAB_UTIL_H__
 
-#include <bonobo/bonobo-object.h>
-#include <bonobo/bonobo-moniker-util.h>
 #include <libebook/e-book.h>
 #include "e-util/e-config-listener.h"
 

Modified: branches/kill-bonobo/composer/Makefile.am
==============================================================================
--- branches/kill-bonobo/composer/Makefile.am	(original)
+++ branches/kill-bonobo/composer/Makefile.am	Fri Nov 14 03:56:01 2008
@@ -47,7 +47,7 @@
 	e-msg-composer.c			\
 	e-msg-composer.h
 
-libcomposer_la_LIBADD =						\
+libcomposer_la_LIBADD =							\
 	$(top_builddir)/widgets/misc/libemiscwidgets.la
 
 uidir = $(evolutionuidir)

Modified: branches/kill-bonobo/composer/e-msg-composer.c
==============================================================================
--- branches/kill-bonobo/composer/e-msg-composer.c	(original)
+++ branches/kill-bonobo/composer/e-msg-composer.c	Fri Nov 14 03:56:01 2008
@@ -69,8 +69,8 @@
 #include "e-util/e-util.h"
 #include <mail/em-event.h>
 #include "e-signature-combo-box.h"
+#include "shell/e-shell.h"
 
-#include <camel/camel-session.h>
 #include <camel/camel-charset-map.h>
 #include <camel/camel-iconv.h>
 #include <camel/camel-stream-filter.h>
@@ -94,7 +94,6 @@
 #include "mail/mail-crypto.h"
 #include "mail/mail-mt.h"
 #include "mail/mail-ops.h"
-#include "mail/mail-session.h"
 #include "mail/mail-tools.h"
 
 #include "e-msg-composer.h"
@@ -875,7 +874,9 @@
 
 		if (smime_sign) {
 			CamelMimePart *npart = camel_mime_part_new ();
+			CamelSession *session;
 
+			session = e_msg_composer_get_session (composer);
 			cipher = camel_smime_context_new (session);
 
 			/* if we're also encrypting, envelope-sign rather than clear-sign */
@@ -899,10 +900,13 @@
 		}
 
 		if (smime_encrypt) {
+			CamelSession *session;
+
 			/* check to see if we should encrypt to self, NB removed after use */
 			if (account->smime_encrypt_to_self)
 				g_ptr_array_add (recipients, g_strdup (account->smime_encrypt_key));
 
+			session = e_msg_composer_get_session (composer);
 			cipher = camel_smime_context_new (session);
 			camel_smime_context_set_encrypt_key ((CamelSMIMEContext *)cipher, TRUE, account->smime_encrypt_key);
 
@@ -2932,6 +2936,7 @@
 
 /**
  * e_msg_composer_new_with_type:
+ * @type: the type of composer to create
  *
  * Create a new message composer widget. The type can be
  * E_MSG_COMPOSER_MAIL, E_MSG_COMPOSER_POST or E_MSG_COMPOSER_MAIL_POST.
@@ -2940,7 +2945,7 @@
  **/
 
 EMsgComposer *
-e_msg_composer_new_with_type (int type)
+e_msg_composer_new_with_type (gint type)
 {
 	EMsgComposer *composer;
 	gint visible_mask;
@@ -3750,6 +3755,32 @@
 }
 
 /**
+ * e_msg_composer_get_session:
+ * @composer: an #EMsgComposer
+ *
+ * Returns the mail module's global #CamelSession instance.  Calling
+ * this function will load the mail module if it isn't already loaded.
+ *
+ * Returns: the mail module's #CamelSession
+ **/
+CamelSession *
+e_msg_composer_get_session (EMsgComposer *composer)
+{
+	EShellModule *shell_module;
+	CamelSession *session;
+	EShell *shell;
+
+	g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), NULL);
+
+	shell = e_shell_get_default ();
+	shell_module = e_shell_get_module_by_name (shell, "mail");
+	session = g_object_get_data (G_OBJECT (shell_module), "session");
+	g_return_val_if_fail (CAMEL_IS_SESSION (session), NULL);
+
+	return session;
+}
+
+/**
  * e_msg_composer_send:
  * @composer: an #EMsgComposer
  *

Modified: branches/kill-bonobo/composer/e-msg-composer.h
==============================================================================
--- branches/kill-bonobo/composer/e-msg-composer.h	(original)
+++ branches/kill-bonobo/composer/e-msg-composer.h	Fri Nov 14 03:56:01 2008
@@ -25,6 +25,7 @@
 
 #include <camel/camel-internet-address.h>
 #include <camel/camel-mime-message.h>
+#include <camel/camel-session.h>
 #include <libedataserver/e-account.h>
 #include <libebook/e-destination.h>
 #include <gtkhtml-editor.h>
@@ -78,6 +79,7 @@
 EMsgComposer *	e_msg_composer_new_from_url	(const gchar *url);
 EMsgComposer *	e_msg_composer_new_redirect	(CamelMimeMessage *message,
 						 const gchar *resent_from);
+CamelSession *	e_msg_composer_get_session	(EMsgComposer *composer);
 
 void		e_msg_composer_send		(EMsgComposer *composer);
 void		e_msg_composer_save_draft	(EMsgComposer *composer);
@@ -155,7 +157,7 @@
 		e_msg_composer_get_attachment_bar
 						(EMsgComposer *composer);
 
-gboolean	e_msg_composer_is_exiting (EMsgComposer *composer);
+gboolean	e_msg_composer_is_exiting	(EMsgComposer *composer);
 
 G_END_DECLS
 

Modified: branches/kill-bonobo/doc/reference/shell/tmpl/e-shell.sgml
==============================================================================
--- branches/kill-bonobo/doc/reference/shell/tmpl/e-shell.sgml	(original)
+++ branches/kill-bonobo/doc/reference/shell/tmpl/e-shell.sgml	Fri Nov 14 03:56:01 2008
@@ -29,6 +29,7 @@
 </para>
 
 @eshell: the object which received the signal.
+ Param2: 
 
 <!-- ##### SIGNAL EShell::handle-uri ##### -->
 <para>
@@ -78,15 +79,6 @@
 @E_SHELL_LINE_STATUS_OFFLINE: 
 @E_SHELL_LINE_STATUS_FORCED_OFFLINE: 
 
-<!-- ##### FUNCTION e_shell_new ##### -->
-<para>
-
-</para>
-
- online: 
- Returns: 
-
-
 <!-- ##### FUNCTION e_shell_list_modules ##### -->
 <para>
 

Modified: branches/kill-bonobo/doc/reference/shell/tmpl/eshell-unused.sgml
==============================================================================
--- branches/kill-bonobo/doc/reference/shell/tmpl/eshell-unused.sgml	(original)
+++ branches/kill-bonobo/doc/reference/shell/tmpl/eshell-unused.sgml	Fri Nov 14 03:56:01 2008
@@ -1964,6 +1964,14 @@
 @error: 
 @Returns: 
 
+<!-- ##### FUNCTION e_shell_new ##### -->
+<para>
+
+</para>
+
+ online: 
+ Returns: 
+
 <!-- ##### FUNCTION e_shell_sidebar_get_primary_text ##### -->
 <para>
 

Modified: branches/kill-bonobo/mail/Makefile.am
==============================================================================
--- branches/kill-bonobo/mail/Makefile.am	(original)
+++ branches/kill-bonobo/mail/Makefile.am	Fri Nov 14 03:56:01 2008
@@ -161,8 +161,10 @@
 	$(top_builddir)/widgets/table/libetable.la	\
 	$(top_builddir)/widgets/text/libetext.la	\
 	$(top_builddir)/widgets/misc/libemiscwidgets.la	\
+	$(top_builddir)/mail/importers/libevolution-mail-importers.la \
 	$(top_builddir)/addressbook/gui/contact-editor/libecontacteditor.la \
-	$(top_builddir)/mail/importers/libevolution-mail-importers.la
+	$(top_builddir)/addressbook/gui/contact-list-editor/libecontactlisteditor.la \
+	$(SMIME_LIBS)
 
 # plugin mail api
 #mailinclude_HEADERS =				\

Modified: branches/kill-bonobo/mail/e-mail-shell-module.c
==============================================================================
--- branches/kill-bonobo/mail/e-mail-shell-module.c	(original)
+++ branches/kill-bonobo/mail/e-mail-shell-module.c	Fri Nov 14 03:56:01 2008
@@ -459,21 +459,30 @@
 }
 
 static gboolean
-mail_shell_module_handle_uri (EShellModule *shell_module,
-                              const gchar *uri)
+mail_shell_module_handle_uri_cb (EShell *shell,
+                                 const gchar *uri,
+                                 EShellModule *shell_module)
 {
 	/* FIXME */
 	return FALSE;
 }
 
 static void
-mail_shell_module_window_created (EShellModule *shell_module,
-                                  EShellWindow *shell_window)
+mail_shell_module_window_weak_notify_cb (EShell *shell,
+                                         GObject *where_the_object_was)
+{
+	g_signal_handlers_disconnect_by_func (
+		shell, mail_shell_module_new_mail_cb,
+		where_the_object_was);
+}
+
+static void
+mail_shell_module_window_created_cb (EShell *shell,
+                                     EShellWindow *shell_window,
+                                     EShellModule *shell_module)
 {
-	EShell *shell;
 	const gchar *module_name;
 
-	shell = e_shell_module_get_shell (shell_module);
 	module_name = G_TYPE_MODULE (shell_module)->name;
 
 	e_shell_window_register_new_item_actions (
@@ -487,6 +496,10 @@
 	g_signal_connect_swapped (
 		shell, "event::new-mail",
 		G_CALLBACK (mail_shell_module_new_mail_cb), shell_window);
+
+	g_object_weak_ref (
+		G_OBJECT (shell_window), (GWeakNotify)
+		mail_shell_module_window_weak_notify_cb, shell);
 }
 
 static EShellModuleInfo module_info = {
@@ -532,13 +545,15 @@
 
 	folder_tree_model = em_folder_tree_model_new (shell_module);
 
-	g_signal_connect_swapped (
+	g_signal_connect (
 		shell, "handle-uri",
-		G_CALLBACK (mail_shell_module_handle_uri), shell_module);
+		G_CALLBACK (mail_shell_module_handle_uri_cb),
+		shell_module);
 
-	g_signal_connect_swapped (
+	g_signal_connect (
 		shell, "window-created",
-		G_CALLBACK (mail_shell_module_window_created), shell_module);
+		G_CALLBACK (mail_shell_module_window_created_cb),
+		shell_module);
 
 	mail_config_init ();
 	mail_msg_init ();

Modified: branches/kill-bonobo/mail/mail-folder-cache.c
==============================================================================
--- branches/kill-bonobo/mail/mail-folder-cache.c	(original)
+++ branches/kill-bonobo/mail/mail-folder-cache.c	Fri Nov 14 03:56:01 2008
@@ -198,7 +198,7 @@
 			t->name = em_folder_tree_model_get_folder_name (model, up->store, up->full_name);
 
 			if (t->new > 0)
-				e_shell_event (shell, "new-mail");
+				e_shell_event (shell, "new-mail", NULL);
 
 			/** @Event: folder.changed
 			 * @Title: Folder changed

Modified: branches/kill-bonobo/shell/e-shell-window-actions.c
==============================================================================
--- branches/kill-bonobo/shell/e-shell-window-actions.c	(original)
+++ branches/kill-bonobo/shell/e-shell-window-actions.c	Fri Nov 14 03:56:01 2008
@@ -1781,7 +1781,6 @@
 {
 	const gchar *current_view;
 	GList *match_list = NULL;
-	GList *primary = NULL;
 	GList *iter;
 
 	/* Pick out the actions from the source list that are tagged

Modified: branches/kill-bonobo/shell/e-shell.c
==============================================================================
--- branches/kill-bonobo/shell/e-shell.c	(original)
+++ branches/kill-bonobo/shell/e-shell.c	Fri Nov 14 03:56:01 2008
@@ -62,6 +62,7 @@
 	LAST_SIGNAL
 };
 
+EShell *default_shell = NULL;
 static gpointer parent_class;
 static guint signals[LAST_SIGNAL];
 
@@ -362,8 +363,9 @@
 		G_OBJECT_CLASS_TYPE (object_class),
 		G_SIGNAL_RUN_FIRST | G_SIGNAL_DETAILED | G_SIGNAL_ACTION,
 		0, NULL, NULL,
-		g_cclosure_marshal_VOID__VOID,
-		G_TYPE_NONE, 0);
+		g_cclosure_marshal_VOID__POINTER,
+		G_TYPE_NONE, 1,
+		G_TYPE_POINTER);
 
 	signals[HANDLE_URI] = g_signal_new (
 		"handle-uri",
@@ -451,9 +453,12 @@
 }
 
 EShell *
-e_shell_new (gboolean online_mode)
+e_shell_get_default (void)
 {
-	return g_object_new (E_TYPE_SHELL, "online-mode", online_mode, NULL);
+	/* Emit a warning if we call this too early. */
+	g_return_val_if_fail (default_shell != NULL, NULL);
+
+	return default_shell;
 }
 
 GList *
@@ -626,7 +631,8 @@
 
 void
 e_shell_event (EShell *shell,
-               const gchar *event_name)
+               const gchar *event_name,
+               gpointer event_data)
 {
 	GQuark detail;
 
@@ -634,7 +640,7 @@
 	g_return_if_fail (event_name != NULL);
 
 	detail = g_quark_from_string (event_name);
-	g_signal_emit (shell, signals[EVENT], detail);
+	g_signal_emit (shell, signals[EVENT], detail, event_data);
 }
 
 gboolean

Modified: branches/kill-bonobo/shell/e-shell.h
==============================================================================
--- branches/kill-bonobo/shell/e-shell.h	(original)
+++ branches/kill-bonobo/shell/e-shell.h	Fri Nov 14 03:56:01 2008
@@ -81,7 +81,7 @@
 };
 
 GType		e_shell_get_type		(void);
-EShell *	e_shell_new			(gboolean online);
+EShell *	e_shell_get_default		(void);
 GList *		e_shell_list_modules		(EShell *shell);
 const gchar *	e_shell_get_canonical_name	(EShell *shell,
 						 const gchar *name);
@@ -104,7 +104,8 @@
                                                  EShellLineStatus status);
 GtkWidget *	e_shell_get_preferences_window	(void);
 void		e_shell_event			(EShell *shell,
-						 const gchar *event_name);
+						 const gchar *event_name,
+						 gpointer event_data);
 gboolean	e_shell_is_busy			(EShell *shell);
 gboolean	e_shell_do_quit			(EShell *shell);
 gboolean	e_shell_quit			(EShell *shell);

Modified: branches/kill-bonobo/shell/main.c
==============================================================================
--- branches/kill-bonobo/shell/main.c	(original)
+++ branches/kill-bonobo/shell/main.c	Fri Nov 14 03:56:01 2008
@@ -96,11 +96,13 @@
 static gboolean disable_preview = FALSE;
 static gboolean idle_cb (gchar **uris);
 
-static EShell *global_shell;
 static char *requested_view = NULL;
 static char *evolution_debug_log = NULL;
 static gchar **remaining_args;
 
+/* Defined in <e-shell.h> */
+extern EShell *default_shell;
+
 #ifdef KILL_PROCESS_CMD
 
 static void
@@ -265,12 +267,15 @@
 static void
 open_uris (gchar **uris)
 {
+	EShell *shell;
 	guint ii;
 
 	g_return_if_fail (uris != NULL);
 
+	shell = e_shell_get_default ();
+
 	for (ii = 0; uris[ii] != NULL; ii++)
-		if (!e_shell_handle_uri (global_shell, uris[ii]))
+		if (!e_shell_handle_uri (shell, uris[ii]))
 			g_warning ("Invalid URI: %s", uris[ii]);
 }
 
@@ -279,6 +284,7 @@
 static gboolean
 idle_cb (gchar **uris)
 {
+	EShell *shell;
 	GtkWidget *shell_window;
 	const gchar *initial_view;
 
@@ -293,8 +299,8 @@
 		return FALSE;
 	}
 
-	initial_view = e_shell_get_canonical_name (
-		global_shell, requested_view);
+	shell = e_shell_get_default ();
+	initial_view = e_shell_get_canonical_name (shell, requested_view);
 
 	if (initial_view != NULL) {
 		GConfClient *client;
@@ -306,7 +312,7 @@
 		g_object_unref (client);
 	}
 
-	shell_window = e_shell_create_window (global_shell);
+	shell_window = e_shell_create_window (shell);
 
 #if 0  /* MBARNES */
 	if (shell == NULL) {
@@ -481,7 +487,7 @@
 }
 
 static void
-create_shell (void)
+create_default_shell (void)
 {
 	EShell *shell;
 	GConfClient *conf_client;
@@ -510,7 +516,7 @@
 		}
 	}
 
-	shell = e_shell_new (online_mode);
+	shell = g_object_new (E_TYPE_SHELL, "online-mode", online_mode, NULL);
 
 	g_signal_connect (
 		shell, "window-destroyed",
@@ -526,7 +532,7 @@
 
 	g_object_unref (conf_client);
 
-	global_shell = shell;
+	default_shell = shell;
 }
 
 int
@@ -662,7 +668,7 @@
 
 	g_object_unref (client);
 
-	create_shell ();
+	create_default_shell ();
 
 	gtk_main ();
 

Modified: branches/kill-bonobo/ui/evolution-shell.ui
==============================================================================
--- branches/kill-bonobo/ui/evolution-shell.ui	(original)
+++ branches/kill-bonobo/ui/evolution-shell.ui	Fri Nov 14 03:56:01 2008
@@ -38,17 +38,17 @@
       <menu action='window-menu'/>
       <menu action='layout-menu'>
         <menuitem action='show-toolbar'/>
-	<menuitem action='show-statusbar'/>
-	<menuitem action='show-sidebar'/>
+        <menuitem action='show-statusbar'/>
+        <menuitem action='show-sidebar'/>
       </menu>
       <placeholder name='view-custom-menus'/>
       <menu action='switcher-menu'>
         <menuitem action='switcher-style-both'/>
-	<menuitem action='switcher-style-icons'/>
-	<menuitem action='switcher-style-text'/>
-	<menuitem action='switcher-style-user'/>
-	<separator/>
-	<menuitem action='show-switcher'/>
+        <menuitem action='switcher-style-icons'/>
+        <menuitem action='switcher-style-text'/>
+        <menuitem action='switcher-style-user'/>
+        <separator/>
+        <menuitem action='show-switcher'/>
       </menu>
     </menu>
     <placeholder name='custom-menus'/>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]