diff options
author | Jason Leach <jasonleach@usa.net> | 2001-01-26 03:35:54 +0800 |
---|---|---|
committer | Jacob Leach <jleach@src.gnome.org> | 2001-01-26 03:35:54 +0800 |
commit | 024435f8ccbc749533474c882627680145649a4c (patch) | |
tree | c766fcebd81c22db378c3e10798485c1d571b45d /composer | |
parent | 593f0036f8dfa204eb0d70c6ad5b5243ee2b49a7 (diff) | |
download | gsoc2013-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')
-rw-r--r-- | composer/ChangeLog | 19 | ||||
-rw-r--r-- | composer/e-msg-composer-hdrs.c | 19 | ||||
-rw-r--r-- | composer/e-msg-composer-hdrs.h | 2 | ||||
-rw-r--r-- | composer/e-msg-composer.c | 55 | ||||
-rw-r--r-- | composer/e-msg-composer.h | 5 |
5 files changed, 92 insertions, 8 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog index 10365cc362..34fffcad58 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,22 @@ +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 + composer_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. + 2001-01-24 Jeffrey Stedfast <fejj@ximian.com> * e-msg-composer.c (menu_security_pgp_encrypt_cb): New callback. diff --git a/composer/e-msg-composer-hdrs.c b/composer/e-msg-composer-hdrs.c index 4228bd5f4c..1ac061ed82 100644 --- a/composer/e-msg-composer-hdrs.c +++ b/composer/e-msg-composer-hdrs.c @@ -68,6 +68,7 @@ static GtkTableClass *parent_class = NULL; enum { SHOW_ADDRESS_DIALOG, SUBJECT_CHANGED, + HDRS_CHANGED, LAST_SIGNAL }; @@ -209,7 +210,7 @@ addressbook_entry_changed (BonoboListener *listener, { EMsgComposerHdrs *hdrs = E_MSG_COMPOSER_HDRS (user_data); - hdrs->has_changed = TRUE; + gtk_signal_emit (GTK_OBJECT (hdrs), signals[HDRS_CHANGED]); } static GtkWidget * @@ -262,14 +263,13 @@ entry_changed (GtkWidget *entry, EMsgComposerHdrs *hdrs) gchar *tmp; gchar *subject; - /* Mark the composer as changed so it prompts to save on close */ - hdrs->has_changed = TRUE; - tmp = e_msg_composer_hdrs_get_subject (hdrs); subject = e_utf8_to_gtk_string (GTK_WIDGET (entry), tmp); gtk_signal_emit (GTK_OBJECT (hdrs), signals[SUBJECT_CHANGED], subject); g_free (tmp); + + gtk_signal_emit (GTK_OBJECT (hdrs), signals[HDRS_CHANGED]); } static GtkWidget * @@ -448,6 +448,15 @@ class_init (EMsgComposerHdrsClass *class) GTK_TYPE_NONE, 1, GTK_TYPE_STRING); + signals[HDRS_CHANGED] = + gtk_signal_new ("hdrs_changed", + GTK_RUN_LAST, + object_class->type, + GTK_SIGNAL_OFFSET (EMsgComposerHdrsClass, + hdrs_changed), + gtk_marshal_NONE__NONE, + GTK_TYPE_NONE, 0); + gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); } @@ -475,8 +484,6 @@ init (EMsgComposerHdrs *hdrs) hdrs->priv = priv; hdrs->account = NULL; - - hdrs->has_changed = FALSE; } diff --git a/composer/e-msg-composer-hdrs.h b/composer/e-msg-composer-hdrs.h index dc48356c06..9b1c5c4c84 100644 --- a/composer/e-msg-composer-hdrs.h +++ b/composer/e-msg-composer-hdrs.h @@ -60,6 +60,8 @@ struct _EMsgComposerHdrsClass { void (* show_address_dialog) (EMsgComposerHdrs *hdrs); void (* subject_changed) (EMsgComposerHdrs *hdrs, gchar *subject); + + void (* hdrs_changed) (EMsgComposerHdrs *hdrs); }; 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; +} diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h index 428bd9f110..ef60ebd1e4 100644 --- a/composer/e-msg-composer.h +++ b/composer/e-msg-composer.h @@ -77,6 +77,8 @@ struct _EMsgComposer { gboolean send_html : 1; gboolean pgp_sign : 1; gboolean pgp_encrypt : 1; + + gboolean has_changed : 1; }; struct _EMsgComposerClass { @@ -128,6 +130,9 @@ gboolean e_msg_composer_get_pgp_encrypt (EMsgComposer *compose void e_msg_composer_clear_inlined_table (EMsgComposer *composer); gchar * e_msg_composer_guess_mime_type (const gchar *file_name); +void e_msg_composer_set_changed (EMsgComposer *composer); +void e_msg_composer_unset_changed (EMsgComposer *composer); + #ifdef __cplusplus } #endif /* __cplusplus */ |