Index: shell/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/shell/ChangeLog,v
retrieving revision 1.1459
diff -u -3 -r1.1459 ChangeLog
--- shell/ChangeLog	24 Jun 2004 08:14:51 -0000	1.1459
+++ shell/ChangeLog	25 Jun 2004 11:55:00 -0000
@@ -1,3 +1,28 @@
+2004-06-25  Not Zed  <NotZed@Ximian.com>
+
+	** See bug #60354.
+
+	* Evolution-Component.idl: createControls -> createView and
+	ComponentView to keep track of things.
+
+	* Evolution-Shell.idl: return a new type ShellView from
+	createNewWindow so other parts of the system can access it later.
+	ShellView so far just lets you set title or switch component, but
+	could be subclassed later.
+
+	* e-shell.c (impl_Shell_createNewWindow): return a shell view.
+
+	* e-shell-window.c (init_view): create the view from the compnent
+	first, then get the controls from it separately.
+	(init): setup the e-shell-view object for the create view
+	thing.
+
+	* e-shell-view.c (e_shell_view_new): simple bonobo object for
+	Evolution_ShellView, keep track of the EShellWindow.
+
+	* e-component-view.[ch]: simple bonobo object for
+	Evolution_ComponentView.  Just keep track of the controls.
+
 2004-06-24  Not Zed  <NotZed@Ximian.com>
 
 	** See bug #57367.
Index: shell/Evolution-Component.idl
===================================================================
RCS file: /cvs/gnome/evolution/shell/Evolution-Component.idl,v
retrieving revision 1.15
diff -u -3 -r1.15 Evolution-Component.idl
--- shell/Evolution-Component.idl	12 May 2004 03:33:51 -0000	1.15
+++ shell/Evolution-Component.idl	25 Jun 2004 11:55:00 -0000
@@ -30,6 +30,12 @@
 	};
 	typedef sequence <CreatableItemType> CreatableItemTypeList;
 
