aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-format.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2003-01-08 09:39:21 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2003-01-08 09:39:21 +0800
commitfb6caf533c7629ff9a7ffbdfa1eafd9afd5e7817 (patch)
tree032f32319f3465855cce2e52944838c9b63a471b /mail/mail-format.c
parent235dc4e759f1781b34a985233c6b707613db41ad (diff)
downloadgsoc2013-evolution-fb6caf533c7629ff9a7ffbdfa1eafd9afd5e7817.tar.gz
gsoc2013-evolution-fb6caf533c7629ff9a7ffbdfa1eafd9afd5e7817.tar.zst
gsoc2013-evolution-fb6caf533c7629ff9a7ffbdfa1eafd9afd5e7817.zip
Use gconf to get the paned size. (folder_browser_set_message_preview):
2003-01-07 Jeffrey Stedfast <fejj@ximian.com> * folder-browser.c (save_cursor_pos): Use gconf to get the paned size. (folder_browser_set_message_preview): Same. (folder_browser_toggle_hide_deleted): Use gconf to set the hide-deleted state. (folder_browser_set_message_display_style): Same but for the message_display_style. (fb_resize_cb): Save the paned_size via gconf. (paned_size_changed): Callback for when the paned_size gets changed. Change the folder-browser's paned size to the new setting. (folder_browser_gui_init): Listen to changes to the paned_size and also get the initial size from gconf. * message-list.c (message_list_set_folder): Use gconf. (regen_list_regen): Use gconf. * message-browser.c (transfer_msg_done): Use gconf to get the hide_deleted setting. * mail-account-gui.c (sig_add_new_signature): Use gconf. * folder-browser-ui.c (folder_browser_ui_add_list): Use gconf. * folder-browser.c (save_cursor_pos): Use gconf. (folder_browser_set_message_preview): Same. (folder_browser_toggle_hide_deleted): Here too. (folder_browser_set_message_display_style): And here. (folder_browser_gui_init): Here too. (done_message_selected): And here. * mail-config.c (mail_config_get_thread_subject): Removed. (mail_config_set_thread_subject): Removed. (mail_config_get_empty_trash_on_exit): Removed. (mail_config_set_empty_trash_on_exit): Removed. (mail_config_get_last_filesel_dir): Removed. (mail_config_set_last_filesel_dir): Removed. (mail_config_get_hide_deleted): Removed. (mail_config_set_hide_deleted): Removed. (mail_config_get_paned_size): Removed. (mail_config_set_paned_size): Removed. (mail_config_get_send_html): Removed. (mail_config_set_send_html): Removed. (mail_config_get_confirm_unwanted_html): Removed. (mail_config_set_confirm_unwanted_html): Removed. (mail_config_get_citation_highlight): Removed. (mail_config_set_citation_highlight): Removed. (mail_config_get_citation_color): Removed. (mail_config_set_citation_color): Removed. (mail_config_get_do_seen_timeout): Removed. (mail_config_set_do_seen_timeout): Removed. (mail_config_get_mark_as_seen_timeout): Removed. (mail_config_set_mark_as_seen_timeout): Removed. (mail_config_get_prompt_empty_subject): Removed. (mail_config_set_prompt_empty_subject): Removed. (mail_config_get_prompt_only_bcc): Removed. (mail_config_set_prompt_only_bcc): Removed. (mail_config_get_confirm_expunge): Removed. (mail_config_set_confirm_expunge): Removed. (mail_config_get_confirm_goto_next_folder): Removed. (mail_config_set_confirm_goto_next_folder): Removed. (mail_config_get_goto_next_folder): Removed. (mail_config_set_goto_next_folder): Removed. (mail_config_get_http_mode): Removed. (mail_config_set_http_mode): Removed. (mail_config_get_default_forward_style): Removed. (mail_config_set_default_forward_style): Removed. (mail_config_get_default_reply_style): Removed. (mail_config_set_default_reply_style): Removed. (mail_config_get_message_display_style): Removed. (mail_config_set_message_display_style): Removed. (mail_config_get_default_charset): Removed. (mail_config_set_default_charset): Removed. (mail_config_get_x_mailer_display_style): Removed. (mail_config_set_x_mailer_display_style): Removed. * subscribe-dialog.c (populate_store_list): Use the list of accounts. We can't get the list of sources anymore. (populate_store_foreach): Updated. * mail-callbacks.c (guess_me_from_accounts): Use account->enabled. (mail_generate_reply): Same. (empty_trash): Here too. * mail-accounts.c (account_delete_clicked): Use account->enabled rather than source->enabled. (account_able_clicked): Same. (account_cursor_change): Here too. (mail_accounts_load): And here. * component-factory.c (owner_unset_cb): Use gconf empty-on-exit settings. (mail_load_storages): Use account->enabled rather than account->source->enabled. The struct changed. * mail-composer-prefs.c (sig_add): Get the send_html pref from gconf. * message-tag-followup.c (target_date_new): Use gconf. * mail-config.c (mail_config_get_week_start_day): Removed. * mail-tools.c (mail_tool_quote_message): Use gconf here too, but we don't need to parse the colour - just use it as a raw string. (mail_tool_forward_message): Use gconf. * mail-format.c (mail_format_data_wrapper_write_to_stream): Use gconf. (write_headers): Use gconf. (handle_text_plain): Same. * mail-display.c (mail_text_write): Updated to use gconf and parse GdkColour strings. (on_url_requested): Updated to use gconf. * mail-callbacks.c (ask_confirm_for_unwanted_html_mail): Use gconf rather than the old mail-config APIs which will be removed. (ask_confirm_for_empty_subject): Same. (ask_confirm_for_only_bcc): Here too. (composer_get_message): And here. (create_msg_composer): Same. (transfer_msg_done): Again here. (delete_msg): Here too. (confirm_expunge): And finally here. * mail-config.c (mail_config_write): Use gconf. (mail_config_get_sources): Removed. * mail-account-gui.c (mail_account_gui_save): No need to save enabled-state anymore for a source. * mail-config-druid.c (wizard_finish_cb): Instead of setting account->source->enabled to TRUE, just set account->enabled to TRUE. The structures changed a bit. * mail-send-recv.c (mail_send_receive): Get the list of accounts instead of sources, and pass them along to build_dialogue. I'm trying to get rid of the mail_config_get_sources() api. (mail_autoreceive_setup): Here too. * mail-config.c (mail_config_get_filter_log): Removed. (mail_config_set_filter_log): Removed. (mail_config_get_filter_log_path): Removed. (mail_config_set_filter_log_path): Removed. (mail_config_get_new_mail_notify): Removed. (mail_config_set_new_mail_notify): Removed. (mail_config_get_new_mail_notify_sound_file): Removed. (mail_config_set_new_mail_notify_sound_file): Removed. * mail-session.c (main_get_filter_driver): Updated to use the gconf settings. svn path=/trunk/; revision=19271
Diffstat (limited to 'mail/mail-format.c')
-rw-r--r--mail/mail-format.c64
1 files changed, 43 insertions, 21 deletions
diff --git a/mail/mail-format.c b/mail/mail-format.c
index fefa9ef721..d1583db0fb 100644
--- a/mail/mail-format.c
+++ b/mail/mail-format.c
@@ -30,6 +30,9 @@
#include <ctype.h>
#include <fcntl.h>
+#include <gconf/gconf.h>
+#include <gconf/gconf-client.h>
+
#include <libgnome/gnome-util.h>
#include <libgnomevfs/gnome-vfs-mime-handlers.h>
#include <gal/util/e-iconv.h>
@@ -913,8 +916,7 @@ write_default_header (CamelMimeMessage *message, MailDisplay *md,
static gboolean
write_xmailer_header (CamelMimeMessage *message, MailDisplay *md,
- MailDisplayStream *stream,
- MailConfigXMailerDisplayStyle xm)
+ MailDisplayStream *stream, int xmask)
{
const char *xmailer, *evolution;
@@ -926,11 +928,11 @@ write_xmailer_header (CamelMimeMessage *message, MailDisplay *md,
}
evolution = strstr (xmailer, "Evolution");
- if ((xm & MAIL_CONFIG_XMAILER_OTHER) ||
- (evolution && (xm & MAIL_CONFIG_XMAILER_EVO)))
+ if ((xmask & MAIL_CONFIG_XMAILER_OTHER) ||
+ (evolution && (xmask & MAIL_CONFIG_XMAILER_EVO)))
write_text_header (stream, _("Mailer"), xmailer, WRITE_BOLD);
- return evolution != NULL && (xm & MAIL_CONFIG_XMAILER_RUPERT_APPROVED);
+ return evolution != NULL && (xmask & MAIL_CONFIG_XMAILER_RUPERT_APPROVED);
}
#define COLOR_IS_LIGHT(r, g, b) ((r + g + b) > (128 * 3))
@@ -938,12 +940,15 @@ write_xmailer_header (CamelMimeMessage *message, MailDisplay *md,
static void
write_headers (MailDisplayStream *stream, MailDisplay *md, CamelMimeMessage *message)
{
- MailConfigXMailerDisplayStyle xm = mail_config_get_x_mailer_display_style ();
gboolean full = (md->display_style == MAIL_CONFIG_DISPLAY_FULL_HEADERS);
char bgcolor[7], fontcolor[7];
GtkStyle *style = NULL;
gboolean evo_icon = FALSE;
- int i;
+ GConfClient *gconf;
+ int xmask, i;
+
+ gconf = gconf_client_get_default ();
+ xmask = gconf_client_get_int (gconf, "/apps/evolution/mail/display/xmailer_mask", NULL);
/* My favorite thing to do... muck around with colors so we respect people's stupid themes.
However, we only do this if we are rendering to the screen -- we ignore the theme
@@ -1026,8 +1031,8 @@ write_headers (MailDisplayStream *stream, MailDisplay *md, CamelMimeMessage *mes
} else {
for (i = 0; i < sizeof (default_headers) / sizeof (default_headers[0]); i++)
write_default_header (message, md, stream, i, 0);
- if (xm != MAIL_CONFIG_XMAILER_NONE)
- evo_icon = write_xmailer_header (message, md, stream, xm);
+ if (xmask != MAIL_CONFIG_XMAILER_NONE)
+ evo_icon = write_xmailer_header (message, md, stream, xmask);
}
/* Close off the internal header table */
@@ -1092,7 +1097,10 @@ mail_format_data_wrapper_write_to_stream (CamelDataWrapper *wrapper, MailDisplay
if (wrapper->rawtext || (mail_display && mail_display->charset)) {
CamelMimeFilterCharset *filter;
- const char *charset;
+ GConfClient *gconf;
+ char *charset;
+
+ gconf = gconf_client_get_default ();
if (!wrapper->rawtext) {
/* data wrapper had been successfully converted to UTF-8 using the mime
@@ -1102,31 +1110,35 @@ mail_format_data_wrapper_write_to_stream (CamelDataWrapper *wrapper, MailDisplay
/* get the original charset of the mime part */
content_type = camel_data_wrapper_get_mime_type_field (wrapper);
- charset = content_type ? header_content_type_param (content_type, "charset") : NULL;
+ charset = (char *) (content_type ? header_content_type_param (content_type, "charset") : NULL);
if (!charset)
- charset = mail_config_get_default_charset ();
+ charset = gconf_client_get_string (gconf, "/apps/evolution/mail/format/charset", NULL);
+ else
+ charset = g_strdup (charset);
/* since the content is already in UTF-8, we need to decode into the
original charset before we can convert back to UTF-8 using the charset
the user is overriding with... */
- filter = camel_mime_filter_charset_new_convert ("utf-8", charset);
- if (filter) {
+ if ((filter = camel_mime_filter_charset_new_convert ("utf-8", charset))) {
camel_stream_filter_add (filtered_stream, CAMEL_MIME_FILTER (filter));
camel_object_unref (filter);
}
+
+ g_free (charset);
}
/* find out the charset the user wants to override to */
if (mail_display && mail_display->charset)
charset = mail_display->charset;
else
- charset = mail_config_get_default_charset ();
+ charset = gconf_client_get_string (gconf, "/apps/evolution/mail/format/charset", NULL);
- filter = camel_mime_filter_charset_new_convert (charset, "utf-8");
- if (filter) {
+ if ((filter = camel_mime_filter_charset_new_convert (charset, "utf-8"))) {
camel_stream_filter_add (filtered_stream, CAMEL_MIME_FILTER (filter));
camel_object_unref (filter);
}
+
+ g_free (charset);
}
written = camel_data_wrapper_write_to_stream (wrapper, CAMEL_STREAM (filtered_stream));
@@ -1185,16 +1197,26 @@ handle_text_plain (CamelMimePart *part, const char *mime_type,
CamelStreamFilter *filtered_stream;
CamelMimeFilter *html_filter;
CamelDataWrapper *wrapper;
- guint32 flags, colour = 0;
CamelContentType *type;
const char *format;
+ GConfClient *gconf;
+ guint32 flags, rgb = 0;
+ GdkColor colour;
+ char *buf;
+
+ gconf = gconf_client_get_default ();
flags = CAMEL_MIME_FILTER_TOHTML_CONVERT_NL | CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES;
if (!md->printing) {
flags |= CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS | CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES;
- if (mail_config_get_citation_highlight ()) {
+ if (gconf_client_get_bool (gconf, "/apps/evolution/mail/display/mark_citations", NULL)) {
flags |= CAMEL_MIME_FILTER_TOHTML_MARK_CITATION;
- colour = mail_config_get_citation_color ();
+
+ buf = gconf_client_get_string (gconf, "/apps/evolution/mail/display/citation_colour", NULL);
+ gdk_color_parse (buf ? buf : "#737373", &colour);
+ g_free (buf);
+
+ rgb = ((colour.red & 0xff00) << 8) | (colour.green & 0xff00) | ((colour.blue & 0xff00) >> 8);
}
}
@@ -1204,7 +1226,7 @@ handle_text_plain (CamelMimePart *part, const char *mime_type,
if (format && !strcasecmp (format, "flowed"))
flags |= CAMEL_MIME_FILTER_TOHTML_FORMAT_FLOWED;
- html_filter = camel_mime_filter_tohtml_new (flags, colour);
+ html_filter = camel_mime_filter_tohtml_new (flags, rgb);
filtered_stream = camel_stream_filter_new_with_stream ((CamelStream *) stream);
camel_stream_filter_add (filtered_stream, html_filter);
camel_object_unref (html_filter);