diff options
author | Not Zed <NotZed@Ximian.com> | 2003-09-30 14:52:13 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2003-09-30 14:52:13 +0800 |
commit | dbecfb231409fd9170147739862e8517a3d3979a (patch) | |
tree | 41c5e85046e0427956f8b1645cc1cb1817a23c16 /mail/em-format.c | |
parent | 1af3fe8fe0e326a71c78e87caa68c4532765f9eb (diff) | |
download | gsoc2013-evolution-dbecfb231409fd9170147739862e8517a3d3979a.tar.gz gsoc2013-evolution-dbecfb231409fd9170147739862e8517a3d3979a.tar.zst gsoc2013-evolution-dbecfb231409fd9170147739862e8517a3d3979a.zip |
remove gconf stuff. (em_format_html_set_xmailer_mask): new method to set
2003-09-30 Not Zed <NotZed@Ximian.com>
* em-format-html.c (efh_init): remove gconf stuff.
(em_format_html_set_xmailer_mask): new method to set the xmailer mask.
* em-folder-view.c (emfv_display_keys[]): Added charset key to
monitor/retrieve, and xmailer_mask.
(emfv_setting_notify): Monitor charset setting, pass onto the
formatter, as well as xmailer_mask.
* mail-preferences.c (mail_preferences_construct): use the new
charset key.
(mail_preferences_apply): use the new charset key.
* evolution-mail.schemas: Moved the mail/format/charset to
mail/display/charset. 1. it makes more sense, and 2. it makes
notification update easier in em-folder-view.c
* em-format.c (emf_init): remove the gconf charset stuff, for bug
#48791, and also actually fixes the fixme that jeff thought he
fixed.
(em_format_format_text): use default charset as fallback.
(em_format_set_default_charset): New method to set the default charset.
(gconf_charset_changed): removed.
svn path=/trunk/; revision=22768
Diffstat (limited to 'mail/em-format.c')
-rw-r--r-- | mail/em-format.c | 61 |
1 files changed, 26 insertions, 35 deletions
diff --git a/mail/em-format.c b/mail/em-format.c index 5cac389dc9..2b8b70b14e 100644 --- a/mail/em-format.c +++ b/mail/em-format.c @@ -33,8 +33,6 @@ #include <libgnomevfs/gnome-vfs-mime-utils.h> #include <libgnomevfs/gnome-vfs-mime-handlers.h> -#include <gconf/gconf-client.h> - #include <e-util/e-msgport.h> #include <camel/camel-url.h> #include <camel/camel-stream.h> @@ -55,12 +53,6 @@ #define d(x) -struct _EMFormatPrivate { - GConfClient *gconf; - guint charset_id; - char *gconf_charset; -}; - static void emf_builtin_init(EMFormatClass *); static const char *emf_snoop_part(CamelMimePart *part); @@ -76,29 +68,10 @@ static guint emf_signals[EMF_LAST_SIGNAL]; static GObjectClass *emf_parent; static void -gconf_charset_changed (GConfClient *client, guint cnxn_id, - GConfEntry *entry, gpointer user_data) -{ - struct _EMFormatPrivate *priv = ((EMFormat *) user_data)->priv; - - g_free (priv->gconf_charset); - priv->gconf_charset = gconf_client_get_string (priv->gconf, "/apps/evolution/mail/format/charset", NULL); -} - -static void emf_init(GObject *o) { - struct _EMFormatPrivate *priv; EMFormat *emf = (EMFormat *)o; - priv = emf->priv = g_new (struct _EMFormatPrivate, 1); - priv->gconf = gconf_client_get_default (); - gconf_client_add_dir (priv->gconf, "/apps/evolution/mail/format/charset", - GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); - priv->charset_id = gconf_client_notify_add (priv->gconf, "/apps/evolution/mail/format/charset", - gconf_charset_changed, emf, NULL, NULL); - priv->gconf_charset = gconf_client_get_string (priv->gconf, "/apps/evolution/mail/format/charset", NULL); - emf->inline_table = g_hash_table_new(NULL, NULL); e_dlist_init(&emf->header_list); em_format_default_headers(emf); @@ -107,15 +80,8 @@ emf_init(GObject *o) static void emf_finalise(GObject *o) { - struct _EMFormatPrivate *priv = ((EMFormat *) o)->priv; EMFormat *emf = (EMFormat *)o; - gconf_client_notify_remove (priv->gconf, priv->charset_id); - priv->charset_id = 0; - g_object_unref (priv->gconf); - g_free (priv->gconf_charset); - g_free (priv); - if (emf->session) camel_object_unref(emf->session); @@ -658,6 +624,31 @@ em_format_set_charset(EMFormat *emf, const char *charset) em_format_format_clone(emf, emf->message, emf); } + +/** + * em_format_set_default_charset: + * @emf: + * @charset: + * + * Set the fallback, default system charset to use when no other charsets + * are present. Message will be redisplayed if required (and sometimes redisplayed + * when it isn't). + **/ +void +em_format_set_default_charset(EMFormat *emf, const char *charset) +{ + if ((emf->default_charset && charset && g_ascii_strcasecmp(emf->default_charset, charset) == 0) + || (emf->default_charset == NULL && charset == NULL) + || (emf->default_charset == charset)) + return; + + g_free(emf->default_charset); + emf->default_charset = g_strdup(charset); + + if (emf->message && emf->charset == NULL) + em_format_format_clone(emf, emf->message, emf); +} + /** * em_format_clear_headers: * @emf: @@ -858,7 +849,7 @@ em_format_format_text(EMFormat *emf, CamelStream *stream, CamelDataWrapper *dw) charset = camel_mime_filter_windows_real_charset (windows); camel_object_unref(windows); } else if (charset == NULL) { - charset = emf->priv->gconf_charset; + charset = emf->default_charset; } filter_stream = camel_stream_filter_new_with_stream(stream); |