diff options
author | Sankar P <psankar@novell.com> | 2008-05-20 19:28:05 +0800 |
---|---|---|
committer | Sankarasivasubramanian Pasupathilingam <psankar@src.gnome.org> | 2008-05-20 19:28:05 +0800 |
commit | f71fd06f1e510c623689918412eb208f44dd6deb (patch) | |
tree | 613417b93e3aedc3a9bcea1051c8937dcbaaf409 /plugins | |
parent | 12e92f4fefcbff4967aba9a6e0f5d9c1e46f8eb8 (diff) | |
download | gsoc2013-evolution-f71fd06f1e510c623689918412eb208f44dd6deb.tar.gz gsoc2013-evolution-f71fd06f1e510c623689918412eb208f44dd6deb.tar.zst gsoc2013-evolution-f71fd06f1e510c623689918412eb208f44dd6deb.zip |
Indicate error if backup folder chosen lacks permissions.
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
svn path=/trunk/; revision=35519
Diffstat (limited to 'plugins')
-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> |