From a668b294887993db872ba94f5ecd3f0375b8c398 Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Wed, 23 Oct 2002 13:46:16 +0000 Subject: Fixes #32613 2002-10-23 Rodrigo Moya Fixes #32613 * gui/component-factory.c (sc_user_create_new_item_cb): use the default calendar/tasks folder to activate the component editor. (get_data_uri): deal correctly with the URIs being used. svn path=/trunk/; revision=18415 --- calendar/ChangeLog | 8 ++++++++ calendar/gui/calendar-component.c | 35 +++++++++++++++++++++++++---------- calendar/gui/component-factory.c | 35 +++++++++++++++++++++++++---------- 3 files changed, 58 insertions(+), 20 deletions(-) diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 939b343bdc..ca6550e582 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,11 @@ +2002-10-23 Rodrigo Moya + + Fixes #32613 + + * gui/component-factory.c (sc_user_create_new_item_cb): use the + default calendar/tasks folder to activate the component editor. + (get_data_uri): deal correctly with the URIs being used. + 2002-10-23 JP Rosevear * gui/e-itip-control.c (show_current): fix warning diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c index 82dfc8b575..aa33766260 100644 --- a/calendar/gui/calendar-component.c +++ b/calendar/gui/calendar-component.c @@ -542,10 +542,11 @@ get_data_uri (const char *uri, CalComponentVType vtype) if (uri) { if (*uri != '/' && strncmp (uri, "file:", 5) != 0) return g_strdup (uri); + if (vtype == CAL_COMPONENT_EVENT) - return g_concat_dir_and_file (uri, "calendar.ics"); + return cal_util_expand_uri ((char *) uri, FALSE); else if (vtype == CAL_COMPONENT_TODO) - return g_concat_dir_and_file (uri, "tasks.ics"); + return cal_util_expand_uri ((char *) uri, TRUE); else g_assert_not_reached (); } else { @@ -631,34 +632,48 @@ sc_user_create_new_item_cb (EvolutionShellComponent *shell_component, const char *parent_folder_physical_uri, const char *parent_folder_type) { + char *tmp_uri; + if (strcmp (id, CREATE_EVENT_ID) == 0) { if (type_is_calendar (parent_folder_type)) create_component (parent_folder_physical_uri, GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_EVENT); - else - create_component (NULL, + else { + tmp_uri = calendar_config_default_calendar_folder (); + create_component (tmp_uri, GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_EVENT); + g_free (tmp_uri); + } } else if (strcmp (id, CREATE_ALLDAY_EVENT_ID) == 0) { if (type_is_calendar (parent_folder_type)) create_component (parent_folder_physical_uri, GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_ALLDAY_EVENT); - else - create_component (NULL, + else { + tmp_uri = calendar_config_default_calendar_folder (); + create_component (tmp_uri, GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_ALLDAY_EVENT); + g_free (tmp_uri); + } } else if (strcmp (id, CREATE_MEETING_ID) == 0) { if (type_is_calendar (parent_folder_type)) create_component (parent_folder_physical_uri, GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_MEETING); - else - create_component (NULL, + else { + tmp_uri = calendar_config_default_calendar_folder (); + create_component (tmp_uri, GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_MEETING); + g_free (tmp_uri); + } } else if (strcmp (id, CREATE_TASK_ID) == 0) { if (type_is_tasks (parent_folder_type)) create_component (parent_folder_physical_uri, GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_TODO); - else - create_component (NULL, + else { + tmp_uri = calendar_config_default_tasks_folder (); + create_component (tmp_uri, GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_TODO); + g_free (tmp_uri); + } } else g_assert_not_reached (); } diff --git a/calendar/gui/component-factory.c b/calendar/gui/component-factory.c index 82dfc8b575..aa33766260 100644 --- a/calendar/gui/component-factory.c +++ b/calendar/gui/component-factory.c @@ -542,10 +542,11 @@ get_data_uri (const char *uri, CalComponentVType vtype) if (uri) { if (*uri != '/' && strncmp (uri, "file:", 5) != 0) return g_strdup (uri); + if (vtype == CAL_COMPONENT_EVENT) - return g_concat_dir_and_file (uri, "calendar.ics"); + return cal_util_expand_uri ((char *) uri, FALSE); else if (vtype == CAL_COMPONENT_TODO) - return g_concat_dir_and_file (uri, "tasks.ics"); + return cal_util_expand_uri ((char *) uri, TRUE); else g_assert_not_reached (); } else { @@ -631,34 +632,48 @@ sc_user_create_new_item_cb (EvolutionShellComponent *shell_component, const char *parent_folder_physical_uri, const char *parent_folder_type) { + char *tmp_uri; + if (strcmp (id, CREATE_EVENT_ID) == 0) { if (type_is_calendar (parent_folder_type)) create_component (parent_folder_physical_uri, GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_EVENT); - else - create_component (NULL, + else { + tmp_uri = calendar_config_default_calendar_folder (); + create_component (tmp_uri, GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_EVENT); + g_free (tmp_uri); + } } else if (strcmp (id, CREATE_ALLDAY_EVENT_ID) == 0) { if (type_is_calendar (parent_folder_type)) create_component (parent_folder_physical_uri, GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_ALLDAY_EVENT); - else - create_component (NULL, + else { + tmp_uri = calendar_config_default_calendar_folder (); + create_component (tmp_uri, GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_ALLDAY_EVENT); + g_free (tmp_uri); + } } else if (strcmp (id, CREATE_MEETING_ID) == 0) { if (type_is_calendar (parent_folder_type)) create_component (parent_folder_physical_uri, GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_MEETING); - else - create_component (NULL, + else { + tmp_uri = calendar_config_default_calendar_folder (); + create_component (tmp_uri, GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_MEETING); + g_free (tmp_uri); + } } else if (strcmp (id, CREATE_TASK_ID) == 0) { if (type_is_tasks (parent_folder_type)) create_component (parent_folder_physical_uri, GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_TODO); - else - create_component (NULL, + else { + tmp_uri = calendar_config_default_tasks_folder (); + create_component (tmp_uri, GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_TODO); + g_free (tmp_uri); + } } else g_assert_not_reached (); } -- cgit v1.2.3