evolution r35175 - in trunk: addressbook addressbook/gui/component calendar calendar/gui composer e-util mail plugins/face smime smime/lib



Author: mbarnes
Date: Tue Mar 11 15:20:59 2008
New Revision: 35175
URL: http://svn.gnome.org/viewvc/evolution?rev=35175&view=rev

Log:
2008-03-11  Matthew Barnes  <mbarnes redhat com>

	** 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.



Modified:
   trunk/addressbook/ChangeLog
   trunk/addressbook/gui/component/addressbook-component.c
   trunk/addressbook/gui/component/addressbook-migrate.c
   trunk/calendar/ChangeLog
   trunk/calendar/gui/cal-search-bar.c
   trunk/calendar/gui/calendar-component.c
   trunk/calendar/gui/e-memos.c
   trunk/calendar/gui/gnome-cal.c
   trunk/calendar/gui/memos-component.c
   trunk/calendar/gui/migration.c
   trunk/calendar/gui/tasks-component.c
   trunk/composer/ChangeLog
   trunk/composer/e-msg-composer.c
   trunk/e-util/ChangeLog
   trunk/e-util/e-mktemp.c
   trunk/e-util/e-util.c
   trunk/e-util/e-util.h
   trunk/mail/ChangeLog
   trunk/mail/mail-component.c
   trunk/mail/mail-config.c
   trunk/plugins/face/ChangeLog
   trunk/plugins/face/face.c
   trunk/smime/ChangeLog
   trunk/smime/lib/e-cert-db.c

Modified: trunk/addressbook/gui/component/addressbook-component.c
==============================================================================
--- trunk/addressbook/gui/component/addressbook-component.c	(original)
+++ trunk/addressbook/gui/component/addressbook-component.c	Tue Mar 11 15:20:59 2008
@@ -76,6 +76,7 @@
 	ESourceGroup *on_ldap_servers;
 	ESource *personal_source;
 	char *base_uri, *base_uri_proto;
+	const gchar *base_dir;
 
 	on_this_computer = NULL;
 	on_ldap_servers = NULL;
@@ -86,9 +87,8 @@
 		return;
 	}
 
-	base_uri = g_build_filename (addressbook_component_peek_base_directory (component),
-				     "addressbook", "local",
-				     NULL);
+	base_dir = addressbook_component_peek_base_directory (component);
+	base_uri = g_build_filename (base_dir, "local", NULL);
 
 	base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL);
 
@@ -486,7 +486,7 @@
 	/* EPFIXME: Should use a custom one instead? */
 	priv->gconf_client = gconf_client_get_default ();
 
-	priv->base_directory = g_build_filename (g_get_home_dir (), ".evolution", NULL);
+	priv->base_directory = g_build_filename (e_get_user_data_dir (), "addressbook", NULL);
 
 	component->priv = priv;
 

Modified: trunk/addressbook/gui/component/addressbook-migrate.c
==============================================================================
--- trunk/addressbook/gui/component/addressbook-migrate.c	(original)
+++ trunk/addressbook/gui/component/addressbook-migrate.c	Tue Mar 11 15:20:59 2008
@@ -449,14 +449,14 @@
 	GSList *groups;
 	ESourceGroup *group;
 	char *base_uri, *base_uri_proto;
+	const gchar *base_dir;
 
 	*on_this_computer = NULL;
 	*on_ldap_servers = NULL;
 	*personal_source = NULL;
 
-	base_uri = g_build_filename (addressbook_component_peek_base_directory (context->component),
-				     "addressbook", "local",
-				     NULL);
+	base_dir = addressbook_component_peek_base_directory (context->component);
+	base_uri = g_build_filename (base_dir, "local", NULL);
 
 	base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL);
 
