From 7838233834765fa21f3597eb6d0e44558141e6fd Mon Sep 17 00:00:00 2001 From: Larry Ewing Date: Wed, 14 Nov 2001 22:41:26 +0000 Subject: popup failure dialog if we cannot get a valid editor_engine. 2001-11-14 Larry Ewing * e-msg-composer.c (create_composer): popup failure dialog if we cannot get a valid editor_engine. (prepare_engine): make the checks robust and make sure that we unset the engine if any part fails. svn path=/trunk/; revision=14715 --- composer/ChangeLog | 7 +++++++ composer/e-msg-composer.c | 33 +++++++++++++++++++++++++++++---- 2 files changed, 36 insertions(+), 4 deletions(-) (limited to 'composer') diff --git a/composer/ChangeLog b/composer/ChangeLog index 97ce5674bb..dfd3eff5e6 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,10 @@ +2001-11-14 Larry Ewing + + * e-msg-composer.c (create_composer): popup failure dialog if we + cannot get a valid editor_engine. + (prepare_engine): make the checks robust and make sure that we + unset the engine if any part fails. + 2001-11-02 Radek Doulik * e-msg-composer.c (add_inlined_images): use hash table to diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index aeca4b58cb..7ac6c3b770 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -734,20 +734,35 @@ prepare_engine (EMsgComposer *composer) CORBA_exception_init (&ev); composer->editor_engine = (GNOME_GtkHTML_Editor_Engine) bonobo_object_client_query_interface (bonobo_widget_get_server (BONOBO_WIDGET (composer->editor)), "IDL:GNOME/GtkHTML/Editor/Engine:1.0", &ev); - if (composer->editor_engine != CORBA_OBJECT_NIL) { + if ((composer->editor_engine != CORBA_OBJECT_NIL) && (ev._major == CORBA_NO_EXCEPTION)) { /* printf ("trying set listener\n"); */ composer->editor_listener = BONOBO_OBJECT (listener_new (composer)); - if (composer->editor_listener != CORBA_OBJECT_NIL) + if (composer->editor_listener != NULL) GNOME_GtkHTML_Editor_Engine__set_listener (composer->editor_engine, (GNOME_GtkHTML_Editor_Listener) bonobo_object_dup_ref (bonobo_object_corba_objref (composer->editor_listener), &ev), &ev); - else + + if ((ev._major != CORBA_NO_EXCEPTION) || (composer->editor_listener == NULL)) { + CORBA_Environment err_ev; + + CORBA_exception_init (&err_ev); + + Bonobo_Unknown_unref (composer->editor_engine, &err_ev); + CORBA_Object_release (composer->editor_engine, &err_ev); + + CORBA_exception_free (&err_ev); + + composer->editor_engine = CORBA_OBJECT_NIL; g_warning ("Can't establish Editor Listener\n"); - } else + } + } else { + composer->editor_engine = CORBA_OBJECT_NIL; g_warning ("Can't get Editor Engine\n"); + } + CORBA_exception_free (&ev); } @@ -2426,6 +2441,16 @@ create_composer (void) e_msg_composer_show_attachments (composer, FALSE); prepare_engine (composer); + if (composer->editor_engine == CORBA_OBJECT_NIL) { + e_activation_failure_dialog (GTK_WINDOW (composer), + _("Could not create composer window:\n" + "Unable to activate HTML editor component."), + GNOME_GTKHTML_EDITOR_CONTROL_ID, + "IDL:GNOME/GtkHTML/Editor/Engine:1.0"); + gtk_object_destroy (GTK_OBJECT (composer)); + return NULL; + } + gtk_signal_connect (GTK_OBJECT (composer), "map", map_default_cb, NULL); if (am == NULL) { -- cgit