[evolution] Fix places where "~/.evolution" is hard-coded.



commit f92b45d7df69c958bb4fc606831bc51ee2bcc914
Author: Matthew Barnes <mbarnes redhat com>
Date:   Thu Jul 8 16:59:11 2010 -0400

    Fix places where "~/.evolution" is hard-coded.
    
    Also replace "$USER_DATA_DIR/cache" path constructions with
    e_get_user_cache_dir().

 doc/reference/shell/eshell-sections.txt     |    1 -
 doc/reference/shell/tmpl/e-util.sgml        |    9 ---------
 doc/reference/shell/tmpl/eshell-unused.sgml |    8 ++++++++
 e-util/e-mktemp.c                           |    9 +++++----
 e-util/e-util.c                             |   20 --------------------
 e-util/e-util.h                             |    5 ++++-
 mail/em-format-html.c                       |    8 +++-----
 shell/Makefile.am                           |    7 +++++--
 shell/killev.c                              |    9 +++++----
 9 files changed, 30 insertions(+), 46 deletions(-)
---
diff --git a/doc/reference/shell/eshell-sections.txt b/doc/reference/shell/eshell-sections.txt
index 7ee56ab..ee39dfd 100644
--- a/doc/reference/shell/eshell-sections.txt
+++ b/doc/reference/shell/eshell-sections.txt
@@ -657,7 +657,6 @@ e_run_signature_script
 <SECTION>
 <FILE>e-util</FILE>
 <TITLE>Miscellaneous Utilities</TITLE>
-e_get_user_data_dir
 e_get_gnome2_user_dir
 e_get_accels_filename
 e_show_uri
diff --git a/doc/reference/shell/tmpl/e-util.sgml b/doc/reference/shell/tmpl/e-util.sgml
index 1d17258..b07000d 100644
--- a/doc/reference/shell/tmpl/e-util.sgml
+++ b/doc/reference/shell/tmpl/e-util.sgml
@@ -20,15 +20,6 @@ Miscellaneous Utilities
 <!-- ##### SECTION Image ##### -->
 
 
-<!-- ##### FUNCTION e_get_user_data_dir ##### -->
-<para>
-
-</para>
-
- void: 
- Returns: 
-
-
 <!-- ##### FUNCTION e_get_gnome2_user_dir ##### -->
 <para>
 
diff --git a/doc/reference/shell/tmpl/eshell-unused.sgml b/doc/reference/shell/tmpl/eshell-unused.sgml
index 11fa503..596abb3 100644
--- a/doc/reference/shell/tmpl/eshell-unused.sgml
+++ b/doc/reference/shell/tmpl/eshell-unused.sgml
@@ -11,6 +11,14 @@
 
 @window: 
 
+<!-- ##### FUNCTION e_get_user_data_dir ##### -->
+<para>
+
+</para>
+
+ void: 
+ Returns: 
+
 <!-- ##### FUNCTION e_shell_content_get_search_name ##### -->
 <para>
 
diff --git a/e-util/e-mktemp.c b/e-util/e-mktemp.c
index e53ea60..064c019 100644
--- a/e-util/e-mktemp.c
+++ b/e-util/e-mktemp.c
@@ -36,7 +36,6 @@
 #include <stdio.h>
 #include <time.h>
 
-#include <libedataserver/e-data-server-util.h>
 #include "e-util.h"
 #include "e-mktemp.h"
 
@@ -109,9 +108,11 @@ get_dir (gboolean make)
 	static time_t last = 0;
 
 #ifdef TEMP_HOME