@@ -1171,7 +1171,7 @@
 
 			old_path = g_build_filename (g_get_home_dir (), "evolution", "local", "Contacts", NULL);
 			new_path = g_build_filename (addressbook_component_peek_base_directory (component),
-						     "addressbook", "local", "system", NULL);
+						     "local", "system", NULL);
 			migrate_pilot_data (old_path, new_path);
 			g_free (new_path);
 			g_free (old_path);

Modified: trunk/calendar/gui/cal-search-bar.c
==============================================================================
--- trunk/calendar/gui/cal-search-bar.c	(original)
+++ trunk/calendar/gui/cal-search-bar.c	Tue Mar 11 15:20:59 2008
@@ -37,6 +37,9 @@
 #include <filter/rule-editor.h>
 
 #include "cal-search-bar.h"
+#include "calendar-component.h"
+#include "memos-component.h"
+#include "tasks-component.h"
 
 #include "e-util/e-util.h"
 #include "e-util/e-error.h"
@@ -736,6 +739,7 @@
 	FilterPart *part;
 	RuleContext *search_context;
 	FilterRule  *search_rule;
+	const gchar *base_dir;
 
 	g_return_val_if_fail (IS_CAL_SEARCH_BAR (cal_search), NULL);
 
@@ -760,16 +764,18 @@
 			rule_context_add_rule, rule_context_next_rule);
 
 	if (flags == CAL_SEARCH_MEMOS_DEFAULT) {
-		userfile = g_build_filename (g_get_home_dir (), ".evolution", "memos", "searches.xml", NULL);
+		base_dir = memos_component_peek_base_directory (memos_component_peek ());
 		xmlfile = g_build_filename (SEARCH_RULE_DIR, "memotypes.xml", NULL);
 	} else if (flags == CAL_SEARCH_TASKS_DEFAULT) {
-		userfile = g_build_filename (g_get_home_dir (), ".evolution", "tasks", "searches.xml", NULL);
+		base_dir = tasks_component_peek_base_directory (tasks_component_peek ());
 		xmlfile = g_build_filename (SEARCH_RULE_DIR, "tasktypes.xml", NULL);
 	} else {
-		userfile = g_build_filename (g_get_home_dir (), ".evolution", "calendar", "searches.xml", NULL);
+		base_dir = calendar_component_peek_base_directory (calendar_component_peek ());
 		xmlfile = g_build_filename (SEARCH_RULE_DIR, "caltypes.xml", NULL);
 	}
 
+	userfile = g_build_filename (base_dir, "searches.xml", NULL);
+
 	g_object_set_data_full (G_OBJECT (search_context), "user", userfile, g_free);
 	g_object_set_data_full (G_OBJECT (search_context), "system", xmlfile, g_free);
 

Modified: trunk/calendar/gui/calendar-component.c
==============================================================================
--- trunk/calendar/gui/calendar-component.c	(original)
+++ trunk/calendar/gui/calendar-component.c	Tue Mar 11 15:20:59 2008
@@ -161,6 +161,7 @@
 	ESource *personal_source;
 	ESource *birthdays_source;
 	char *base_uri, *base_uri_proto;
+	const gchar *base_dir;
 	gchar *create_source;
 
 	on_this_computer = NULL;
@@ -175,9 +176,8 @@
 		return;
 	}
 
-	base_uri = g_build_filename (calendar_component_peek_base_directory (component),
-				     "calendar", "local",
-				     NULL);
+	base_dir = calendar_component_peek_base_directory (component);
+	base_uri = g_build_filename (base_dir, "local", NULL);
 
 	base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL);
 
@@ -1726,10 +1726,8 @@
 
 	priv = g_new0 (CalendarComponentPrivate, 1);
 
-	priv->base_directory = g_build_filename (g_get_home_dir (), ".evolution", NULL);
-	priv->config_directory = g_build_filename (g_get_home_dir (),
-						   ".evolution", "calendar", "config",
-						   NULL);
+	priv->base_directory = g_build_filename (e_get_user_data_dir (), "calendar", NULL);
+	priv->config_directory = g_build_filename (priv->base_directory, "config", NULL);
 
 	/* EPFIXME: Should use a custom one instead?  Also we should add
 	 * calendar_component_peek_gconf_client().  */

