aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/dialogs/comp-editor.c20
-rw-r--r--calendar/gui/dialogs/task-editor.c20
2 files changed, 30 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 ();
}
diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c
index 2a1f25cfbf..6fcff0d2cb 100644
--- a/calendar/gui/dialogs/task-editor.c
+++ b/calendar/gui/dialogs/task-editor.c
@@ -46,6 +46,14 @@ static void task_editor_class_init (TaskEditorClass *class);
static void task_editor_init (TaskEditor *te);
static void task_editor_destroy (GtkObject *object);
+static void forward_cmd (GtkWidget *widget, gpointer data);
+
+static BonoboUIVerb verbs [] = {
+ BONOBO_UI_UNSAFE_VERB ("ActionForward", forward_cmd),
+
+ BONOBO_UI_VERB_END
+};
+
static CompEditor *parent_class;
@@ -113,6 +121,10 @@ task_editor_init (TaskEditor *te)
comp_editor_append_page (COMP_EDITOR (te),
COMP_EDITOR_PAGE (priv->task_details_page),
_("Details"));
+
+ comp_editor_merge_ui (COMP_EDITOR (te), EVOLUTION_DATADIR
+ "/gnome/ui/evolution-task-editor.xml",
+ verbs);
}
/* Destroy handler for the event editor */
@@ -145,3 +157,11 @@ task_editor_new (void)
{
return TASK_EDITOR (gtk_type_new (TYPE_TASK_EDITOR));
}
+
+static void
+forward_cmd (GtkWidget *widget, gpointer data)
+{
+ TaskEditor *te = TASK_EDITOR (data);
+
+ comp_editor_send_comp (COMP_EDITOR (te), CAL_COMPONENT_METHOD_PUBLISH);
+}