aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
Diffstat (limited to 'e-util')
-rw-r--r--e-util/ChangeLog16
-rw-r--r--e-util/e-mktemp.c2
-rw-r--r--e-util/e-util.c36
-rw-r--r--e-util/e-util.h2
4 files changed, 52 insertions, 4 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog
index a52c585e10..8c6978b5e0 100644
--- a/e-util/ChangeLog
+++ b/e-util/ChangeLog
@@ -1,3 +1,19 @@
+2008-03-11 Matthew Barnes <mbarnes@redhat.com>
+
+ ** Fixes part of bug #513951
+
+ * e-mktemp.c (get_dir):
+ * e-util.c (get_lock_filename):
+ Use e_get_user_data_dir() instead of constructing the full path.
+
+ * 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.
+
+ * e-util.c (e_file_update_save_path), (e_file_get_save_path):
+ Emit warnings when saving to GConf fails.
+
2008-02-19 Milan Crha <mcrha@redhat.com>
** Fix for bug #209353
diff --git a/e-util/e-mktemp.c b/e-util/e-mktemp.c
index 9ff294f929..e1f6a382bb 100644
--- a/e-util/e-mktemp.c
+++ b/e-util/e-mktemp.c
@@ -110,7 +110,7 @@ get_dir (gboolean make)
#ifdef TEMP_HOME
char *tmpdir = NULL;
- tmpdir = g_build_filename(g_get_home_dir(), ".evolution",
+ tmpdir = g_build_filename(e_get_user_data_dir (),
"cache", "tmp", NULL);
path = g_string_new(tmpdir);
if (make && g_mkdir_with_parents(tmpdir, 0777) == -1) {
diff --git a/e-util/e-util.c b/e-util/e-util.c
index b1634bcfff..87a78341f2 100644
--- a/e-util/e-util.c
+++ b/e-util/e-util.c
@@ -50,6 +50,26 @@
#include "e-util-private.h"
/**
+ * e_get_user_data_dir:
+ *
+ * Returns the base directory for Evolution-specific user data.
+ * The string is owned by Evolution and must not be modified or freed.
+ *
+ * Returns: base directory for user data
+ **/
+const gchar *
+e_get_user_data_dir (void)
+{
+ static gchar* dirname = NULL;
+
+ if (G_UNLIKELY (dirname == NULL))
+ dirname = g_build_filename (
+ g_get_home_dir (), ".evolution", NULL);
+
+ return dirname;
+}
+
+/**
* e_str_without_underscores:
* @s: the string to strip underscores from.
*
@@ -989,8 +1009,13 @@ void
e_file_update_save_path (gchar *uri, gboolean free)
{
GConfClient *gconf = gconf_client_get_default();
+ GError *error = NULL;
- gconf_client_set_string(gconf, "/apps/evolution/mail/save_dir", uri, NULL);
+ gconf_client_set_string(gconf, "/apps/evolution/mail/save_dir", uri, &error);
+ if (error != NULL) {
+ g_warning("%s (%s) %s", G_STRLOC, G_STRFUNC, error->message);
+ g_clear_error(&error);
+ }
g_object_unref(gconf);
if (free)
g_free(uri);
@@ -1007,9 +1032,14 @@ gchar *
e_file_get_save_path (void)
{
GConfClient *gconf = gconf_client_get_default();
+ GError *error = NULL;
gchar *uri;
- uri = gconf_client_get_string(gconf, "/apps/evolution/mail/save_dir", NULL);
+ uri = gconf_client_get_string(gconf, "/apps/evolution/mail/save_dir", &error);
+ if (error != NULL) {
+ g_warning("%s (%s) %s", G_STRLOC, G_STRFUNC, error->message);
+ g_clear_error(&error);
+ }
g_object_unref(gconf);
if (uri == NULL)
@@ -1027,7 +1057,7 @@ get_lock_filename (void)
static gchar *filename = NULL;
if (G_UNLIKELY (filename == NULL))
- filename = g_build_filename (g_get_home_dir (), ".evolution", LOCK_FILE, NULL);
+ filename = g_build_filename (e_get_user_data_dir (), LOCK_FILE, NULL);
return filename;
}
diff --git a/e-util/e-util.h b/e-util/e-util.h
index fc8da98b7f..15003d7226 100644
--- a/e-util/e-util.h
+++ b/e-util/e-util.h
@@ -44,6 +44,8 @@ typedef enum {
E_FOCUS_END
} EFocus;
+const gchar * e_get_user_data_dir (void);
+
char * e_str_without_underscores (const char *s);
gint e_str_compare (gconstpointer x,
gconstpointer y);