Modified: trunk/calendar/gui/e-memos.c
==============================================================================
--- trunk/calendar/gui/e-memos.c	(original)
+++ trunk/calendar/gui/e-memos.c	Tue Mar 11 15:20:59 2008
@@ -1155,7 +1155,7 @@
 					 "memos",
 					 NULL);
 		dir1 = g_build_filename (memos_component_peek_base_directory (memos_component_peek ()),
-					 "memos", "views", NULL);
+					 "views", NULL);
 		gal_view_collection_set_storage_directories (collection,
 							     dir0,
 							     dir1);

Modified: trunk/calendar/gui/gnome-cal.c
==============================================================================
--- trunk/calendar/gui/gnome-cal.c	(original)
+++ trunk/calendar/gui/gnome-cal.c	Tue Mar 11 15:20:59 2008
@@ -2386,7 +2386,7 @@
 					  "calendar",
 					  NULL);
 		path1 = g_build_filename (calendar_component_peek_base_directory (calendar_component_peek ()),
-					 "calendar", "views", NULL);
+					 "views", NULL);
 		gal_view_collection_set_storage_directories (collection,
 							     path0,
 							     path1);

Modified: trunk/calendar/gui/memos-component.c
==============================================================================
--- trunk/calendar/gui/memos-component.c	(original)
+++ trunk/calendar/gui/memos-component.c	Tue Mar 11 15:20:59 2008
@@ -132,6 +132,7 @@
 	ESourceGroup *on_the_web;
 	ESource *personal_source;
 	char *base_uri, *base_uri_proto;
+	const gchar *base_dir;
 
 	on_this_computer = NULL;
 	on_the_web = NULL;
@@ -142,9 +143,8 @@
 		return;
 	}
 
-	base_uri = g_build_filename (memos_component_peek_base_directory (component),
-				     "memos", "local",
-				     NULL);
+	base_dir = memos_component_peek_base_directory (component);
+	base_uri = g_build_filename (base_dir, "local", NULL);
 
 	base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL);
 
@@ -1388,10 +1388,8 @@
 
 	priv = g_new0 (MemosComponentPrivate, 1);
 
-	priv->base_directory = g_build_filename (g_get_home_dir (), ".evolution", NULL);
-	priv->config_directory = g_build_filename (g_get_home_dir (),
-						   ".evolution", "memos", "config",
-						   NULL);
+	priv->base_directory = g_build_filename (e_get_user_data_dir (), "memos", NULL);
+	priv->config_directory = g_build_filename (priv->base_directory, "config", NULL);
 
 	component->priv = priv;
 	ensure_sources (component);

Modified: trunk/calendar/gui/migration.c
==============================================================================
--- trunk/calendar/gui/migration.c	(original)
+++ trunk/calendar/gui/migration.c	Tue Mar 11 15:20:59 2008
@@ -424,15 +424,15 @@
 	GSList *groups;
 	ESourceGroup *group;
 	char *base_uri, *base_uri_proto;
+	const gchar *base_dir;
 
 	*on_this_computer = NULL;
 	*on_the_web = NULL;
 	*contacts = NULL;
 	*personal_source = NULL;
 
-	base_uri = g_build_filename (calendar_component_peek_base_directory (component),
-				     "calendar", "local",
-				     NULL);
+	base_dir = calendar_component_peek_base_directory (component);
+	base_uri = g_build_filename (base_dir, "local", NULL);
 
 	base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL);
 
@@ -535,13 +535,14 @@
 	GSList *groups;
 	ESourceGroup *group;
 	char *base_uri, *base_uri_proto;
+	const gchar *base_dir;
 
 	*on_this_computer = NULL;
 	*on_the_web = NULL;
 	*personal_source = NULL;
 