-	gchar *tmpdir = NULL;
-	tmpdir = g_build_filename(e_get_user_data_dir (),
-		"cache", "tmp", NULL);
+	const gchar *user_cache_dir;
+	gchar *tmpdir;
+
+	user_cache_dir = e_get_user_cache_dir ();
+	tmpdir = g_build_filename (user_cache_dir, "tmp", NULL);
 	path = g_string_new(tmpdir);
 	if (make && g_mkdir_with_parents(tmpdir, 0777) == -1) {
 		g_string_free(path, TRUE);
diff --git a/e-util/e-util.c b/e-util/e-util.c
index 956f7d0..4b73fd7 100644
--- a/e-util/e-util.c
+++ b/e-util/e-util.c
@@ -59,26 +59,6 @@
 #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_get_gnome2_user_dir:
  *
  * Returns the base directory for user data, according to libgnome.
diff --git a/e-util/e-util.h b/e-util/e-util.h
index 6f7e56b..e3ce5cb 100644
--- a/e-util/e-util.h
+++ b/e-util/e-util.h
@@ -30,6 +30,10 @@
 
 #include <e-util/e-marshal.h>
 
+/* e_get_user_data_dir() used to live here, so #include its new home
+ * for backward-compatibility (not that we really care about that). */
+#include <libedataserver/e-data-server-util.h>
+
 /* Convenience macro to help migrate from libglade to GtkBuilder.
  * Use it as a direct replacement for glade_xml_get_widget(). */
 #define e_builder_get_widget(builder, name) \
@@ -46,7 +50,6 @@ typedef enum {
 
 typedef void (*ETypeFunc) (GType type, gpointer user_data);
 
-const gchar *	e_get_user_data_dir		(void);
 const gchar *	e_get_gnome2_user_dir		(void);
 const gchar *	e_get_accels_filename		(void);
 void		e_show_uri			(GtkWindow *parent,
diff --git a/mail/em-format-html.c b/mail/em-format-html.c
index c63ed28..55cbca1 100644
--- a/mail/em-format-html.c
+++ b/mail/em-format-html.c
@@ -761,7 +761,7 @@ efh_class_init (EMFormatHTMLClass *class)
 {
 	GObjectClass *object_class;
 	EMFormatClass *format_class;
-	gchar *pathname;
+	const gchar *user_cache_dir;
 
 	parent_class = g_type_class_peek_parent (class);
 	g_type_class_add_private (class, sizeof (EMFormatHTMLPrivate));
@@ -908,14 +908,12 @@ efh_class_init (EMFormatHTMLClass *class)
 			G_PARAM_READABLE));
 
 	/* cache expiry - 2 hour access, 1 day max */
-	pathname = g_build_filename (
-		e_get_user_data_dir (), "cache", NULL);
-	emfh_http_cache = camel_data_cache_new (pathname, NULL);
+	user_cache_dir = e_get_user_cache_dir ();
+	emfh_http_cache = camel_data_cache_new (user_cache_dir, NULL);
 	if (emfh_http_cache) {
 		camel_data_cache_set_expire_age(emfh_http_cache, 24*60*60);
 		camel_data_cache_set_expire_access(emfh_http_cache, 2*60*60);
 	}
-	g_free (pathname);
 }
 
 static void
diff --git a/shell/Makefile.am b/shell/Makefile.am
index 2f044e4..2fc70ae 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -156,11 +156,14 @@ endif
 killev_CPPFLAGS =						\
 	$(AM_CPPFLAGS)						\
 	-DEVOLUTION_LOCALEDIR=\""$(localedir)"\"		\
-	$(GNOME_PLATFORM_CFLAGS)
+	$(GNOME_PLATFORM_CFLAGS)				\
+	$(EVOLUTION_DATA_SERVER_CFLAGS)
 
 killev_SOURCES = killev.c
 
-killev_LDADD = $(GNOME_PLATFORM_LIBS)
+killev_LDADD =							\
+	$(GNOME_PLATFORM_LIBS)					\
+	$(EVOLUTION_DATA_SERVER_LIBS)
 
 # Misc stuff
 
diff --git a/shell/killev.c b/shell/killev.c
index d1eb523..16849ee 100644
--- a/shell/killev.c
+++ b/shell/killev.c
@@ -29,6 +29,8 @@
 #include <gio/gio.h>
 #include <glib/gi18n.h>
 
+#include <libedataserver/e-data-server-util.h>
+
 /* Seconds to wait after asking Evolution to terminate gracefully.
  * If the process has not terminated before the timeout expires,
  * then we get violent. */
@@ -97,6 +99,7 @@ main (gint argc, gchar **argv)
 {
 	GFile *pid_file;
 	GFileMonitor *monitor;
+	const gchar *user_config_dir;
 	gchar *filename;
 	GError *error = NULL;
 
@@ -106,10 +109,8 @@ main (gint argc, gchar **argv)
 
 	g_type_init ();
 
-	/* XXX If e_get_user_data_dir() ever gets moved to libedataserver,
-	 *     use that instead of hard-coding the directory path here. */
-	filename = g_build_filename (
-		g_get_home_dir (), ".evolution", ".running", NULL);
+	user_config_dir = e_get_user_config_dir ();
+	filename = g_build_filename (user_config_dir, ".running", NULL);
 	pid_file = g_file_new_for_path (filename);
 	g_free (filename);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]