+	interface ComponentView : Bonobo::Unknown {
+		void getControls (out Bonobo::Control sidebar_control,
+				  out Bonobo::Control view_control,
+				  out Bonobo::Control statusbar_control);
+	};
+
 	interface Component : Bonobo::Unknown {
 		exception Failed {};
 		exception UnknownType {};
@@ -48,11 +54,15 @@
 
 		/*** Basic functionality.  ***/
 
+		ComponentView createView(in ShellView parent)
+			raises (Failed);
+
+
 		/* Create the controls for embedding in the shell.  */
-		void createControls (out Bonobo::Control sidebar_control,
+		/*void createControls (out Bonobo::Control sidebar_control,
 				     out Bonobo::Control view_control,
 				     out Bonobo::Control statusbar_control)
-			raises (Failed);
+				     raises (Failed);*/
 
 		/* Check if the component can quit.
 		   Do not perform any quit-related tasks however.
Index: shell/Evolution-Shell.idl
===================================================================
RCS file: /cvs/gnome/evolution/shell/Evolution-Shell.idl,v
retrieving revision 1.25
diff -u -3 -r1.25 Evolution-Shell.idl
--- shell/Evolution-Shell.idl	11 Nov 2003 01:01:11 -0000	1.25
+++ shell/Evolution-Shell.idl	25 Jun 2004 11:55:00 -0000
@@ -12,6 +12,12 @@
 
 module GNOME {
 module Evolution {
+
+	interface ShellView : Bonobo::Unknown {
+		void setTitle(in string title);
+		void setComponent(in string component);
+	};
+
 	interface Shell : Bonobo::Unknown {
 		exception Busy {};
 		exception ComponentNotFound {};
@@ -26,7 +32,7 @@
 		 * @component_id: id or alias of the component to display in the new window.
 		 *
 		 */
-		void createNewWindow (in string component_id)
+		ShellView createNewWindow (in string component_id)
 			raises (NotReady, ComponentNotFound, UnsupportedSchema, InternalError);
 
 		/**
Index: shell/Evolution.idl
===================================================================
RCS file: /cvs/gnome/evolution/shell/Evolution.idl,v
retrieving revision 1.22
diff -u -3 -r1.22 Evolution.idl
--- shell/Evolution.idl	3 Dec 2003 17:59:27 -0000	1.22
+++ shell/Evolution.idl	25 Jun 2004 11:55:00 -0000
@@ -12,8 +12,8 @@
 
 #include <Evolution-common.idl>
 
-#include <Evolution-Component.idl>
 #include <Evolution-ConfigControl.idl>
 #include <Evolution-Offline.idl>
 #include <Evolution-Shell.idl>
+#include <Evolution-Component.idl>
 #include <Evolution-Wizard.idl>
Index: shell/Makefile.am
===================================================================
RCS file: /cvs/gnome/evolution/shell/Makefile.am,v
retrieving revision 1.199
diff -u -3 -r1.199 Makefile.am
--- shell/Makefile.am	10 Jun 2004 16:30:14 -0000	1.199
+++ shell/Makefile.am	25 Jun 2004 11:55:00 -0000
@@ -79,6 +79,7 @@
 
 eshellinclude_HEADERS = 			\
 	Evolution.h				\
+	e-component-view.h			\
 	e-shell-corba-icon-utils.h		\
 	e-shell-utils.h				\
 	e-user-creatable-items-handler.h	\
@@ -89,6 +90,7 @@
 libeshell_la_SOURCES = 				\
 	$(IDL_GENERATED)			\
 	$(MARSHAL_GENERATED)			\
+	e-component-view.c			\
 	e-shell-corba-icon-utils.c		\
 	e-shell-utils.c				\
 	e-user-creatable-items-handler.c	\
@@ -113,6 +115,8 @@
 	e-corba-config-page.h			\
 	e-history.c				\
 	e-history.h				\
+	e-shell.c				\
+	e-shell.h				\
 	e-shell-constants.h			\
 	e-shell-folder-title-bar.c		\
 	e-shell-folder-title-bar.h		\
@@ -128,8 +132,8 @@
 	e-shell-window-commands.h		\
 	e-shell-window.c			\
 	e-shell-window.h			\
-	e-shell.c				\
-	e-shell.h				\
+	e-shell-view.c				\
+	e-shell-view.h				\
 	e-sidebar.c				\
 	e-sidebar.h				\
 	main.c
Index: shell/e-component-view.c
===================================================================
RCS file: shell/e-component-view.c
diff -N shell/e-component-view.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ shell/e-component-view.c	25 Jun 2004 11:55:01 -0000
@@ -0,0 +1,107 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
+ * e-component-view.c
+ *
+ * Copyright (C) 2004 Novell Inc.
+ *
+ * Author(s): Michael Zucchi <notzed@ximian.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Helper class for evolution components to setup a view
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib.h>
+
+#include "e-component-view.h"
+
+#include "bonobo/bonobo-control.h"
+
+static BonoboObjectClass *parent_class = NULL;
+
+static void
+impl_ComponentView_getControls(PortableServer_Servant servant,
+		 Bonobo_Control *side_control,
+		 Bonobo_Control *view_control,
+		 Bonobo_Control *statusbar_control,
+		 CORBA_Environment *ev)
+{
+	EComponentView *ecv = (EComponentView *)bonobo_object_from_servant(servant);
+
+	*side_control = CORBA_Object_duplicate (BONOBO_OBJREF (ecv->side_control), ev);
+	*view_control = CORBA_Object_duplicate (BONOBO_OBJREF (ecv->view_control), ev);
+	*statusbar_control = CORBA_Object_duplicate (BONOBO_OBJREF (ecv->statusbar_control), ev);
+}
+
+/* GObject methods.  */
+
+static void
+impl_dispose (GObject *object)
+{
+	EComponentView *ecv = (EComponentView *)object;
+
+	ecv->side_control = NULL;
+	ecv->view_control = NULL;
+	ecv->statusbar_control = NULL;
+
+	((GObjectClass *)parent_class)->dispose(object);
+}
+
+static void
+impl_finalise (GObject *object)
+{
+	((GObjectClass *)parent_class)->finalize(object);
+}
+
+static void
+e_component_view_class_init (EComponentViewClass *klass)
+{
+	GObjectClass *object_class;
+	POA_GNOME_Evolution_ComponentView__epv *epv;
+
+	parent_class = g_type_class_ref(bonobo_object_get_type());
+
+	object_class = G_OBJECT_CLASS (klass);
+	object_class->dispose  = impl_dispose;
+	object_class->finalize = impl_finalise;
+
+	epv = & klass->epv;
+	epv->getControls = impl_ComponentView_getControls;
+}
+
+static void
+e_component_view_init (EComponentView *shell)
+{
+}
+
+EComponentView *e_component_view_new(GNOME_Evolution_ShellView parent, struct _GtkWidget *side, struct _GtkWidget *view, struct _GtkWidget *statusbar)
+{
+	EComponentView *new = g_object_new (e_component_view_get_type (), NULL);
+	CORBA_Environment ev = { 0 };
+
+	new->shell_view = CORBA_Object_duplicate(parent, &ev);
+	CORBA_exception_free(&ev);
+
+	new->side_control = bonobo_control_new(side);
+	new->view_control = bonobo_control_new(view);
+	new->statusbar_control = bonobo_control_new(statusbar);
+
+	return new;
+}
+
+BONOBO_TYPE_FUNC_FULL (EComponentView, GNOME_Evolution_ComponentView, bonobo_object_get_type(), e_component_view)
Index: shell/e-component-view.h
===================================================================
RCS file: shell/e-component-view.h
diff -N shell/e-component-view.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ shell/e-component-view.h	25 Jun 2004 11:55:01 -0000
@@ -0,0 +1,73 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
+ * e-component-view.h
+ *
+ * Copyright (C) 2004 Novell Inc.
+ *
+ * Author(s): Michael Zucchi <notzed@ximian.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef _E_COMPONENT_VIEW_H_
+#define _E_COMPONENT_VIEW_H_
+
+#include <bonobo/bonobo-object.h>
+
+#ifdef __cplusplus
+extern "C" {
+#pragma }
+#endif /* __cplusplus */
+
+struct _GtkWidget;
+
+typedef struct _EComponentView        EComponentView;
+typedef struct _EComponentViewPrivate EComponentViewPrivate;
+typedef struct _EComponentViewClass   EComponentViewClass;
+
+#include "Evolution.h"
+
+#define E_TYPE_COMPONENT_VIEW			(e_component_view_get_type ())
+#define E_COMPONENT_VIEW(obj)			(GTK_CHECK_CAST ((obj), E_TYPE_COMPONENT_VIEW, EComponentView))
+#define E_COMPONENT_VIEW_CLASS(klass)		(GTK_CHECK_CLASS_CAST ((klass), E_TYPE_COMPONENT_VIEW, EComponentViewClass))
+#define E_IS_COMPONENT_VIEW(obj)			(GTK_CHECK_TYPE ((obj), E_TYPE_COMPONENT_VIEW))
+#define E_IS_COMPONENT_VIEW_CLASS(klass)		(GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_COMPONENT_VIEW))
+
+struct _EComponentView {
+	BonoboObject parent;
+
+	GNOME_Evolution_ShellView shell_view;
+
+	struct _BonoboControl *side_control;
+	struct _BonoboControl *view_control;
+	struct _BonoboControl *statusbar_control;
+
+	EComponentViewPrivate *priv;
+};
+
+struct _EComponentViewClass {
+	BonoboObjectClass parent_class;
+
+	POA_GNOME_Evolution_ComponentView__epv epv;
+};
+
+GType           e_component_view_get_type(void);
+EComponentView *e_component_view_new(GNOME_Evolution_ShellView shell_view, struct _GtkWidget *side, struct _GtkWidget *view, struct _GtkWidget *status);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _E_COMPONENT_VIEW_H_ */
Index: shell/e-shell-view.c
===================================================================
RCS file: shell/e-shell-view.c
diff -N shell/e-shell-view.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ shell/e-shell-view.c	25 Jun 2004 11:55:01 -0000
@@ -0,0 +1,108 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
+ * e-shell-view.c
+ *
+ * Copyright (C) 2004 Novell Inc.
+ *
+ * Author(s): Michael Zucchi <notzed@ximian.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Helper class for evolution shells to setup a view
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib.h>
+
+#include <gtk/gtkwindow.h>
+
+#include "e-shell-view.h"
+#include "e-shell-window.h"
+
+static BonoboObjectClass *parent_class = NULL;
+
+struct _EShellViewPrivate {
+	int dummy;
+};
+
+static void
+impl_ShellView_setTitle(PortableServer_Servant _servant, const CORBA_char * title, CORBA_Environment * ev)
+{
+	EShellView *esw = (EShellView *)bonobo_object_from_servant(_servant);
+	char *tmp = g_strdup_printf("Evolution = %s", title);
+
+	printf("shell view:setTitle '%s'\n", title);
+
+	gtk_window_set_title((GtkWindow *)esw->window, tmp);
+	g_free(tmp);
+}
+
+static void
+impl_ShellView_setComponent(PortableServer_Servant _servant, const CORBA_char *id, CORBA_Environment * ev)
+{
+	EShellView *esw = (EShellView *)bonobo_object_from_servant(_servant);
+
+	e_shell_window_switch_to_component(esw->window, id);
+}
+
+static void
+impl_dispose (GObject *object)
+{
+	/*EShellView *esv = (EShellView *)object;*/
+
+	((GObjectClass *)parent_class)->dispose(object);
+}
+
+static void
+impl_finalise (GObject *object)
+{
+	((GObjectClass *)parent_class)->finalize(object);
+}
+
+static void
+e_shell_view_class_init (EShellViewClass *klass)
+{
+	GObjectClass *object_class;
+	POA_GNOME_Evolution_ShellView__epv *epv;
+
+	parent_class = g_type_class_ref(bonobo_object_get_type());
+
+	object_class = G_OBJECT_CLASS (klass);
+	object_class->dispose  = impl_dispose;
+	object_class->finalize = impl_finalise;
+
+	epv = & klass->epv;
+	epv->setTitle = impl_ShellView_setTitle;
+	epv->setComponent = impl_ShellView_setComponent;
+}
+
+static void
+e_shell_view_init (EShellView *shell)
+{
+}
+
+EShellView *e_shell_view_new(struct _EShellWindow *window)
+{
+	EShellView *new = g_object_new (e_shell_view_get_type (), NULL);
+
+	/* TODO: listen to destroy? */
+	new->window = window;
+
+	return new;
+}
+
+BONOBO_TYPE_FUNC_FULL (EShellView, GNOME_Evolution_ShellView, bonobo_object_get_type(), e_shell_view)
Index: shell/e-shell-view.h
===================================================================
RCS file: shell/e-shell-view.h
diff -N shell/e-shell-view.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ shell/e-shell-view.h	25 Jun 2004 11:55:01 -0000
@@ -0,0 +1,69 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-shell-view.h
+ *
+ * Copyright (C) 2000  Ximian, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * This is only a CORBA wrapper around e_shell_window.
+ */
+
+#ifndef _E_SHELL_VIEW_H_
+#define _E_SHELL_VIEW_H_
+
+#include <bonobo-activation/bonobo-activation.h>
+#include <bonobo/bonobo-object.h>
+
+#ifdef __cplusplus
+extern "C" {
+#pragma }
+#endif /* __cplusplus */
+
+struct _EShell;
+
+typedef struct _EShellView        EShellView;
+typedef struct _EShellViewPrivate EShellViewPrivate;
+typedef struct _EShellViewClass   EShellViewClass;
+
+#include "Evolution.h"
+
+#define E_TYPE_SHELL_VIEW			(e_shell_view_get_type ())
+#define E_SHELL_VIEW(obj)			(GTK_CHECK_CAST ((obj), E_TYPE_SHELL_VIEW, EShellView))
+#define E_SHELL_VIEW_CLASS(klass)		(GTK_CHECK_CLASS_CAST ((klass), E_TYPE_SHELL_VIEW, EShellViewClass))
+#define E_IS_SHELL_VIEW(obj)			(GTK_CHECK_TYPE ((obj), E_TYPE_SHELL_VIEW))
+#define E_IS_SHELL_VIEW_CLASS(klass)		(GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_SHELL_VIEW))
+
+struct _EShellView {
+	BonoboObject parent;
+
+	struct _EShellWindow *window;
+
+	EShellViewPrivate *priv;
+};
+
+struct _EShellViewClass {
+	BonoboObjectClass parent_class;
+
+	POA_GNOME_Evolution_ShellView__epv epv;
+};
+
+GType                e_shell_view_get_type   (void);
+EShellView *e_shell_view_new(struct _EShellWindow *window);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _E_SHELL_VIEW_H_ */
Index: shell/e-shell-window.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell-window.c,v
retrieving revision 1.27
diff -u -3 -r1.27 e-shell-window.c
--- shell/e-shell-window.c	24 Jun 2004 08:14:51 -0000	1.27
+++ shell/e-shell-window.c	25 Jun 2004 11:55:01 -0000
@@ -23,6 +23,7 @@
 #include <config.h>
 
 #include "e-shell-window.h"
+#include "e-shell-view.h"
 
 #include "Evolution.h"
 
@@ -67,6 +68,8 @@
 	char *component_id;
 	char *component_alias;
 
+	GNOME_Evolution_ComponentView component_view;
+
 	GtkWidget *sidebar_widget;
 	GtkWidget *view_widget;
 	GtkWidget *statusbar_widget;
@@ -79,6 +82,8 @@
 struct _EShellWindowPrivate {
 	EShell *shell;
 
+	EShellView *shell_view;	/* CORBA wrapper for this, just a placeholder */
+
 	/* All the ComponentViews.  */
 	GSList *component_views;
 
@@ -145,6 +150,9 @@
 static void
 component_view_free (ComponentView *view)
 {
+	if (view->component_view)
+		bonobo_object_release_unref(view->component_view, NULL);
+
 	g_free (view->component_id);
 	g_free (view->component_alias);
 	g_free (view);
@@ -189,6 +197,7 @@
 	EShellWindowPrivate *priv = window->priv;
 	EComponentRegistry *registry = e_shell_peek_component_registry (window->priv->shell);
 	GNOME_Evolution_Component component_iface;
+	GNOME_Evolution_ComponentView component_view;
 	Bonobo_UIContainer container;
 	Bonobo_Control sidebar_control;
 	Bonobo_Control view_control;
@@ -217,19 +226,30 @@
 
 	/* 2. Set up view.  */
 
-	GNOME_Evolution_Component_createControls (component_iface, &sidebar_control, &view_control, &statusbar_control, &ev);
-	if (BONOBO_EX (&ev)) {
+	/* The rest of the code assumes that the component is valid and can create
+	   controls; if this fails something is really wrong in the component
+	   (e.g. methods not implemented)...  So handle it as if there was no
+	   component at all.  */
+
+	component_view = GNOME_Evolution_Component_createView(component_iface, BONOBO_OBJREF(priv->shell_view), &ev);
+	if (component_view == NULL || BONOBO_EX (&ev)) {
 		g_warning ("Cannot create view for %s", view->component_id);
+		bonobo_object_release_unref (component_iface, NULL);
+		CORBA_exception_free (&ev);
+		return;
+	}
 
-		/* The rest of the code assumes that the component is valid and can create
-		   controls; if this fails something is really wrong in the component
-		   (e.g. methods not implemented)...  So handle it as if there was no
-		   component at all.  */
+	GNOME_Evolution_ComponentView_getControls(component_view, &sidebar_control, &view_control, &statusbar_control, &ev);
+	if (BONOBO_EX (&ev)) {
+		g_warning ("Cannot create view for %s", view->component_id);
 		bonobo_object_release_unref (component_iface, NULL);
+		bonobo_object_release_unref (component_view, NULL);
 		CORBA_exception_free (&ev);
 		return;
 	}
 
+	view->component_view = component_view;
+
 	CORBA_exception_free (&ev);
 
 	container = bonobo_ui_component_get_container (priv->ui_component);
@@ -706,7 +726,6 @@
 	(* G_OBJECT_CLASS (parent_class)->finalize) (object);
 }
 
-
 /* Initialization.  */
 
 static void
@@ -736,6 +755,7 @@
 	EShellWindowPrivate *priv = g_new0 (EShellWindowPrivate, 1);
 
 	priv->tooltips = gtk_tooltips_new ();
+	priv->shell_view = e_shell_view_new(shell_window);
 
 	shell_window->priv = priv;
 }
Index: shell/e-shell.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell.c,v
retrieving revision 1.250
diff -u -3 -r1.250 e-shell.c
--- shell/e-shell.c	24 Jun 2004 08:14:51 -0000	1.250
+++ shell/e-shell.c	25 Jun 2004 11:55:02 -0000
@@ -25,6 +25,7 @@
 #endif
 
 #include "e-shell.h"
+#include "e-shell-view.h"
 
 #include "e-util/e-dialog-utils.h"
 #include "e-util/e-bconf-map.h"
@@ -208,7 +209,7 @@
 	return FALSE;
 }
 
-static void
+static GNOME_Evolution_ShellView
 impl_Shell_createNewWindow (PortableServer_Servant servant,
 			    const CORBA_char *component_id,
 			    CORBA_Environment *ev)
@@ -216,9 +217,10 @@
 	BonoboObject *bonobo_object;
 	EShell *shell;
 	EShellWindow *shell_window;
+	EShellView *shell_view;
 
 	if (raise_exception_if_not_ready (servant, ev))
-		return;
+		return CORBA_OBJECT_NIL;
 
 	bonobo_object = bonobo_object_from_servant (servant);
 	shell = E_SHELL (bonobo_object);
@@ -230,8 +232,13 @@
 	if (shell_window == NULL) {
 		CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
 				     ex_GNOME_Evolution_Shell_ComponentNotFound, NULL);
-		return;
+		return CORBA_OBJECT_NIL;
 	}
+
+	/* refs?? */
+	shell_view = e_shell_view_new(shell_window);
+	
+	return BONOBO_OBJREF(shell_view);
 }
 
 static void
Index: mail/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.3404
diff -u -3 -r1.3404 ChangeLog
--- mail/ChangeLog	25 Jun 2004 04:15:38 -0000	1.3404
+++ mail/ChangeLog	25 Jun 2004 11:55:07 -0000
@@ -1,5 +1,14 @@
 2004-06-25  Not Zed  <NotZed@Ximian.com>
 
+	** See bug #60354.
+
+	* mail-component.c (view_changed_cb): set the shell window title
+	as well.
+	(impl_createView): renamed from createControls, just return a
+	EComponentView instead.
+
+2004-06-25  Not Zed  <NotZed@Ximian.com>
+
 	* em-folder-tree.c (folder_tree_new): set search column.  #60152.
 
 2004-06-24  Rodney Dawes  <dobey@novell.com>
Index: mail/mail-component.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-component.c,v
retrieving revision 1.94
diff -u -3 -r1.94 mail-component.c
--- mail/mail-component.c	17 Jun 2004 07:34:49 -0000	1.94
+++ mail/mail-component.c	25 Jun 2004 11:55:08 -0000
@@ -64,6 +64,7 @@
 
 #include "e-activity-handler.h"
 #include "shell/e-user-creatable-items-handler.h"
+#include "shell/e-component-view.h"
 
 #include "composer/e-msg-composer.h"
 
@@ -440,10 +441,15 @@
 }
 
 static void
-view_changed_cb(EMFolderView *emfv, EInfoLabel *el)
+view_changed_cb(EMFolderView *emfv, EComponentView *component_view)
 {
+	EInfoLabel *el = g_object_get_data((GObject *)component_view, "info-label");
+	CORBA_Environment ev;
+
+	CORBA_exception_init(&ev);
+
 	if (emfv->folder) {
-		char *name;
+		char *name, *title;
 		guint32 visible, unread, deleted, junked;
 		GString *tmp = g_string_new("");
 
@@ -500,27 +506,31 @@
 		}
 
 		e_info_label_set_info(el, name, tmp->str);
+
+		title = g_strdup_printf("%s, %s", name, tmp->str);
+		GNOME_Evolution_ShellView_setTitle(component_view->shell_view, title, &ev);
+		g_free(title);
+
 		g_string_free(tmp, TRUE);
 		camel_object_free(emfv->folder, CAMEL_FOLDER_NAME, name);
 	} else {
 		e_info_label_set_info(el, _("Mail"), "");
+		GNOME_Evolution_ShellView_setTitle(component_view->shell_view, _("Mail"), &ev);
 	}
+
+	CORBA_exception_free(&ev);
 }
 
 /* Evolution::Component CORBA methods.  */
 
