From 534e5a1764bdbeb542cf3531c2575df451d8e572 Mon Sep 17 00:00:00 2001
From: Matthew Barnes <mbarnes@redhat.com>
Date: Wed, 9 Apr 2008 02:00:45 +0000
Subject: ** Fixes bug #523413

2008-04-08  Matthew Barnes  <mbarnes@redhat.com>

	** Fixes bug #523413

	* composer/e-msg-composer.c (msg_composer_dispose):
	Use the 'application_exiting' private flag to determine whether
	to tell e_composer_autosave_unregister() to delete the autosave
	file.

	* composer/e-msg-composer.c (msg_composer_class_init),
	(e_msg_composer_save_draft):
	Remove the 'quit' parameter from the 'save-draft' signal.

	* composer/e-msg-composer.c (e_msg_composer_request_close_all):
	Take an autosave snapshot before activating the CLOSE action,
	and set the private 'application_exiting' flag.  This should
	avoid prompting the user before shutting down.

	* composer/e-composer-actions.c (action_close_cb):
	When electing to save a message before closing, hide the window
	immediately.  The callback function can then check the window's
	visibility after the save is complete to know whether to destroy
	the window.

	* composer/e-composer-autosave.c (e_composer_autosave_unregister):
	Add a 'delete_file' boolean parameter to determine whether to
	delete the autosave file.

	* composer/e-composer-private.h:
	Add an 'application_exiting' flag.

	* mail/em-composer-utils.c (save_draft_done):
	Check the composer window's visibility to determine whether to
	destroy the window.  See the corresponding composer/ChangeLog
	entry to get the full story.

	* mail/em-composer-utils.c (em_utils_composer_save_draft_cb):
	Remove the 'quit' parameter.


svn path=/trunk/; revision=35346
---
 mail/em-composer-utils.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

(limited to 'mail/em-composer-utils.c')

diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index 089b3bfea7..f5a3a2ced0 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -459,7 +459,6 @@ struct _save_draft_info {
 	struct emcs_t *emcs;
 	EMsgComposer *composer;
 	CamelMessageInfo *info;
-	int quit;
 };
 
 static void
@@ -511,7 +510,10 @@ save_draft_done (CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *i
 		emcs->drafts_uid = g_strdup (appended_uid);
 	}
 
-	if (sdi->quit)
+	/* This is kind of a hack, but the composer's CLOSE action
+	 * hides the window before emitting the "save-draft" signal.
+	 * We use that to determine whether to destroy the composer. */
+	if (!GTK_WIDGET_VISIBLE (sdi->composer))
 		gtk_widget_destroy (GTK_WIDGET (sdi->composer));
 
  done:
@@ -534,7 +536,7 @@ save_draft_folder (char *uri, CamelFolder *folder, gpointer data)
 }
 
 void
-em_utils_composer_save_draft_cb (EMsgComposer *composer, int quit, gpointer user_data)
+em_utils_composer_save_draft_cb (EMsgComposer *composer, gpointer user_data)
 {
 	const char *default_drafts_folder_uri = mail_component_get_folder_uri(NULL, MAIL_COMPONENT_FOLDER_DRAFTS);
 	CamelFolder *drafts_folder = mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_DRAFTS);