-	base_uri = g_build_filename (tasks_component_peek_base_directory (component),
-				     "tasks", "local", NULL);
+	base_dir = tasks_component_peek_base_directory (component);
+	base_uri = g_build_filename (base_dir, "local", NULL);
 
 	base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL);
 
@@ -851,7 +852,7 @@
 
 			old_path = g_build_filename (g_get_home_dir (), "evolution", "local", "Calendar", NULL);
 			new_path = g_build_filename (calendar_component_peek_base_directory (component),
-						     "calendar", "local", "system", NULL);
+						     "local", "system", NULL);
 			migrate_pilot_data ("calendar", "calendar", old_path, new_path);
 			g_free (new_path);
 			g_free (old_path);
@@ -993,7 +994,7 @@
 
 			old_path = g_build_filename (g_get_home_dir (), "evolution", "local", "Tasks", NULL);
 			new_path = g_build_filename (tasks_component_peek_base_directory (component),
-						     "tasks", "local", "system", NULL);
+						     "local", "system", NULL);
 			migrate_pilot_data ("tasks", "todo", old_path, new_path);
 			g_free (new_path);
 			g_free (old_path);
@@ -1048,13 +1049,14 @@
 	GSList *groups;
 	ESourceGroup *group;
 	char *base_uri, *base_uri_proto;
+	const gchar *base_dir;
 
 	*on_this_computer = NULL;
 	*on_the_web = NULL;
 	*personal_source = NULL;
 
-	base_uri = g_build_filename (memos_component_peek_base_directory (component),
-				     "memos", "local", NULL);
+	base_dir = memos_component_peek_base_directory (component);
+	base_uri = g_build_filename (base_dir, "local", NULL);
 
 	base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL);
 
@@ -1146,6 +1148,7 @@
 	ESourceGroup *group;
 	ESource *source;
 	GSList *ids, *temp ;
+	GError *error = NULL;
 	char *relative_uri;
 	const char *soap_port;
 	const char * use_ssl;
@@ -1180,7 +1183,11 @@
 	e_source_set_color_spec (source, "#EEBC60");
 	e_source_group_add_source (group, source, -1);
 
-	ids = gconf_client_get_list (client, CALENDAR_CONFIG_MEMOS_SELECTED_MEMOS, GCONF_VALUE_STRING, NULL);
+	ids = gconf_client_get_list (client, CALENDAR_CONFIG_MEMOS_SELECTED_MEMOS, GCONF_VALUE_STRING, &error);
+	if ( error != NULL ) {
+		g_warning("%s (%s) %s\n", G_STRLOC, G_STRFUNC, error->message);
+		g_error_free(error);
+	}
 	ids = g_slist_append (ids, g_strdup (e_source_peek_uid (source)));
 	gconf_client_set_list (client, CALENDAR_CONFIG_MEMOS_SELECTED_MEMOS, GCONF_VALUE_STRING, ids, NULL);
 	temp  = ids;

Modified: trunk/calendar/gui/tasks-component.c
==============================================================================
--- trunk/calendar/gui/tasks-component.c	(original)
+++ trunk/calendar/gui/tasks-component.c	Tue Mar 11 15:20:59 2008
@@ -128,6 +128,7 @@
 	ESourceGroup *on_the_web;
 	ESource *personal_source;
 	char *base_uri, *base_uri_proto;
+	const gchar *base_dir;
 
 	on_this_computer = NULL;
 	on_the_web = NULL;
@@ -138,9 +139,8 @@
 		return;
 	}
 
-	base_uri = g_build_filename (tasks_component_peek_base_directory (component),
-				     "tasks", "local",
-				     NULL);
+	base_dir = tasks_component_peek_base_directory (component);
+	base_uri = g_build_filename (base_dir, "local", NULL);
 
 	base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL);
 
@@ -1449,10 +1449,8 @@
 
 	priv = g_new0 (TasksComponentPrivate, 1);
 
