From 121d056d45b9766532ba9b7ec3f687c04582194f Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Sat, 29 Jul 2000 06:04:24 +0000 Subject: New function to create composer with sig file set. 2000-07-28 JP Rosevear * e-msg-composer.c (e_msg_composer_new_with_sig_file): New function to create composer with sig file set. (e_msg_composer_get_sig_file): New function to get sig file (e_msg_composer_set_sig_file): New function to set sig file 2000-07-29 JP Rosevear * mail-format.c (mail_generate_reply): Use new mail config stuff * component-factory.c (create_imap_storage): Use new mail config stuff (create_news_storage): ditto * evolution-mail.schemas: Gconf schema for evolution mail * mail-config-druid.glade: Gladification of config druid * mail-config.h: New header with config structs. * mail-config.c: Rewrite of GUI configuration tools to use new config structs. Stores multiple identities and sources now. Still only uses the first one found. (mail_config_fetch): Returns MailConfig struct to caller for configuration queries. (mail_config): Renamed function to show mail config dialog. (mail_config_druid): Renamed function to show mail config druid. * mail-ops.c (create_msg_composer): Use e_msg_composer_new_with_sig_file and new config stuff (check_configured): Use new config stuff (fetch_mail): ditto (composer_send_cb): ditto svn path=/trunk/; revision=4413 --- composer/ChangeLog | 7 +++++ composer/e-msg-composer.c | 80 +++++++++++++++++++++++++++++++++++++++++------ composer/e-msg-composer.h | 7 +++++ 3 files changed, 84 insertions(+), 10 deletions(-) (limited to 'composer') diff --git a/composer/ChangeLog b/composer/ChangeLog index 9ae33b15d5..fb8cb90743 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,10 @@ +2000-07-28 JP Rosevear + + * e-msg-composer.c (e_msg_composer_new_with_sig_file): New + function to create composer with sig file set. + (e_msg_composer_get_sig_file): New function to get sig file + (e_msg_composer_set_sig_file): New function to set sig file + 2000-07-25 Michael Meeks * e-msg-composer.c (get_text): add textual exception printout. diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 90f019b11e..67b1eaa206 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -304,17 +304,14 @@ build_message (EMsgComposer *composer) } static char * -get_signature (void) +get_signature (char *sigfile) { - char *path, *sigfile, *rawsig; + char *rawsig; static char *htmlsig = NULL; static time_t sigmodtime = -1; struct stat st; int fd; - path = g_strdup_printf ("=%s/config=/mail/id_sig", evolution_dir); - sigfile = gnome_config_get_string (path); - g_free (path); if (!sigfile || !*sigfile) { return NULL; } @@ -357,14 +354,14 @@ get_signature (void) } static void -set_editor_text (BonoboWidget *editor, const char *text) +set_editor_text (BonoboWidget *editor, char *sig_file, const char *text) { Bonobo_PersistStream persist; BonoboStream *stream; CORBA_Environment ev; char *sig, *fulltext; - sig = get_signature (); + sig = get_signature (sig_file); if (sig) { if (!strncmp ("--\n", sig, sizeof ("--\n"))) fulltext = g_strdup_printf ("%s
\n
\n%s
", @@ -1216,11 +1213,37 @@ e_msg_composer_new (void) e_msg_composer_construct (E_MSG_COMPOSER (new)); /* Load the signature, if any. */ - set_editor_text (BONOBO_WIDGET (E_MSG_COMPOSER (new)->editor), ""); + set_editor_text (BONOBO_WIDGET (E_MSG_COMPOSER (new)->editor), + NULL, ""); return new; } +/** + * e_msg_composer_new_with_sig_file: + * + * Create a new message composer widget. This function must be called + * within the GTK+ main loop, or it will fail. Sets the signature + * file. + * + * Return value: A pointer to the newly created widget + **/ +GtkWidget * +e_msg_composer_new_with_sig_file (char *sig_file) +{ + GtkWidget *new; + + g_return_val_if_fail (gtk_main_level () > 0, NULL); + + new = gtk_type_new (e_msg_composer_get_type ()); + e_msg_composer_construct (E_MSG_COMPOSER (new)); + + /* Load the signature, if any. */ + set_editor_text (BONOBO_WIDGET (E_MSG_COMPOSER (new)->editor), + sig_file, ""); + + return new; +} static GList * add_recipients (GList *list, const char *recips, gboolean decode) @@ -1337,7 +1360,8 @@ e_msg_composer_new_from_url (const char *url) if (body) { char *htmlbody = e_text_to_html (body, E_TEXT_TO_HTML_PRE); - set_editor_text (BONOBO_WIDGET (composer->editor), htmlbody); + set_editor_text (BONOBO_WIDGET (composer->editor), + NULL, htmlbody); g_free (htmlbody); } @@ -1401,7 +1425,8 @@ 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); + set_editor_text (BONOBO_WIDGET (composer->editor), + composer->sig_file, text); } @@ -1468,6 +1493,41 @@ e_msg_composer_get_message (EMsgComposer *composer) } + +/** + * e_msg_composer_set_sig: + * @composer: A message composer widget + * @path: Signature file + * + * Set a signature + **/ +void +e_msg_composer_set_sig_file (EMsgComposer *composer, const char *sig_file) +{ + g_return_if_fail (composer != NULL); + g_return_if_fail (E_IS_MSG_COMPOSER (composer)); + + composer->sig_file = g_strdup (sig_file); +} + +/** + * e_msg_composer_get_sig_file: + * @composer: A message composer widget + * + * Get the signature file + * + * Return value: The signature file. + **/ +char * +e_msg_composer_get_sig_file (EMsgComposer *composer) +{ + g_return_val_if_fail (composer != NULL, NULL); + g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), NULL); + + return composer->sig_file; +} + + /** * e_msg_composer_set_send_html: * @composer: A message composer widget diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h index 2b802ffc19..107b9e69a0 100644 --- a/composer/e-msg-composer.h +++ b/composer/e-msg-composer.h @@ -64,6 +64,8 @@ struct _EMsgComposer { Bonobo_PersistFile persist_file_interface; Bonobo_PersistStream persist_stream_interface; + char *sig_file; + gboolean attachment_bar_visible : 1; gboolean send_html : 1; }; @@ -80,6 +82,7 @@ GtkType e_msg_composer_get_type (void); void e_msg_composer_construct (EMsgComposer *composer); GtkWidget *e_msg_composer_new (void); +GtkWidget *e_msg_composer_new_with_sig_file (char *sig_file); GtkWidget *e_msg_composer_new_from_url (const char *url); void e_msg_composer_show_attachments (EMsgComposer *composer, gboolean show); @@ -99,6 +102,10 @@ void e_msg_composer_attach (EMsgComposer *composer, CamelMimeMessage *e_msg_composer_get_message (EMsgComposer *composer); +void e_msg_composer_set_sig_file (EMsgComposer *composer, + const char *sig_file); +char *e_msg_composer_get_sig_file (EMsgComposer *composer); + void e_msg_composer_set_send_html (EMsgComposer *composer, gboolean send_html); gboolean e_msg_composer_get_send_html (EMsgComposer *composer); -- cgit