From f286676ead838f371de0096b6bfd3c46748d84ec Mon Sep 17 00:00:00 2001 From: Matthew Loper Date: Wed, 22 Mar 2000 16:35:58 +0000 Subject: + * shell/main.c (evolution_boot): gtk_signal_connect'ed "destroy" + to gtk_main_quit, so that the shell dies when you want it to. + + * shell/e-shell-view.c (get_view): Reorganized, and added + assertions. + (e_shell_view_set_view): Added assertions. + + * camel/camel-formatter.c (debug): Disabled some useless debug + messaging. svn path=/trunk/; revision=2141 --- shell/e-shell-view.c | 119 +++++++++++++++++++++++++-------------------------- shell/main.c | 5 ++- 2 files changed, 63 insertions(+), 61 deletions(-) (limited to 'shell') diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c index 9f41b4ec3b..398c67f377 100644 --- a/shell/e-shell-view.c +++ b/shell/e-shell-view.c @@ -85,24 +85,25 @@ static GtkWidget * get_view (EShellView *eshell_view, EFolder *efolder, Bonobo_UIHandler uih) { GtkWidget *w = NULL; - EFolderType e_folder_type; - BonoboControlFrame *control_frame = NULL; - BonoboObjectClient *server; - EShell *shell_model; Evolution_Shell corba_shell = CORBA_OBJECT_NIL; CORBA_Environment ev; + EShell *shell_model = eshell_view->eshell; + + /* This type could be E_FOLDER_MAIL, E_FOLDER_CONTACTS, etc */ + EFolderType e_folder_type; + g_assert (efolder); + g_assert (eshell_view); + + e_folder_type = e_folder_get_folder_type (efolder); - shell_model = eshell_view->eshell; if (shell_model) - corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (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"); + 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); @@ -111,65 +112,57 @@ get_view (EShellView *eshell_view, EFolder *efolder, Bonobo_UIHandler uih) switch (e_folder_type) { case E_FOLDER_MAIL : - { - 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"); - } - } + w = bonobo_widget_new_control ("control:evolution-mail", uih); break; case E_FOLDER_CONTACTS : - { -#if 0 - Evolution_ServiceRepository corba_sr; -#endif - - w = bonobo_widget_new_control ("control:addressbook", - uih); -#if 0 - 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"); - } -#endif - } + w = bonobo_widget_new_control ("control:addressbook", uih); break; - + + case E_FOLDER_CALENDAR : + case E_FOLDER_TASKS : + case E_FOLDER_OTHER : default : - printf ("No bonobo component associated to %s\n", + printf ("%s: %s: No bonobo component associated with %s\n", + __FILE__, + __FUNCTION__, e_folder_get_description (efolder)); + return NULL; } - - 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); - if (w) gtk_widget_show (w); + if (w) + { + Evolution_ServiceRepository corba_sr; + BonoboObjectClient *server = + bonobo_widget_get_server (BONOBO_WIDGET (w)); + BonoboControlFrame *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); + + /* Does this control have the "ServiceRepository" interface? */ + corba_sr = (Evolution_ServiceRepository) + bonobo_object_client_query_interface ( + server, + "IDL:Evolution/ServiceRepository:1.0", + NULL); + + /* If it does, pass our shell interface to it */ + 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"); + } + + gtk_widget_show (w); + } return w; - } @@ -181,6 +174,9 @@ e_shell_view_set_view (EShellView *eshell_view, EFolder *efolder) GtkWidget *folder_view = g_hash_table_lookup ( eshell_view->priv->folder_views, efolder); + g_assert (eshell_view); + g_assert (efolder); + /* if we found a notebook page in our hash, that represents this efolder, switch to it */ if (folder_view) { @@ -221,6 +217,9 @@ e_shell_view_new (EShell *eshell, EFolder *efolder, gboolean show_shortcut_bar) { EShellView *eshell_view; + g_return_val_if_fail (eshell != NULL, NULL); + g_return_val_if_fail (efolder != NULL, NULL); + eshell_view = gtk_type_new (e_shell_view_get_type ()); eshell_view->priv = g_new (EShellViewPrivate, 1); diff --git a/shell/main.c b/shell/main.c index 1d6d8bed7c..1c93579d85 100644 --- a/shell/main.c +++ b/shell/main.c @@ -73,7 +73,10 @@ evolution_boot (void) e_shell_view_new (eshell, eshell->default_folders.inbox, TRUE)); - + gtk_signal_connect (GTK_OBJECT (e_shell_view), "destroy", + GTK_SIGNAL_FUNC(gtk_main_quit), + NULL); + gtk_widget_show (GTK_WIDGET (e_shell_view)); } -- cgit v1.2.3