From 2493b75dbbd985baf1c280a1271ea48e9ea31c10 Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Wed, 21 Jan 2004 17:15:29 +0000 Subject: added 'ECalSourceType' argument to be able to create the ECal correctly. 2004-01-21 Rodrigo Moya * gui/dialogs/calendar-setup.c (create_new_source_with_group): added 'ECalSourceType' argument to be able to create the ECal correctly. Added a call to e_cal_open with 'only_if_exists' set to FALSE so that the backend creates the calendar. (new_calendar_finish, new_task_list_finish): pass new argument to create_new_source_with_group. svn path=/trunk/; revision=24352 --- calendar/ChangeLog | 9 +++++++++ calendar/gui/dialogs/calendar-setup.c | 34 ++++++++++++++++++---------------- 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/calendar/ChangeLog b/calendar/ChangeLog index a1999658aa..409c1bc54c 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,12 @@ +2004-01-21 Rodrigo Moya + + * gui/dialogs/calendar-setup.c (create_new_source_with_group): + added 'ECalSourceType' argument to be able to create the + ECal correctly. Added a call to e_cal_open with 'only_if_exists' + set to FALSE so that the backend creates the calendar. + (new_calendar_finish, new_task_list_finish): pass new argument + to create_new_source_with_group. + 2004-01-21 Rodrigo Moya * gui/tasks-component.c (delete_task_list_cb): call diff --git a/calendar/gui/dialogs/calendar-setup.c b/calendar/gui/dialogs/calendar-setup.c index 91c821b34c..149ff5c33f 100644 --- a/calendar/gui/dialogs/calendar-setup.c +++ b/calendar/gui/dialogs/calendar-setup.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include "calendar-setup.h" @@ -204,9 +205,11 @@ static ESource * create_new_source_with_group (GtkWindow *parent, ESourceGroup *group, const char *source_name, - const char *source_location) + const char *source_location, + ECalSourceType source_type) { ESource *source; + ECal *cal; if (e_source_group_peek_source_by_name (group, source_name)) { e_notice (parent, GTK_MESSAGE_ERROR, @@ -242,24 +245,21 @@ create_new_source_with_group (GtkWindow *parent, g_free (relative_uri); } else { - char *new_dir; - /* Local source */ - - new_dir = g_build_filename (e_source_group_peek_base_uri (group), - source_name, NULL); - if (e_mkdir_hier (new_dir, 0700)) { - g_free (new_dir); - e_notice (parent, GTK_MESSAGE_ERROR, - _("Could not create directory for new calendar")); - return NULL; - } - source = e_source_new (source_name, source_name); - g_free (new_dir); } e_source_group_add_source (group, source, -1); + + /* create the calendar in the backend */ + cal = e_cal_new (source, source_type); + if (!e_cal_open (cal, FALSE, NULL)) { + e_source_group_remove_source (group, source); + g_object_unref (source); + } + + g_object_unref (cal); + return source; } @@ -482,7 +482,8 @@ new_calendar_finish (SourceDialog *source_dialog) source_dialog->source = create_new_source_with_group (GTK_WINDOW (source_dialog->window), source_dialog->source_group, gtk_entry_get_text (GTK_ENTRY (source_dialog->name_entry)), - gtk_entry_get_text (GTK_ENTRY (source_dialog->uri_entry))); + gtk_entry_get_text (GTK_ENTRY (source_dialog->uri_entry)), + E_CAL_SOURCE_TYPE_EVENT); dialog_to_source (source_dialog); gtk_widget_destroy (source_dialog->window); @@ -643,7 +644,8 @@ new_task_list_finish (SourceDialog *source_dialog) { source_dialog->source = create_new_source_with_group (GTK_WINDOW (source_dialog->window), source_dialog->source_group, - gtk_entry_get_text (GTK_ENTRY (source_dialog->name_entry)), NULL); + gtk_entry_get_text (GTK_ENTRY (source_dialog->name_entry)), NULL, + E_CAL_SOURCE_TYPE_TODO); dialog_to_source (source_dialog); gtk_widget_destroy (source_dialog->window); -- cgit v1.2.3