[evolution] Kill mail_config_get_gconf_client().



commit 22ef5aa7e61bcea10169153932f100a0954942da
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sun Oct 17 17:19:13 2010 -0400

    Kill mail_config_get_gconf_client().

 mail/e-mail-reader-utils.c       |   12 +++-
 mail/e-mail-reader.c             |  114 ++++++++++++++++++++++++---------
 mail/e-mail-session.c            |   39 ++++++++----
 mail/em-account-editor.c         |  121 +-----------------------------------
 mail/em-composer-utils.c         |   47 +++++++++-----
 mail/em-folder-properties.c      |   16 +++--
 mail/em-folder-tree.c            |    8 ++-
 mail/em-utils.c                  |   21 +++++--
 mail/mail-config.c               |  130 ++++++++++++++++++--------------------
 mail/mail-config.h               |    2 -
 mail/mail-vfolder.c              |    9 ++-
 mail/message-list.c              |   57 +++++++++++------
 modules/mail/em-composer-prefs.c |    3 +-
 modules/mail/em-mailer-prefs.c   |    4 +-
 modules/mail/em-network-prefs.c  |   22 ++++---
 15 files changed, 303 insertions(+), 302 deletions(-)
---
diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c
index 162e78b..794b25a 100644
--- a/mail/e-mail-reader-utils.c
+++ b/mail/e-mail-reader-utils.c
@@ -795,16 +795,16 @@ headers_changed_cb (GConfClient *client,
 static void
 remove_header_notify_cb (gpointer data)
 {
-	GConfClient *client = mail_config_get_gconf_client ();
+	GConfClient *client;
 	guint notify_id;
 
-	g_return_if_fail (client != NULL);
-
 	notify_id = GPOINTER_TO_INT (data);
 	g_return_if_fail (notify_id != 0);
 
+	client = gconf_client_get_default ();
 	gconf_client_notify_remove (client, notify_id);
 	gconf_client_remove_dir (client, "/apps/evolution/mail/display", NULL);
+	g_object_unref (client);
 }
 
 /**
@@ -817,9 +817,11 @@ remove_header_notify_cb (gpointer data)
 void
 e_mail_reader_connect_headers (EMailReader *reader)
 {
-	GConfClient *client = mail_config_get_gconf_client ();
+	GConfClient *client;
 	guint notify_id;
 
+	client = gconf_client_get_default ();
+
 	gconf_client_add_dir (
 		client, "/apps/evolution/mail/display",
 		GCONF_CLIENT_PRELOAD_NONE, NULL);
@@ -833,4 +835,6 @@ e_mail_reader_connect_headers (EMailReader *reader)
 		GINT_TO_POINTER (notify_id), remove_header_notify_cb);
 
 	headers_changed_cb (client, 0, NULL, reader);
+
+	g_object_unref (client);
 }
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index 2b9c832..76ec3c5 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -442,7 +442,7 @@ action_mail_flag_for_followup_cb (GtkAction *action,
 static void
 check_close_browser_reader (EMailReader *reader)
 {
-	GConfClient *gconf;
+	GConfClient *client;
 	gchar *value;
 	gboolean close_it = FALSE;
 
@@ -452,8 +452,11 @@ check_close_browser_reader (EMailReader *reader)
 	if (!E_IS_MAIL_BROWSER (reader))
 		return;
 
-	gconf = mail_config_get_gconf_client ();
-	value = gconf_client_get_string (gconf, "/apps/evolution/mail/prompts/reply_close_browser", NULL);
+	client = gconf_client_get_default ();
+
+	value = gconf_client_get_string (
+		client, "/apps/evolution/mail/prompts/reply_close_browser", NULL);
+
 	if (value && g_str_equal (value, "always")) {
 		close_it = TRUE;
 	} else if (!value || !g_str_equal (value, "never")) {
@@ -481,7 +484,7 @@ check_close_browser_reader (EMailReader *reader)
 
 		if (response == GTK_RESPONSE_OK || response == GTK_RESPONSE_CANCEL)
 			gconf_client_set_string (
-				gconf, "/apps/evolution/mail/prompts/reply_close_browser",
+				client, "/apps/evolution/mail/prompts/reply_close_browser",
 				response == GTK_RESPONSE_OK ? "always" : "never", NULL);
 	}
 
@@ -489,6 +492,8 @@ check_close_browser_reader (EMailReader *reader)
 
 	if (close_it)
 		gtk_widget_destroy (GTK_WIDGET (reader));
+
+	g_object_unref (client);
 }
 
 static void
@@ -1047,7 +1052,6 @@ action_mail_reply_all_check (CamelFolder *folder,
 	recip_count += camel_address_length (CAMEL_ADDRESS (cc));
 
 	if (recip_count >= 15) {
-		GConfClient *gconf = mail_config_get_gconf_client ();
 		GtkWidget *dialog;
 		GtkWidget *content_area, *check;
 		gint response;
@@ -1065,8 +1069,15 @@ action_mail_reply_all_check (CamelFolder *folder,
 
 		response = gtk_dialog_run (GTK_DIALOG (dialog));
 
-		if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check)))
-			gconf_client_set_bool (gconf, "/apps/evolution/mail/prompts/reply_many_recips", FALSE, NULL);
+		if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check))) {
+			GConfClient *client;
+			const gchar *key;
+
+			client = gconf_client_get_default ();
+			key = "/apps/evolution/mail/prompts/reply_many_recips";
+			gconf_client_set_bool (client, key, FALSE, NULL);
+			g_object_unref (client);
+		}
 
 		gtk_widget_destroy (dialog);
 
@@ -1084,11 +1095,19 @@ static void
 action_mail_reply_all_cb (GtkAction *action,
                           EMailReader *reader)
 {
-	guint32 state = e_mail_reader_check_state (reader);
-	GConfClient *gconf = mail_config_get_gconf_client ();
+	GConfClient *client;
+	const gchar *key;
+	guint32 state;
+	gboolean ask;
 
-	if (gconf_client_get_bool (gconf, "/apps/evolution/mail/prompts/reply_many_recips", NULL) &&
-	    !(state & E_MAIL_READER_SELECTION_IS_MAILING_LIST)) {
+	state = e_mail_reader_check_state (reader);
+
+	client = gconf_client_get_default ();
+	key = "/apps/evolution/mail/prompts/reply_many_recips";
+	ask = gconf_client_get_bool (client, key, NULL);
+	g_object_unref (client);
+
+	if (ask && !(state & E_MAIL_READER_SELECTION_IS_MAILING_LIST)) {
 		CamelMimeMessage *message = NULL;
 		EWebView *web_view;
 		EMFormatHTML *formatter;
@@ -1126,10 +1145,17 @@ static void
 action_mail_reply_group_cb (GtkAction *action,
 			    EMailReader *reader)
 {
-	GConfClient *gconf = mail_config_get_gconf_client ();
-	gboolean reply_list = gconf_client_get_bool (gconf,
-					"/apps/evolution/mail/composer/group_reply_to_list", NULL);
-	guint32 state = e_mail_reader_check_state (reader);
+	GConfClient *client;
+	gboolean reply_list;
+	const gchar *key;
+	guint32 state;
+
+	state = e_mail_reader_check_state (reader);
+
+	client = gconf_client_get_default ();
+	key = "/apps/evolution/mail/composer/group_reply_to_list";
+	reply_list = gconf_client_get_bool (client, key, NULL);
+	g_object_unref (client);
 
 	if (reply_list && (state & E_MAIL_READER_SELECTION_IS_MAILING_LIST)) {
 		e_mail_reader_reply_to_message (reader, NULL, REPLY_MODE_LIST);
@@ -1152,21 +1178,34 @@ action_mail_reply_sender_check (CamelFolder *folder,
                                 CamelMimeMessage *message,
                                 gpointer user_data)
 {
-	GConfClient *gconf = mail_config_get_gconf_client ();
 	EMailReader *reader = user_data;
+	GConfClient *client;
 	gint mode = REPLY_MODE_SENDER;
+	const gchar *key;
+	gboolean ask_ignore_list_reply_to;
+	gboolean ask_list_reply_to;
+	gboolean munged_list_message;
 
 	if (!message)
 		return;
 
+	client = gconf_client_get_default ();
+
+	key = "/apps/evolution/mail/composer/ignore_list_reply_to";
+	ask_ignore_list_reply_to = gconf_client_get_bool (client, key, NULL);
+
+	key = "/apps/evolution/mail/prompts/list_reply_to";
+	ask_list_reply_to = gconf_client_get_bool (client, key, NULL);
+
+	munged_list_message = em_utils_is_munged_list_message (message);
+
 	/* get_message_free () will unref the message, so we need to take an
 	   extra ref for e_mail_reader_reply_to_message () to own. */
 	g_object_ref (message);
 
 	/* Don't do the "Are you sure you want to reply in private?" pop-up if
 	   it's a Reply-To: munged list message... unless we're ignoring munging */
-	if (gconf_client_get_bool (gconf, "/apps/evolution/mail/composer/ignore_list_reply_to", NULL)
-	    || !em_utils_is_munged_list_message (message)) {
+	if (ask_ignore_list_reply_to || !munged_list_message) {
 		GtkWidget *dialog;
 		GtkWidget *content_area, *check;
 		gint response;
@@ -1188,7 +1227,7 @@ action_mail_reply_sender_check (CamelFolder *folder,
 
 		if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check)))
 			gconf_client_set_bool (
-				gconf, "/apps/evolution/mail/prompts/private_list_reply", FALSE, NULL);
+				client, "/apps/evolution/mail/prompts/private_list_reply", FALSE, NULL);
 
 		gtk_widget_destroy (dialog);
 
