diff options
author | Milan Crha <mcrha@redhat.com> | 2010-10-29 23:07:00 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2010-10-29 23:07:00 +0800 |
commit | 709a0807d35d6cb55f0d262cb780929550009bad (patch) | |
tree | f52c2a0a0bb836e8ba7ff41a25d41b7f90a026dd | |
parent | 059caea47b692d0ca5ed2ddd32a42a1cf0cc9dc5 (diff) | |
download | gsoc2013-evolution-709a0807d35d6cb55f0d262cb780929550009bad.tar.gz gsoc2013-evolution-709a0807d35d6cb55f0d262cb780929550009bad.tar.zst gsoc2013-evolution-709a0807d35d6cb55f0d262cb780929550009bad.zip |
Bug #632280 - Backup file name should include date (YYYYMMDD)
-rw-r--r-- | plugins/backup-restore/backup-restore.c | 19 | ||||
-rw-r--r-- | 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 2174606e13..1c6e0d0014 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 2ce3d08532..555eebe2d8 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; |