-static void
-impl_createControls (PortableServer_Servant servant,
-		     Bonobo_Control *corba_tree_control,
-		     Bonobo_Control *corba_view_control,
-		     Bonobo_Control *corba_statusbar_control,
-		     CORBA_Environment *ev)
+static GNOME_Evolution_ComponentView
+impl_createView (PortableServer_Servant servant,
+		 GNOME_Evolution_ShellView parent,
+		 CORBA_Environment *ev)
 {
 	MailComponent *mail_component = MAIL_COMPONENT (bonobo_object_from_servant (servant));
 	MailComponentPrivate *priv = mail_component->priv;
-	BonoboControl *tree_control;
-	BonoboControl *view_control;
-	BonoboControl *statusbar_control;
+	EComponentView *component_view;
 	GtkWidget *tree_widget, *vbox, *info;
 	GtkWidget *view_widget;
 	GtkWidget *statusbar_widget;
@@ -563,23 +573,21 @@
 	gtk_widget_show(info);
 	gtk_widget_show(vbox);
 
-	tree_control = bonobo_control_new (vbox);
-	view_control = bonobo_control_new (view_widget);
-	statusbar_control = bonobo_control_new (statusbar_widget);
-	
-	*corba_tree_control = CORBA_Object_duplicate (BONOBO_OBJREF (tree_control), ev);
-	*corba_view_control = CORBA_Object_duplicate (BONOBO_OBJREF (view_control), ev);
-	*corba_statusbar_control = CORBA_Object_duplicate (BONOBO_OBJREF (statusbar_control), ev);
+	component_view = e_component_view_new(parent, vbox, view_widget, statusbar_widget);
+
+	g_object_set_data((GObject *)component_view, "info-label", info);
 
 	g_object_set_data_full((GObject *)view_widget, "e-creatable-items-handler",
 			       e_user_creatable_items_handler_new("mail", create_local_item_cb, tree_widget),
 			       (GDestroyNotify)g_object_unref);
 
-	g_signal_connect (view_control, "activate", G_CALLBACK (view_control_activate_cb), view_widget);
+	g_signal_connect (component_view->view_control, "activate", G_CALLBACK (view_control_activate_cb), view_widget);
 	g_signal_connect (tree_widget, "folder-selected", G_CALLBACK (folder_selected_cb), view_widget);
 
-	g_signal_connect(view_widget, "changed", G_CALLBACK(view_changed_cb), info);
-	g_signal_connect(view_widget, "loaded", G_CALLBACK(view_changed_cb), info);
+	g_signal_connect(view_widget, "changed", G_CALLBACK(view_changed_cb), component_view);
+	g_signal_connect(view_widget, "loaded", G_CALLBACK(view_changed_cb), component_view);
+
+	return BONOBO_OBJREF(component_view);
 }
 
 static CORBA_boolean
@@ -821,7 +829,7 @@
 	object_class->dispose  = impl_dispose;
 	object_class->finalize = impl_finalize;
 	
-	epv->createControls          = impl_createControls;
+	epv->createView          = impl_createView;
 	epv->requestQuit = impl_requestQuit;
 	epv->quit = impl_quit;
 	epv->_get_userCreatableItems = impl__get_userCreatableItems;
