From 44968e072f3298bb59af4e51a804998ef1690894 Mon Sep 17 00:00:00 2001 From: Larry Ewing Date: Tue, 11 Sep 2001 06:02:43 +0000 Subject: call menu_file_save_error when there is an exception while saving. 2001-09-11 Larry Ewing * mail-account-gui.c (menu_file_save_cb): call menu_file_save_error when there is an exception while saving. (menu_file_save_error): pop up a dialog telling the user the file has not been saved. svn path=/trunk/; revision=12765 --- mail/mail-account-gui.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'mail/mail-account-gui.c') diff --git a/mail/mail-account-gui.c b/mail/mail-account-gui.c index c08538e55c..b65398731d 100644 --- a/mail/mail-account-gui.c +++ b/mail/mail-account-gui.c @@ -939,6 +939,15 @@ destroy_editor (ESignatureEditor *editor) g_free (editor); } +static void +menu_file_save_error (BonoboUIComponent *uic, CORBA_Environment *ev) { + e_notice (GTK_WINDOW (uic), GNOME_MESSAGE_BOX_ERROR, + _("Could not save signature file.")); + + g_warning ("Exception while saving signature (%s)", + bonobo_exception_get_text (ev)); +} + static void menu_file_save_cb (BonoboUIComponent *uic, void *data, @@ -955,8 +964,10 @@ menu_file_save_cb (BonoboUIComponent *uic, pfile_iface = bonobo_object_client_query_interface (bonobo_widget_get_server (BONOBO_WIDGET (editor->control)), "IDL:Bonobo/PersistFile:1.0", NULL); Bonobo_PersistFile_save (pfile_iface, editor->filename, &ev); + if (ev._major != CORBA_NO_EXCEPTION) - g_warning ("Cannot save."); + menu_file_save_error (uic, &ev); + CORBA_exception_free (&ev); } else { BonoboStream *stream; @@ -967,16 +978,17 @@ menu_file_save_cb (BonoboUIComponent *uic, stream = bonobo_stream_open (BONOBO_IO_DRIVER_FS, editor->filename, Bonobo_Storage_WRITE | Bonobo_Storage_CREATE, 0); + pstream_iface = bonobo_object_client_query_interface (bonobo_widget_get_server (BONOBO_WIDGET (editor->control)), "IDL:Bonobo/PersistStream:1.0", NULL); - Bonobo_PersistStream_save (pstream_iface, (Bonobo_Stream) bonobo_object_corba_objref (BONOBO_OBJECT (stream)), + + Bonobo_PersistStream_save (pstream_iface, + (Bonobo_Stream) bonobo_object_corba_objref (BONOBO_OBJECT (stream)), "text/plain", &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("Exception while saving signature (%s)", - bonobo_exception_get_text (&ev)); - return; - } + + if (ev._major != CORBA_NO_EXCEPTION) + menu_file_save_error (uic, &ev); CORBA_exception_free (&ev); bonobo_object_unref (BONOBO_OBJECT (stream)); -- cgit v1.2.3