@@ -559,7 +561,6 @@ em_utils_composer_save_draft_cb (EMsgComposer *composer, int quit, gpointer user
 	sdi->emcs = user_data;
 	if (sdi->emcs)
 		emcs_ref(sdi->emcs);
-	sdi->quit = quit;
 
 	if (account && account->drafts_folder_uri &&
 	    strcmp (account->drafts_folder_uri, default_drafts_folder_uri) != 0) {
-- 
cgit 

alue='branches/2014Q2'>branches/2014Q2</option>
<option value='branches/2014Q3'>branches/2014Q3</option>
<option value='branches/2014Q4'>branches/2014Q4</option>
<option value='branches/2015Q1'>branches/2015Q1</option>
<option value='branches/2015Q2'>branches/2015Q2</option>
<option value='branches/2015Q3'>branches/2015Q3</option>
<option value='branches/2015Q4'>branches/2015Q4</option>
<option value='branches/2016Q1'>branches/2016Q1</option>
<option value='branches/2016Q2'>branches/2016Q2</option>
<option value='branches/2016Q3'>branches/2016Q3</option>
<option value='branches/2016Q4'>branches/2016Q4</option>
<option value='branches/2017Q1'>branches/2017Q1</option>
<option value='branches/2017Q2'>branches/2017Q2</option>
<option value='branches/2017Q3'>branches/2017Q3</option>
<option value='branches/2017Q4'>branches/2017Q4</option>
<option value='branches/2018Q1'>branches/2018Q1</option>
<option value='branches/2018Q2'>branches/2018Q2</option>
<option value='branches/2018Q3'>branches/2018Q3</option>
<option value='branches/2018Q4'>branches/2018Q4</option>
<option value='branches/2019Q1'>branches/2019Q1</option>
<option value='branches/2019Q2'>branches/2019Q2</option>
<option value='branches/2019Q3'>branches/2019Q3</option>
<option value='branches/2019Q4'>branches/2019Q4</option>
<option value='branches/2020Q1'>branches/2020Q1</option>
<option value='branches/2020Q2'>branches/2020Q2</option>
<option value='branches/2020Q3'>branches/2020Q3</option>
<option value='branches/2020Q4'>branches/2020Q4</option>
<option value='branches/2021Q1'>branches/2021Q1</option>
<option value='branches/RELEASE_8_4_0'>branches/RELEASE_8_4_0</option>
<option value='branches/RELENG_2_1_0'>branches/RELENG_2_1_0</option>
<option value='branches/RELENG_2_2'>branches/RELENG_2_2</option>
<option value='branches/RELENG_9_1_0'>branches/RELENG_9_1_0</option>
<option value='branches/RELENG_9_2_0'>branches/RELENG_9_2_0</option>
<option value='dependabot/npm_and_yarn/devel/electron4/files/eslint-utils-1.4.3'>dependabot/npm_and_yarn/devel/electron4/files/eslint-utils-1.4.3</option>
<option value='dependabot/npm_and_yarn/devel/electron4/files/lodash-4.17.15'>dependabot/npm_and_yarn/devel/electron4/files/lodash-4.17.15</option>
<option value='dependabot/npm_and_yarn/devel/electron4/files/lodash.merge-4.6.2'>dependabot/npm_and_yarn/devel/electron4/files/lodash.merge-4.6.2</option>
<option value='dependabot/npm_and_yarn/devel/electron4/files/lodash.template-4.5.0'>dependabot/npm_and_yarn/devel/electron4/files/lodash.template-4.5.0</option>
<option value='dependabot/npm_and_yarn/devel/electron4/files/minimist-1.2.2'>dependabot/npm_and_yarn/devel/electron4/files/minimist-1.2.2</option>
<option value='dependabot/npm_and_yarn/devel/electron4/files/mixin-deep-1.3.2' selected='selected'>dependabot/npm_and_yarn/devel/electron4/files/mixin-deep-1.3.2</option>
<option value='main'>main</option>
<option value='master'>master</option>
<option value='svn_head'>svn_head</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>FreeBSD Ports (https://github.com/freebsd/freebsd-ports)</td><td class='sub right'></td></tr></table>
<table class='tabs'><tr><td>
<a href='/~lantw44/cgit/cgit.cgi/freebsd-ports/about/?h=dependabot/npm_and_yarn/devel/electron4/files/mixin-deep-1.3.2'>about</a><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports/?h=dependabot/npm_and_yarn/devel/electron4/files/mixin-deep-1.3.2'>summary</a><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports/refs/?h=dependabot/npm_and_yarn/devel/electron4/files/mixin-deep-1.3.2&amp;id=76ec03a72c2b16da982bce6e922e45c4bf788bdd'>refs</a><a class='active' href='/~lantw44/cgit/cgit.cgi/freebsd-ports/log/misc/py-tflearn?h=dependabot/npm_and_yarn/devel/electron4/files/mixin-deep-1.3.2'>log</a><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports/tree/misc/py-tflearn?h=dependabot/npm_and_yarn/devel/electron4/files/mixin-deep-1.3.2&amp;id=76ec03a72c2b16da982bce6e922e45c4bf788bdd'>tree</a><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports/commit/misc/py-tflearn?h=dependabot/npm_and_yarn/devel/electron4/files/mixin-deep-1.3.2&amp;id=76ec03a72c2b16da982bce6e922e45c4bf788bdd'>commit</a><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports/diff/misc/py-tflearn?h=dependabot/npm_and_yarn/devel/electron4/files/mixin-deep-1.3.2&amp;id=76ec03a72c2b16da982bce6e922e45c4bf788bdd'>diff</a><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports/stats/misc/py-tflearn?h=dependabot/npm_and_yarn/devel/electron4/files/mixin-deep-1.3.2'>stats</a></td><td class='form'><form class='right' method='get' action='/~lantw44/cgit/cgit.cgi/freebsd-ports/log/misc/py-tflearn'>
<input type='hidden' name='h' value='dependabot/npm_and_yarn/devel/electron4/files/mixin-deep-1.3.2'/><input type='hidden' name='id' value='76ec03a72c2b16da982bce6e922e45c4bf788bdd'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/~lantw44/cgit/cgit.cgi/freebsd-ports/log/?h=dependabot/npm_and_yarn/devel/electron4/files/mixin-deep-1.3.2&amp;id=76ec03a72c2b16da982bce6e922e45c4bf788bdd'>root</a>/<a href='/~lantw44/cgit/cgit.cgi/freebsd-ports/log/misc?h=dependabot/npm_and_yarn/devel/electron4/files/mixin-deep-1.3.2&amp;id=76ec03a72c2b16da982bce6e922e45c4bf788bdd'>misc</a>/<a href='/~lantw44/cgit/cgit.cgi/freebsd-ports/log/misc/py-tflearn?h=dependabot/npm_and_yarn/devel/electron4/files/mixin-deep-1.3.2&amp;id=76ec03a72c2b16da982bce6e922e45c4bf788bdd'>py-tflearn</a></div><div class='content'><table class='list nowrap'><tr class='nohover'><th></th><th class='left'>Commit message (<a href='/~lantw44/cgit/cgit.cgi/freebsd-ports/log/misc/py-tflearn?h=dependabot/npm_and_yarn/devel/electron4/files/mixin-deep-1.3.2&amp;id=76ec03a72c2b16da982bce6e922e45c4bf788bdd&amp;showmsg=1'>Expand</a>)</th><th class='left'>Author</th><th class='left'>Age</th><th class='left'>Files</th><th class='left'>Lines</th></tr>