diff options
author | Radek Doulik <rodo@ximian.com> | 2001-06-29 00:23:55 +0800 |
---|---|---|
committer | Radek Doulik <rodo@src.gnome.org> | 2001-06-29 00:23:55 +0800 |
commit | 311491b26baf67164d5486b13cf794c29d6000cf (patch) | |
tree | 2de6ed152ea1446ff801a731e854e715cdcc4533 | |
parent | 3460368f5986462c91b18f1a7c9ffac67031f9cd (diff) | |
download | gsoc2013-evolution-311491b26baf67164d5486b13cf794c29d6000cf.tar.gz gsoc2013-evolution-311491b26baf67164d5486b13cf794c29d6000cf.tar.zst gsoc2013-evolution-311491b26baf67164d5486b13cf794c29d6000cf.zip |
simplified(refactored) signature handling + better support for html
signatures
2001-06-28 Radek Doulik <rodo@ximian.com>
* 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
-rw-r--r-- | mail/ChangeLog | 8 | ||||
-rw-r--r-- | mail/Mail.idl | 2 | ||||
-rw-r--r-- | mail/mail-account-gui.c | 13 | ||||
-rw-r--r-- | mail/mail-account-gui.h | 2 | ||||
-rw-r--r-- | mail/mail-callbacks.c | 25 | ||||
-rw-r--r-- | mail/mail-config.c | 21 | ||||
-rw-r--r-- | mail/mail-config.glade | 152 | ||||
-rw-r--r-- | 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 <rodo@ximian.com> + + * 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 <ettore@ximian.com> * 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.</text> <class>GtkTable</class> <name>table2</name> <border_width>4</border_width> - <rows>2</rows> - <columns>2</columns> + <rows>3</rows> + <columns>3</columns> <homogeneous>False</homogeneous> <row_spacing>4</row_spacing> <column_spacing>4</column_spacing> <widget> - <class>GtkEntry</class> - <name>identity_organization</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> + <class>GnomeFileEntry</class> + <name>fileentry_signature</name> + <max_saved>10</max_saved> + <directory>False</directory> + <modal>False</modal> <child> <left_attach>1</left_attach> <right_attach>2</right_attach> + <top_attach>1</top_attach> + <bottom_attach>2</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + + <widget> + <class>GtkEntry</class> + <child_name>GnomeEntry:entry</child_name> + <name>entry_signature</name> + <can_focus>True</can_focus> + <editable>True</editable> + <text_visible>True</text_visible> + <text_max_length>0</text_max_length> + <text></text> + </widget> + </widget> + + <widget> + <class>GtkLabel</class> + <name>identity_organization_label</name> + <label>Organization:</label> + <justify>GTK_JUSTIFY_RIGHT</justify> + <wrap>False</wrap> + <xalign>1</xalign> + <yalign>0.5</yalign> + <xpad>7</xpad> + <ypad>0</ypad> + <child> + <left_attach>0</left_attach> + <right_attach>1</right_attach> <top_attach>0</top_attach> <bottom_attach>1</bottom_attach> <xpad>0</xpad> <ypad>0</ypad> - <xexpand>True</xexpand> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkCheckButton</class> + <name>check_html_signature</name> + <can_focus>True</can_focus> + <label>HTML Signature:</label> + <active>False</active> + <draw_indicator>True</draw_indicator> + <child> + <left_attach>0</left_attach> + <right_attach>1</right_attach> + <top_attach>2</top_attach> + <bottom_attach>3</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> <yexpand>False</yexpand> <xshrink>False</xshrink> <yshrink>False</yshrink> @@ -489,15 +547,15 @@ Click "Finish" to save your settings.</text> <widget> <class>GnomeFileEntry</class> - <name>identity_signature</name> + <name>fileentry_html_signature</name> <max_saved>10</max_saved> <directory>False</directory> <modal>False</modal> <child> <left_attach>1</left_attach> <right_attach>2</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> + <top_attach>2</top_attach> + <bottom_attach>3</bottom_attach> <xpad>0</xpad> <ypad>0</ypad> <xexpand>True</xexpand> @@ -511,7 +569,7 @@ Click "Finish" to save your settings.</text> <widget> <class>GtkEntry</class> <child_name>GnomeEntry:entry</child_name> - <name>identity_signature_entry</name> + <name>entry_html_signature</name> <can_focus>True</can_focus> <editable>True</editable> <text_visible>True</text_visible> @@ -528,7 +586,7 @@ Click "Finish" to save your settings.</text> <wrap>False</wrap> <xalign>1</xalign> <yalign>0.5</yalign> - <xpad>0</xpad> + <xpad>7</xpad> <ypad>0</ypad> <child> <left_attach>0</left_attach> @@ -547,22 +605,64 @@ Click "Finish" to save your settings.</text> </widget> <widget> - <class>GtkLabel</class> - <name>identity_organization_label</name> - <label>Organization:</label> - <justify>GTK_JUSTIFY_RIGHT</justify> - <wrap>False</wrap> - <xalign>1</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> + <class>GtkEntry</class> + <name>identity_organization</name> + <can_focus>True</can_focus> + <editable>True</editable> + <text_visible>True</text_visible> + <text_max_length>0</text_max_length> + <text></text> <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> + <left_attach>1</left_attach> + <right_attach>3</right_attach> <top_attach>0</top_attach> <bottom_attach>1</bottom_attach> <xpad>0</xpad> <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button_edit_signature</name> + <can_focus>True</can_focus> + <label>Edit...</label> + <relief>GTK_RELIEF_NORMAL</relief> + <child> + <left_attach>2</left_attach> + <right_attach>3</right_attach> + <top_attach>1</top_attach> + <bottom_attach>2</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>button_edit_html_signature</name> + <can_focus>True</can_focus> + <label>Edit...</label> + <relief>GTK_RELIEF_NORMAL</relief> + <child> + <left_attach>2</left_attach> + <right_attach>3</right_attach> + <top_attach>2</top_attach> + <bottom_attach>3</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> <xexpand>False</xexpand> <yexpand>False</yexpand> <xshrink>False</xshrink> 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 { |