-	priv->base_directory = g_build_filename (g_get_home_dir (), ".evolution", NULL);
-	priv->config_directory = g_build_filename (g_get_home_dir (),
-						   ".evolution", "tasks", "config",
-						   NULL);
+	priv->base_directory = g_build_filename (e_get_user_data_dir (), "tasks", NULL);
+	priv->config_directory = g_build_filename (priv->base_directory, "config", NULL);
 
 	component->priv = priv;
 	ensure_sources (component);

Modified: trunk/composer/e-msg-composer.c
==============================================================================
--- trunk/composer/e-msg-composer.c	(original)
+++ trunk/composer/e-msg-composer.c	Tue Mar 11 15:20:59 2008
@@ -1615,9 +1615,9 @@
 	GSList *match = NULL;
 	gint len = strlen (AUTOSAVE_SEED);
 	gint load = FALSE;
-	gchar *dirname;
+	const gchar *dirname;
 
-	dirname = g_build_filename (g_get_home_dir (), ".evolution", NULL);
+	dirname = e_get_user_data_dir ();
 	dir = g_dir_open (dirname, 0, NULL);
 	if (!dir) {
 		return;
@@ -1646,7 +1646,6 @@
 	}
 
 	g_dir_close (dir);
-	g_free (dirname);
 
 	if (match != NULL)
 		load = e_error_run(parent, "mail-composer:recover-autosave", NULL) == GTK_RESPONSE_YES;
@@ -1698,7 +1697,7 @@
 	EMsgComposerPrivate *p = composer->priv;
 	if (p->autosave_file == NULL) {
 		p->autosave_file = g_build_filename (
-			g_get_home_dir (), ".evolution", AUTOSAVE_SEED, NULL);
+			e_get_user_data_dir (), AUTOSAVE_SEED, NULL);
 		p->autosave_fd = g_mkstemp (p->autosave_file);
 		return TRUE;
 	}
@@ -3587,13 +3586,20 @@
 {
 	EMsgComposer *composer = E_MSG_COMPOSER (widget);
 	GConfClient *gconf;
+	GError *error = NULL;
 	int width, height;
 
 	gtk_window_get_size (GTK_WINDOW (composer), &width, &height);
 
 	gconf = gconf_client_get_default ();
-	gconf_client_set_int (gconf, "/apps/evolution/mail/composer/width", width, NULL);
-	gconf_client_set_int (gconf, "/apps/evolution/mail/composer/height", height, NULL);
+	if (!gconf_client_set_int (gconf, "/apps/evolution/mail/composer/width", width, &error)) {
+		g_warning("%s (%s) %s\n", G_STRLOC, G_STRFUNC, error->message);
+		g_clear_error(&error);
+	}
+	if (!gconf_client_set_int (gconf, "/apps/evolution/mail/composer/height", height, &error)) {
+		g_warning("%s (%s) %s\n", G_STRLOC, G_STRFUNC, error->message);
+		g_error_free(error);
+	}
 	g_object_unref (gconf);
 }
 
