From 470823e288099d4409b81fb18fadea77b2c49e11 Mon Sep 17 00:00:00 2001 From: bertrand Date: Mon, 13 Mar 2000 06:09:26 +0000 Subject: (get_view): added a parameter to have a reference to the EShellView. 2000-03-13 bertrand (get_view): added a parameter to have a reference to the EShellView. (get_view): In the case of the mail component use the Evolution_ServiceRepository to give the component a reference to the Shell server. The Mail component now has a reference to the shell corba server. It is gonna make it possible to register new services in the shell. svn path=/trunk/; revision=2111 --- shell/e-shell-view.c | 49 +++++++++++++++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 12 deletions(-) (limited to 'shell/e-shell-view.c') diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c index 5a75ad74c2..0ea017c58e 100644 --- a/shell/e-shell-view.c +++ b/shell/e-shell-view.c @@ -15,6 +15,7 @@ #include "e-shell-view.h" #include "e-shell-view-menu.h" #include "e-shell-shortcut.h" +#include "Evolution.h" #include #include @@ -71,38 +72,62 @@ e_shell_view_setup_shortcut_display (EShellView *eshell_view) } static GtkWidget * -get_view (EFolder *efolder, Bonobo_UIHandler uih) +get_view (EShellView *eshell_view, EFolder *efolder, Bonobo_UIHandler uih) { GtkWidget *w = NULL; EFolderType e_folder_type; - BonoboControlFrame *control_frame; - - + BonoboControlFrame *control_frame = NULL; + BonoboObjectClient *server; + EShell *shell_model; + Evolution_Shell corba_shell = CORBA_OBJECT_NIL; + CORBA_Environment ev; - printf ("I am the view for %s\n", - e_folder_get_description (efolder)); + shell_model = eshell_view->eshell; + if (shell_model) + corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_model)); + else + g_warning ("The shell Bonobo object does not have an associated CORBA object\n"); /* get the folder type */ e_folder_type = e_folder_get_folder_type (efolder); - + /* initialize the corba environment */ + CORBA_exception_init (&ev); + /* depending on the type of folder, * we launch a different bonobo component */ switch (e_folder_type) { case E_FOLDER_MAIL : - w = bonobo_widget_new_control ("control:evolution-mail", - uih ); + { + Evolution_ServiceRepository corba_sr; + + w = bonobo_widget_new_control ("control:evolution-mail", + uih); + server = bonobo_widget_get_server (BONOBO_WIDGET (w)); + + corba_sr = (Evolution_ServiceRepository) + bonobo_object_client_query_interface (server, + "IDL:Evolution/ServiceRepository:1.0", + NULL); + if (corba_sr != CORBA_OBJECT_NIL) { + Evolution_ServiceRepository_set_shell (corba_sr, corba_shell, &ev); + } else { + g_warning ("The bonobo component for the mail doesn't seem to implement the " + "Evolution::ServiceRepository interface\n"); + } + } break; - + default : printf ("No bonobo component associated to %s\n", e_folder_get_description (efolder)); } - control_frame = bonobo_widget_get_control_frame (w); + if (!control_frame) + control_frame = bonobo_widget_get_control_frame (BONOBO_WIDGET (w)); bonobo_control_frame_set_autoactivate (control_frame, FALSE); bonobo_control_frame_control_activate (control_frame); @@ -120,7 +145,7 @@ e_shell_view_set_view (EShellView *eshell_view, EFolder *efolder) uih = bonobo_object_corba_objref (BONOBO_OBJECT (eshell_view->uih)); - w = get_view (efolder, uih); + w = get_view (eshell_view, efolder, uih); if (eshell_view->contents){ gtk_widget_destroy (eshell_view->contents); -- cgit v1.2.3