@@ -1197,8 +1236,9 @@ action_mail_reply_sender_check (CamelFolder *folder,
 		else if (response == GTK_RESPONSE_OK)
 			mode = REPLY_MODE_LIST;
 		else if (response == GTK_RESPONSE_CANCEL)
-			return;
-	} else if (gconf_client_get_bool (gconf, "/apps/evolution/mail/prompts/list_reply_to", NULL)) {
+			goto exit;
+
+	} else if (ask_list_reply_to) {
 		GtkWidget *dialog;
 		GtkWidget *content_area;
 		GtkWidget *vbox;
@@ -1232,10 +1272,10 @@ action_mail_reply_sender_check (CamelFolder *folder,
 
 		if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_again)))
 			gconf_client_set_bool (
-				gconf, "/apps/evolution/mail/prompts/list_reply_to", FALSE, NULL);
+				client, "/apps/evolution/mail/prompts/list_reply_to", FALSE, NULL);
 
 		gconf_client_set_bool (
-			gconf, "/apps/evolution/mail/composer/ignore_list_reply_to",
+			client, "/apps/evolution/mail/composer/ignore_list_reply_to",
 			gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_always_ignore)),
 			NULL);
 
@@ -1246,23 +1286,37 @@ action_mail_reply_sender_check (CamelFolder *folder,
 		else if (response == GTK_RESPONSE_OK)
 			mode = REPLY_MODE_LIST;
 		else if (response == GTK_RESPONSE_CANCEL)
-			return;
+			goto exit;
 	}
 
 	e_mail_reader_reply_to_message (reader, message, mode);
 	check_close_browser_reader (reader);
