aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/dialogs/comp-editor.c
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2001-06-20 07:48:12 +0800
committerJP Rosevear <jpr@src.gnome.org>2001-06-20 07:48:12 +0800
commit0adb39b6b0d8a41ce80444b86be9555719d2552a (patch)
treec97ce55c0f1a5c6dcf64ab7bc21e0e2f93bfa48a /calendar/gui/dialogs/comp-editor.c
parentb33b09f19def72f9fecc84ce2e2e3efff18b232e (diff)
downloadgsoc2013-evolution-0adb39b6b0d8a41ce80444b86be9555719d2552a.tar
gsoc2013-evolution-0adb39b6b0d8a41ce80444b86be9555719d2552a.tar.gz
gsoc2013-evolution-0adb39b6b0d8a41ce80444b86be9555719d2552a.tar.bz2
gsoc2013-evolution-0adb39b6b0d8a41ce80444b86be9555719d2552a.tar.lz
gsoc2013-evolution-0adb39b6b0d8a41ce80444b86be9555719d2552a.tar.xz
gsoc2013-evolution-0adb39b6b0d8a41ce80444b86be9555719d2552a.tar.zst
gsoc2013-evolution-0adb39b6b0d8a41ce80444b86be9555719d2552a.zip
add ui (forward_cmd): implement forward command
2001-06-19 JP Rosevear <jpr@ximian.com> * gui/dialogs/task-editor.c (task_editor_init): add ui (forward_cmd): implement forward command * gui/dialogs/comp-editor.c (save_as_ok): bug fix, seems to work now svn path=/trunk/; revision=10315
Diffstat (limited to 'calendar/gui/dialogs/comp-editor.c')
-rw-r--r--calendar/gui/dialogs/comp-editor.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index 5347a40df3..bdcaefd269 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -23,9 +23,10 @@
#include <config.h>
#endif
+#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <fcntl.h>
+#include <unistd.h>
#include <gnome.h>
#include <bonobo/bonobo-win.h>
#include <bonobo/bonobo-ui-component.h>
@@ -728,20 +729,18 @@ save_as_ok (GtkWidget *widget, gpointer data)
{
CompEditor *editor = COMP_EDITOR (data);
CompEditorPrivate *priv;
+ struct stat s;
char *path;
- int fd, ret = 0;
+ int ret = 0;
priv = editor->priv;
path = gtk_file_selection_get_filename (GTK_FILE_SELECTION (priv->filesel));
- fd = open (path, O_RDONLY);
- if (fd != -1) {
+ if (stat (path, &s) == 0) {
GtkWidget *dlg;
GtkWidget *text;
- close (fd);
-
dlg = gnome_dialog_new (_("Overwrite file?"),
GNOME_STOCK_BUTTON_YES,
GNOME_STOCK_BUTTON_NO,
@@ -755,6 +754,7 @@ save_as_ok (GtkWidget *widget, gpointer data)
}
if (ret == 0) {
+ FILE *file;
gchar *ical_string;
icalcomponent *top_level;
@@ -784,15 +784,15 @@ save_as_ok (GtkWidget *widget, gpointer data)
ical_string = icalcomponent_as_ical_string (top_level);
- fd = open (path, O_WRONLY);
- if (fd == -1) {
+ file = fopen (path, "w");
+ if (file == NULL) {
g_warning ("Couldn't save item");
gtk_main_quit ();
return;
}
- write (fd, ical_string, strlen (ical_string));
- close (fd);
+ fprintf (file, ical_string);
+ fclose (file);
gtk_main_quit ();
}