aboutsummaryrefslogtreecommitdiffstats
path: root/composer/e-msg-composer.c
diff options
context:
space:
mode:
authorJason Leach <jasonleach@usa.net>2001-01-26 03:35:54 +0800
committerJacob Leach <jleach@src.gnome.org>2001-01-26 03:35:54 +0800
commit024435f8ccbc749533474c882627680145649a4c (patch)
treec766fcebd81c22db378c3e10798485c1d571b45d /composer/e-msg-composer.c
parent593f0036f8dfa204eb0d70c6ad5b5243ee2b49a7 (diff)
downloadgsoc2013-evolution-024435f8ccbc749533474c882627680145649a4c.tar
gsoc2013-evolution-024435f8ccbc749533474c882627680145649a4c.tar.gz
gsoc2013-evolution-024435f8ccbc749533474c882627680145649a4c.tar.bz2
gsoc2013-evolution-024435f8ccbc749533474c882627680145649a4c.tar.lz
gsoc2013-evolution-024435f8ccbc749533474c882627680145649a4c.tar.xz
gsoc2013-evolution-024435f8ccbc749533474c882627680145649a4c.tar.zst
gsoc2013-evolution-024435f8ccbc749533474c882627680145649a4c.zip
(Moving the flag for has_changed from the Hdrs to the Composer itself.
2001-01-25 Jason Leach <jasonleach@usa.net> (Moving the flag for has_changed from the Hdrs to the Composer itself. Providing public methods to set/unset a composer as changed. Adding attachments now flags the composer as changed) * e-msg-composer.c (e_msg_composer_unset_changed): New function. (e_msg_composer_set_changed): New function. * e-msg-composer.c (hdrs_changed_cb): Callback to the new signal, uses the new composer_set_changed. (attachment_bar_changed_cb): Add a call to the new _set_changed. * e-msg-composer-hdrs.c (class_init): New signal "hdrs_changed" to tell the parent composer that any of the headers have changed. (addressbook_entry_changed): emit the new signal here. (entry_changed): And here. svn path=/trunk/; revision=7818
Diffstat (limited to 'composer/e-msg-composer.c')
-rw-r--r--composer/e-msg-composer.c55
1 files changed, 53 insertions, 2 deletions
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 85ba03651b..ef4b8414f2 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -807,7 +807,7 @@ exit_dialog_cb (int reply, EMsgComposer *composer)
default:
}
}
-
+
static void
do_exit (EMsgComposer *composer)
{
@@ -815,7 +815,7 @@ do_exit (EMsgComposer *composer)
GtkWidget *label;
gint button;
- if (E_MSG_COMPOSER_HDRS (composer->hdrs)->has_changed) {
+ if (composer->has_changed) {
dialog = gnome_dialog_new (_("Evolution"),
GNOME_STOCK_BUTTON_YES, /* Save */
GNOME_STOCK_BUTTON_NO, /* Don't save */
@@ -1271,6 +1271,9 @@ attachment_bar_changed_cb (EMsgComposerAttachmentBar *bar,
e_msg_composer_show_attachments (composer, TRUE);
else
e_msg_composer_show_attachments (composer, FALSE);
+
+ /* Mark the composer as changed so it prompts about unsaved changes on close */
+ e_msg_composer_set_changed (composer);
}
static void
@@ -1290,6 +1293,18 @@ subject_changed_cb (EMsgComposerHdrs *hdrs,
g_free (subject);
}
+static void
+hdrs_changed_cb (EMsgComposerHdrs *hdrs,
+ void *data)
+{
+ EMsgComposer *composer;
+
+ composer = E_MSG_COMPOSER (data);
+
+ /* Mark the composer as changed so it prompts about unsaved changes on close */
+ e_msg_composer_set_changed (composer);
+}
+
/* GtkObject methods. */
@@ -1459,6 +1474,8 @@ init (EMsgComposer *composer)
composer->send_html = FALSE;
composer->pgp_sign = FALSE;
composer->pgp_encrypt = FALSE;
+
+ composer->has_changed = FALSE;
}
@@ -1523,6 +1540,8 @@ e_msg_composer_construct (EMsgComposer *composer)
gtk_box_pack_start (GTK_BOX (vbox), composer->hdrs, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (composer->hdrs), "subject_changed",
GTK_SIGNAL_FUNC (subject_changed_cb), composer);
+ gtk_signal_connect (GTK_OBJECT (composer->hdrs), "hdrs_changed",
+ GTK_SIGNAL_FUNC (hdrs_changed_cb), composer);
gtk_widget_show (composer->hdrs);
/* Editor component. */
@@ -2338,3 +2357,35 @@ e_msg_composer_guess_mime_type (const gchar *file_name)
} else
return NULL;
}
+
+/**
+ * e_msg_composer_set_changed:
+ * @composer: An EMsgComposer object.
+ *
+ * Mark the composer as changed, so before the composer gets destroyed
+ * the user will be prompted about unsaved changes.
+ **/
+void
+e_msg_composer_set_changed (EMsgComposer *composer)
+{
+ g_return_if_fail (composer != NULL);
+ g_return_if_fail (E_IS_MSG_COMPOSER (composer));
+
+ composer->has_changed = TRUE;
+}
+
+/**
+ * e_msg_composer_unset_changed:
+ * @composer: An EMsgComposer object.
+ *
+ * Mark the composer as unchanged, so no prompt about unsaved changes
+ * will appear before destroying the composer.
+ **/
+void
+e_msg_composer_unset_changed (EMsgComposer *composer)
+{
+ g_return_if_fail (composer != NULL);
+ g_return_if_fail (E_IS_MSG_COMPOSER (composer));
+
+ composer->has_changed = FALSE;
+}