diff options
-rw-r--r-- | plugins/backup-restore/ChangeLog | 9 | ||||
-rw-r--r-- | plugins/backup-restore/backup-restore.c | 26 | ||||
-rw-r--r-- | plugins/backup-restore/org-gnome-backup-restore.error.xml | 4 |
3 files changed, 36 insertions, 3 deletions
diff --git a/plugins/backup-restore/ChangeLog b/plugins/backup-restore/ChangeLog index 528a68e321..f59c307f8d 100644 --- a/plugins/backup-restore/ChangeLog +++ b/plugins/backup-restore/ChangeLog @@ -1,3 +1,12 @@ +2008-05-20 Sankar P <psankar@novell.com> + + * backup-restore.c: (epbr_perform_pre_backup_checks), + (org_gnome_backup_restore_backup): + * org-gnome-backup-restore.error.xml: + Indicate error if backup folder chosen lacks permissions. + + ** Fixes bug #534012 + 2008-02-25 Jeff Cai<jeff.cai@sun.com> * backup.c: (backup), (restore): diff --git a/plugins/backup-restore/backup-restore.c b/plugins/backup-restore/backup-restore.c index f5b608bb7a..b7d0793ca1 100644 --- a/plugins/backup-restore/backup-restore.c +++ b/plugins/backup-restore/backup-restore.c @@ -3,6 +3,7 @@ #include <sys/wait.h> #include <gtk/gtk.h> #include <glib/gi18n.h> +#include <glib/gstdio.h> #include <libgnomeui/libgnomeui.h> #include "shell/es-menu.h" #include "mail/em-config.h" @@ -86,6 +87,16 @@ dialog_prompt_user(GtkWindow *parent, const char *string, const char *tag, const return mask; } +static gboolean +epbr_perform_pre_backup_checks (char* dir) +{ +#ifdef G_OS_WIN32 + return TRUE; +#else + return (g_access (dir, W_OK) == 0); +#endif +} + void org_gnome_backup_restore_backup (EPlugin *ep, ESMenuTargetShell *target) { @@ -110,18 +121,27 @@ org_gnome_backup_restore_backup (EPlugin *ep, ESMenuTargetShell *target) char *filename; guint32 mask; char *uri = NULL; + char *dir; uri = gtk_file_chooser_get_current_folder_uri(GTK_FILE_CHOOSER (dlg)); e_file_update_save_path(uri, TRUE); filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dlg)); + dir = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (dlg)); gtk_widget_destroy (dlg); - mask = dialog_prompt_user (GTK_WINDOW (target->target.widget), _("_Restart Evolution after backup"), "org.gnome.backup-restore:backup-confirm", NULL); - if (mask & BR_OK) - backup (filename, (mask & BR_START) ? TRUE: FALSE); + + if (epbr_perform_pre_backup_checks (dir)) { + + mask = dialog_prompt_user (GTK_WINDOW (target->target.widget), _("_Restart Evolution after backup"), "org.gnome.backup-restore:backup-confirm", NULL); + if (mask & BR_OK) + backup (filename, (mask & BR_START) ? TRUE: FALSE); + } else { + e_error_run (NULL, "org.gnome.backup-restore:insufficient-permissions", NULL); + } g_free (filename); + g_free (dir); return; } diff --git a/plugins/backup-restore/org-gnome-backup-restore.error.xml b/plugins/backup-restore/org-gnome-backup-restore.error.xml index 95f1d033ea..6085a1196d 100644 --- a/plugins/backup-restore/org-gnome-backup-restore.error.xml +++ b/plugins/backup-restore/org-gnome-backup-restore.error.xml @@ -17,4 +17,8 @@ <button stock="gtk-no" response="GTK_RESPONSE_NO"/> <button stock="gtk-yes" response="GTK_RESPONSE_YES"/> </error> + <error id="insufficient-permissions" type="error"> + <_title>Insufficient Permissions</_title> + <_secondary>The selected folder does not have enough permissions to create the file</_secondary> + </error> </error-list> |