aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--e-util/e-util.c2
-rw-r--r--mail/ChangeLog29
-rw-r--r--mail/em-folder-browser.c4
-rw-r--r--mail/em-folder-tree.c2
-rw-r--r--mail/em-folder-view.c2
-rw-r--r--mail/em-format-html.c5
-rw-r--r--mail/em-utils.c4
-rw-r--r--mail/importers/mail-importer.c4
-rw-r--r--mail/mail-autofilter.c6
-rw-r--r--mail/mail-component.c12
-rw-r--r--mail/mail-config.c14
-rw-r--r--mail/mail-folder-cache.c8
-rw-r--r--mail/mail-ops.c4
-rw-r--r--mail/mail-session.c2
-rw-r--r--mail/mail-tools.c2
-rw-r--r--mail/mail-vfolder.c20
16 files changed, 80 insertions, 40 deletions
diff --git a/e-util/e-util.c b/e-util/e-util.c
index 87a78341f2..50bd7eab70 100644
--- a/e-util/e-util.c
+++ b/e-util/e-util.c
@@ -60,7 +60,7 @@
const gchar *
e_get_user_data_dir (void)
{
- static gchar* dirname = NULL;
+ static gchar *dirname = NULL;
if (G_UNLIKELY (dirname == NULL))
dirname = g_build_filename (
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 00550adad4..84a224755f 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,32 @@
+2008-03-12 Matthew Barnes <mbarnes@redhat.com>
+
+ ** Fixes breakage caused by bug #513951
+
+ * mail-autofilter.c (filter_gui_add_from_message),
+ (mail_filter_rename_uri), (mail_filter_delete_uri):
+ * mail-tools.c (mail_tool_get_local_movemail_path):
+ * mail-vfolder.c (mail_vfolder_delete_uri), (mail_vfolder_rename_uri),
+ (store_folder_deleted), (store_folder_renamed),
+ (vfolder_load_storage), (vfolder_revert),
+ (em_vfolder_editor_response), (edit_rule_response),
+ (new_rule_clicked):
+ * em-folder-browser.c (emfb_search_search_activated):
+ * em-folder-tree.c (em_folder_tree_new):
+ * mail-ops.c (uid_cachename_hack), (empty_trash_exec):
+ * em-folder-view.c (emfv_setup_view_instance):
+ * em-utils.c (em_filter_editor_response), (em_utils_edit_filters):
+ * importers/mail-importer.c (import_folders_rec):
+ * mail-folder-cache.c (rename_folders):
+ * em-format-html.c (em_format_html_get_type):
+ * mail-session.c (main_get_filter_driver):
+ * mail-config.c (gconf_mime_types_changed), (uri_to_evname),
+ (mail_config_folder_to_cachename), (get_new_signature_filename):
+ Adapt to new meaning of mail_component_peek_base_directory().
+
+ * mail-component.c (mail_component_init):
+ Add back initialization of priv->base_directory. Accidentally
+ removed it somehow in last commit.
+
2008-03-11 Matthew Barnes <mbarnes@redhat.com>
** Fixes part of bug #513951
diff --git a/mail/em-folder-browser.c b/mail/em-folder-browser.c
index 1d58859a4e..bbe4d29250 100644
--- a/mail/em-folder-browser.c
+++ b/mail/em-folder-browser.c
@@ -1118,7 +1118,7 @@ emfb_search_search_activated(ESearchBar *esb, EMFolderBrowser *emfb)
}
/* Create a camel vee folder */
- storeuri = g_strdup_printf("vfolder:%s/mail/vfolder", mail_component_peek_base_directory (mail_component_peek ()));
+ storeuri = g_strdup_printf("vfolder:%s/vfolder", mail_component_peek_base_directory (mail_component_peek ()));
vfolder_store = camel_session_get_store (session, storeuri, NULL);
efb->account_search_vf = (CamelVeeFolder *)camel_vee_folder_new (vfolder_store,_("Account Search"),CAMEL_STORE_VEE_FOLDER_AUTO);
@@ -1171,7 +1171,7 @@ emfb_search_search_activated(ESearchBar *esb, EMFolderBrowser *emfb)
if (!efb->all_account_search_vf) {
/* Create a camel vee folder */
- storeuri = g_strdup_printf("vfolder:%s/mail/vfolder", mail_component_peek_base_directory (mail_component_peek ()));
+ storeuri = g_strdup_printf("vfolder:%s/vfolder", mail_component_peek_base_directory (mail_component_peek ()));
vfolder_store = camel_session_get_store (session, storeuri, NULL);
efb->all_account_search_vf = (CamelVeeFolder *)camel_vee_folder_new (vfolder_store,_("All Account Search"),CAMEL_STORE_VEE_FOLDER_AUTO);
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
index 87a2ad9c4b..e0db603fb3 100644
--- a/mail/em-folder-tree.c
+++ b/mail/em-folder-tree.c
@@ -566,7 +566,7 @@ em_folder_tree_new (void)
EMFolderTreeModel *model;
EMFolderTree *emft;
- model = em_folder_tree_model_new (mail_component_peek_base_directory (mail_component_peek ()));
+ model = em_folder_tree_model_new (e_get_user_data_dir ());
emft = (EMFolderTree *) em_folder_tree_new_with_model (model);
g_object_unref (model);
diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c
index 53ec53d526..7d59b549c6 100644
--- a/mail/em-folder-view.c
+++ b/mail/em-folder-view.c
@@ -614,7 +614,7 @@ emfv_setup_view_instance(EMFolderView *emfv)
galviewsmaildir = g_build_filename (EVOLUTION_GALVIEWSDIR,
"mail",
NULL);
- dir = g_build_filename (evolution_dir, "mail", "views", NULL);
+ dir = g_build_filename (evolution_dir, "views", NULL);
gal_view_collection_set_storage_directories (collection, galviewsmaildir, dir);
g_free (dir);
g_free (galviewsmaildir);
diff --git a/mail/em-format-html.c b/mail/em-format-html.c
index a1faece46a..fd54e08696 100644
--- a/mail/em-format-html.c
+++ b/mail/em-format-html.c
@@ -254,9 +254,12 @@ em_format_html_get_type(void)
sizeof(EMFormatHTML), 0,
(GInstanceInitFunc)efh_init
};
- const char *base_directory = mail_component_peek_base_directory (mail_component_peek ());
+ const char *base_directory = e_get_user_data_dir ();
char *path;
+ /* Trigger creation of mail component. */
+ mail_component_peek ();
+
efh_parent = g_type_class_ref(em_format_get_type());
type = g_type_register_static(em_format_get_type(), "EMFormatHTML", &info, 0);
diff --git a/mail/em-utils.c b/mail/em-utils.c
index 1e41708afa..0c81fbe8bd 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -255,7 +255,7 @@ em_filter_editor_response (GtkWidget *dialog, int button, gpointer user_data)
char *user;
fc = g_object_get_data ((GObject *) dialog, "context");
- user = g_strdup_printf ("%s/mail/filters.xml",
+ user = g_strdup_printf ("%s/filters.xml",
mail_component_peek_base_directory (mail_component_peek ()));
rule_context_save ((RuleContext *) fc, user);
g_free (user);
@@ -293,7 +293,7 @@ em_utils_edit_filters (GtkWidget *parent)
}
fc = em_filter_context_new ();
- user = g_strdup_printf ("%s/mail/filters.xml", base_directory);
+ user = g_strdup_printf ("%s/filters.xml", base_directory);
system = g_build_filename (EVOLUTION_PRIVDATADIR, "filtertypes.xml", NULL);
rule_context_load ((RuleContext *) fc, system, user);
g_free (user);
diff --git a/mail/importers/mail-importer.c b/mail/importers/mail-importer.c
index 99241d8ddb..e3a56a4bc8 100644
--- a/mail/importers/mail-importer.c
+++ b/mail/importers/mail-importer.c
@@ -396,9 +396,9 @@ import_folders_rec(struct _import_folders_data *m, const char *filepath, const c
break;
}
/* FIXME: need a better way to get default store location */
- uri = g_strdup_printf("mbox:%s/mail/local#%s", mail_component_peek_base_directory(NULL), folder);
+ uri = g_strdup_printf("mbox:%s/local#%s", mail_component_peek_base_directory(NULL), folder);
} else {
- uri = g_strdup_printf("mbox:%s/mail/local#%s/%s", mail_component_peek_base_directory(NULL), folderparent, folder);
+ uri = g_strdup_printf("mbox:%s/local#%s/%s", mail_component_peek_base_directory(NULL), folderparent, folder);
}
printf("importing to uri %s\n", uri);
diff --git a/mail/mail-autofilter.c b/mail/mail-autofilter.c
index 9fa59622da..023d5942dd 100644
--- a/mail/mail-autofilter.c
+++ b/mail/mail-autofilter.c
@@ -359,7 +359,7 @@ filter_gui_add_from_message (CamelMimeMessage *msg, const char *source, int flag
g_return_if_fail (msg != NULL);
fc = em_filter_context_new ();
- user = g_strdup_printf ("%s/mail/filters.xml",
+ user = g_strdup_printf ("%s/filters.xml",
mail_component_peek_base_directory (mail_component_peek ()));
system = g_build_filename (EVOLUTION_PRIVDATADIR, "filtertypes.xml", NULL);
rule_context_load ((RuleContext *)fc, system, user);
@@ -386,7 +386,7 @@ mail_filter_rename_uri(CamelStore *store, const char *olduri, const char *newuri
enewuri = em_uri_from_camel(newuri);
fc = em_filter_context_new ();
- user = g_strdup_printf ("%s/mail/filters.xml", mail_component_peek_base_directory (mail_component_peek ()));
+ user = g_strdup_printf ("%s/filters.xml", mail_component_peek_base_directory (mail_component_peek ()));
system = g_build_filename (EVOLUTION_PRIVDATADIR, "filtertypes.xml", NULL);
rule_context_load ((RuleContext *)fc, system, user);
g_free (system);
@@ -417,7 +417,7 @@ mail_filter_delete_uri(CamelStore *store, const char *uri)
euri = em_uri_from_camel(uri);
fc = em_filter_context_new ();
- user = g_strdup_printf ("%s/mail/filters.xml", mail_component_peek_base_directory (mail_component_peek ()));
+ user = g_strdup_printf ("%s/filters.xml", mail_component_peek_base_directory (mail_component_peek ()));
system = g_build_filename (EVOLUTION_PRIVDATADIR, "filtertypes.xml", NULL);
rule_context_load ((RuleContext *)fc, system, user);
g_free (system);
diff --git a/mail/mail-component.c b/mail/mail-component.c
index 66f0833658..abe98170a0 100644
--- a/mail/mail-component.c
+++ b/mail/mail-component.c
@@ -1209,6 +1209,18 @@ mail_component_init (MailComponent *component)
priv->lock = g_mutex_new();
priv->quit_state = -1;
+ /* FIXME This is used as both a filename and URI path throughout
+ * the mail code. Need to clean this up; maybe provide a
+ * mail_component_get_base_uri() function. */
+ priv->base_directory = g_build_filename (e_get_user_data_dir (), "mail", NULL);
+#ifdef G_OS_WIN32
+ {
+ char *p = priv->base_directory;
+ while ((p = strchr(p, '\\')))
+ *p++ = '/';
+ }
+#endif
+
if (g_mkdir_with_parents (e_get_user_data_dir (), 0777) == -1 && errno != EEXIST)
abort ();
diff --git a/mail/mail-config.c b/mail/mail-config.c
index 4828187a5b..3e34ea100d 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -371,17 +371,13 @@ 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 (base_dir, "config", "gtkrc-mail-fonts", NULL);
+ config->gtkrc = g_build_filename (e_get_user_data_dir (), "mail", "config", "gtkrc-mail-fonts", NULL);
mail_config_clear ();
@@ -882,9 +878,9 @@ uri_to_evname (const char *uri, const char *prefix)
e_filename_make_safe (safe);
/* blah, easiest thing to do */
if (prefix[0] == '*')
- tmp = g_strdup_printf ("%s/mail/%s%s.xml", base_directory, prefix + 1, safe);
+ tmp = g_strdup_printf ("%s/%s%s.xml", base_directory, prefix + 1, safe);
else
- tmp = g_strdup_printf ("%s/mail/%s%s", base_directory, prefix, safe);
+ tmp = g_strdup_printf ("%s/%s%s", base_directory, prefix, safe);
g_free (safe);
return tmp;
}
@@ -1002,7 +998,7 @@ mail_config_folder_to_cachename (CamelFolder *folder, const char *prefix)
url = mail_config_folder_to_safe_url (folder);
basename = g_strdup_printf ("%s%s", prefix, url);
- filename = g_build_filename (evolution_dir, "mail", "config", basename, NULL);
+ filename = g_build_filename (evolution_dir, "config", basename, NULL);
g_free (basename);
g_free (url);
@@ -1023,7 +1019,7 @@ get_new_signature_filename (void)
struct stat st;
int i;
- base_directory = mail_component_peek_base_directory (mail_component_peek ());
+ base_directory = e_get_user_data_dir ();
filename = g_build_filename (base_directory, "signatures", NULL);
if (g_lstat (filename, &st)) {
if (errno == ENOENT) {
diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c
index 417f115999..95709e7d5f 100644
--- a/mail/mail-folder-cache.c
+++ b/mail/mail-folder-cache.c
@@ -646,13 +646,13 @@ rename_folders(struct _store_info *si, const char *oldbase, const char *newbase,
e_filename_make_safe(olduri);
newuri = folder_to_url(si->store, fi->full_name);
e_filename_make_safe(newuri);
- oldfile = g_strdup_printf("%s/mail/config/custom_view-%s.xml", mail_component_peek_base_directory(NULL), olduri);
- newfile = g_strdup_printf("%s/mail/config/custom_view-%s.xml", mail_component_peek_base_directory(NULL), newuri);
+ oldfile = g_strdup_printf("%s/config/custom_view-%s.xml", mail_component_peek_base_directory(NULL), olduri);
+ newfile = g_strdup_printf("%s/config/custom_view-%s.xml", mail_component_peek_base_directory(NULL), newuri);
g_rename(oldfile, newfile);
g_free(oldfile);
g_free(newfile);
- oldfile = g_strdup_printf("%s/mail/config/current_view-%s.xml", mail_component_peek_base_directory(NULL), olduri);
- newfile = g_strdup_printf("%s/mail/config/current_view-%s.xml", mail_component_peek_base_directory(NULL), newuri);
+ oldfile = g_strdup_printf("%s/config/current_view-%s.xml", mail_component_peek_base_directory(NULL), olduri);
+ newfile = g_strdup_printf("%s/config/current_view-%s.xml", mail_component_peek_base_directory(NULL), newuri);
g_rename(oldfile, newfile);
g_free(oldfile);
g_free(newfile);
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index f11c2e0258..36f45efe6e 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -252,7 +252,7 @@ uid_cachename_hack (CamelStore *store)
e_filename_make_safe (encoded_url);
evolution_dir = mail_component_peek_base_directory (mail_component_peek ());
- filename = g_build_filename (evolution_dir, "mail", "pop", encoded_url, "uid-cache", NULL);
+ filename = g_build_filename (evolution_dir, "pop", encoded_url, "uid-cache", NULL);
g_free (encoded_url);
return filename;
@@ -1647,7 +1647,7 @@ empty_trash_exec (struct _empty_trash_msg *m)
trash = mail_tool_get_trash (m->account->source->url, FALSE, &m->base.ex);
} else {
evolution_dir = mail_component_peek_base_directory (mail_component_peek ());
- uri = g_strdup_printf ("mbox:%s/mail/local", evolution_dir);
+ uri = g_strdup_printf ("mbox:%s/local", evolution_dir);
trash = mail_tool_get_trash (uri, TRUE, &m->base.ex);
g_free (uri);
}
diff --git a/mail/mail-session.c b/mail/mail-session.c
index 9f9a2712b7..c8710d63d4 100644
--- a/mail/mail-session.c
+++ b/mail/mail-session.c
@@ -499,7 +499,7 @@ main_get_filter_driver (CamelSession *session, const char *type, CamelException
gconf = mail_config_get_gconf_client ();
- user = g_strdup_printf ("%s/mail/filters.xml", mail_component_peek_base_directory (mail_component_peek ()));
+ user = g_strdup_printf ("%s/filters.xml", mail_component_peek_base_directory (mail_component_peek ()));
system = g_build_filename (EVOLUTION_PRIVDATADIR, "filtertypes.xml", NULL);
fc = (RuleContext *) em_filter_context_new ();
rule_context_load (fc, system, user);
diff --git a/mail/mail-tools.c b/mail/mail-tools.c
index 59bbf7936d..d24daf4d45 100644
--- a/mail/mail-tools.c
+++ b/mail/mail-tools.c
@@ -115,7 +115,7 @@ mail_tool_get_local_movemail_path (const unsigned char *uri, CamelException *ex)
if (strchr("/:;=|%&#!*^()\\, ", *c) || !isprint((int) *c))
*c = '_';
- path = g_strdup_printf("%s/mail/spool", mail_component_peek_base_directory(NULL));
+ path = g_strdup_printf("%s/spool", mail_component_peek_base_directory(NULL));
if (g_stat(path, &st) == -1 && g_mkdir_with_parents(path, 0777) == -1) {
camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, _("Could not create spool directory `%s': %s"),
path, g_strerror(errno));
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c
index 7ed1dfb93b..4e1662c595 100644
--- a/mail/mail-vfolder.c
+++ b/mail/mail-vfolder.c
@@ -588,7 +588,7 @@ mail_vfolder_delete_uri(CamelStore *store, const char *curi)
dialog = e_error_new(NULL, "mail:vfolder-updated", changed->str, uri, NULL);
em_utils_show_info_silent (dialog);
- user = g_strdup_printf ("%s/mail/vfolders.xml",
+ user = g_strdup_printf ("%s/vfolders.xml",
mail_component_peek_base_directory (mail_component_peek ()));
rule_context_save ((RuleContext *) context, user);
g_free (user);
@@ -655,7 +655,7 @@ mail_vfolder_rename_uri(CamelStore *store, const char *cfrom, const char *cto)
char *user;
d(printf("Vfolders updated from renamed folder\n"));
- user = g_strdup_printf("%s/mail/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ()));
+ user = g_strdup_printf("%s/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ()));
rule_context_save((RuleContext *)context, user);
g_free(user);
}
@@ -839,7 +839,7 @@ store_folder_deleted(CamelObject *o, void *event_data, void *data)
g_object_unref(rule);
g_signal_connect(context, "rule_removed", G_CALLBACK(context_rule_removed), context);
- user = g_strdup_printf("%s/mail/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ()));
+ user = g_strdup_printf("%s/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ()));
rule_context_save((RuleContext *)context, user);
g_free(user);
} else {
@@ -882,7 +882,7 @@ store_folder_renamed(CamelObject *o, void *event_data, void *data)
filter_rule_set_name(rule, info->new->full_name);
g_signal_connect(rule, "changed", G_CALLBACK(rule_changed), folder);
- user = g_strdup_printf("%s/mail/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ()));
+ user = g_strdup_printf("%s/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ()));
rule_context_save((RuleContext *)context, user);
g_free(user);
@@ -917,7 +917,7 @@ vfolder_load_storage(void)
pthread_mutex_unlock (&lock);
/* first, create the vfolder store, and set it up */
- storeuri = g_strdup_printf("vfolder:%s/mail/vfolder", mail_component_peek_base_directory (mail_component_peek ()));
+ storeuri = g_strdup_printf("vfolder:%s/vfolder", mail_component_peek_base_directory (mail_component_peek ()));
vfolder_store = camel_session_get_store(session, storeuri, NULL);
if (vfolder_store == NULL) {
g_warning("Cannot open vfolder store - no vfolders available");
@@ -935,7 +935,7 @@ vfolder_load_storage(void)
mail_component_load_store_by_uri (mail_component_peek (), storeuri, _("Search Folders"));
/* load our rules */
- user = g_strdup_printf ("%s/mail/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ()));
+ user = g_strdup_printf ("%s/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ()));
context = em_vfolder_context_new ();
xmlfile = g_build_filename (EVOLUTION_PRIVDATADIR, "vfoldertypes.xml", NULL);
@@ -976,7 +976,7 @@ vfolder_revert(void)
char *user;
d(printf("vfolder_revert\n"));
- user = g_strdup_printf("%s/mail/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ()));
+ user = g_strdup_printf("%s/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ()));
rule_context_revert((RuleContext *)context, user);
g_free(user);
}
@@ -988,7 +988,7 @@ em_vfolder_editor_response (GtkWidget *dialog, int button, void *data)
{
char *user;
- user = g_strdup_printf ("%s/mail/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ()));
+ user = g_strdup_printf ("%s/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ()));
switch(button) {
case GTK_RESPONSE_OK:
@@ -1032,7 +1032,7 @@ edit_rule_response(GtkWidget *w, int button, void *data)
FilterRule *orig = g_object_get_data (G_OBJECT (w), "orig");
filter_rule_copy(orig, rule);
- user = g_strdup_printf("%s/mail/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ()));
+ user = g_strdup_printf("%s/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ()));
rule_context_save((RuleContext *)context, user);
g_free(user);
}
@@ -1105,7 +1105,7 @@ new_rule_clicked(GtkWidget *w, int button, void *data)
g_object_ref(rule);
rule_context_add_rule((RuleContext *)context, rule);
- user = g_strdup_printf("%s/mail/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ()));
+ user = g_strdup_printf("%s/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ()));
rule_context_save((RuleContext *)context, user);
g_free(user);
}