From 495a7e6a3c57aa86c0be011331bb20a505c96a58 Mon Sep 17 00:00:00 2001 From: Larry Ewing Date: Tue, 30 Oct 2001 23:17:48 +0000 Subject: add delete_event_handler. (menu_file_save_close_cb): add save and close 2001-10-30 Larry Ewing * mail-account-gui.c (delete_event_cb): add delete_event_handler. (menu_file_save_close_cb): add save and close command. (launch_signature_editor): initial the editor as having changed and attach the delete event handler. svn path=/trunk/; revision=14499 --- mail/ChangeLog | 7 +++++++ mail/mail-account-gui.c | 32 +++++++++++++++++++++++++++----- 2 files changed, 34 insertions(+), 5 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index 1b33ad5259..adbf060337 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,10 @@ +2001-10-30 Larry Ewing + + * mail-account-gui.c (delete_event_cb): add delete_event_handler. + (menu_file_save_close_cb): add save and close command. + (launch_signature_editor): initial the editor as having changed + and attach the delete event handler. + 2001-10-30 * message-browser.c (d): Turn it off. diff --git a/mail/mail-account-gui.c b/mail/mail-account-gui.c index ef16de0ba3..3445b5cd60 100644 --- a/mail/mail-account-gui.c +++ b/mail/mail-account-gui.c @@ -1052,6 +1052,12 @@ do_exit (ESignatureEditor *editor) destroy_editor (editor); } +static int +delete_event_cb (GtkWidget *w, GdkEvent *event, ESignatureEditor *editor) +{ + do_exit (editor); +} + static void menu_file_close_cb (BonoboUIComponent *uic, gpointer data, const gchar *path) { @@ -1061,11 +1067,23 @@ menu_file_close_cb (BonoboUIComponent *uic, gpointer data, const gchar *path) do_exit (editor); } +static void +menu_file_save_close_cb (BonoboUIComponent *uic, gpointer data, const gchar *path) +{ + ESignatureEditor *editor; + + editor = E_SIGNATURE_EDITOR (data); + + menu_file_save_cb (uic, editor, path); + destroy_editor (editor); +} + static BonoboUIVerb verbs [] = { - BONOBO_UI_VERB ("FileSave", menu_file_save_cb), - BONOBO_UI_VERB ("FileClose", menu_file_close_cb), - + BONOBO_UI_VERB ("FileSave", menu_file_save_cb), + BONOBO_UI_VERB ("FileClose", menu_file_close_cb), + BONOBO_UI_VERB ("FileSaveClose", menu_file_save_close_cb), + BONOBO_UI_VERB_END }; @@ -1133,7 +1151,8 @@ launch_signature_editor (MailAccountGui *gui, const gchar *filename, gboolean ht editor->html = html; editor->filename = g_strdup (filename); - + editor->has_changed = TRUE; + title = g_strdup_printf ("Edit %ssignature (%s)", html ? "HTML " : "", filename); editor->win = bonobo_window_new ("e-sig-editor", title); editor->gui = gui; @@ -1161,7 +1180,10 @@ launch_signature_editor (MailAccountGui *gui, const gchar *filename, gboolean ht } load_signature (editor); - + + gtk_signal_connect (GTK_OBJECT (editor->win), "delete_event", + GTK_SIGNAL_FUNC (delete_event_cb), editor); + bonobo_window_set_contents (BONOBO_WINDOW (editor->win), editor->control); bonobo_widget_set_property (BONOBO_WIDGET (editor->control), "FormatHTML", html, NULL); gtk_widget_show (GTK_WIDGET (editor->win)); -- cgit v1.2.3