From e0d5ae3e97f318fb60674de189c8eff91477bac9 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 11 Mar 2008 15:20:59 +0000 Subject: ** Fixes bug #513951 2008-03-11 Matthew Barnes ** Fixes bug #513951 * addressbook/gui/component/addressbook-component.c (ensure_sources): * addressbook/gui/component/addressbook-migrate.c (addressbook_migrate): * calendar/gui/cal-search-bar.c (cal_search_bar_construct): * calendar/gui/migration.c (create_calendar_sources), (create_task_sources), (migrate_calendars), (migrate_tasks), (create_memo_sources): * calendar/gui/e-memos.c (e_memos_setup_view_menus): * calendar/gui/tasks-component.c (ensure_sources): * calendar/gui/gnome-cal.c (gnome_calendar_setup_view_menus): * calendar/gui/calendar-component.c (ensure_sources): * calendar/gui/memos-component.c (ensure_sources): * mail/mail-config.c (gconf_mime_types_changed): Adapt to new meaning of xxx_component_peek_base_directory(). * addressbook/gui/component/addressbook-component.c (addressbook_component_init): * addressbook/gui/component/addressbook-migrate.c (create_groups): * calendar/gui/tasks-component.c (tasks_component_init): * calendar/gui/calendar-component.c (calendar_component_init): * calendar/gui/memos-component.c (memos_component_init): * composer/e-msg-composer.c (autosave_manager_query_load_orphans), (autosave_init_file): * e-util/e-mktemp.c (get_dir): * e-util/e-util.c (get_lock_filename): * mail/mail-component.c: * plugins/face/face.c (org_gnome_composer_face): * smime/lib/e-cert-db.c (initialize_nss): Use e_get_user_data_dir() instead of constructing the full path. * calendar/gui/migration.c (add_gw_esource): * composer/e-msg-composer.c (e_msg-composer_unrealize), (e_msg_composer_set_view_from), (e_msg_composer_set_view_replyto), (e_msg_composer_set_view_to), (e_msg_composer_set_view_postto), (e_msg_composer_set_view_cc), (e_msg_composer_set_view_bcc): * e-util/e-util.c (e_file_update_save_path), (e_file_get_save_path): Emit warnings if saving to GConf fails. * e-util/e-util.c (e_get_user_data_dir): New function returns the base directory for Evolution user data. This should be the /only/ place in the application where this directory is hard-coded. svn path=/trunk/; revision=35175 --- mail/ChangeLog | 10 ++++++++++ mail/mail-component.c | 21 +++++++-------------- mail/mail-config.c | 6 +++++- 3 files changed, 22 insertions(+), 15 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index c20c4b84da..00550adad4 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,13 @@ +2008-03-11 Matthew Barnes + + ** Fixes part of bug #513951 + + * mail-config.c (gconf_mime_types_changed): + Adapt to new meaning of xxx_component_peek_base_directory(). + + * mail-component.c: + Use e_get_user_data_dir() instead of constructing the full path. + 2008-03-06 Tobias Mueller ** Fix for bug #520745 diff --git a/mail/mail-component.c b/mail/mail-component.c index 0e5e19a398..66f0833658 100644 --- a/mail/mail-component.c +++ b/mail/mail-component.c @@ -49,6 +49,7 @@ #include "e-util/e-icon-factory.h" #include "misc/e-info-label.h" +#include "e-util/e-util.h" #include "e-util/e-error.h" #include "e-util/e-util-private.h" #include "e-util/e-logger.h" @@ -281,7 +282,7 @@ mc_setup_local_store(MailComponent *mc) camel_exception_init(&ex); url = camel_url_new("mbox:", NULL); - tmp = g_strdup_printf("%s/mail/local", p->base_directory); + tmp = g_build_filename (p->base_directory, "local", NULL); camel_url_set_path(url, tmp); g_free(tmp); tmp = camel_url_to_string(url, 0); @@ -356,7 +357,7 @@ setup_search_context (MailComponent *component) MailComponentPrivate *priv = component->priv; if (priv->search_context == NULL) { - char *user = g_build_filename(component->priv->base_directory, "mail/searches.xml", NULL); + char *user = g_build_filename(component->priv->base_directory, "searches.xml", NULL); char *system = g_build_filename (EVOLUTION_PRIVDATADIR, "searchtypes.xml", NULL); priv->search_context = (RuleContext *)em_search_context_new (); @@ -1046,7 +1047,7 @@ impl_upgradeFromVersion (PortableServer_Servant servant, const short major, cons component = mail_component_peek (); camel_exception_init (&ex); - if (em_migrate (component->priv->base_directory, major, minor, revision, &ex) == -1) { + if (em_migrate (e_get_user_data_dir (), major, minor, revision, &ex) == -1) { GNOME_Evolution_Component_UpgradeFailed *failedex; failedex = GNOME_Evolution_Component_UpgradeFailed__alloc(); @@ -1208,24 +1209,16 @@ mail_component_init (MailComponent *component) priv->lock = g_mutex_new(); priv->quit_state = -1; - priv->base_directory = g_build_filename (g_get_home_dir (), ".evolution", NULL); -#ifdef G_OS_WIN32 - { - char *p = priv->base_directory; - while ((p = strchr(p, '\\'))) - *p++ = '/'; - } -#endif - if (g_mkdir_with_parents (priv->base_directory, 0777) == -1 && errno != EEXIST) + if (g_mkdir_with_parents (e_get_user_data_dir (), 0777) == -1 && errno != EEXIST) abort (); - priv->model = em_folder_tree_model_new (priv->base_directory); + priv->model = em_folder_tree_model_new (e_get_user_data_dir ()); priv->logger = e_logger_create ("mail"); priv->activity_handler = e_activity_handler_new (); e_activity_handler_set_logger (priv->activity_handler, priv->logger); e_activity_handler_set_error_flush_time (priv->activity_handler, mail_config_get_error_timeout ()*1000); - mail_session_init (priv->base_directory); + mail_session_init (e_get_user_data_dir ()); priv->async_event = mail_async_event_new(); priv->store_hash = g_hash_table_new_full ( diff --git a/mail/mail-config.c b/mail/mail-config.c index 90de0ec75b..4828187a5b 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -371,13 +371,17 @@ gconf_mime_types_changed (GConfClient *client, guint cnxn_id, void mail_config_init (void) { + const gchar *base_dir; + if (config) return; + base_dir = mail_component_peek_base_directory (NULL); + config = g_new0 (MailConfig, 1); config->gconf = gconf_client_get_default (); config->mime_types = g_ptr_array_new (); - config->gtkrc = g_build_filename (g_get_home_dir (), ".evolution", "mail", "config", "gtkrc-mail-fonts", NULL); + config->gtkrc = g_build_filename (base_dir, "config", "gtkrc-mail-fonts", NULL); mail_config_clear (); -- cgit v1.2.3