aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/save-calendar/rdf-format.c
diff options
context:
space:
mode:
authorPhilip Van Hoof <pvanhoof@gnome.org>2005-01-03 20:39:33 +0800
committerPhilip Van Hoof <pvanhoof@src.gnome.org>2005-01-03 20:39:33 +0800
commit8cfe52bd9e50155e045442a4ae80bd2e1fe060f0 (patch)
tree7c87349c5213b746d86f22852a830981df81ea5e /plugins/save-calendar/rdf-format.c
parente244bd48b230087bc62364b5c7e7ffcc635a8b30 (diff)
downloadgsoc2013-evolution-8cfe52bd9e50155e045442a4ae80bd2e1fe060f0.tar.gz
gsoc2013-evolution-8cfe52bd9e50155e045442a4ae80bd2e1fe060f0.tar.zst
gsoc2013-evolution-8cfe52bd9e50155e045442a4ae80bd2e1fe060f0.zip
Warning when overwriting file
2004-12-27 Philip Van Hoof <pvanhoof@gnome.org> * csv-format.c, rdf-format.c: Warning when overwriting file svn path=/trunk/; revision=28213
Diffstat (limited to 'plugins/save-calendar/rdf-format.c')
-rw-r--r--plugins/save-calendar/rdf-format.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/plugins/save-calendar/rdf-format.c b/plugins/save-calendar/rdf-format.c
index efa038a1f2..bcacd1f373 100644
--- a/plugins/save-calendar/rdf-format.c
+++ b/plugins/save-calendar/rdf-format.c
@@ -195,6 +195,7 @@ do_save_calendar_rdf (FormatHandler *handler, EPlugin *ep, ECalPopupTargetSource
GnomeVFSHandle *handle;
GnomeVFSURI *uri;
gchar *temp = NULL;
+ gboolean doit = TRUE;
if (!dest_uri)
return;
@@ -211,13 +212,36 @@ do_save_calendar_rdf (FormatHandler *handler, EPlugin *ep, ECalPopupTargetSource
}
uri = gnome_vfs_uri_new (dest_uri);
- result = gnome_vfs_open_uri (&handle, uri, GNOME_VFS_OPEN_WRITE);
- if (result != GNOME_VFS_OK) {
- gnome_vfs_create (&handle, dest_uri, GNOME_VFS_OPEN_WRITE, TRUE, GNOME_VFS_PERM_USER_ALL);
+
+ result = gnome_vfs_open_uri (&handle, uri, GNOME_VFS_OPEN_READ);
+ if (result == GNOME_VFS_OK) {
+ GtkWidget *warning =
+ gtk_message_dialog_new_with_markup (NULL,
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_NONE,
+ _("<b>File exists \"%s\".\n"
+ "Do you wish to overwrite it?"), dest_uri);
+
+ gtk_dialog_add_button (GTK_DIALOG (warning), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+ gtk_dialog_add_button (GTK_DIALOG (warning), _("_Overwrite"), GTK_RESPONSE_YES);
+
+ doit = FALSE;
+ if (gtk_dialog_run (GTK_DIALOG (warning)) == GTK_RESPONSE_YES)
+ doit = TRUE;
+ gtk_widget_destroy (warning);
+ }
+
+ if (doit) {
result = gnome_vfs_open_uri (&handle, uri, GNOME_VFS_OPEN_WRITE);
+ if (result != GNOME_VFS_OK) {
+ gnome_vfs_create (&handle, dest_uri, GNOME_VFS_OPEN_WRITE, TRUE, GNOME_VFS_PERM_USER_ALL);
+ result = gnome_vfs_open_uri (&handle, uri, GNOME_VFS_OPEN_WRITE);
+ }
}
- if (result == GNOME_VFS_OK && e_cal_get_object_list_as_comp (source_client, "#t", &objects, NULL)) {
+
+ if (result == GNOME_VFS_OK && doit && e_cal_get_object_list_as_comp (source_client, "#t", &objects, NULL)) {
xmlBufferPtr buffer=xmlBufferCreate();
xmlDocPtr doc = xmlNewDoc((xmlChar *) "1.0");
xmlNodePtr fnode = doc->children;