diff options
author | Srinivasa Ragavan <sragavan@novell.com> | 2008-01-24 11:03:46 +0800 |
---|---|---|
committer | Srinivasa Ragavan <sragavan@src.gnome.org> | 2008-01-24 11:03:46 +0800 |
commit | 2c0ce47a992b68ccfe06d6b3da22da3aec07e872 (patch) | |
tree | 1fab9c37a286409e8fc2a89b2be3e2157a6eeeac /mail/mail-config.c | |
parent | 06be294b09f6a3d05ad67b7d6c40f9cddd3567e7 (diff) | |
download | gsoc2013-evolution-2c0ce47a992b68ccfe06d6b3da22da3aec07e872.tar gsoc2013-evolution-2c0ce47a992b68ccfe06d6b3da22da3aec07e872.tar.gz gsoc2013-evolution-2c0ce47a992b68ccfe06d6b3da22da3aec07e872.tar.bz2 gsoc2013-evolution-2c0ce47a992b68ccfe06d6b3da22da3aec07e872.tar.lz gsoc2013-evolution-2c0ce47a992b68ccfe06d6b3da22da3aec07e872.tar.xz gsoc2013-evolution-2c0ce47a992b68ccfe06d6b3da22da3aec07e872.tar.zst gsoc2013-evolution-2c0ce47a992b68ccfe06d6b3da22da3aec07e872.zip |
** Fix for bug #510779
2008-01-24 Srinivasa Ragavan <sragavan@novell.com>
** Fix for bug #510779
* em-mailer-prefs.c: (jh_tree_refill), (jh_add_cb), (jh_remove_cb),
(init_junk_tree), (custom_junk_button_toggled),
(em_mailer_prefs_construct): Added UI for the new junk preferences.
* em-mailer-prefs.h:
* evolution-mail.schemas.in: Add schema for junk header and address
lookup.
* mail-config.c: (gconf_jh_check_changed),
(gconf_lookup_book_changed), (gconf_jh_headers_changed),
(mail_config_init), (mail_config_reload_junk_headers),
(mail_config_get_lookup_book):
* mail-config.glade:
* mail-config.h:
* mail-session.c: (class_init), (lookup_addressbook),
(mail_session_init), (mail_session_set_junk_headers):
* mail-session.h:
2008-01-22 Srinivasa Ragavan <sragavan@novell.com>
** Fix for bug #405777
* em-folder-view.c: (emfv_setup_view_instance),
(emfv_setting_notify): Don't break abstraction. Call the right derived
class.
svn path=/trunk/; revision=34873
Diffstat (limited to 'mail/mail-config.c')
-rw-r--r-- | mail/mail-config.c | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/mail/mail-config.c b/mail/mail-config.c index 2a483750c8..90de0ec75b 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -111,6 +111,13 @@ typedef struct { GPtrArray *mime_types; guint mime_types_notify_id; + + GSList *jh_header; + gboolean jh_check; + guint jh_header_id; + guint jh_check_id; + gboolean book_lookup; + guint book_lookup_id; } MailConfig; static MailConfig *config = NULL; @@ -251,6 +258,59 @@ gconf_style_changed (GConfClient *client, guint cnxn_id, } static void +gconf_jh_check_changed (GConfClient *client, guint cnxn_id, + GConfEntry *entry, gpointer user_data) +{ + config->jh_check = gconf_client_get_bool (config->gconf, "/apps/evolution/mail/junk/check_custom_header", NULL); + if (!config->jh_check) { + mail_session_set_junk_headers (NULL, NULL, 0); + } else { + config->jh_header = gconf_client_get_list (config->gconf, "/apps/evolution/mail/junk/custom_header", GCONF_VALUE_STRING, NULL); + GSList *node = config->jh_header; + GPtrArray *name, *value; + name = g_ptr_array_new (); + value = g_ptr_array_new (); + while (node && node->data) { + char **tok = g_strsplit (node->data, "=", 2); + g_ptr_array_add (name, g_strdup(tok[0])); + g_ptr_array_add (value, g_strdup(tok[1])); + node = node->next; + g_strfreev (tok); + } + mail_session_set_junk_headers ((const char **)name->pdata, (const char **)value->pdata, name->len); + g_ptr_array_free (name, TRUE); + g_ptr_array_free (value, TRUE); + } +} + +static void +gconf_lookup_book_changed (GConfClient *client, guint cnxn_id, + GConfEntry *entry, gpointer data) +{ + config->book_lookup = gconf_client_get_bool (config->gconf, "/apps/evolution/mail/junk/lookup_addressbook", NULL); +} + +static void +gconf_jh_headers_changed (GConfClient *client, guint cnxn_id, + GConfEntry *entry, gpointer user_data) +{ + config->jh_header = gconf_client_get_list (config->gconf, "/apps/evolution/mail/junk/custom_header", GCONF_VALUE_STRING, NULL); + GSList *node = config->jh_header; + GPtrArray *name, *value; + name = g_ptr_array_new (); + value = g_ptr_array_new (); + while (node && node->data) { + char **tok = g_strsplit (node->data, "=", 2); + g_ptr_array_add (name, g_strdup(tok[0])); + g_ptr_array_add (value, g_strdup(tok[1])); + node = node->next; + g_strfreev (tok); + } + mail_session_set_junk_headers ((const char **)name->pdata, (const char **)value->pdata, name->len); +} + + +static void gconf_address_count_changed (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data) { @@ -329,6 +389,9 @@ mail_config_init (void) GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); gconf_client_add_dir (config->gconf, "/GNOME/Spell", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); + gconf_client_add_dir (config->gconf, "/apps/evolution/mail/junk", + GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); + config->font_notify_id = gconf_client_notify_add (config->gconf, "/apps/evolution/mail/display/fonts", gconf_style_changed, NULL, NULL, NULL); config->font_notify_id = gconf_client_notify_add (config->gconf, "/apps/evolution/mail/display/address_compress", @@ -377,6 +440,18 @@ mail_config_init (void) config->magic_spacebar = gconf_client_get_bool (config->gconf, "/apps/evolution/mail/display/magic_spacebar", NULL); config->accounts = e_account_list_new (config->gconf); config->signatures = e_signature_list_new (config->gconf); + + config->jh_check = gconf_client_get_bool (config->gconf, "/apps/evolution/mail/junk/check_custom_header", NULL); + config->jh_check_id = gconf_client_notify_add (config->gconf, "/apps/evolution/mail/junk/check_custom_header", + gconf_jh_check_changed, NULL, NULL, NULL); + config->jh_header_id = gconf_client_notify_add (config->gconf, "/apps/evolution/mail/junk/custom_header", + gconf_jh_headers_changed, NULL, NULL, NULL); + config->book_lookup = gconf_client_get_bool (config->gconf, "/apps/evolution/mail/junk/lookup_addressbook", NULL); + config->book_lookup_id = gconf_client_notify_add (config->gconf, "/apps/evolution/mail/junk/lookup_addressbook", + gconf_lookup_book_changed, NULL, NULL, NULL); + + gconf_jh_check_changed (config->gconf, 0, NULL, config); + } @@ -1025,6 +1100,28 @@ mail_config_remove_signature (ESignature *signature) mail_config_save_signatures (); } +void +mail_config_reload_junk_headers () +{ + /* It automatically sets in the session */ + if (config == NULL) + mail_config_init (); + else + gconf_jh_check_changed (config->gconf, 0, NULL, config); + +} + +gboolean +mail_config_get_lookup_book() +{ + /* It automatically sets in the session */ + if (config == NULL) + mail_config_init (); + + return config->book_lookup; + +} + char * mail_config_signature_run_script (const char *script) { |