aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-component.c
diff options
context:
space:
mode:
authorSrinivasa Ragavan <sragavan@src.gnome.org>2007-04-03 17:14:16 +0800
committerSrinivasa Ragavan <sragavan@src.gnome.org>2007-04-03 17:14:16 +0800
commit1e8c2df476794bcb93962ec65ccbe5e1e8e33f66 (patch)
tree03e885101854c1ce0d98aa9b005c856cce421c4c /mail/mail-component.c
parent8a5e6ecc960889f624419b0e88dbb231a4b667cc (diff)
downloadgsoc2013-evolution-1e8c2df476794bcb93962ec65ccbe5e1e8e33f66.tar.gz
gsoc2013-evolution-1e8c2df476794bcb93962ec65ccbe5e1e8e33f66.tar.zst
gsoc2013-evolution-1e8c2df476794bcb93962ec65ccbe5e1e8e33f66.zip
Add pluggable junk filter code and move SA options to the plugins.
svn path=/trunk/; revision=33367
Diffstat (limited to 'mail/mail-component.c')
-rw-r--r--mail/mail-component.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/mail/mail-component.c b/mail/mail-component.c
index efeb17dab3..c91096eec0 100644
--- a/mail/mail-component.c
+++ b/mail/mail-component.c
@@ -702,6 +702,7 @@ impl_createView (PortableServer_Servant servant,
if ((uri = em_folder_tree_model_get_selected (priv->model))) {
em_folder_tree_set_selected ((EMFolderTree *) tree_widget, uri);
+ em_folder_view_set_folder_uri (view_widget, uri);
g_free (uri);
}
@@ -784,6 +785,24 @@ mc_quit_sync(CamelStore *store, struct _store_info *si, MailComponent *mc)
mail_sync_store(store, mc->priv->quit_expunge, mc_quit_sync_done, mc);
}
+static void
+mc_quit_delete (CamelStore *store, struct _store_info *si, MailComponent *mc)
+{
+ CamelFolder *folder = camel_store_get_junk (store, NULL);
+
+ if (folder) {
+ GPtrArray *uids;
+ int i;
+
+ uids = camel_folder_get_uids (folder);
+ camel_folder_freeze(folder);
+ for (i=0;i<uids->len;i++)
+ camel_folder_set_message_flags(folder, uids->pdata[i], CAMEL_MESSAGE_DELETED|CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_DELETED|CAMEL_MESSAGE_SEEN);
+ camel_folder_thaw(folder);
+ camel_folder_free_uids (folder, uids);
+ }
+}
+
static CORBA_boolean
impl_quit(PortableServer_Servant servant, CORBA_Environment *ev)
{
@@ -793,6 +812,8 @@ impl_quit(PortableServer_Servant servant, CORBA_Environment *ev)
switch (mc->priv->quit_state) {
case MC_QUIT_START: {
int now = time(NULL)/60/60/24, days;
+ gboolean empty_junk;
+
GConfClient *gconf = mail_config_get_gconf_client();
mail_vfolder_shutdown();
@@ -801,6 +822,15 @@ impl_quit(PortableServer_Servant servant, CORBA_Environment *ev)
&& ((days = gconf_client_get_int(gconf, "/apps/evolution/mail/trash/empty_on_exit_days", NULL)) == 0
|| (days + gconf_client_get_int(gconf, "/apps/evolution/mail/trash/empty_date", NULL)) <= now);
+ empty_junk = gconf_client_get_bool(gconf, "/apps/evolution/mail/junk/empty_on_exit", NULL)
+ && ((days = gconf_client_get_int(gconf, "/apps/evolution/mail/junk/empty_on_exit_days", NULL)) == 0
+ || (days + gconf_client_get_int(gconf, "/apps/evolution/mail/junk/empty_date", NULL)) <= now);
+
+ if (empty_junk) {
+ g_hash_table_foreach(mc->priv->store_hash, (GHFunc)mc_quit_delete, mc);
+ gconf_client_set_int(gconf, "/apps/evolution/mail/junk/empty_date", now, NULL);
+ }
+
g_hash_table_foreach(mc->priv->store_hash, (GHFunc)mc_quit_sync, mc);
if (mc->priv->quit_expunge)