[evolution] Bug #632280 - Backup file name should include date (YYYYMMDD)



commit 709a0807d35d6cb55f0d262cb780929550009bad
Author: Milan Crha <mcrha redhat com>
Date:   Fri Oct 29 17:07:00 2010 +0200

    Bug #632280 - Backup file name should include date (YYYYMMDD)

 plugins/backup-restore/backup-restore.c |   19 ++++++++++++++++++-
 plugins/backup-restore/backup.c         |    1 -
 2 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/plugins/backup-restore/backup-restore.c b/plugins/backup-restore/backup-restore.c
index 2174606..1c6e0d0 100644
--- a/plugins/backup-restore/backup-restore.c
+++ b/plugins/backup-restore/backup-restore.c
@@ -145,6 +145,18 @@ set_local_only (GtkFileChooser *file_chooser)
 	gtk_file_chooser_set_local_only (file_chooser, TRUE);
 }
 
+static gchar *
+suggest_file_name (void)
+{
+	time_t t;
+	struct tm tm;
+
+	t = time (NULL);
+	localtime_r (&t, &tm);
+
+	return g_strdup_printf ("evolution-backup-%04d%02d%02d.tar.gz", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday);
+}
+
 static void
 action_settings_backup_cb (GtkAction *action,
                            EShellWindow *shell_window)
@@ -154,13 +166,18 @@ action_settings_backup_cb (GtkAction *action,
 	GFileInfo *file_info;
 	const gchar *attribute;
 	GError *error = NULL;
+	gchar *suggest;
+
+	suggest = suggest_file_name ();
 
 	file = e_shell_run_save_dialog (
 		e_shell_window_get_shell (shell_window),
 		_("Select name of the Evolution back up file"),
-		"evolution-backup.tar.gz", "*.tar.gz", (GtkCallback)
+		suggest, "*.tar.gz", (GtkCallback)
 		set_local_only, NULL);
 
+	g_free (suggest);
+
 	if (file == NULL)
 		return;
 
diff --git a/plugins/backup-restore/backup.c b/plugins/backup-restore/backup.c
index 2ce3d08..555eebe 100644
--- a/plugins/backup-restore/backup.c
+++ b/plugins/backup-restore/backup.c
@@ -58,7 +58,6 @@
 #define EVOLUTION_DIR_FILE EVOLUTION ".dir"
 #define GCONF_DUMP_FILE "backup-restore-gconf.xml"
 #define GCONF_DIR "/apps/evolution"
-#define ARCHIVE_NAME "evolution-backup.tar.gz"
 
 static gboolean backup_op = FALSE;
 static gchar *bk_file = NULL;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]