[anjal] BUGFIX: GNOME Bugzilla: #590110 - Warn while closing dirty composer.
- From: Srinivasa Ragavan <sragavan src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [anjal] BUGFIX: GNOME Bugzilla: #590110 - Warn while closing dirty composer.
- Date: Wed, 29 Jul 2009 09:27:16 +0000 (UTC)
commit e21e7f23cf6891ee9f4eb4b359d6805cd8cd4c92
Author: Srinivasa Ragavan <sragavan novell com>
Date: Wed Jul 29 14:42:34 2009 +0530
BUGFIX: GNOME Bugzilla: #590110 - Warn while closing dirty composer.
src/mail-composer-view.c | 30 ++++++++++++++++++++++++++++++
src/mail-composer-view.h | 1 +
src/mail-view.c | 5 +++++
3 files changed, 36 insertions(+), 0 deletions(-)
---
diff --git a/src/mail-composer-view.c b/src/mail-composer-view.c
index 68fdfe0..e3049a4 100644
--- a/src/mail-composer-view.c
+++ b/src/mail-composer-view.c
@@ -26,10 +26,13 @@
#include <glib/gi18n.h>
+#include <e-util/e-error.h>
+
#include "mail-view.h"
#include "mail-composer-view.h"
#include <composer/e-composer-header-table.h>
#include <composer/e-msg-composer.h>
+#include <composer/e-composer-actions.h>
struct _MailComposerViewPrivate {
GtkWidget *box;
@@ -224,6 +227,33 @@ mail_composer_view_activate (MailComposerView *mfv, GtkWidget *folder_tree, GtkW
gtk_widget_set_sensitive (sort_by, act);
}
+gboolean
+mail_composer_view_can_quit (MailComposerView *mcv)
+{
+ GtkhtmlEditor *editor;
+ struct _EMsgComposer *composer = (struct _EMsgComposer *)mcv->priv->composer;
+ gint response;
+
+ editor = GTKHTML_EDITOR(composer);
+
+ if (gtkhtml_editor_get_changed(editor) && !e_msg_composer_is_exiting (composer)) {
+ const char *subject;
+ EComposerHeaderTable *table = e_msg_composer_get_header_table (composer);
+
+ subject = e_composer_header_table_get_subject (table);
+ if (subject == NULL || *subject == '\0')
+ subject = _("Untitled Message");
+ response = e_error_run (GTK_WINDOW (composer), "mail-composer:exit-unsaved", subject, NULL);
+ if (response == GTK_RESPONSE_YES)
+ gtk_action_activate (gtkhtml_editor_get_action (editor, "save-draft"));
+ else if (response == GTK_RESPONSE_CANCEL)
+ return FALSE;
+
+ }
+
+ return TRUE;
+}
+
#ifndef HACK_TO_COMPILE
void
diff --git a/src/mail-composer-view.h b/src/mail-composer-view.h
index b5c9e3e..1be599a 100644
--- a/src/mail-composer-view.h
+++ b/src/mail-composer-view.h
@@ -60,5 +60,6 @@ MailComposerView * mail_composer_view_new (void);
void mail_composer_view_activate (MailComposerView *mfv, GtkWidget *folder_tree, GtkWidget *check_mail, GtkWidget *sort_by, gboolean act);
void mail_composer_view_replace_composer (MailComposerView *mcv, GtkWidget *composer);
MailComposerView * mail_composer_view_new_with_composer (GtkWidget *composer);
+gboolean mail_composer_view_can_quit (MailComposerView *mcv);
#endif
diff --git a/src/mail-view.c b/src/mail-view.c
index b5f84f5..a008780 100644
--- a/src/mail-view.c
+++ b/src/mail-view.c
@@ -273,6 +273,11 @@ mv_close_mcv (MailViewChild *mfv, MailView *mv)
if (!found)
return;
}
+
+ if (mfv->type == MAIL_VIEW_COMPOSER) {
+ if (!mail_composer_view_can_quit((MailComposerView *)mfv))
+ return;
+ }
g_signal_handlers_block_by_func(mv, mv_switch, mv);
gtk_notebook_remove_page ((GtkNotebook *)mv, n);
g_signal_handlers_unblock_by_func(mv, mv_switch, mv);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]