+
+exit:
+	g_object_unref (client);
 }
 
 static void
 action_mail_reply_sender_cb (GtkAction *action,
                              EMailReader *reader)
 {
-	GConfClient *gconf;
+	GConfClient *client;
+	gboolean ask_list_reply_to;
+	gboolean ask_private_list_reply;
+	const gchar *key;
+	guint32 state;
+
+	state = e_mail_reader_check_state (reader);
+
+	client = gconf_client_get_default ();
+	key = "/apps/evolution/mail/prompts/list_reply_to";
+	ask_list_reply_to = gconf_client_get_bool (client, key, NULL);
+	key = "/apps/evolution/mail/prompts/private_list_reply";
+	ask_private_list_reply = gconf_client_get_bool (client, key, NULL);
+	g_object_unref (client);
 
-	gconf = mail_config_get_gconf_client ();
-	if ((gconf_client_get_bool (gconf, "/apps/evolution/mail/prompts/private_list_reply", NULL) ||
-	     gconf_client_get_bool (gconf, "/apps/evolution/mail/prompts/list_reply_to", NULL)) &&
-	    e_mail_reader_check_state (reader) & E_MAIL_READER_SELECTION_IS_MAILING_LIST) {
+	if ((ask_private_list_reply || ask_list_reply_to) &&
+	    state & E_MAIL_READER_SELECTION_IS_MAILING_LIST) {
 		CamelMimeMessage *message = NULL;
 		EWebView *web_view;
 		EMFormatHTML *formatter;
diff --git a/mail/e-mail-session.c b/mail/e-mail-session.c
index 1d9b44f..8e8d699 100644
--- a/mail/e-mail-session.c
+++ b/mail/e-mail-session.c
@@ -284,10 +284,10 @@ main_get_filter_driver (CamelSession *session,
 	EFilterRule *rule = NULL;
 	const gchar *config_dir;
 	gchar *user, *system;
-	GConfClient *gconf;
+	GConfClient *client;
 	ERuleContext *fc;
 
-	gconf = mail_config_get_gconf_client ();
+	client = gconf_client_get_default ();
 
 	config_dir = mail_session_get_config_dir ();
 	user = g_build_filename (config_dir, "filters.xml", NULL);
@@ -300,11 +300,11 @@ main_get_filter_driver (CamelSession *session,
 	driver = camel_filter_driver_new (session);
 	camel_filter_driver_set_folder_func (driver, get_folder, session);
 
-	if (gconf_client_get_bool (gconf, "/apps/evolution/mail/filters/log", NULL)) {
+	if (gconf_client_get_bool (client, "/apps/evolution/mail/filters/log", NULL)) {
 		if (ms->priv->filter_logfile == NULL) {
 			gchar *filename;
 
-			filename = gconf_client_get_string (gconf, "/apps/evolution/mail/filters/logfile", NULL);
+			filename = gconf_client_get_string (client, "/apps/evolution/mail/filters/logfile", NULL);
 			if (filename) {
 				ms->priv->filter_logfile = g_fopen (filename, "a+");
 				g_free (filename);
@@ -354,6 +354,8 @@ main_get_filter_driver (CamelSession *session,
 
 	g_object_unref (fc);
 
+	g_object_unref (client);
+
 	return driver;
 }
 
@@ -381,12 +383,15 @@ ms_forward_to_cb (CamelFolder *folder,
                   gpointer data)
 {
 	EMailSession *session = E_MAIL_SESSION (data);
+	GConfClient *client;
+
+	client = gconf_client_get_default ();
 
 	camel_message_info_free (info);
 
 	/* do not call mail send immediately, just pile them all in the outbox */
 	if (preparing_flush ||
-	    gconf_client_get_bool (mail_config_get_gconf_client (), "/apps/evolution/mail/filters/flush-outbox", NULL)) {
+	    gconf_client_get_bool (client, "/apps/evolution/mail/filters/flush-outbox", NULL)) {
 		if (preparing_flush)
 			g_source_remove (preparing_flush);
 
@@ -394,6 +399,8 @@ ms_forward_to_cb (CamelFolder *folder,
 			60, (GSourceFunc)
 			forward_to_flush_outbox_cb, session);
 	}
+
+	g_object_unref (client);
 }
 
 /* Support for SOCKS proxy ***************************************************/
@@ -410,7 +417,7 @@ set_socks_proxy_from_gconf (CamelSession *session)
 	gchar *mode, *host;
 	gint port;
 
-	client = mail_config_get_gconf_client ();
+	client = gconf_client_get_default ();
 
 	mode = gconf_client_get_string (client, MODE_PROXY, NULL);
 	if (!g_strcmp0(mode, "manual")) {
@@ -420,6 +427,8 @@ set_socks_proxy_from_gconf (CamelSession *session)
 		g_free (host);
 	}
 	g_free (mode);
+
+	g_object_unref (client);
 }
 
 static void
@@ -443,7 +452,7 @@ set_socks_proxy_gconf_watch (CamelSession *session)
 {
 	GConfClient *client;
 
-	client = mail_config_get_gconf_client ();
+	client = gconf_client_get_default ();
 
 	gconf_client_add_dir (
 		client, DIR_PROXY,
@@ -451,6 +460,8 @@ set_socks_proxy_gconf_watch (CamelSession *session)
 	session_gconf_proxy_id = gconf_client_notify_add (
 		client, DIR_PROXY, proxy_gconf_notify_cb,
 		session, NULL, NULL); /* NULL-GError */
+
+	g_object_unref (client);
 }
 
 static void
@@ -552,7 +563,7 @@ mail_session_finalize (GObject *object)
 {
 	GConfClient *client;
 
-	client = mail_config_get_gconf_client ();
+	client = gconf_client_get_default ();
 
 	if (session_check_junk_notify_id != 0) {
 		gconf_client_notify_remove (client, session_check_junk_notify_id);
@@ -564,6 +575,8 @@ mail_session_finalize (GObject *object)
 		session_gconf_proxy_id = 0;
 	}
 
+	g_object_unref (client);
+
 	g_free (mail_data_dir);
 	g_free (mail_config_dir);
 
@@ -1374,14 +1387,16 @@ mail_session_add_junk_plugin (EMailSession *session,
                               const gchar *plugin_name,
                               CamelJunkPlugin *junk_plugin)
 {
-	GConfClient *gconf;
+	GConfClient *client;
 	gchar *def_plugin;
+	const gchar *key;
 
 	g_return_if_fail (E_IS_MAIL_SESSION (session));
 
-	gconf = mail_config_get_gconf_client ();
-	def_plugin = gconf_client_get_string (
-		gconf, "/apps/evolution/mail/junk/default_plugin", NULL);
+	client = gconf_client_get_default ();
+	key = "/apps/evolution/mail/junk/default_plugin";
+	def_plugin = gconf_client_get_string (client, key, NULL);
+	g_object_unref (client);
 
 	session->priv->junk_plugins = g_list_append (
 		session->priv->junk_plugins, junk_plugin);
diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c
index 7d0b371..85a3507 100644
--- a/mail/em-account-editor.c
+++ b/mail/em-account-editor.c
@@ -611,119 +611,6 @@ emae_account_url (EMAccountEditor *emae, gint urlid)
 }
 
 /* ********************************************************************** */
-static void
-emae_license_state (GtkToggleButton *button, GtkDialog *dialog)
-{
-	gtk_dialog_set_response_sensitive (dialog, GTK_RESPONSE_ACCEPT,
-					  gtk_toggle_button_get_active (button));
-}
-
-static gboolean
-emae_load_text (GtkTextView *view, const gchar *filename)
-{
-	FILE *fd;
-	gchar filebuf[1024];
-	GtkTextIter iter;
-	GtkTextBuffer *buffer;
-	gint count;
-
-	g_return_val_if_fail (filename != NULL , FALSE);
-
-	fd = g_fopen (filename, "r");
-	if (fd) {
-		buffer =  gtk_text_buffer_new (NULL);
-		gtk_text_buffer_get_start_iter (buffer, &iter);
-		while (!feof (fd) && !ferror (fd)) {
-			count = fread (filebuf, 1, sizeof (filebuf), fd);
-			gtk_text_buffer_insert (buffer, &iter, filebuf, count);
-		}
-
-		gtk_text_view_set_buffer (GTK_TEXT_VIEW (view), GTK_TEXT_BUFFER (buffer));
-		fclose (fd);
-	}
-
-	return fd != NULL;
-}
-
-static gboolean
-emae_display_license (EMAccountEditor *emae, CamelProvider *prov)
-{
-	GtkBuilder *builder;
-	GtkWidget *w, *dialog;
-	gchar *tmp;
-	GtkResponseType response = GTK_RESPONSE_NONE;
-
-	builder = gtk_builder_new ();
-	e_load_ui_builder_definition (builder, "mail-dialogs.ui");
-
-	dialog = e_builder_get_widget (builder, "license_dialog");
-	gtk_dialog_set_response_sensitive ((GtkDialog *)dialog, GTK_RESPONSE_ACCEPT, FALSE);
-	tmp = g_strdup_printf (_("%s License Agreement"), prov->license);
-	gtk_window_set_title ((GtkWindow *)dialog, tmp);
-	g_free (tmp);
-
-	g_signal_connect (e_builder_get_widget (builder, "license_checkbutton"),
-			 "toggled", G_CALLBACK(emae_license_state), dialog);
-
-	tmp = g_strdup_printf (_("\nPlease read carefully the license agreement\n"
-				"for %s displayed below\n"
-				"and tick the check box for accepting it\n"), prov->license);
-	gtk_label_set_text ((GtkLabel *)e_builder_get_widget (builder, "license_top_label"), tmp);
-	g_free (tmp);
-
-	w = e_builder_get_widget (builder, "license_textview");
-	if (emae_load_text ((GtkTextView *)w, prov->license_file)) {
-		gtk_text_view_set_editable ((GtkTextView *)w, FALSE);
-		response = gtk_dialog_run ((GtkDialog *)dialog);
-	} else {
-		GtkWidget *editor;
-		GtkWindow *window;
-
-		editor = E_CONFIG (emae->config)->window;
-		if (editor != NULL)
-			window = (GtkWindow *) gtk_widget_get_toplevel (editor);
-		else
-			window = e_shell_get_active_window (NULL);
-		e_alert_run_dialog_for_args (
-			window, "mail:no-load-license",
-			prov->license_file, NULL);
-	}
-
-	gtk_widget_destroy (dialog);
-	g_object_unref (builder);
-
-	return (response == GTK_RESPONSE_ACCEPT);
-}
-
-static gboolean
-emae_check_license (EMAccountEditor *emae, CamelProvider *prov)
-{
-	gboolean accepted = TRUE;
-
-	if (prov->flags & CAMEL_PROVIDER_HAS_LICENSE) {
-		GConfClient *gconf = mail_config_get_gconf_client ();
-		GSList *providers_list, *l;
-
-		providers_list = gconf_client_get_list (gconf, "/apps/evolution/mail/licenses", GCONF_VALUE_STRING, NULL);
-
-		for (l = providers_list, accepted = FALSE; l && !accepted; l = g_slist_next (l))
-			accepted = (strcmp ((gchar *)l->data, prov->protocol) == 0);
-
-		if (!accepted
-		    && (accepted = emae_display_license (emae, prov)) == TRUE) {
-			providers_list = g_slist_append (providers_list, g_strdup (prov->protocol));
-			gconf_client_set_list (gconf,
-					      "/apps/evolution/mail/licenses",
-					      GCONF_VALUE_STRING,
-					      providers_list, NULL);
-		}
-
-		g_slist_foreach (providers_list, (GFunc)g_free, NULL);
-		g_slist_free (providers_list);
-	}
-
-	return accepted;
-}
 
 static void
 default_folders_clicked (GtkButton *button, gpointer user_data)
@@ -995,9 +882,6 @@ emae_setup_signatures (EMAccountEditor *emae, GtkBuilder *builder)
 
 	button = e_builder_get_widget (builder, "sigAddNew");
 	g_signal_connect (button, "clicked", G_CALLBACK(emae_signature_new), emae);
-	gtk_widget_set_sensitive (button,
-				 gconf_client_key_is_writable (mail_config_get_gconf_client (),
-							      "/apps/evolution/mail/signatures", NULL));
 
 	return (GtkWidget *)dropdown;
 }
@@ -1658,10 +1542,7 @@ emae_service_provider_changed (EMAccountEditorService *service)
 
 		camel_url_set_protocol (url, service->provider->protocol);
 		gtk_label_set_text (service->description, service->provider->description);
-		if (!emae_check_license (service->emae, service->provider))
-			gtk_widget_hide (service->frame);
-		else
-			gtk_widget_show (service->frame);
+		gtk_widget_show (service->frame);
 
 		enable = e_account_writable_option (account, service->provider->protocol, "auth");
 		gtk_widget_set_sensitive ((GtkWidget *)service->authtype, enable);
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index 316046e..0dcfa9b 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -1505,7 +1505,8 @@ em_utils_forward_message (EShell *shell,
 {
 	GPtrArray *messages;
 	CamelMimePart *part;
-	GConfClient *gconf;
+	GConfClient *client;
+	const gchar *key;
 	gchar *subject;
 	gint mode;
 	EMsgComposer *composer = NULL;
@@ -1515,8 +1516,10 @@ em_utils_forward_message (EShell *shell,
 	messages = g_ptr_array_new ();
 	g_ptr_array_add (messages, message);
 
-	gconf = mail_config_get_gconf_client ();
-	mode = gconf_client_get_int (gconf, "/apps/evolution/mail/format/forward_style", NULL);
+	client = gconf_client_get_default ();
+	key = "/apps/evolution/mail/format/forward_style";
+	mode = gconf_client_get_int (client, key, NULL);
+	g_object_unref (client);
 
 	switch (mode) {
 		case MAIL_CONFIG_FORWARD_ATTACHED:
@@ -1565,13 +1568,16 @@ em_utils_forward_messages (EShell *shell,
                            GPtrArray *uids,
                            const gchar *from_uri)
 {
-	GConfClient *gconf;
+	GConfClient *client;
+	const gchar *key;
 	gint mode;
 
 	g_return_if_fail (E_IS_SHELL (shell));
 
-	gconf = mail_config_get_gconf_client ();
-	mode = gconf_client_get_int (gconf, "/apps/evolution/mail/format/forward_style", NULL);
+	client = gconf_client_get_default ();
+	key = "/apps/evolution/mail/format/forward_style";
+	mode = gconf_client_get_int (client, key, NULL);
+	g_object_unref (client);
 
 	switch (mode) {
 		case MAIL_CONFIG_FORWARD_ATTACHED:
@@ -2103,12 +2109,14 @@ get_reply_to (CamelMimeMessage *message)
 
 	reply_to = camel_mime_message_get_reply_to (message);
 	if (reply_to) {
-		GConfClient *gconf;
+		GConfClient *client;
+		const gchar *key;
 		gboolean ignore_list_reply_to;
 
-		gconf = mail_config_get_gconf_client ();
-		ignore_list_reply_to = gconf_client_get_bool (gconf,
-					"/apps/evolution/mail/composer/ignore_list_reply_to", NULL);
+		client = gconf_client_get_default ();
+		key = "/apps/evolution/mail/composer/ignore_list_reply_to";
+		ignore_list_reply_to = gconf_client_get_bool (client, key, NULL);
+		g_object_unref (client);
 
 		if (ignore_list_reply_to && em_utils_is_munged_list_message (message))
 			reply_to = NULL;
@@ -2448,15 +2456,22 @@ composer_set_body (EMsgComposer *composer, CamelMimeMessage *message, EMFormat *
 {
 	gchar *text, *credits;
 	CamelMimePart *part;
-	GConfClient *gconf;
+	GConfClient *client;
 	gssize len = 0;
 	gboolean start_bottom;
 	guint32 validity_found = 0;
+	const gchar *key;
+	MailConfigReplyStyle style;
+
+	client = gconf_client_get_default ();
 
-	gconf = mail_config_get_gconf_client ();
-	start_bottom = gconf_client_get_bool (gconf, "/apps/evolution/mail/composer/reply_start_bottom", NULL);
+	key = "/apps/evolution/mail/composer/reply_start_bottom";
+	start_bottom = gconf_client_get_bool (client, key, NULL);
 
-	switch (gconf_client_get_int (gconf, "/apps/evolution/mail/format/reply_style", NULL)) {
+	key = "/apps/evolution/mail/format/reply_style";
+	style = gconf_client_get_int (client, key, NULL);
+
+	switch (style) {
 	case MAIL_CONFIG_REPLY_DO_NOT_QUOTE:
 		/* do nothing */
 		break;
@@ -2493,13 +2508,15 @@ composer_set_body (EMsgComposer *composer, CamelMimeMessage *message, EMFormat *
 		   before the signature. We added there an empty line already. */
 		gtkhtml_editor_run_command (editor, "block-selection");
 		gtkhtml_editor_run_command (editor, "cursor-bod");
-		if (gconf_client_get_bool (gconf, "/apps/evolution/mail/composer/top_signature", NULL)
+		if (gconf_client_get_bool (client, "/apps/evolution/mail/composer/top_signature", NULL)
 		    || !gtkhtml_editor_search_by_data (editor, 1, "ClueFlow", "signature", "1"))
 			gtkhtml_editor_run_command (editor, "cursor-eod");
 		else
 			gtkhtml_editor_run_command (editor, "selection-move-left");
 		gtkhtml_editor_run_command (editor, "unblock-selection");
 	}
+
+	g_object_unref (client);
 }
 
 struct _reply_data {
diff --git a/mail/em-folder-properties.c b/mail/em-folder-properties.c
index d802aeb..dbec096 100644
--- a/mail/em-folder-properties.c
+++ b/mail/em-folder-properties.c
@@ -222,8 +222,9 @@ emfp_dialog_got_folder_quota (CamelFolder *folder,
 	CamelStore *local_store;
 	CamelStore *parent_store;
 	gboolean hide_deleted;
-	GConfClient *gconf;
+	GConfClient *client;
 	const gchar *name;
+	const gchar *key;
 
 	if (folder == NULL)
 		return;
@@ -238,17 +239,18 @@ emfp_dialog_got_folder_quota (CamelFolder *folder,
 	prop_data->object = g_object_ref (folder);
 	prop_data->quota = camel_folder_quota_info_clone (quota);
 
-	/*
-	  Get number of VISIBLE and DELETED messages, instead of TOTAL messages.  VISIBLE+DELETED
-	   gives the correct count that matches the label below the Send & Receive button
-	*/
+	/* Get number of VISIBLE and DELETED messages, instead of TOTAL
+	 * messages.  VISIBLE+DELETED gives the correct count that matches
+	 * the label below the Send & Receive button. */
 	name = camel_folder_get_name (folder);
 	prop_data->total = folder->summary->visible_count;
 	prop_data->unread = folder->summary->unread_count;
 	deleted = folder->summary->deleted_count;
 
-	gconf = mail_config_get_gconf_client ();
-	hide_deleted = !gconf_client_get_bool(gconf, "/apps/evolution/mail/display/show_deleted", NULL);
+	client = gconf_client_get_default ();
+	key = "/apps/evolution/mail/display/show_deleted";
+	hide_deleted = !gconf_client_get_bool(client, key, NULL);
+	g_object_unref (client);
 
 	/*
 	   Do the calculation only for those accounts that support VTRASHes
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
index 4441d39..1f4500c 100644
--- a/mail/em-folder-tree.c
+++ b/mail/em-folder-tree.c
@@ -1258,10 +1258,10 @@ folder_tree_new (EMFolderTree *folder_tree)
 	GtkTreeViewColumn *column;
 	GtkCellRenderer *renderer;
 	GtkWidget *tree;
-	GConfClient *gconf;
+	GConfClient *client;
 	const gchar *key;
 
-	gconf = mail_config_get_gconf_client ();
+	client = gconf_client_get_default ();
 
 	/* FIXME Gross hack */
 	tree = GTK_WIDGET (folder_tree);
@@ -1282,7 +1282,7 @@ folder_tree_new (EMFolderTree *folder_tree)
 
 	renderer = gtk_cell_renderer_text_new ();
 	key = "/apps/evolution/mail/display/no_folder_dots";
-	if (!gconf_client_get_bool (gconf, key, NULL))
+	if (!gconf_client_get_bool (client, key, NULL))
 		g_object_set (
 			renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
 	gtk_tree_view_column_pack_start (column, renderer, TRUE);
@@ -1303,6 +1303,8 @@ folder_tree_new (EMFolderTree *folder_tree)
 
 	gtk_tree_view_set_search_column ((GtkTreeView *)tree, COL_STRING_DISPLAY_NAME);
 
+	g_object_unref (client);
+
 	return (GtkTreeView *) tree;
 }
 
diff --git a/mail/em-utils.c b/mail/em-utils.c
index dab327a..3fcc530 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -124,18 +124,24 @@ em_utils_ask_open_many (GtkWindow *parent,
  * Returns %TRUE if the user clicks Yes or %FALSE otherwise.
  **/
 gboolean
-em_utils_prompt_user (GtkWindow *parent, const gchar *promptkey, const gchar *tag, ...)
+em_utils_prompt_user (GtkWindow *parent,
+                      const gchar *promptkey,
+                      const gchar *tag,
+                      ...)
 {
 	GtkWidget *mbox, *check = NULL;
 	GtkWidget *container;
 	va_list ap;
 	gint button;
-	GConfClient *gconf = mail_config_get_gconf_client ();
+	GConfClient *client;
 	EAlert *alert = NULL;
 
-	if (promptkey
-	    && !gconf_client_get_bool (gconf, promptkey, NULL))
+	client = gconf_client_get_default ();
+
+	if (promptkey && !gconf_client_get_bool (client, promptkey, NULL)) {
+		g_object_unref (client);
 		return TRUE;
+	}
 
 	va_start (ap, tag);
 	alert = e_alert_new_valist (tag, ap);
@@ -154,10 +160,15 @@ em_utils_prompt_user (GtkWindow *parent, const gchar *promptkey, const gchar *ta
 
 	button = gtk_dialog_run ((GtkDialog *) mbox);
 	if (promptkey)
-		gconf_client_set_bool (gconf, promptkey, !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check)), NULL);
+		gconf_client_set_bool (
+			client, promptkey,
+			!gtk_toggle_button_get_active (
+			GTK_TOGGLE_BUTTON (check)), NULL);
 
 	gtk_widget_destroy (mbox);
 
+	g_object_unref (client);
+
 	return button == GTK_RESPONSE_YES;
 }
 
diff --git a/mail/mail-config.c b/mail/mail-config.c
index 5bd85ac..390b113 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -43,8 +43,6 @@
 #include "mail-tools.h"
 
 typedef struct {
-	GConfClient *gconf;
-
 	gchar *gtkrc;
 
 	GSList *labels;
@@ -80,7 +78,7 @@ config_write_style (void)
 		return;
 	}
 
-	client = config->gconf;
+	client = gconf_client_get_default ();
 
 	key = "/apps/evolution/mail/display/fonts/use_custom";
 	custom = gconf_client_get_bool (client, key, NULL);
@@ -101,7 +99,7 @@ config_write_style (void)
 	fprintf (rc, "        GtkHTML::spell_error_color = \"%s\"\n", spell_color);
 	g_free (spell_color);
 
-	if (gconf_client_get_bool (config->gconf, "/apps/evolution/mail/display/mark_citations", NULL))
+	if (gconf_client_get_bool (client, "/apps/evolution/mail/display/mark_citations", NULL))
 		fprintf (rc, "        GtkHTML::cite_color = \"%s\"\n",
 			 citation_color);
 	g_free (citation_color);
@@ -122,6 +120,8 @@ config_write_style (void)
 	fclose (rc);
 
 	gtk_rc_reparse_all ();
+
+	g_object_unref (client);
 }
 
 static void
@@ -157,7 +157,9 @@ gconf_jh_headers_changed (GConfClient *client,
 	g_slist_foreach (config->jh_header, (GFunc) g_free, NULL);
 	g_slist_free (config->jh_header);
 
-	config->jh_header = gconf_client_get_list (config->gconf, "/apps/evolution/mail/junk/custom_header", GCONF_VALUE_STRING, NULL);
+	config->jh_header = gconf_client_get_list (
+		client, "/apps/evolution/mail/junk/custom_header",
+		GCONF_VALUE_STRING, NULL);
 
 	node = config->jh_header;
 	name = g_ptr_array_new ();
@@ -187,12 +189,12 @@ gconf_jh_check_changed (GConfClient *client,
                         EMailSession *session)
 {
 	config->jh_check = gconf_client_get_bool (
-		config->gconf, "/apps/evolution/mail/junk/check_custom_header", NULL);
+		client, "/apps/evolution/mail/junk/check_custom_header", NULL);
 	if (!config->jh_check) {
 		camel_session_set_junk_headers (
 			CAMEL_SESSION (session), NULL, NULL, 0);
 	} else {
-		gconf_jh_headers_changed (NULL, 0, NULL, session);
+		gconf_jh_headers_changed (client, 0, NULL, session);
 	}
 }
 
@@ -229,6 +231,7 @@ gconf_int_value_changed (GConfClient *client,
 void
 mail_config_write (void)
 {
+	GConfClient *client;
 	EAccountList *account_list;
 	ESignatureList *signature_list;
 
@@ -241,16 +244,9 @@ mail_config_write (void)
 	e_account_list_save (account_list);
 	e_signature_list_save (signature_list);
 
-	gconf_client_suggest_sync (config->gconf, NULL);
-}
-
-/* Accessor functions */
-GConfClient *
-mail_config_get_gconf_client (void)
-{
-	g_return_val_if_fail (config != NULL, NULL);
-
-	return config->gconf;
+	client = gconf_client_get_default ();
+	gconf_client_suggest_sync (client, NULL);
+	g_object_unref (client);
 }
 
 gint
@@ -266,23 +262,23 @@ mail_config_get_address_count (void)
 gint
 mail_config_get_sync_timeout (void)
 {
-	GConfClient *gconf = mail_config_get_gconf_client ();
+	GConfClient *client;
 	gint res = 60;
+	GError *error = NULL;
 
-	if (gconf) {
-		GError *error = NULL;
+	client = gconf_client_get_default ();
 
-		res = gconf_client_get_int (gconf, "/apps/evolution/mail/sync_interval", &error);
+	res = gconf_client_get_int (
+		client, "/apps/evolution/mail/sync_interval", &error);
 
-		/* do not allow recheck sooner than every 30 seconds */
-		if (error || res == 0)
-			res = 60;
-		else if (res < 30)
-			res = 30;
+	/* do not allow recheck sooner than every 30 seconds */
+	if (error || res == 0)
+		res = 60;
+	else if (res < 30)
+		res = 30;
 
-		if (error)
-			g_error_free (error);
-	}
+	if (error)
+		g_error_free (error);
 
 	return res;
 }
@@ -547,9 +543,13 @@ mail_config_reload_junk_headers (EMailSession *session)
 	/* It automatically sets in the session */
 	if (config == NULL)
 		mail_config_init (session);
-	else
-		gconf_jh_check_changed (config->gconf, 0, NULL, session);
+	else {
+		GConfClient *client;
 
+		client = gconf_client_get_default ();
+		gconf_jh_check_changed (client, 0, NULL, session);
+		g_object_unref (client);
+	}
 }
 
 gboolean
@@ -585,6 +585,7 @@ folder_renamed_cb (MailFolderCache *cache, CamelStore *store, const gchar *oldur
 void
 mail_config_init (EMailSession *session)
 {
+	GConfClient *client;
 	GConfClientNotifyFunc func;
 	MailFolderCache *folder_cache;
 	const gchar *key;
@@ -595,120 +596,109 @@ mail_config_init (EMailSession *session)
 		return;
 
 	config = g_new0 (MailConfig, 1);
-	config->gconf = gconf_client_get_default ();
 	config->gtkrc = g_build_filename (
 		mail_session_get_config_dir (),
 		"gtkrc-mail-fonts", NULL);
 
 	gtk_rc_parse (config->gtkrc);
 
+	client = gconf_client_get_default ();
+
 	gconf_client_add_dir (
-		config->gconf, "/apps/evolution/mail/prompts",
+		client, "/apps/evolution/mail/prompts",
 		GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
 
 	/* Composer Configuration */
 
 	gconf_client_add_dir (
-		config->gconf, "/apps/evolution/mail/composer",
+		client, "/apps/evolution/mail/composer",
 		GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
 
 	key = "/apps/evolution/mail/composer/spell_color";
 	func = (GConfClientNotifyFunc) gconf_style_changed;
-	gconf_client_notify_add (
-		config->gconf, key, func, NULL, NULL, NULL);
+	gconf_client_notify_add (client, key, func, NULL, NULL, NULL);
 
 	key = "/apps/evolution/mail/composer/outlook_filenames";
 	func = (GConfClientNotifyFunc) gconf_outlook_filenames_changed;
-	gconf_outlook_filenames_changed (config->gconf, 0, NULL, NULL);
-	gconf_client_notify_add (
-		config->gconf, key, func, NULL, NULL, NULL);
+	gconf_outlook_filenames_changed (client, 0, NULL, NULL);
+	gconf_client_notify_add (client, key, func, NULL, NULL, NULL);
 
 	/* Display Configuration */
 
 	gconf_client_add_dir (
-		config->gconf, "/apps/evolution/mail/display",
+		client, "/apps/evolution/mail/display",
 		GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
 
 	key = "/apps/evolution/mail/display/address_compress";
 	func = (GConfClientNotifyFunc) gconf_bool_value_changed;
 	gconf_client_notify_add (
-		config->gconf, key, func,
+		client, key, func,
 		&config->address_compress, NULL, NULL);
-	config->address_compress =
-		gconf_client_get_bool (config->gconf, key, NULL);
+	config->address_compress = gconf_client_get_bool (client, key, NULL);
 
 	key = "/apps/evolution/mail/display/address_count";
 	func = (GConfClientNotifyFunc) gconf_int_value_changed;
 	gconf_client_notify_add (
-		config->gconf, key, func,
+		client, key, func,
 		&config->address_count, NULL, NULL);
-	config->address_count =
-		gconf_client_get_int (config->gconf, key, NULL);
+	config->address_count = gconf_client_get_int (client, key, NULL);
 
 	key = "/apps/evolution/mail/display/citation_colour";
 	func = (GConfClientNotifyFunc) gconf_style_changed;
-	gconf_client_notify_add (
-		config->gconf, key, func, NULL, NULL, NULL);
+	gconf_client_notify_add (client, key, func, NULL, NULL, NULL);
 
 	key = "/apps/evolution/mail/display/mark_citations";
 	func = (GConfClientNotifyFunc) gconf_style_changed;
-	gconf_client_notify_add (
-		config->gconf, key, func, NULL, NULL, NULL);
+	gconf_client_notify_add (client, key, func, NULL, NULL, NULL);
 
 	/* Font Configuration */
 
 	gconf_client_add_dir (
-		config->gconf, "/apps/evolution/mail/display/fonts",
+		client, "/apps/evolution/mail/display/fonts",
 		GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
 
 	key = "/apps/evolution/mail/display/fonts";
 	func = (GConfClientNotifyFunc) gconf_style_changed;
-	gconf_client_notify_add (
-		config->gconf, key, func, NULL, NULL, NULL);
+	gconf_client_notify_add (client, key, func, NULL, NULL, NULL);
 
 	/* Junk Configuration */
 
 	gconf_client_add_dir (
-		config->gconf, "/apps/evolution/mail/junk",
+		client, "/apps/evolution/mail/junk",
 		GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
 
 	key = "/apps/evolution/mail/junk/check_custom_header";
 	func = (GConfClientNotifyFunc) gconf_jh_check_changed;
-	gconf_client_notify_add (
-		config->gconf, key, func, session, NULL, NULL);
-	config->jh_check =
-		gconf_client_get_bool (config->gconf, key, NULL);
+	gconf_client_notify_add (client, key, func, session, NULL, NULL);
+	config->jh_check = gconf_client_get_bool (client, key, NULL);
 
 	key = "/apps/evolution/mail/junk/custom_header";
 	func = (GConfClientNotifyFunc) gconf_jh_headers_changed;
-	gconf_client_notify_add (
-		config->gconf, key, func, session, NULL, NULL);
+	gconf_client_notify_add (client, key, func, session, NULL, NULL);
 
 	key = "/apps/evolution/mail/junk/lookup_addressbook";
 	func = (GConfClientNotifyFunc) gconf_bool_value_changed;
 	gconf_client_notify_add (
-		config->gconf, key, func,
+		client, key, func,
 		&config->book_lookup, NULL, NULL);
-	config->book_lookup =
-		gconf_client_get_bool (config->gconf, key, NULL);
+	config->book_lookup = gconf_client_get_bool (client, key, NULL);
 
 	key = "/apps/evolution/mail/junk/lookup_addressbook_local_only";
 	func = (GConfClientNotifyFunc) gconf_bool_value_changed;
 	gconf_client_notify_add (
-		config->gconf, key, func,
+		client, key, func,
 		&config->book_lookup_local_only, NULL, NULL);
 	config->book_lookup_local_only =
-		gconf_client_get_bool (config->gconf, key, NULL);
+		gconf_client_get_bool (client, key, NULL);
 
 	key = "/desktop/gnome/lockdown/disable_command_line";
 	func = (GConfClientNotifyFunc) gconf_bool_value_changed;
 	gconf_client_notify_add (
-		config->gconf, key, func,
+		client, key, func,
 		&config->scripts_disabled, NULL, NULL);
-	config->scripts_disabled =
-		gconf_client_get_bool (config->gconf, key, NULL);
+	config->scripts_disabled = gconf_client_get_bool (client, key, NULL);
 
-	gconf_jh_check_changed (config->gconf, 0, NULL, session);
+	gconf_jh_check_changed (client, 0, NULL, session);
 
 	folder_cache = e_mail_session_get_folder_cache (session);
 
@@ -718,4 +708,6 @@ mail_config_init (EMailSession *session)
 	g_signal_connect (
 		folder_cache, "folder-renamed",
 		(GCallback) folder_renamed_cb, NULL);
+
+	g_object_unref (client);
 }
diff --git a/mail/mail-config.h b/mail/mail-config.h
index 8bd87c5..792b5f3 100644
--- a/mail/mail-config.h
+++ b/mail/mail-config.h
@@ -66,8 +66,6 @@ GType		evolution_mail_config_get_type	(void);
 void		mail_config_init		(EMailSession *session);
 void		mail_config_write		(void);
 
-GConfClient *	mail_config_get_gconf_client	(void);
-
 /* General Accessor functions */
 
 void		mail_config_service_set_save_passwd
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c
index dbca145..90f6209 100644
--- a/mail/mail-vfolder.c
+++ b/mail/mail-vfolder.c
@@ -1082,7 +1082,7 @@ vfolder_load_storage (EMailBackend *backend)
 	MailFolderCache *folder_cache;
 	EMailSession *session;
 	gchar *xmlfile;
-	GConfClient *gconf;
+	GConfClient *client;
 
 	g_return_if_fail (E_IS_MAIL_BACKEND (backend));
 
@@ -1153,9 +1153,10 @@ vfolder_load_storage (EMailBackend *backend)
 	g_free (storeuri);
 
 	/* reenable the feature if required */
-	gconf = mail_config_get_gconf_client ();
-	if (!gconf_client_get_bool (gconf, "/apps/evolution/mail/display/enable_vfolders", NULL))
-		gconf_client_set_bool (gconf, "/apps/evolution/mail/display/enable_vfolders", TRUE, NULL);
+	client = gconf_client_get_default ();
+	if (!gconf_client_get_bool (client, "/apps/evolution/mail/display/enable_vfolders", NULL))
+		gconf_client_set_bool (client, "/apps/evolution/mail/display/enable_vfolders", TRUE, NULL);
+	g_object_unref (client);
 
 	folder_cache = e_mail_session_get_folder_cache (session);
 
diff --git a/mail/message-list.c b/mail/message-list.c
index 6200e89..137215f 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -1851,17 +1851,18 @@ filter_date (time_t date)
 static ECell * create_composite_cell (gint col)
 {
 	ECell *cell_vbox, *cell_hbox, *cell_sub, *cell_date, *cell_from, *cell_tree, *cell_attach;
-	GConfClient *gconf;
+	GConfClient *client;
 	gchar *fixed_name = NULL;
 	gboolean show_email;
 	gint alt_col = (col == COL_FROM) ? COL_SENDER : COL_RECIPIENTS;
 	gboolean same_font = FALSE;
 
-	gconf = mail_config_get_gconf_client ();
-	show_email = gconf_client_get_bool (gconf, "/apps/evolution/mail/display/show_email", NULL);
-	same_font = gconf_client_get_bool (gconf, "/apps/evolution/mail/display/vertical_view_fonts", NULL);
+	client = gconf_client_get_default ();
+	show_email = gconf_client_get_bool (client, "/apps/evolution/mail/display/show_email", NULL);
+	same_font = gconf_client_get_bool (client, "/apps/evolution/mail/display/vertical_view_fonts", NULL);
 	if (!same_font)
-		fixed_name = gconf_client_get_string (gconf, "/desktop/gnome/interface/monospace_font_name", NULL);
+		fixed_name = gconf_client_get_string (client, "/desktop/gnome/interface/monospace_font_name", NULL);
+	g_object_unref (client);
 
 	cell_vbox = e_cell_vbox_new ();
 
@@ -2706,7 +2707,7 @@ message_list_construct (MessageList *message_list)
 	AtkObject *a11y;
 	gboolean constructed;
 	gchar *etspecfile;
-	GConfClient *gconf = mail_config_get_gconf_client ();
+	GConfClient *client;
 
 	message_list->model =
 		e_tree_memory_callbacks_new (ml_tree_icon_at,
@@ -2732,12 +2733,15 @@ message_list_construct (MessageList *message_list)
 
 					     message_list);
 
-	e_tree_memory_set_expanded_default (E_TREE_MEMORY (message_list->model),
-					   read_boolean_with_default (gconf,
-								      "/apps/evolution/mail/display/thread_expand",
-								      TRUE));
-
-	message_list->priv->thread_latest = read_boolean_with_default (gconf, "/apps/evolution/mail/display/thread_latest", TRUE);
+	client = gconf_client_get_default ();
+	e_tree_memory_set_expanded_default (
+		E_TREE_MEMORY (message_list->model),
+		read_boolean_with_default (
+			client, "/apps/evolution/mail/display/thread_expand", TRUE));
+	message_list->priv->thread_latest =
+		read_boolean_with_default (
+		client, "/apps/evolution/mail/display/thread_latest", TRUE);
+	g_object_unref (client);
 
 	/*
 	 * The etree
@@ -3704,7 +3708,7 @@ message_list_set_folder (MessageList *message_list, CamelFolder *folder, const g
 {
 	ETreeModel *etm = message_list->model;
 	gboolean hide_deleted;
-	GConfClient *gconf;
+	GConfClient *client;
 	CamelStore *folder_store;
 
 	g_return_if_fail (IS_MESSAGE_LIST (message_list));
@@ -3796,10 +3800,18 @@ message_list_set_folder (MessageList *message_list, CamelFolder *folder, const g
 			folder, "changed",
 			G_CALLBACK (folder_changed), message_list);
 
-		gconf = mail_config_get_gconf_client ();
-		hide_deleted = !gconf_client_get_bool (gconf, "/apps/evolution/mail/display/show_deleted", NULL);
-		message_list->hidedeleted = hide_deleted && (!(folder->folder_flags & CAMEL_FOLDER_IS_TRASH) || !(folder_store->flags & CAMEL_STORE_VTRASH));
-		message_list->hidejunk = folder_store_supports_vjunk_folder (message_list->folder) && !(folder->folder_flags & CAMEL_FOLDER_IS_JUNK) && !(folder->folder_flags & CAMEL_FOLDER_IS_TRASH);
+		client = gconf_client_get_default ();
+		hide_deleted = !gconf_client_get_bool (client, "/apps/evolution/mail/display/show_deleted", NULL);
+		g_object_unref (client);
+
+		message_list->hidedeleted =
+			hide_deleted &&
+			(!(folder->folder_flags & CAMEL_FOLDER_IS_TRASH) ||
+			 !(folder_store->flags & CAMEL_STORE_VTRASH));
+		message_list->hidejunk =
+			folder_store_supports_vjunk_folder (message_list->folder) &&
+			!(folder->folder_flags & CAMEL_FOLDER_IS_JUNK) &&
+			!(folder->folder_flags & CAMEL_FOLDER_IS_TRASH);
 
 		if (message_list->frozen == 0)
 			mail_regen_list (message_list, message_list->search, NULL, NULL);
@@ -4762,7 +4774,9 @@ static void
 mail_regen_list (MessageList *ml, const gchar *search, const gchar *hideexpr, CamelFolderChangeInfo *changes)
 {
 	struct _regen_list_msg *m;
-	GConfClient *gconf;
+	GConfClient *client;
+	const gchar *key;
+	gboolean thread_subject;
 
 	/* report empty search as NULL, not as one/two-space string */
 	if (search && (strcmp (search, " ") == 0 || strcmp (search, "  ") == 0))
@@ -4778,7 +4792,10 @@ mail_regen_list (MessageList *ml, const gchar *search, const gchar *hideexpr, Ca
 
 	mail_regen_cancel (ml);
 
-	gconf = mail_config_get_gconf_client ();
+	client = gconf_client_get_default ();
+	key = "/apps/evolution/mail/display/thread_subject";
+	thread_subject = gconf_client_get_bool (client, key, NULL);
+	g_object_unref (client);
 
 #ifndef BROKEN_ETREE
 	/* this can sometimes crash,so ... */
@@ -4800,7 +4817,7 @@ mail_regen_list (MessageList *ml, const gchar *search, const gchar *hideexpr, Ca
 	m->dotree = ml->threaded;
 	m->hidedel = ml->hidedeleted;
 	m->hidejunk = ml->hidejunk;
-	m->thread_subject = gconf_client_get_bool (gconf, "/apps/evolution/mail/display/thread_subject", NULL);
+	m->thread_subject = thread_subject;
 	m->folder = g_object_ref (ml->folder);
 	m->last_row = -1;
 	m->expand_state = NULL;
diff --git a/modules/mail/em-composer-prefs.c b/modules/mail/em-composer-prefs.c
index 196e215..2ae67cb 100644
--- a/modules/mail/em-composer-prefs.c
+++ b/modules/mail/em-composer-prefs.c
@@ -339,7 +339,6 @@ em_composer_prefs_construct (EMComposerPrefs *prefs,
 	GSList *l;
 	gint i;
 
-	client = mail_config_get_gconf_client ();
 	shell_settings = e_shell_get_shell_settings (shell);
 
 	/* Make sure our custom widget classes are registered with
@@ -597,10 +596,12 @@ em_composer_prefs_construct (EMComposerPrefs *prefs,
 					       NULL);
 
 	/* get our toplevel widget */
+	client = gconf_client_get_default ();
 	target = em_config_target_new_prefs (ec, client);
 	e_config_set_target ((EConfig *)ec, (EConfigTarget *)target);
 	toplevel = e_config_create_widget ((EConfig *)ec);
 	gtk_container_add (GTK_CONTAINER (prefs), toplevel);
+	g_object_unref (client);
 }
 
 GtkWidget *
diff --git a/modules/mail/em-mailer-prefs.c b/modules/mail/em-mailer-prefs.c
index a1aed25..f0f8e42 100644
--- a/modules/mail/em-mailer-prefs.c
+++ b/modules/mail/em-mailer-prefs.c
@@ -112,6 +112,8 @@ em_mailer_prefs_finalize (GObject *object)
 		prefs->labels_change_notify_id = 0;
 	}
 
+	g_object_unref (prefs->gconf);
+
 	/* Chain up to parent's finalize() method. */
 	G_OBJECT_CLASS (em_mailer_prefs_parent_class)->finalize (object);
 }
@@ -128,7 +130,7 @@ em_mailer_prefs_class_init (EMMailerPrefsClass *class)
 static void
 em_mailer_prefs_init (EMMailerPrefs *preferences)
 {
-	preferences->gconf = mail_config_get_gconf_client ();
+	preferences->gconf = gconf_client_get_default ();
 }
 
 enum {
diff --git a/modules/mail/em-network-prefs.c b/modules/mail/em-network-prefs.c
index fee1985..9d4ff96 100644
--- a/modules/mail/em-network-prefs.c
+++ b/modules/mail/em-network-prefs.c
@@ -198,7 +198,9 @@ widget_entry_changed_cb (GtkWidget *widget, gpointer data)
 {
 	const gchar *value;
 	gint port = -1;
-	GConfClient *gconf = mail_config_get_gconf_client ();
+	GConfClient *client;
+
+	client = gconf_client_get_default ();
 
 	/*
 	   Do not change the order of comparison -
@@ -206,14 +208,15 @@ widget_entry_changed_cb (GtkWidget *widget, gpointer data)
 	*/
 	if (GTK_IS_SPIN_BUTTON (widget)) {
 		port = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (widget));
-		gconf_client_set_int (gconf, (const gchar *)data, port, NULL);
+		gconf_client_set_int (client, (const gchar *)data, port, NULL);
 		d(g_print ("%s:%s: %s is SpinButton: value = [%d]\n", G_STRLOC, G_STRFUNC, (const gchar *)data, port));
 	} else if (GTK_IS_ENTRY (widget)) {
 		value = gtk_entry_get_text (GTK_ENTRY (widget));
-		gconf_client_set_string (gconf, (const gchar *)data, value, NULL);
+		gconf_client_set_string (client, (const gchar *)data, value, NULL);
 		d(g_print ("%s:%s: %s is Entry: value = [%s]\n", G_STRLOC, G_STRFUNC, (const gchar *)data, value));
 	}
 
+	g_object_unref (client);
 }
 
 static void
@@ -221,7 +224,7 @@ ignore_hosts_entry_changed_cb (GtkWidget *widget, const gchar *key)
 {
 	const gchar *value;
 	GSList *lst = NULL;
-	GConfClient *gconf;
+	GConfClient *client;
 
 	g_return_if_fail (widget != NULL);
 	g_return_if_fail (key != NULL);
@@ -252,12 +255,13 @@ ignore_hosts_entry_changed_cb (GtkWidget *widget, const gchar *key)
 		g_strfreev (split);
 	}
 
-	gconf = mail_config_get_gconf_client ();
-	if (!gconf_client_set_list (gconf, key, GCONF_VALUE_STRING, lst, NULL)) {
+	client = gconf_client_get_default ();
+	if (!gconf_client_set_list (client, key, GCONF_VALUE_STRING, lst, NULL)) {
 		/* for cases where migration didn't happen, get rid of the old GConf key and "re-type" it */
-		gconf_client_unset (gconf, key, NULL);
-		gconf_client_set_list (gconf, key, GCONF_VALUE_STRING, lst, NULL);
+		gconf_client_unset (client, key, NULL);
+		gconf_client_set_list (client, key, GCONF_VALUE_STRING, lst, NULL);
 	}
+	g_object_unref (client);
 
 	g_slist_foreach (lst, (GFunc) g_free, NULL);
 	g_slist_free (lst);
@@ -304,7 +308,7 @@ em_network_prefs_construct (EMNetworkPrefs *prefs)
 	gboolean locked;
 	gint i, val, port;
 
-	prefs->gconf = mail_config_get_gconf_client ();
+	prefs->gconf = gconf_client_get_default ();
 
 	/* Make sure our custom widget classes are registered with
 	 * GType before we load the GtkBuilder definition file. */



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