aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog12
-rw-r--r--mail/mail-accounts.c40
-rw-r--r--mail/mail-accounts.h2
-rw-r--r--mail/mail-config.c52
-rw-r--r--mail/mail-config.glade57
-rw-r--r--mail/mail-config.h6
-rw-r--r--mail/mail-display.c10
-rw-r--r--mail/mail-tools.c20
8 files changed, 184 insertions, 15 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 8ceca6555f..bf2f31181a 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,15 @@
+2001-03-20 Radek Doulik <rodo@ximian.com>
+
+ * mail-tools.c (mail_tool_quote_message): set color in html
+ citation
+
+ * mail-config.c: added citation highlighting configuration
+
+ * mail-tools.c (mail_tool_quote_message): use citation
+ highlighting
+
+ * mail-display.c (mail_text_write): use citation highlighting
+
2001-03-20 Christopher James Lahey <clahey@ximian.com>
* folder-browser.c (etree_key): Made this check if the control
diff --git a/mail/mail-accounts.c b/mail/mail-accounts.c
index 76d91fabaa..9c48df2c00 100644
--- a/mail/mail-accounts.c
+++ b/mail/mail-accounts.c
@@ -373,6 +373,27 @@ send_html_toggled (GtkToggleButton *button, gpointer data)
}
static void
+citation_highlight_toggled (GtkToggleButton *button, gpointer data)
+{
+ mail_config_set_citation_highlight (gtk_toggle_button_get_active (button));
+}
+
+static void
+citation_color_set (GnomeColorPicker *cp, guint r, guint g, guint b, guint a)
+{
+ guint32 rgb;
+
+ rgb = r >> 8;
+ rgb <<= 8;
+ rgb |= g >> 8;
+ rgb <<= 8;
+ rgb |= b >> 8;
+
+ mail_config_set_citation_color (rgb);
+}
+
+
+static void
timeout_changed (GtkEntry *entry, gpointer data)
{
MailAccountsDialog *dialog = data;
@@ -405,6 +426,14 @@ pgp_path_changed (GtkEntry *entry, gpointer data)
}
static void
+set_color (GnomeColorPicker *cp)
+{
+ guint32 rgb = mail_config_get_citation_color ();
+
+ gnome_color_picker_set_i8 (cp, (rgb & 0xff0000) >> 16, (rgb & 0xff00) >> 8, rgb & 0xff, 0xff);
+}
+
+static void
construct (MailAccountsDialog *dialog)
{
GladeXML *gui;
@@ -470,6 +499,17 @@ construct (MailAccountsDialog *dialog)
gtk_signal_connect (GTK_OBJECT (dialog->send_html), "toggled",
GTK_SIGNAL_FUNC (send_html_toggled), dialog);
+ dialog->citation_highlight = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chckHighlightCitations"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->citation_highlight),
+ mail_config_get_citation_highlight ());
+ gtk_signal_connect (GTK_OBJECT (dialog->citation_highlight), "toggled",
+ GTK_SIGNAL_FUNC (citation_highlight_toggled), dialog);
+
+ dialog->citation_color = GNOME_COLOR_PICKER (glade_xml_get_widget (gui, "colorpickerCitations"));
+ set_color (dialog->citation_color);
+ gtk_signal_connect (GTK_OBJECT (dialog->citation_color), "color_set",
+ GTK_SIGNAL_FUNC (citation_color_set), dialog);
+
dialog->timeout = GTK_SPIN_BUTTON (glade_xml_get_widget (gui, "spinMarkTimeout"));
gtk_spin_button_set_value (GTK_SPIN_BUTTON (dialog->timeout),
(1.0 * mail_config_get_mark_as_seen_timeout ()) / 1000.0);
diff --git a/mail/mail-accounts.h b/mail/mail-accounts.h
index dcee0528c6..016200484b 100644
--- a/mail/mail-accounts.h
+++ b/mail/mail-accounts.h
@@ -65,6 +65,8 @@ struct _MailAccountsDialog {
/* "Other" widgets */
GtkCheckButton *send_html;
+ GtkCheckButton *citation_highlight;
+ GnomeColorPicker *citation_color;
GtkSpinButton *timeout;
GnomeFileEntry *pgp_path;
};
diff --git a/mail/mail-config.c b/mail/mail-config.c
index 33edd27ecc..9630def2df 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -40,6 +40,8 @@ typedef struct {
gboolean view_source;
gint paned_size;
gboolean send_html;
+ gboolean citation_highlight;
+ guint32 citation_color;
gboolean prompt_empty_subject;
gint seen_timeout;
@@ -193,7 +195,7 @@ mail_config_clear (void)
g_slist_free (config->news);
config->news = NULL;
}
-
+
/* overkill? */
memset (config, 0, sizeof (MailConfig));
}
@@ -335,6 +337,20 @@ config_read (void)
config->send_html = FALSE;
g_free (str);
+ /* Citation */
+ str = g_strdup_printf ("=%s/config/Mail=/Display/citation_highlight",
+ evolution_dir);
+ config->citation_highlight = gnome_config_get_bool_with_default (str, &def);
+ if (def)
+ config->citation_highlight = TRUE;
+ g_free (str);
+ str = g_strdup_printf ("=%s/config/Mail=/Display/citation_color",
+ evolution_dir);
+ config->citation_color = gnome_config_get_int_with_default (str, &def);
+ if (def)
+ config->citation_color = 0x737373;
+ g_free (str);
+
/* Mark as seen timeout */
str = g_strdup_printf ("=%s/config/Mail=/Display/seen_timeout",
evolution_dir);
@@ -509,6 +525,16 @@ mail_config_write_on_exit (void)
gnome_config_set_bool (str, config->send_html);
g_free (str);
+ /* Citation */
+ str = g_strdup_printf ("=%s/config/Mail=/Display/citation_highlight",
+ evolution_dir);
+ gnome_config_set_bool (str, config->citation_highlight);
+ g_free (str);
+ str = g_strdup_printf ("=%s/config/Mail=/Display/citation_color",
+ evolution_dir);
+ gnome_config_set_int (str, config->citation_color);
+ g_free (str);
+
/* Empty Subject */
str = g_strdup_printf ("=%s/config/Mail=/Prompts/empty_subject",
evolution_dir);
@@ -593,6 +619,30 @@ mail_config_set_send_html (gboolean send_html)
config->send_html = send_html;
}
+gboolean
+mail_config_get_citation_highlight (void)
+{
+ return config->citation_highlight;
+}
+
+void
+mail_config_set_citation_highlight (gboolean citation_highlight)
+{
+ config->citation_highlight = citation_highlight;
+}
+
+guint32
+mail_config_get_citation_color (void)
+{
+ return config->citation_color;
+}
+
+void
+mail_config_set_citation_color (guint32 citation_color)
+{
+ config->citation_color = citation_color;
+}
+
gint
mail_config_get_mark_as_seen_timeout (void)
{
diff --git a/mail/mail-config.glade b/mail/mail-config.glade
index 4a902dd31e..53fa0649b4 100644
--- a/mail/mail-config.glade
+++ b/mail/mail-config.glade
@@ -2004,6 +2004,63 @@ Click &quot;Finish&quot; to save your settings.</text>
<widget>
<class>GtkHBox</class>
+ <name>hbox42</name>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>chckHighlightCitations</name>
+ <can_focus>True</can_focus>
+ <label>Highlight citations with </label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GnomeColorPicker</class>
+ <name>colorpickerCitations</name>
+ <can_focus>True</can_focus>
+ <dither>True</dither>
+ <use_alpha>False</use_alpha>
+ <title>Pick a color</title>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label1</name>
+ <label> color</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkHBox</class>
<name>hbox38</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
diff --git a/mail/mail-config.h b/mail/mail-config.h
index 3f1207bd79..f800e48275 100644
--- a/mail/mail-config.h
+++ b/mail/mail-config.h
@@ -93,6 +93,12 @@ void mail_config_set_paned_size (gint size);
gboolean mail_config_get_send_html (void);
void mail_config_set_send_html (gboolean send_html);
+gboolean mail_config_get_citation_highlight (void);
+void mail_config_set_citation_highlight (gboolean);
+
+guint32 mail_config_get_citation_color (void);
+void mail_config_set_citation_color (guint32);
+
gint mail_config_get_mark_as_seen_timeout (void);
void mail_config_set_mark_as_seen_timeout (gint timeout);
diff --git a/mail/mail-display.c b/mail/mail-display.c
index 4458256d14..fa755c15d8 100644
--- a/mail/mail-display.c
+++ b/mail/mail-display.c
@@ -885,10 +885,12 @@ mail_text_write (GtkHTML *html, GtkHTMLStream *stream,
buf = g_strdup_vprintf (format, ap);
va_end (ap);
- htmltext = e_text_to_html (buf,
- E_TEXT_TO_HTML_CONVERT_URLS |
- E_TEXT_TO_HTML_CONVERT_NL |
- E_TEXT_TO_HTML_CONVERT_SPACES);
+ htmltext = e_text_to_html_full (buf,
+ E_TEXT_TO_HTML_CONVERT_URLS |
+ E_TEXT_TO_HTML_CONVERT_NL |
+ E_TEXT_TO_HTML_CONVERT_SPACES |
+ (mail_config_get_citation_highlight () ? E_TEXT_TO_HTML_MARK_CITATION : 0),
+ mail_config_get_citation_color ());
gtk_html_write (html, stream, "<tt>", 4);
gtk_html_write (html, stream, htmltext, strlen (htmltext));
gtk_html_write (html, stream, "</tt>", 5);
diff --git a/mail/mail-tools.c b/mail/mail-tools.c
index 48a0bd94e8..9f78e100b9 100644
--- a/mail/mail-tools.c
+++ b/mail/mail-tools.c
@@ -307,15 +307,12 @@ mail_tool_quote_message (CamelMimeMessage *message, const char *fmt, ...)
}
if (is_html) {
- if (credits) {
- ret_text = g_strdup_printf ("<blockquote><i>\n%s\n%s\n"
- "</i></blockquote>\n",
- credits, text);
- } else {
- ret_text = g_strdup_printf ("<blockquote><i>\n%s\n"
- "</i></blockquote>\n",
- text);
- }
+ ret_text = g_strdup_printf ("<blockquote><i><font color=\"%06x\">\n%s%s%s\n"
+ "</font></i></blockquote>\n",
+ mail_config_get_citation_color (),
+ credits ? credits : "",
+ credits ? "\n" : "",
+ text);
} else {
gchar *s, *d, *quoted_text;
gint lines, len, offset = 0;
@@ -360,7 +357,10 @@ mail_tool_quote_message (CamelMimeMessage *message, const char *fmt, ...)
*d = '\0';
/* Now convert that to HTML. */
- ret_text = e_text_to_html (quoted_text, E_TEXT_TO_HTML_PRE);
+ ret_text = e_text_to_html_full (quoted_text, E_TEXT_TO_HTML_PRE
+ | (mail_config_get_citation_highlight ()
+ ? E_TEXT_TO_HTML_MARK_CITATION : 0),
+ mail_config_get_citation_color ());
g_free (quoted_text);
}