aboutsummaryrefslogtreecommitdiffstats
path: root/composer/e-msg-composer.c
diff options
context:
space:
mode:
authorJP Rosevear <jpr@arcavia.com>2000-07-29 14:04:24 +0800
committerJP Rosevear <jpr@src.gnome.org>2000-07-29 14:04:24 +0800
commit121d056d45b9766532ba9b7ec3f687c04582194f (patch)
tree75859f4896fce1e883e5c1f5440097092db0f7ad /composer/e-msg-composer.c
parentf34353458d545d679e9daebb22ade4f1f02c8e00 (diff)
downloadgsoc2013-evolution-121d056d45b9766532ba9b7ec3f687c04582194f.tar.gz
gsoc2013-evolution-121d056d45b9766532ba9b7ec3f687c04582194f.tar.zst
gsoc2013-evolution-121d056d45b9766532ba9b7ec3f687c04582194f.zip
New function to create composer with sig file set.
2000-07-28 JP Rosevear <jpr@arcavia.com> * 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 <jpr@arcavia.com> * 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
Diffstat (limited to 'composer/e-msg-composer.c')
-rw-r--r--composer/e-msg-composer.c80
1 files changed, 70 insertions, 10 deletions
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<BR>\n<PRE>\n%s</PRE>",
@@ -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