[evolution] Bug 607409 - ~/.evolution/mail/config not created on demand
- From: Matthew Barnes <mbarnes src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [evolution] Bug 607409 - ~/.evolution/mail/config not created on demand
- Date: Tue, 19 Jan 2010 16:28:05 +0000 (UTC)
commit efa5316395303bc8f2a627100b8274f0c39c218a
Author: Matthew Barnes <mbarnes redhat com>
Date: Tue Jan 19 11:26:33 2010 -0500
Bug 607409 - ~/.evolution/mail/config not created on demand
mail/mail-config.c | 4 ++--
mail/mail-session.c | 24 ++++++++++++++++++------
2 files changed, 20 insertions(+), 8 deletions(-)
---
diff --git a/mail/mail-config.c b/mail/mail-config.c
index 4914f26..a9f1870 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -617,8 +617,8 @@ mail_config_init (void)
config = g_new0 (MailConfig, 1);
config->gconf = gconf_client_get_default ();
config->gtkrc = g_build_filename (
- e_get_user_data_dir (), "mail",
- "config", "gtkrc-mail-fonts", NULL);
+ mail_session_get_config_dir (),
+ "gtkrc-mail-fonts", NULL);
mail_config_clear ();
diff --git a/mail/mail-session.c b/mail/mail-session.c
index a985aef..86f6fa1 100644
--- a/mail/mail-session.c
+++ b/mail/mail-session.c
@@ -25,6 +25,7 @@
#include <config.h>
+#include <errno.h>
#include <stdlib.h>
#include <string.h>
@@ -87,8 +88,8 @@ typedef struct _MailSessionClass {
} MailSessionClass;
static CamelSessionClass *ms_parent_class;
-static gchar * mail_data_dir;
-static gchar * mail_config_dir;
+static gchar *mail_data_dir;
+static gchar *mail_config_dir;
static gchar *get_password(CamelSession *session, CamelService *service, const gchar *domain, const gchar *prompt, const gchar *item, guint32 flags, CamelException *ex);
static void forget_password(CamelSession *session, CamelService *service, const gchar *domain, const gchar *item, CamelException *ex);
@@ -805,10 +806,7 @@ mail_session_init (void)
session = CAMEL_SESSION (camel_object_new (MAIL_SESSION_TYPE));
e_account_writable(NULL, E_ACCOUNT_SOURCE_SAVE_PASSWD); /* Init the EAccount Setup */
- mail_data_dir = g_build_filename (e_get_user_data_dir (), "mail", NULL);
- mail_config_dir = g_build_filename (mail_data_dir, "config", NULL);
-
- camel_session_construct (session, mail_data_dir);
+ camel_session_construct (session, mail_session_get_data_dir ());
gconf = mail_config_get_gconf_client ();
gconf_client_add_dir (gconf, "/apps/evolution/mail/junk", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
@@ -877,12 +875,26 @@ mail_session_set_junk_headers (const gchar **name, const gchar **value, gint len
const gchar *
mail_session_get_data_dir (void)
{
+ if (G_UNLIKELY (mail_data_dir == NULL))
+ mail_data_dir = g_build_filename (
+ e_get_user_data_dir (), "mail", NULL);
+
return mail_data_dir;
}
const gchar *
mail_session_get_config_dir (void)
{
+ if (G_UNLIKELY (mail_config_dir == NULL)) {
+ mail_config_dir = g_build_filename (
+ mail_session_get_data_dir (), "config", NULL);
+
+ if (g_mkdir_with_parents (mail_config_dir, 0777) != 0)
+ g_critical (
+ "Cannot create directory %s: %s",
+ mail_config_dir, g_strerror (errno));
+ }
+
return mail_config_dir;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]