2006-04-06 [mones] 2.1.0cvs7
[claws.git] / src / folder_item_prefs.c
index 75a55d8d0a7eeacd962039988aba2c4e528623a5..7caaa7e19b476edd90f753f2ada2ae0d7a941fbe 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2006 Hiroyuki Yamamoto and the Sylpheed-Claws team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
 /* alfons - all folder item specific settings should migrate into 
@@ -25,7 +25,9 @@
 #  include "config.h"
 #endif
 
-#include "intl.h"
+#include <glib.h>
+#include <glib/gi18n.h>
+
 #include "defs.h"
 #include "folder.h"
 #include "utils.h"
@@ -50,14 +52,6 @@ static PrefParam param[] = {
         NULL, NULL, NULL},
        {"sort_descending", "FALSE", &tmp_prefs.sort_descending, P_BOOL,
         NULL, NULL, NULL},
-       /*{"enable_thread", "TRUE", &tmp_prefs.enable_thread, P_BOOL,
-        NULL, NULL, NULL},*/
-#if 0
-       {"hide_score", "-9999", &tmp_prefs.kill_score, P_INT,
-        NULL, NULL, NULL},
-       {"important_score", "1", &tmp_prefs.important_score, P_INT,
-        NULL, NULL, NULL},
-#endif
        /* MIGRATION */  
        {"request_return_receipt", "", &tmp_prefs.request_return_receipt, P_BOOL,
         NULL, NULL, NULL},
@@ -95,6 +89,8 @@ static PrefParam param[] = {
         NULL, NULL, NULL},
        {"newmailcheck", "TRUE", &tmp_prefs.newmailcheck, P_BOOL,
         NULL, NULL, NULL},
+       {"offlinesync", "FALSE", &tmp_prefs.offlinesync, P_BOOL,
+        NULL, NULL, NULL},
        {NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL}
 };
 
@@ -103,11 +99,14 @@ static FolderItemPrefs *folder_item_prefs_clear(FolderItemPrefs *prefs);
 void folder_item_prefs_read_config(FolderItem * item)
 {
        gchar * id;
+       gchar *rcpath;
 
        id = folder_item_get_identifier(item);
        folder_item_prefs_clear(&tmp_prefs);
-       prefs_read_config(param, id, FOLDERITEM_RC);
+       rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, FOLDERITEM_RC, NULL);
+       prefs_read_config(param, id, rcpath, NULL);
        g_free(id);
+       g_free(rcpath);
 
        *item->prefs = tmp_prefs;
 
@@ -142,7 +141,7 @@ void folder_item_prefs_save_config(FolderItem * item)
 
        id = folder_item_get_identifier(item);
 
-       prefs_save_config(param, id, FOLDERITEM_RC);
+       prefs_write_config(param, id, FOLDERITEM_RC);
        g_free(id);
 
        /* MIGRATION: make sure migrated items are not saved
@@ -190,6 +189,7 @@ static FolderItemPrefs *folder_item_prefs_clear(FolderItemPrefs *prefs)
        prefs->processing = NULL;
 
        prefs->newmailcheck = TRUE;
+       prefs->offlinesync = FALSE;
 
        return prefs;
 }
@@ -205,10 +205,8 @@ FolderItemPrefs * folder_item_prefs_new(void)
 
 void folder_item_prefs_free(FolderItemPrefs * prefs)
 {
-       if (prefs->default_to) 
-               g_free(prefs->default_to);
-       if (prefs->default_reply_to) 
-               g_free(prefs->default_reply_to);
+       g_free(prefs->default_to);
+       g_free(prefs->default_reply_to);
        g_free(prefs);
 }
 
@@ -231,7 +229,7 @@ gint folder_item_prefs_get_sort_type(FolderItem * item)
 
 void folder_item_prefs_copy_prefs(FolderItem * src, FolderItem * dest)
 {
-       GSList *tmp_prop_list = NULL, *tmp_scor_list = NULL, *tmp;
+       GSList *tmp_prop_list = NULL, *tmp;
        folder_item_prefs_read_config(src);
 
        tmp_prefs.directory                     = g_strdup(src->prefs->directory);
@@ -244,7 +242,8 @@ void folder_item_prefs_copy_prefs(FolderItem * src, FolderItem * dest)
        tmp_prefs.sort_descending               = src->prefs->sort_descending;
        tmp_prefs.enable_thread                 = src->prefs->enable_thread;
         tmp_prefs.enable_processing             = src->prefs->enable_processing;
-    tmp_prefs.newmailcheck             = src->prefs->newmailcheck;
+       tmp_prefs.newmailcheck                  = src->prefs->newmailcheck;
+       tmp_prefs.offlinesync                  = src->prefs->offlinesync;
 
        prefs_matcher_read_config();
 
@@ -261,7 +260,7 @@ void folder_item_prefs_copy_prefs(FolderItem * src, FolderItem * dest)
        tmp_prefs.enable_default_to             = src->prefs->enable_default_to;
        tmp_prefs.default_to                    = g_strdup(src->prefs->default_to);
        tmp_prefs.enable_default_reply_to       = src->prefs->enable_default_reply_to;
-       tmp_prefs.default_reply_to              = src->prefs->default_reply_to;
+       tmp_prefs.default_reply_to              = g_strdup(src->prefs->default_reply_to);
        tmp_prefs.enable_simplify_subject       = src->prefs->enable_simplify_subject;
        tmp_prefs.simplify_subject_regexp       = g_strdup(src->prefs->simplify_subject_regexp);
        tmp_prefs.enable_folder_chmod           = src->prefs->enable_folder_chmod;