From eb87301392618f045df2df70149c95f637179413 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Fri, 21 Apr 2000 18:38:04 +0000 Subject: new functions * e-msg-composer.c (e_msg_composer_set_headers): (e_msg_composer_set_body_text): new functions * e-msg-composer-hdrs.c: const poisoning (e_msg_composer_hdrs_set_subject): (e_msg_composer_hdrs_get_subject): new functions * e-msg-composer-address-entry.c: const poisoning svn path=/trunk/; revision=2548 --- composer/ChangeLog | 11 +++++++++ composer/e-msg-composer-address-entry.c | 4 +-- composer/e-msg-composer-address-entry.h | 2 +- composer/e-msg-composer-hdrs.c | 29 +++++++++++++++++++--- composer/e-msg-composer-hdrs.h | 9 ++++--- composer/e-msg-composer.c | 43 +++++++++++++++++++++++++++++++++ composer/e-msg-composer.h | 10 ++++++++ 7 files changed, 99 insertions(+), 9 deletions(-) diff --git a/composer/ChangeLog b/composer/ChangeLog index e21591209e..ea41af4a34 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,14 @@ +2000-04-21 Dan Winship + + * e-msg-composer.c (e_msg_composer_set_headers): + (e_msg_composer_set_body_text): new functions + + * e-msg-composer-hdrs.c: const poisoning + (e_msg_composer_hdrs_set_subject): + (e_msg_composer_hdrs_get_subject): new functions + + * e-msg-composer-address-entry.c: const poisoning + 2000-04-20 Dan Winship * e-msg-composer.c (get_editor_text, set_editor_text): new diff --git a/composer/e-msg-composer-address-entry.c b/composer/e-msg-composer-address-entry.c index be63c815f5..ce946d203e 100644 --- a/composer/e-msg-composer-address-entry.c +++ b/composer/e-msg-composer-address-entry.c @@ -151,10 +151,10 @@ e_msg_composer_address_entry_get_addresses (EMsgComposerAddressEntry *entry) **/ void e_msg_composer_address_entry_set_list (EMsgComposerAddressEntry *entry, - GList *list) + const GList *list) { GString *string; - GList *p; + const GList *p; g_return_if_fail (entry != NULL); diff --git a/composer/e-msg-composer-address-entry.h b/composer/e-msg-composer-address-entry.h index 8e926272e4..f2b671bde4 100644 --- a/composer/e-msg-composer-address-entry.h +++ b/composer/e-msg-composer-address-entry.h @@ -54,7 +54,7 @@ GtkType e_msg_composer_address_entry_get_type (void); GtkWidget *e_msg_composer_address_entry_new (void); GList *e_msg_composer_address_entry_get_addresses (EMsgComposerAddressEntry *entry); void e_msg_composer_address_entry_set_list (EMsgComposerAddressEntry *entry, - GList *list); + const GList *list); #ifdef __cplusplus } diff --git a/composer/e-msg-composer-hdrs.c b/composer/e-msg-composer-hdrs.c index 2c27531bb8..e69c15efae 100644 --- a/composer/e-msg-composer-hdrs.c +++ b/composer/e-msg-composer-hdrs.c @@ -285,7 +285,7 @@ e_msg_composer_hdrs_to_message (EMsgComposerHdrs *hdrs, void e_msg_composer_hdrs_set_to (EMsgComposerHdrs *hdrs, - GList *to_list) + const GList *to_list) { EMsgComposerAddressEntry *entry; @@ -298,7 +298,7 @@ e_msg_composer_hdrs_set_to (EMsgComposerHdrs *hdrs, void e_msg_composer_hdrs_set_cc (EMsgComposerHdrs *hdrs, - GList *cc_list) + const GList *cc_list) { EMsgComposerAddressEntry *entry; @@ -311,7 +311,7 @@ e_msg_composer_hdrs_set_cc (EMsgComposerHdrs *hdrs, void e_msg_composer_hdrs_set_bcc (EMsgComposerHdrs *hdrs, - GList *bcc_list) + const GList *bcc_list) { EMsgComposerAddressEntry *entry; @@ -322,6 +322,20 @@ e_msg_composer_hdrs_set_bcc (EMsgComposerHdrs *hdrs, e_msg_composer_address_entry_set_list (entry, bcc_list); } +void +e_msg_composer_hdrs_set_subject (EMsgComposerHdrs *hdrs, + const char *subject) +{ + GtkEntry *entry; + + g_return_if_fail (hdrs != NULL); + g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs)); + g_return_if_fail (subject != NULL); + + entry = GTK_ENTRY (hdrs->priv->subject_entry); + gtk_entry_set_text (entry, subject); +} + GList * e_msg_composer_hdrs_get_to (EMsgComposerHdrs *hdrs) @@ -353,3 +367,12 @@ e_msg_composer_hdrs_get_bcc (EMsgComposerHdrs *hdrs) (E_MSG_COMPOSER_ADDRESS_ENTRY (hdrs->priv->bcc_entry)); } +const char * +e_msg_composer_hdrs_get_subject (EMsgComposerHdrs *hdrs) +{ + g_return_val_if_fail (hdrs != NULL, NULL); + g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL); + + return gtk_entry_get_text + (GTK_ENTRY (hdrs->priv->subject_entry)); +} diff --git a/composer/e-msg-composer-hdrs.h b/composer/e-msg-composer-hdrs.h index d053573d85..edff75518a 100644 --- a/composer/e-msg-composer-hdrs.h +++ b/composer/e-msg-composer-hdrs.h @@ -62,15 +62,18 @@ void e_msg_composer_hdrs_to_message (EMsgComposerHdrs *hdrs, CamelMimeMessage *msg); void e_msg_composer_hdrs_set_to (EMsgComposerHdrs *hdrs, - GList *to_list); + const GList *to_list); void e_msg_composer_hdrs_set_cc (EMsgComposerHdrs *hdrs, - GList *cc_list); + const GList *cc_list); void e_msg_composer_hdrs_set_bcc (EMsgComposerHdrs *hdrs, - GList *bcc_list); + const GList *bcc_list); +void e_msg_composer_hdrs_set_subject (EMsgComposerHdrs *hdrs, + const char *subject); GList *e_msg_composer_hdrs_get_to (EMsgComposerHdrs *hdrs); GList *e_msg_composer_hdrs_get_cc (EMsgComposerHdrs *hdrs); GList *e_msg_composer_hdrs_get_bcc (EMsgComposerHdrs *hdrs); +const char*e_msg_composer_hdrs_get_subject (EMsgComposerHdrs *hdrs); #ifdef _cplusplus } diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 3db5180972..220880ee4c 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -640,6 +640,49 @@ e_msg_composer_show_attachments (EMsgComposer *composer, } +/** + * e_msg_composer_set_headers: + * @composer: a composer object + * @to: the values for the "To" header + * @cc: the values for the "Cc" header + * @bcc: the values for the "Bcc" header + * @subject: the value for the "Subject" header + * + * Sets the headers in the composer to the given values. + **/ +void +e_msg_composer_set_headers (EMsgComposer *composer, const GList *to, + const GList *cc, const GList *bcc, + const char *subject) +{ + EMsgComposerHdrs *hdrs; + + g_return_if_fail (E_IS_MSG_COMPOSER (composer)); + hdrs = E_MSG_COMPOSER_HDRS (composer->hdrs); + + e_msg_composer_hdrs_set_to (hdrs, to); + e_msg_composer_hdrs_set_cc (hdrs, cc); + e_msg_composer_hdrs_set_bcc (hdrs, bcc); + e_msg_composer_hdrs_set_subject (hdrs, subject); +} + + +/** + * e_msg_composer_set_body_text: + * @composer: a composer object + * @text: the HTML text to initialize the editor with + * + * Loads the given HTML text into the editor. + **/ +void +e_msg_composer_set_body_text (EMsgComposer *composer, const char *text) +{ + g_return_if_fail (E_IS_MSG_COMPOSER (composer)); + + set_editor_text (BONOBO_WIDGET (composer->editor), text); +} + + /** * e_msg_composer_get_message: * @composer: A message composer widget diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h index 5109918dc8..5b4cfecb68 100644 --- a/composer/e-msg-composer.h +++ b/composer/e-msg-composer.h @@ -72,10 +72,20 @@ struct _EMsgComposerClass { GtkType e_msg_composer_get_type (void); + void e_msg_composer_construct (EMsgComposer *composer); GtkWidget *e_msg_composer_new (void); void e_msg_composer_show_attachments (EMsgComposer *composer, gboolean show); + +void e_msg_composer_set_headers (EMsgComposer *composer, + const GList *to, + const GList *cc, + const GList *bcc, + const char *subject); +void e_msg_composer_set_body_text (EMsgComposer *composer, + const char *text); + CamelMimeMessage *e_msg_composer_get_message (EMsgComposer *composer); #ifdef __cplusplus -- cgit