From c1f42ab2b0820cd1b52dc75ab1e7dfdaae6d604c Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Thu, 15 Jan 2004 17:15:19 +0000 Subject: update protos 2004-01-15 JP Rosevear * gui/tasks-component.h: update protos * gui/tasks-component.c (impl_finalize): free base dir (impl_upgradeFromVersion): just call migrate_tasks (tasks_component_init): set base dir value (tasks_component_peek_base_directory): accessor (tasks_component_peek_source_list): ditto * gui/migration.c (process_old_dir): look for a source with the name and fallback to creating it (create_calendar_contact_source): create the contacts:// source (create_calendar_sources): use above and create all the necessary sources (create_task_sources): create all the necessary sources (migrate_calendars): do all the migration logic here, upgrade bonobo-conf to gconf (migrate_tasks): ditto * gui/calendar-component.h: update prototypes * gui/calendar-component.c (impl_finalize): free the base directory (impl_upgradeFromVersion): just call migrate_calendars (calendar_component_init): fill in base dir value (calendar_component_peek_base_directory): accessor (calendar_component_peek_source_list): ditto svn path=/trunk/; revision=24248 --- calendar/gui/tasks-component.c | 61 +++++++++++++----------------------------- 1 file changed, 19 insertions(+), 42 deletions(-) (limited to 'calendar/gui/tasks-component.c') diff --git a/calendar/gui/tasks-component.c b/calendar/gui/tasks-component.c index 7aac4dae0c..9f0470773a 100644 --- a/calendar/gui/tasks-component.c +++ b/calendar/gui/tasks-component.c @@ -59,7 +59,9 @@ static BonoboObjectClass *parent_class = NULL; extern ECompEditorRegistry *comp_editor_registry; struct _TasksComponentPrivate { + char *base_directory; char *config_directory; + GConfClient *gconf_client; ESourceList *source_list; @@ -474,6 +476,7 @@ impl_finalize (GObject *object) { TasksComponentPrivate *priv = TASKS_COMPONENT (object)->priv; + g_free (priv->base_directory); g_free (priv->config_directory); g_free (priv); @@ -489,49 +492,9 @@ impl_upgradeFromVersion (PortableServer_Servant servant, CORBA_short revision, CORBA_Environment *ev) { - TasksComponentPrivate *priv; - GSList *groups; - ESourceGroup *group; - ESource *source; - char *base_uri, *new_dir; TasksComponent *component = TASKS_COMPONENT (bonobo_object_from_servant (servant)); - priv = component->priv; - - base_uri = g_build_filename (g_get_home_dir (), - ".evolution/tasks/local/OnThisComputer/", - NULL); - - /* create default tasks folders if there are no groups */ - groups = e_source_list_peek_groups (priv->source_list); - if (!groups) { - /* create the source group */ - group = e_source_group_new (_("On This Computer"), base_uri); - e_source_list_add_group (priv->source_list, group, -1); - e_source_list_sync (priv->source_list, NULL); - } - - if (major == 1 && minor <= 4) { - group = e_source_list_peek_group_by_name (priv->source_list, _("On This Computer")); - - /* migrate tasks from older setup */ - if (!migrate_old_tasks (group)) { - /* create default tasks folders */ - new_dir = g_build_filename (base_uri, "Personal/", NULL); - if (!e_mkdir_hier (new_dir, 0700)) { - source = e_source_new (_("Personal"), "Personal"); - e_source_group_add_source (group, source, -1); - } - - g_free (new_dir); - } - - e_source_list_sync (priv->source_list, NULL); - } - - g_free (base_uri); - - return CORBA_TRUE; + return migrate_tasks (component, major, minor, revision); } static void @@ -803,6 +766,8 @@ tasks_component_init (TasksComponent *component, TasksComponentClass *klass) TasksComponentPrivate *priv; priv = g_new0 (TasksComponentPrivate, 1); + + priv->base_directory = g_build_filename (g_get_home_dir (), ".evolution", NULL); priv->config_directory = g_build_filename (g_get_home_dir (), ".evolution", "tasks", "config", NULL); @@ -836,10 +801,22 @@ tasks_component_peek (void) return component; } +const char * +tasks_component_peek_base_directory (TasksComponent *component) +{ + return component->priv->base_directory; +} + const char * tasks_component_peek_config_directory (TasksComponent *component) { - return (const char *) component->priv->config_directory; + return component->priv->config_directory; +} + +ESourceList * +tasks_component_peek_source_list (TasksComponent *component) +{ + return component->priv->source_list; } BONOBO_TYPE_FUNC_FULL (TasksComponent, GNOME_Evolution_Component, PARENT_TYPE, tasks_component) -- cgit