@@ -5734,7 +5740,8 @@
 {
 	EMsgComposerPrivate *p = composer->priv;
 	GConfClient *gconf;
-
+	GError *error = NULL;
+	
 	g_return_if_fail (E_IS_MSG_COMPOSER (composer));
 
 	if ((p->view_from && view_from) ||
@@ -5746,7 +5753,11 @@
 				      "state", p->view_from ? "1" : "0", NULL);
 
 	gconf = gconf_client_get_default ();
-	gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/From", view_from, NULL);
+	if (!gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/From", view_from, &error)) {
+		g_warning("%s (%s) %s\n", G_STRLOC, G_STRFUNC, error->message);
+		g_error_free(error);
+	}
+	
 	g_object_unref (gconf);
 
 	e_msg_composer_hdrs_set_visible (E_MSG_COMPOSER_HDRS (p->hdrs),
@@ -5784,7 +5795,8 @@
 {
 	EMsgComposerPrivate *p = composer->priv;
 	GConfClient *gconf;
-
+	GError *error = NULL;
+	
 	g_return_if_fail (E_IS_MSG_COMPOSER (composer));
 
 	if ((p->view_replyto && view_replyto) ||
@@ -5797,7 +5809,10 @@
 
 	/* we do this /only/ if the fields is in the visible_mask */
 	gconf = gconf_client_get_default ();
-	gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/ReplyTo", view_replyto, NULL);
+	if (!gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/ReplyTo", view_replyto, &error)) {
+		g_warning("%s (%s) %s\n", G_STRLOC, G_STRFUNC, error->message);
+		g_error_free(error);
+	}
 	g_object_unref (gconf);
 
 	e_msg_composer_hdrs_set_visible (E_MSG_COMPOSER_HDRS (p->hdrs),
@@ -5835,7 +5850,8 @@
 {
 	EMsgComposerPrivate *p = composer->priv;
 	GConfClient *gconf;
-
+	GError *error = NULL;
+	
 	g_return_if_fail (E_IS_MSG_COMPOSER (composer));
 
 	if ((p->view_to && view_to) ||
@@ -5848,7 +5864,10 @@
 
 	if ((E_MSG_COMPOSER_HDRS(p->hdrs))->visible_mask & E_MSG_COMPOSER_VISIBLE_TO) {
 		gconf = gconf_client_get_default ();
-		gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/To", view_to, NULL);
+		if (!gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/To", view_to, &error)) {
+			g_warning("%s (%s) %s\n", G_STRLOC, G_STRFUNC, error->message);
+			g_error_free(error);
+		}
 		g_object_unref (gconf);
 	}
 
@@ -5887,6 +5906,8 @@
 e_msg_composer_set_view_postto (EMsgComposer *composer, gboolean view_postto)
 {
 	GConfClient *gconf;
+	GError *error = NULL;
+	
 	EMsgComposerPrivate *p = composer->priv;
 
 	g_return_if_fail (E_IS_MSG_COMPOSER (composer));
@@ -5901,7 +5922,10 @@
 
 	if ((E_MSG_COMPOSER_HDRS(p->hdrs))->visible_mask & E_MSG_COMPOSER_VISIBLE_POSTTO) {
 		gconf = gconf_client_get_default ();
-		gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/PostTo", view_postto, NULL);
+		if (!gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/PostTo", view_postto, &error)) {
+			g_warning("%s (%s) %s\n", G_STRLOC, G_STRFUNC, error->message);
+			g_error_free(error);
+		}
 		g_object_unref (gconf);
 	}
 
@@ -5940,6 +5964,7 @@
 e_msg_composer_set_view_cc (EMsgComposer *composer, gboolean view_cc)
 {
 	GConfClient *gconf;
+	GError *error = NULL;
 	EMsgComposerPrivate *p = composer->priv;
 
 	g_return_if_fail (E_IS_MSG_COMPOSER (composer));
@@ -5954,7 +5979,10 @@
 
 	if ((E_MSG_COMPOSER_HDRS (p->hdrs))->visible_mask & E_MSG_COMPOSER_VISIBLE_CC) {
 		gconf = gconf_client_get_default ();
-		gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/Cc", view_cc, NULL);
+		if (!gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/Cc", view_cc, &error)) {
+			g_warning("%s (%s) %s\n", G_STRLOC, G_STRFUNC, error->message);
+			g_error_free(error);
+		}
 		g_object_unref (gconf);
 	}
 
@@ -5994,6 +6022,7 @@
 e_msg_composer_set_view_bcc (EMsgComposer *composer, gboolean view_bcc)
 {
 	GConfClient *gconf;
+	GError *error = NULL;
 	EMsgComposerPrivate *p = composer->priv;
 
 	g_return_if_fail (E_IS_MSG_COMPOSER (composer));
@@ -6008,7 +6037,10 @@
 
 	if ((E_MSG_COMPOSER_HDRS (p->hdrs))->visible_mask & E_MSG_COMPOSER_VISIBLE_BCC) {
 		gconf = gconf_client_get_default ();
-		gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/Bcc", view_bcc, NULL);
+		if (!gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/Bcc", view_bcc, &error)) {
+			g_warning("%s (%s) %s\n", G_STRLOC, G_STRFUNC, error->message);
+			g_error_free(error);
+		}
 		g_object_unref (gconf);
 	}
 

Modified: trunk/e-util/e-mktemp.c
==============================================================================
--- trunk/e-util/e-mktemp.c	(original)
+++ trunk/e-util/e-mktemp.c	Tue Mar 11 15:20:59 2008
@@ -110,7 +110,7 @@
 
 #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) {

Modified: trunk/e-util/e-util.c
==============================================================================
--- trunk/e-util/e-util.c	(original)
+++ trunk/e-util/e-util.c	Tue Mar 11 15:20:59 2008
@@ -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 @@
 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 @@
 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 @@
 	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;
 }

Modified: trunk/e-util/e-util.h
==============================================================================
--- trunk/e-util/e-util.h	(original)
+++ trunk/e-util/e-util.h	Tue Mar 11 15:20:59 2008
@@ -44,6 +44,8 @@
 	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);

Modified: trunk/mail/mail-component.c
==============================================================================
--- trunk/mail/mail-component.c	(original)
+++ trunk/mail/mail-component.c	Tue Mar 11 15:20:59 2008
@@ -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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 (

Modified: trunk/mail/mail-config.c
==============================================================================
--- trunk/mail/mail-config.c	(original)
+++ trunk/mail/mail-config.c	Tue Mar 11 15:20:59 2008
@@ -371,13 +371,17 @@
 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 ();
 

Modified: trunk/plugins/face/face.c
==============================================================================
--- trunk/plugins/face/face.c	(original)
+++ trunk/plugins/face/face.c	Tue Mar 11 15:20:59 2008
@@ -29,6 +29,7 @@
 #include <glib/gi18n.h>
 #include <mail/em-menu.h>
 #include <e-util/e-error.h>
+#include <e-util/e-util.h>
 
 #define d(x) x
 
@@ -42,7 +43,7 @@
 	GError *error = NULL;
 
 	composer = (EMsgComposer *) t->target.widget;
-	filename = g_build_filename (g_get_home_dir (), ".evolution", "faces", NULL);
+	filename = g_build_filename (e_get_user_data_dir (), "faces", NULL);
 	g_file_get_contents (filename, &file_contents, NULL, &error);
 
 	if (error) {

Modified: trunk/smime/lib/e-cert-db.c
==============================================================================
--- trunk/smime/lib/e-cert-db.c	(original)
+++ trunk/smime/lib/e-cert-db.c	Tue Mar 11 15:20:59 2008
@@ -87,6 +87,7 @@
 #include "plstr.h"
 #include "prprf.h"
 #include "prmem.h"
+#include "e-util/e-util.h"
 #include "e-util/e-dialog-utils.h"
 #include "e-util/e-util-private.h"
 #include <gtk/gtkmessagedialog.h>
@@ -177,18 +178,11 @@
 	char *evolution_dir_path;
 	gboolean success;
 
-	evolution_dir_path = g_build_filename (g_get_home_dir (), ".evolution", NULL);
-
 #ifdef G_OS_WIN32
 	/* NSS wants filenames in system codepage */
-	{
-		char *cp_path = g_win32_locale_filename_from_utf8 (evolution_dir_path);
-
-		if (cp_path) {
-			g_free (evolution_dir_path);
-			evolution_dir_path = cp_path;
-		}
-	}
+	evolution_dir_path = g_win32_locale_filename_from_utf8 (e_get_user_data_dir ());
+#else
+	evolution_dir_path = g_strdup (e_get_user_data_dir ());
 #endif
 
 	/* we initialize NSS here to make sure it only happens once */



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