From 311491b26baf67164d5486b13cf794c29d6000cf Mon Sep 17 00:00:00 2001 From: Radek Doulik Date: Thu, 28 Jun 2001 16:23:55 +0000 Subject: simplified(refactored) signature handling + better support for html signatures 2001-06-28 Radek Doulik * mail-config.c: use new fields everywhere * mail-config.h: as below * Mail.idl: added html_signature and has_html_signature svn path=/trunk/; revision=10564 --- mail/ChangeLog | 8 +++ mail/Mail.idl | 2 + mail/mail-account-gui.c | 13 ++++- mail/mail-account-gui.h | 2 + mail/mail-callbacks.c | 25 ++------ mail/mail-config.c | 21 ++++++- mail/mail-config.glade | 152 +++++++++++++++++++++++++++++++++++++++--------- mail/mail-config.h | 2 + 8 files changed, 177 insertions(+), 48 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index 3a26eb9156..a066751d53 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,11 @@ +2001-06-28 Radek Doulik + + * mail-config.c: use new fields everywhere + + * mail-config.h: as below + + * Mail.idl: added html_signature and has_html_signature + 2001-06-28 Ettore Perazzoli * component-factory.c (component_fn): Register for the "mailto" diff --git a/mail/Mail.idl b/mail/Mail.idl index d864c59c8c..6144bb22a8 100644 --- a/mail/Mail.idl +++ b/mail/Mail.idl @@ -46,6 +46,8 @@ module Evolution { string address; string organization; string signature; + string html_signature; + boolean has_html_signature; }; struct Service { diff --git a/mail/mail-account-gui.c b/mail/mail-account-gui.c index 5bc80570fc..93b1dc3d25 100644 --- a/mail/mail-account-gui.c +++ b/mail/mail-account-gui.c @@ -798,8 +798,11 @@ mail_account_gui_new (MailConfigAccount *account) gui->full_name = GTK_ENTRY (glade_xml_get_widget (gui->xml, "identity_full_name")); gui->email_address = GTK_ENTRY (glade_xml_get_widget (gui->xml, "identity_address")); gui->organization = GTK_ENTRY (glade_xml_get_widget (gui->xml, "identity_organization")); - gui->signature = GNOME_FILE_ENTRY (glade_xml_get_widget (gui->xml, "identity_signature")); + gui->signature = GNOME_FILE_ENTRY (glade_xml_get_widget (gui->xml, "fileentry_signature")); + gui->html_signature = GNOME_FILE_ENTRY (glade_xml_get_widget (gui->xml, "fileentry_html_signature")); + gui->has_html_signature = GTK_CHECK_BUTTON (glade_xml_get_widget (gui->xml, "check_html_signature")); gnome_file_entry_set_default_path (gui->signature, g_get_home_dir ()); + gnome_file_entry_set_default_path (gui->html_signature, g_get_home_dir ()); if (account->id) { if (account->id->name) e_utf8_gtk_entry_set_text (gui->full_name, account->id->name); @@ -812,6 +815,12 @@ mail_account_gui_new (MailConfigAccount *account) gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (gui->signature)), account->id->signature); } + if (account->id->html_signature) { + gnome_file_entry_set_default_path (gui->html_signature, account->id->html_signature); + gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (gui->html_signature)), + account->id->html_signature); + } + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gui->has_html_signature), account->id->has_html_signature); } /* Source */ @@ -1183,6 +1192,8 @@ mail_account_gui_save (MailAccountGui *gui) account->id->address = e_utf8_gtk_entry_get_text (gui->email_address); account->id->organization = e_utf8_gtk_entry_get_text (gui->organization); account->id->signature = gnome_file_entry_get_full_path (gui->signature, TRUE); + account->id->html_signature = gnome_file_entry_get_full_path (gui->html_signature, TRUE); + account->id->has_html_signature = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gui->has_html_signature)); old_enabled = account->source && account->source->enabled; service_destroy (account->source); diff --git a/mail/mail-account-gui.h b/mail/mail-account-gui.h index f1989a4ec4..910e86c0af 100644 --- a/mail/mail-account-gui.h +++ b/mail/mail-account-gui.h @@ -66,6 +66,8 @@ typedef struct { GtkEntry *email_address; GtkEntry *organization; GnomeFileEntry *signature; + GnomeFileEntry *html_signature; + GtkToggleButton *has_html_signature; /* incoming mail */ MailAccountGuiService source; diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c index a51f573482..209ff16320 100644 --- a/mail/mail-callbacks.c +++ b/mail/mail-callbacks.c @@ -415,20 +415,14 @@ create_msg_composer (const char *url) { const MailConfigAccount *account; gboolean send_html; - gchar *sig_file = NULL; EMsgComposer *composer; account = mail_config_get_default_account (); send_html = mail_config_get_send_html (); - if (account->id) - sig_file = account->id->signature; - composer = url ? e_msg_composer_new_from_url (url) : e_msg_composer_new (); - if (composer) { + if (composer) e_msg_composer_set_send_html (composer, send_html); - e_msg_composer_set_sig_file (composer, sig_file); - } return GTK_WIDGET (composer); } @@ -588,23 +582,17 @@ mail_generate_reply (CamelFolder *folder, CamelMimeMessage *message, const char const char *name = NULL, *address = NULL, *source = NULL; const char *message_id, *references, *reply_addr = NULL; char *text, *subject, *date_str; - const MailConfigAccount *me = NULL; - const MailConfigIdentity *id; + const MailConfigAccount *me; const GSList *accounts = NULL; GList *to = NULL, *cc = NULL; EMsgComposer *composer; - gchar *sig_file = NULL; time_t date; int offset; source = camel_mime_message_get_source (message); me = mail_config_get_account_by_source_url (source); - - id = me ? me->id : mail_config_get_default_identity (); - if (id) - sig_file = id->signature; - - composer = e_msg_composer_new_with_sig_file (sig_file, mail_config_get_send_html ()); + + composer = e_msg_composer_new_with_sig_file (); if (!composer) return NULL; @@ -804,9 +792,8 @@ forward_get_composer (const char *subject) const MailConfigAccount *account; EMsgComposer *composer; - account = mail_config_get_default_account (); - composer = e_msg_composer_new_with_sig_file (account && account->id ? account->id->signature : NULL, - mail_config_get_send_html ()); + account = mail_config_get_default_account (); + composer = e_msg_composer_new_with_sig_file (); if (composer) { gtk_signal_connect (GTK_OBJECT (composer), "send", GTK_SIGNAL_FUNC (composer_send_cb), NULL); diff --git a/mail/mail-config.c b/mail/mail-config.c index 183c31436a..0672b81d6d 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -97,7 +97,9 @@ identity_copy (const MailConfigIdentity *id) new->address = g_strdup (id->address); new->organization = g_strdup (id->organization); new->signature = g_strdup (id->signature); - + new->html_signature = g_strdup (id->html_signature); + new->has_html_signature = id->has_html_signature; + return new; } @@ -111,6 +113,7 @@ identity_destroy (MailConfigIdentity *id) g_free (id->address); g_free (id->organization); g_free (id->signature); + g_free (id->html_signature); g_free (id); } @@ -349,7 +352,13 @@ config_read (void) path = g_strdup_printf ("identity_signature_%d", i); id->signature = gnome_config_get_string (path); g_free (path); - + path = g_strdup_printf ("identity_html_signature_%d", i); + id->html_signature = gnome_config_get_string (path); + g_free (path); + path = g_strdup_printf ("identity_has_html_signature_%d", i); + id->has_html_signature = gnome_config_get_bool_with_default (path, FALSE); + g_free (path); + /* get the source */ source = g_new0 (MailConfigService, 1); path = g_strdup_printf ("source_url_%d", i); @@ -618,6 +627,12 @@ mail_config_write (void) path = g_strdup_printf ("identity_signature_%d", i); gnome_config_set_string (path, account->id->signature); g_free (path); + path = g_strdup_printf ("identity_html_signature_%d", i); + gnome_config_set_string (path, account->id->html_signature); + g_free (path); + path = g_strdup_printf ("identity_has_html_signature_%d", i); + gnome_config_set_bool (path, account->id->has_html_signature); + g_free (path); /* source info */ path = g_strdup_printf ("source_url_%d", i); @@ -1517,6 +1532,8 @@ impl_GNOME_Evolution_MailConfig_addAccount (PortableServer_Servant servant, mail_id->address = g_strdup (id.address); mail_id->organization = g_strdup (id.organization); mail_id->signature = g_strdup (id.signature); + mail_id->html_signature = g_strdup (id.html_signature); + mail_id->has_html_signature = id.has_html_signature; mail_account->id = mail_id; diff --git a/mail/mail-config.glade b/mail/mail-config.glade index 7c8c945059..54b7ce04f7 100644 --- a/mail/mail-config.glade +++ b/mail/mail-config.glade @@ -457,28 +457,86 @@ Click "Finish" to save your settings. GtkTable table2 4 - 2 - 2 + 3 + 3 False 4 4 - GtkEntry - identity_organization - True - True - True - 0 - + GnomeFileEntry + fileentry_signature + 10 + False + False 1 2 + 1 + 2 + 0 + 0 + True + False + False + False + True + False + + + + GtkEntry + GnomeEntry:entry + entry_signature + True + True + True + 0 + + + + + + GtkLabel + identity_organization_label + + GTK_JUSTIFY_RIGHT + False + 1 + 0.5 + 7 + 0 + + 0 + 1 0 1 0 0 - True + False + False + False + False + True + False + + + + + GtkCheckButton + check_html_signature + True + + False + True + + 0 + 1 + 2 + 3 + 0 + 0 + False False False False @@ -489,15 +547,15 @@ Click "Finish" to save your settings. GnomeFileEntry - identity_signature + fileentry_html_signature 10 False False 1 2 - 1 - 2 + 2 + 3 0 0 True @@ -511,7 +569,7 @@ Click "Finish" to save your settings. GtkEntry GnomeEntry:entry - identity_signature_entry + entry_html_signature True True True @@ -528,7 +586,7 @@ Click "Finish" to save your settings. False 1 0.5 - 0 + 7 0 0 @@ -547,22 +605,64 @@ Click "Finish" to save your settings. - GtkLabel - identity_organization_label - - GTK_JUSTIFY_RIGHT - False - 1 - 0.5 - 0 - 0 + GtkEntry + identity_organization + True + True + True + 0 + - 0 - 1 + 1 + 3 0 1 0 0 + True + False + False + False + True + False + + + + + GtkButton + button_edit_signature + True + + GTK_RELIEF_NORMAL + + 2 + 3 + 1 + 2 + 0 + 0 + False + False + False + False + True + False + + + + + GtkButton + button_edit_html_signature + True + + GTK_RELIEF_NORMAL + + 2 + 3 + 2 + 3 + 0 + 0 False False False diff --git a/mail/mail-config.h b/mail/mail-config.h index bd030f6f28..66fca278db 100644 --- a/mail/mail-config.h +++ b/mail/mail-config.h @@ -36,6 +36,8 @@ typedef struct { gchar *address; gchar *organization; gchar *signature; + gchar *html_signature; + gboolean has_html_signature; } MailConfigIdentity; typedef struct { -- cgit v1.2.3