2 * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 2013 Paul Mangan <paul@claws-mail.org>
4 * and the Claws Mail team
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #include "claws-features.h"
29 #include <glib/gi18n.h>
30 #include <gdk/gdkkeysyms.h>
38 #include "file-utils.h"
40 #include "alertpanel.h"
43 static gboolean verify_folderlist_xml();
45 gboolean check_file_integrity()
47 if (verify_folderlist_xml() != TRUE)
53 static gboolean verify_folderlist_xml()
56 static gchar *filename = NULL;
57 static gchar *bak = NULL;
61 gboolean fileexists, bakexists;
63 filename = folder_get_list_path();
65 fileexists = is_file_exist(filename);
67 bak = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
68 FOLDER_LIST, ".bak", NULL);
69 bakexists = is_file_exist(bak);
72 date = get_file_mtime(bak);
73 ts = localtime(&date);
74 strftime(buf, sizeof(buf), "%a %d-%b-%Y %H:%M %Z", ts);
77 if (!fileexists && bakexists) {
82 (_("The file %s is missing! "
83 "Do you want to use the backup file from %s?"), FOLDER_LIST,buf);
84 aval = alertpanel(_("Warning"), msg, GTK_STOCK_NO, GTK_STOCK_YES, NULL,
87 if (aval != G_ALERTALTERNATE)
90 if (copy_file(bak,filename,FALSE) < 0) {
91 alertpanel_warning(_("Could not copy %s to %s"),bak,filename);
100 node = xml_parse_file(filename);
101 if (!node && is_file_exist(bak)) {
105 msg = g_strdup_printf
106 (_("The file %s is empty or corrupted! "
107 "Do you want to use the backup file from %s?"), FOLDER_LIST,buf);
108 aval = alertpanel(_("Warning"), msg, GTK_STOCK_NO, GTK_STOCK_YES, NULL,
111 if (aval != G_ALERTALTERNATE)
114 if (copy_file(bak,filename,FALSE) < 0) {
115 alertpanel_warning(_("Could not copy %s to %s"),bak,filename);