aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2003-06-12 00:19:36 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2003-06-12 00:19:36 +0800
commitd120c67b62d3de62b293becb0d58bc9335df2d0a (patch)
tree9c6a5e26f6c911bf3f815ae697e3260d452205ef /mail
parent2c194837766ea2c43963080f67968fcd21d87137 (diff)
downloadgsoc2013-evolution-d120c67b62d3de62b293becb0d58bc9335df2d0a.tar.gz
gsoc2013-evolution-d120c67b62d3de62b293becb0d58bc9335df2d0a.tar.zst
gsoc2013-evolution-d120c67b62d3de62b293becb0d58bc9335df2d0a.zip
Use mail-config's gconf client. (target_date_new): Same.
2003-06-06 Jeffrey Stedfast <fejj@ximian.com> * message-tag-followup.c (get_week_start_day): Use mail-config's gconf client. (target_date_new): Same. * message-list.c (message_list_set_folder): Use mail-config's gconf client. (mail_regen_list): Same. * mail-tools.c (mail_tool_quote_message): Use mail-config's gconf client. (mail_tool_forward_message): Same. * mail-session.c (main_get_filter_driver): Use mail-config's gconf client. * mail-preferences.c (mail_preferences_init): Use mail-config's gconf client. (mail_preferences_finalise): Don't unref the gconf client. * mail-format.c (write_headers): Use mail-config's gconf client. (mail_format_data_wrapper_write_to_stream): Same. (handle_text_plain): And here. * mail-display.c (save_data_cb): Use mail-config's gconf client. (save_part): Same. (on_url_requested): Here too. (mail_text_write): And here. (mail_display_init): And here. (mail_display_destroy): Here too. (mail_display_new): Again here. * mail-composer-prefs.c (sig_add_cb): Use mail-config's gconf client. (mail_composer_prefs_construct): Same. * mail-callbacks.c (ask_confirm_for_unwanted_html_mail): Use mail-config's gconf client. (ask_confirm_for_empty_subject): Same. (ask_confirm_for_only_bcc): Here too. (composer_get_message): And here. (create_msg_composer): Again here. (mail_generate_reply): Same. (forward): And here. (transfer_msg_done): " (delete_msg): " (confirm_expunge): " * component-factory.c (owner_unset_cb): Use mail-config's gconf client. * folder-browser-ui.c (folder_browser_ui_add_message): Use the mailer's gconf client. (folder_browser_ui_add_list): Same. (folder_browser_ui_add_global): Here too. * folder-browser.c (save_cursor_pos): Use the mailer's gconf client. (folder_browser_set_message_preview): Same. (folder_browser_toggle_preview): Here too. (folder_browser_toggle_threads): And here. (folder_browser_toggle_hide_deleted): Here as well. (folder_browser_set_message_display_style): And here. (fb_resize_cb): Here. (paned_realised): And here. (done_message_selected): And everywhere... * mail-account-gui.c (sig_add_new_signature): Use the mailer gconf client. * mail-config.c (mail_config_get_gconf_client): New function to return the global GConfClient used by the mailer. (mail_config_write_on_exit): On exit, free our objects and such. (mail_config_signature_run_script): Use config->gconf. 2003-06-04 Jeffrey Stedfast <fejj@ximian.com> * mail-callbacks.c (invert_selection): Get rid of the if-focused code, that will always prevent the etree from getting the selection inverted because the menu item will always have focus at this time. Fix for bug #43972. it takes more than good relations to some of the major spirits in this branch of the multiverse to write apps that don't leak gconf-client refs, good coding is important, too. that... or a 100-megaton-kill-o-zap bomb svn path=/trunk/; revision=21410
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog83
-rw-r--r--mail/component-factory.c7
-rw-r--r--mail/folder-browser-ui.c11
-rw-r--r--mail/folder-browser.c50
-rw-r--r--mail/mail-account-gui.c3
-rw-r--r--mail/mail-callbacks.c29
-rw-r--r--mail/mail-composer-prefs.c4
-rw-r--r--mail/mail-config.c19
-rw-r--r--mail/mail-config.h6
-rw-r--r--mail/mail-display.c20
-rw-r--r--mail/mail-format.c6
-rw-r--r--mail/mail-preferences.c4
-rw-r--r--mail/mail-session.c3
-rw-r--r--mail/mail-tools.c7
-rw-r--r--mail/message-list.c4
-rw-r--r--mail/message-tag-followup.c6
16 files changed, 178 insertions, 84 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 0e2c45a308..98a71dd0d1 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,86 @@
+2003-06-06 Jeffrey Stedfast <fejj@ximian.com>
+
+ * message-tag-followup.c (get_week_start_day): Use mail-config's
+ gconf client.
+ (target_date_new): Same.
+
+ * message-list.c (message_list_set_folder): Use mail-config's
+ gconf client.
+ (mail_regen_list): Same.
+
+ * mail-tools.c (mail_tool_quote_message): Use mail-config's gconf
+ client.
+ (mail_tool_forward_message): Same.
+
+ * mail-session.c (main_get_filter_driver): Use mail-config's gconf
+ client.
+
+ * mail-preferences.c (mail_preferences_init): Use mail-config's
+ gconf client.
+ (mail_preferences_finalise): Don't unref the gconf client.
+
+ * mail-format.c (write_headers): Use mail-config's gconf client.
+ (mail_format_data_wrapper_write_to_stream): Same.
+ (handle_text_plain): And here.
+
+ * mail-display.c (save_data_cb): Use mail-config's gconf client.
+ (save_part): Same.
+ (on_url_requested): Here too.
+ (mail_text_write): And here.
+ (mail_display_init): And here.
+ (mail_display_destroy): Here too.
+ (mail_display_new): Again here.
+
+ * mail-composer-prefs.c (sig_add_cb): Use mail-config's gconf
+ client.
+ (mail_composer_prefs_construct): Same.
+
+ * mail-callbacks.c (ask_confirm_for_unwanted_html_mail): Use
+ mail-config's gconf client.
+ (ask_confirm_for_empty_subject): Same.
+ (ask_confirm_for_only_bcc): Here too.
+ (composer_get_message): And here.
+ (create_msg_composer): Again here.
+ (mail_generate_reply): Same.
+ (forward): And here.
+ (transfer_msg_done): "
+ (delete_msg): "
+ (confirm_expunge): "
+
+ * component-factory.c (owner_unset_cb): Use mail-config's gconf
+ client.
+
+ * folder-browser-ui.c (folder_browser_ui_add_message): Use the
+ mailer's gconf client.
+ (folder_browser_ui_add_list): Same.
+ (folder_browser_ui_add_global): Here too.
+
+ * folder-browser.c (save_cursor_pos): Use the mailer's gconf
+ client.
+ (folder_browser_set_message_preview): Same.
+ (folder_browser_toggle_preview): Here too.
+ (folder_browser_toggle_threads): And here.
+ (folder_browser_toggle_hide_deleted): Here as well.
+ (folder_browser_set_message_display_style): And here.
+ (fb_resize_cb): Here.
+ (paned_realised): And here.
+ (done_message_selected): And everywhere...
+
+ * mail-account-gui.c (sig_add_new_signature): Use the mailer gconf
+ client.
+
+ * mail-config.c (mail_config_get_gconf_client): New function to
+ return the global GConfClient used by the mailer.
+ (mail_config_write_on_exit): On exit, free our objects and such.
+ (mail_config_signature_run_script): Use config->gconf.
+
+2003-06-04 Jeffrey Stedfast <fejj@ximian.com>
+
+ * mail-callbacks.c (invert_selection): Get rid of the if-focused
+ code, that will always prevent the etree from getting the
+ selection inverted because the menu item will always have focus at
+ this time. Fix for bug #43972.
+
2003-06-11 Not Zed <NotZed@Ximian.com>
** See bug #22542
diff --git a/mail/component-factory.c b/mail/component-factory.c
index 639382fc5f..a228868a58 100644
--- a/mail/component-factory.c
+++ b/mail/component-factory.c
@@ -913,12 +913,13 @@ static struct {
static void
owner_unset_cb (EvolutionShellComponent *shell_component, gpointer user_data)
{
- GConfClient *gconf;
CORBA_Environment ev;
+ GConfClient *gconf;
int i;
EIterator *it;
-
- gconf = gconf_client_get_default ();
+
+ gconf = mail_config_get_gconf_client ();
+
for (i=0;i<sizeof(shell_component_handlers)/sizeof(shell_component_handlers[0]);i++)
g_signal_handler_disconnect((GtkObject *)shell_component, shell_component_handlers[i].hand);
diff --git a/mail/folder-browser-ui.c b/mail/folder-browser-ui.c
index 3f570b963d..0f47ca66a2 100644
--- a/mail/folder-browser-ui.c
+++ b/mail/folder-browser-ui.c
@@ -44,6 +44,7 @@
#include "e-util/e-meta.h"
+#include "mail-config.h"
#include "mail-callbacks.h" /* almost all the verbs */
#include "mail-session.h" /* mail_session_forget_passwords */
@@ -517,6 +518,8 @@ folder_browser_ui_add_message (FolderBrowser *fb)
GConfClient *gconf;
int style;
+ gconf = mail_config_get_gconf_client ();
+
if (fb->sensitise_state) {
g_hash_table_destroy(fb->sensitise_state);
fb->sensitise_state = NULL;
@@ -524,8 +527,6 @@ folder_browser_ui_add_message (FolderBrowser *fb)
ui_add (fb, "message", message_verbs, message_pixcache);
- gconf = gconf_client_get_default ();
-
/* Display Style */
style = gconf_client_get_int (gconf, "/apps/evolution/mail/display/message_style", NULL);
style = style >= 0 && style < MAIL_CONFIG_DISPLAY_MAX ? style : 0;
@@ -559,7 +560,7 @@ folder_browser_ui_add_list (FolderBrowser *fb)
GConfClient *gconf;
int state;
- gconf = gconf_client_get_default ();
+ gconf = mail_config_get_gconf_client ();
if (fb->sensitise_state) {
g_hash_table_destroy (fb->sensitise_state);
@@ -613,6 +614,8 @@ folder_browser_ui_add_global (FolderBrowser *fb)
GConfClient *gconf;
int paned_size;
+ gconf = mail_config_get_gconf_client ();
+
if (fb->sensitise_state) {
g_hash_table_destroy (fb->sensitise_state);
fb->sensitise_state = NULL;
@@ -620,8 +623,6 @@ folder_browser_ui_add_global (FolderBrowser *fb)
ui_add (fb, "global", global_verbs, global_pixcache);
- gconf = gconf_client_get_default ();
-
/* (Pre)view pane size (do this first because it affects the
preview settings - see folder_browser_set_message_preview()
internals for details) */
diff --git a/mail/folder-browser.c b/mail/folder-browser.c
index 3c11954b45..6ec4bf14e0 100644
--- a/mail/folder-browser.c
+++ b/mail/folder-browser.c
@@ -160,12 +160,9 @@ folder_browser_destroy (GtkObject *object)
{
FolderBrowser *folder_browser;
CORBA_Environment ev;
- GConfClient *gconf;
folder_browser = FOLDER_BROWSER (object);
-
- gconf = gconf_client_get_default ();
-
+
CORBA_exception_init (&ev);
if (folder_browser->seen_id != 0) {
@@ -1121,7 +1118,7 @@ save_cursor_pos (FolderBrowser *fb)
e_tree_get_cell_geometry (fb->message_list->tree, row, 0,
NULL, &y, NULL, &height);
- gconf = gconf_client_get_default ();
+ gconf = mail_config_get_gconf_client ();
paned_size = gconf_client_get_int (gconf, "/apps/evolution/mail/display/paned_size", NULL);
adj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (fb->message_list));
@@ -1156,9 +1153,9 @@ folder_browser_set_message_preview (FolderBrowser *folder_browser, gboolean show
folder_browser->preview_shown = show_preview;
- gconf = gconf_client_get_default ();
+ gconf = mail_config_get_gconf_client ();
paned_size = gconf_client_get_int (gconf, "/apps/evolution/mail/display/paned_size", NULL);
-
+
if (show_preview) {
y = save_cursor_pos (folder_browser);
gtk_paned_set_position (GTK_PANED (folder_browser->vpaned), paned_size);
@@ -1300,13 +1297,17 @@ folder_browser_toggle_preview (BonoboUIComponent *component,
{
FolderBrowser *fb = user_data;
gboolean bstate;
+ GConfClient *gconf;
if (type != Bonobo_UIComponent_STATE_CHANGED || fb->message_list == NULL)
return;
bstate = atoi(state);
e_meta_set_bool(fb->meta, "show_preview", bstate);
- gconf_client_set_bool (gconf_client_get_default(), "/apps/evolution/mail/display/show_preview", bstate, NULL);
+
+ gconf = mail_config_get_gconf_client ();
+ gconf_client_set_bool (gconf, "/apps/evolution/mail/display/show_preview", bstate, NULL);
+
folder_browser_set_message_preview (fb, bstate);
}
@@ -1320,13 +1321,17 @@ folder_browser_toggle_threads (BonoboUIComponent *component,
FolderBrowser *fb = user_data;
int prev_state;
gboolean bstate;
+ GConfClient *gconf;
if (type != Bonobo_UIComponent_STATE_CHANGED || fb->message_list == NULL)
return;
bstate = atoi(state);
e_meta_set_bool(fb->meta, "thread_list", bstate);
- gconf_client_set_bool (gconf_client_get_default (), "/apps/evolution/mail/display/thread_list", bstate, NULL);
+
+ gconf = mail_config_get_gconf_client ();
+ gconf_client_set_bool (gconf, "/apps/evolution/mail/display/thread_list", bstate, NULL);
+
message_list_set_threaded (fb->message_list, bstate);
prev_state = fb->selection_state;
@@ -1347,7 +1352,7 @@ folder_browser_toggle_hide_deleted (BonoboUIComponent *component,
if (type != Bonobo_UIComponent_STATE_CHANGED || fb->message_list == NULL)
return;
- gconf = gconf_client_get_default ();
+ gconf = mail_config_get_gconf_client ();
gconf_client_set_bool (gconf, "/apps/evolution/mail/display/show_deleted",
!atoi (state), NULL);
@@ -1372,9 +1377,7 @@ folder_browser_set_message_display_style (BonoboUIComponent *component
|| fb->message_list == NULL)
return;
- gconf = gconf_client_get_default ();
-
- printf ("message display style: %s\n", path);
+ gconf = mail_config_get_gconf_client ();
for (i = 0; i < MAIL_CONFIG_DISPLAY_MAX; i++) {
if (strstr (message_display_styles[i], path)) {
@@ -1383,6 +1386,7 @@ folder_browser_set_message_display_style (BonoboUIComponent *component
if (fb->pref_master)
gconf_client_set_int (gconf, "/apps/evolution/mail/display/message_style", i, NULL);
+
return;
}
}
@@ -2313,12 +2317,12 @@ static gboolean
fb_resize_cb (GtkWidget *w, GdkEventButton *e, FolderBrowser *fb)
{
GConfClient *gconf;
-
- gconf = gconf_client_get_default ();
-
- if (GTK_WIDGET_REALIZED (w) && fb->preview_shown)
+
+ if (GTK_WIDGET_REALIZED (w) && fb->preview_shown) {
+ gconf = mail_config_get_gconf_client ();
gconf_client_set_int (gconf, "/apps/evolution/mail/display/paned_size", gtk_paned_get_position (GTK_PANED (w)), NULL);
-
+ }
+
return FALSE;
}
@@ -2326,9 +2330,11 @@ fb_resize_cb (GtkWidget *w, GdkEventButton *e, FolderBrowser *fb)
static void
paned_realised(GtkWidget *w, FolderBrowser *fb)
{
+ GConfClient *gconf;
int size;
-
- size = gconf_client_get_int (gconf_client_get_default (), "/apps/evolution/mail/display/paned_size", NULL);
+
+ gconf = mail_config_get_gconf_client ();
+ size = gconf_client_get_int (gconf, "/apps/evolution/mail/display/paned_size", NULL);
gtk_paned_set_position (GTK_PANED (fb->vpaned), size);
}
@@ -2415,12 +2421,10 @@ done_message_selected (CamelFolder *folder, const char *uid, CamelMimeMessage *m
GConfClient *gconf;
int timeout;
- gconf = gconf_client_get_default ();
-
if (folder != fb->folder || fb->mail_display == NULL)
return;
- gconf = gconf_client_get_default ();
+ gconf = mail_config_get_gconf_client ();
timeout = gconf_client_get_int (gconf, "/apps/evolution/mail/display/mark_seen_timeout", NULL);
info = camel_folder_get_message_info (fb->folder, uid);
diff --git a/mail/mail-account-gui.c b/mail/mail-account-gui.c
index b708b93e27..a3df16a1f5 100644
--- a/mail/mail-account-gui.c
+++ b/mail/mail-account-gui.c
@@ -42,6 +42,7 @@
#include "mail-send-recv.h"
#include "mail-signature-editor.h"
#include "mail-composer-prefs.h"
+#include "mail-config.h"
#include "mail-ops.h"
#include "mail-mt.h"
#include "mail.h"
@@ -1302,7 +1303,7 @@ sig_add_new_signature (GtkWidget *w, MailAccountGui *gui)
sig_switch_to_list (w, gui);
- gconf = gconf_client_get_default ();
+ gconf = mail_config_get_gconf_client ();
send_html = gconf_client_get_bool (gconf, "/apps/evolution/mail/composer/send_html", NULL);
parent = gtk_widget_get_toplevel (w);
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index 87bbc24817..6001e8fd7e 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -246,7 +246,7 @@ ask_confirm_for_unwanted_html_mail (EMsgComposer *composer, EDestination **recip
GString *str;
int i;
- gconf = gconf_client_get_default ();
+ gconf = mail_config_get_gconf_client ();
if (!gconf_client_get_bool (gconf, "/apps/evolution/mail/prompts/unwanted_html", NULL))
return TRUE;
@@ -279,7 +279,7 @@ ask_confirm_for_empty_subject (EMsgComposer *composer)
gboolean show_again, res;
GConfClient *gconf;
- gconf = gconf_client_get_default ();
+ gconf = mail_config_get_gconf_client ();
if (!gconf_client_get_bool (gconf, "/apps/evolution/mail/prompts/empty_subject", NULL))
return TRUE;
@@ -299,7 +299,7 @@ ask_confirm_for_only_bcc (EMsgComposer *composer, gboolean hidden_list_case)
const char *first_text;
GConfClient *gconf;
- gconf = gconf_client_get_default ();
+ gconf = mail_config_get_gconf_client ();
if (!gconf_client_get_bool (gconf, "/apps/evolution/mail/prompts/only_bcc", NULL))
return TRUE;
@@ -414,7 +414,7 @@ composer_get_message (EMsgComposer *composer, gboolean post, gboolean save_html_
EAccount *account;
int i;
- gconf = gconf_client_get_default ();
+ gconf = mail_config_get_gconf_client ();
/* We should do all of the validity checks based on the composer, and not on
the created message, as extra interaction may occur when we get the message
@@ -763,7 +763,7 @@ create_msg_composer (EAccount *account, gboolean post, const char *url)
if (account == NULL)
account = mail_config_get_default_account ();
- gconf = gconf_client_get_default ();
+ gconf = mail_config_get_gconf_client ();
send_html = gconf_client_get_bool (gconf, "/apps/evolution/mail/composer/send_html", NULL);
if (post)
@@ -996,7 +996,7 @@ mail_generate_reply (CamelFolder *folder, CamelMimeMessage *message, const char
time_t date;
char *url;
- gconf = gconf_client_get_default ();
+ gconf = mail_config_get_gconf_client ();
if (mode == REPLY_POST) {
composer = e_msg_composer_new_post ();
@@ -1499,7 +1499,7 @@ forward (GtkWidget *widget, gpointer user_data)
MailConfigForwardStyle style;
GConfClient *gconf;
- gconf = gconf_client_get_default ();
+ gconf = mail_config_get_gconf_client ();
style = gconf_client_get_int (gconf, "/apps/evolution/mail/format/forward_style", NULL);
if (style == MAIL_CONFIG_FORWARD_ATTACHED)
@@ -1660,7 +1660,7 @@ transfer_msg_done (gboolean ok, void *data)
int row;
if (ok && !FOLDER_BROWSER_IS_DESTROYED (fb)) {
- gconf = gconf_client_get_default ();
+ gconf = mail_config_get_gconf_client ();
hide_deleted = !gconf_client_get_bool (gconf, "/apps/evolution/mail/display/show_deleted", NULL);
row = e_tree_row_of_node (fb->message_list->tree,
@@ -1960,11 +1960,9 @@ invert_selection (BonoboUIComponent *uih, void *user_data, const char *path)
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
- if (GTK_WIDGET_HAS_FOCUS (fb->message_list)) {
- etsm = e_tree_get_selection_model (fb->message_list->tree);
-
- e_selection_model_invert_selection (etsm);
- }
+ etsm = e_tree_get_selection_model (fb->message_list->tree);
+
+ e_selection_model_invert_selection (etsm);
}
/* flag all selected messages. Return number flagged */
@@ -2545,8 +2543,6 @@ delete_msg (GtkWidget *button, gpointer user_data)
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
- gconf = gconf_client_get_default ();
-
deleted = flag_messages (fb, CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_SEEN,
CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_SEEN);
@@ -2555,6 +2551,7 @@ delete_msg (GtkWidget *button, gpointer user_data)
row = e_tree_row_of_node (fb->message_list->tree,
e_tree_get_cursor (fb->message_list->tree));
+ gconf = mail_config_get_gconf_client ();
hide_deleted = !gconf_client_get_bool (gconf, "/apps/evolution/mail/display/show_deleted", NULL);
/* If this is the last message and deleted messages
@@ -2679,7 +2676,7 @@ confirm_expunge (FolderBrowser *fb)
gboolean res, show_again;
GConfClient *gconf;
- gconf = gconf_client_get_default ();
+ gconf = mail_config_get_gconf_client ();
if (!gconf_client_get_bool (gconf, "/apps/evolution/mail/prompts/expunge", NULL))
return TRUE;
diff --git a/mail/mail-composer-prefs.c b/mail/mail-composer-prefs.c
index 30873a3357..cdbeb491f0 100644
--- a/mail/mail-composer-prefs.c
+++ b/mail/mail-composer-prefs.c
@@ -281,7 +281,7 @@ sig_add_cb (GtkWidget *widget, MailComposerPrefs *prefs)
gboolean send_html;
GtkWidget *parent;
- gconf = gconf_client_get_default ();
+ gconf = mail_config_get_gconf_client ();
send_html = gconf_client_get_bool (gconf, "/apps/evolution/mail/composer/send_html", NULL);
parent = gtk_widget_get_toplevel ((GtkWidget *) prefs);
@@ -796,7 +796,7 @@ mail_composer_prefs_construct (MailComposerPrefs *prefs)
int style;
char *buf;
- prefs->gconf = gconf_client_get_default ();
+ prefs->gconf = mail_config_get_gconf_client ();
gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", "composer_tab", NULL);
prefs->gui = gui;
diff --git a/mail/mail-config.c b/mail/mail-config.c
index 45d44a5524..15b5ebd331 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -38,9 +38,6 @@
#include <gtkhtml/gtkhtml.h>
#include <glade/glade.h>
-#include <gconf/gconf.h>
-#include <gconf/gconf-client.h>
-
#include <libxml/tree.h>
#include <libxml/parser.h>
@@ -653,9 +650,20 @@ mail_config_write_on_exit (void)
/* now do cleanup */
mail_config_clear ();
+
+ g_object_unref (config->gconf);
+ g_ptr_array_free (config->mime_types, TRUE);
+
+ g_free (config);
}
/* Accessor functions */
+GConfClient *
+mail_config_get_gconf_client (void)
+{
+ return config->gconf;
+}
+
gboolean
mail_config_is_configured (void)
{
@@ -1560,7 +1568,6 @@ mail_config_signature_run_script (gchar *script)
CamelStreamMem *memstream;
CamelMimeFilter *charenc;
CamelStream *stream;
- GConfClient *gconf;
GByteArray *buffer;
char *charset;
char *content;
@@ -1568,8 +1575,6 @@ mail_config_signature_run_script (gchar *script)
/* parent process */
close (in_fds[1]);
- gconf = gconf_client_get_default ();
-
stream = camel_stream_fs_new_with_fd (in_fds[0]);
memstream = (CamelStreamMem *) camel_stream_mem_new ();
@@ -1591,7 +1596,7 @@ mail_config_signature_run_script (gchar *script)
filtered_stream = camel_stream_filter_new_with_stream (stream);
camel_object_unref (stream);
- charset = gconf_client_get_string (gconf, "/apps/evolution/mail/composer/charset", NULL);
+ charset = gconf_client_get_string (config->gconf, "/apps/evolution/mail/composer/charset", NULL);
charenc = (CamelMimeFilter *) camel_mime_filter_charset_new_convert (charset, "utf-8");
camel_stream_filter_add (filtered_stream, charenc);
camel_object_unref (charenc);
diff --git a/mail/mail-config.h b/mail/mail-config.h
index d0f5cb138b..5782efe8a6 100644
--- a/mail/mail-config.h
+++ b/mail/mail-config.h
@@ -24,6 +24,10 @@
#define MAIL_CONFIG_H
#include <gtk/gtk.h>
+
+#include <gconf/gconf.h>
+#include <gconf/gconf-client.h>
+
#include <camel/camel.h>
#include "e-util/e-account.h"
@@ -100,6 +104,8 @@ void mail_config_clear (void);
void mail_config_write (void);
void mail_config_write_on_exit (void);
+GConfClient *mail_config_get_gconf_client (void);
+
/* General Accessor functions */
gboolean mail_config_is_configured (void);
gboolean mail_config_is_corrupt (void);
diff --git a/mail/mail-display.c b/mail/mail-display.c
index e8d97034d8..5ecba7c306 100644
--- a/mail/mail-display.c
+++ b/mail/mail-display.c
@@ -255,7 +255,7 @@ save_data_cb (GtkWidget *widget, gpointer user_data)
/* preserve the pathname */
dir = g_path_get_dirname (gtk_file_selection_get_filename (file_select));
- gconf = gconf_client_get_default ();
+ gconf = mail_config_get_gconf_client ();
gconf_client_set_string (gconf, "/apps/evolution/mail/save_dir", dir, NULL);
g_free (dir);
@@ -328,7 +328,7 @@ save_part (CamelMimePart *part)
camel_object_ref (part);
home = getenv ("HOME");
- gconf = gconf_client_get_default ();
+ gconf = mail_config_get_gconf_client ();
dir = gconf_client_get_string (gconf, "/apps/evolution/mail/save_dir", NULL);
filename = make_safe_filename (dir ? dir : (home ? home : ""), part);
g_free (dir);
@@ -1248,7 +1248,7 @@ on_url_requested (GtkHTML *html, const char *url, GtkHTMLStream *handle,
CamelMedium *medium;
GByteArray *ba;
- gconf = gconf_client_get_default ();
+ gconf = mail_config_get_gconf_client ();
urls = g_datalist_get_data (md->data, "part_urls");
g_return_if_fail (urls != NULL);
@@ -1720,7 +1720,7 @@ mail_text_write (MailDisplayStream *stream, MailDisplay *md, CamelMimePart *part
GdkColor colour;
char *buf;
- gconf = gconf_client_get_default ();
+ gconf = mail_config_get_gconf_client ();
flags = CAMEL_MIME_FILTER_TOHTML_CONVERT_NL | CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES;
@@ -2059,7 +2059,7 @@ mail_display_init (GObject *object)
g_object_ref (mail_display->invisible);
gtk_object_sink ((GtkObject *) mail_display->invisible);
- gconf = gconf_client_get_default ();
+ gconf = mail_config_get_gconf_client ();
style = gconf_client_get_int (gconf, "/apps/evolution/mail/format/message_display_style", NULL);
mail_display->display_style = style;
@@ -2113,10 +2113,9 @@ mail_display_destroy (GtkObject *object)
}
if (mail_display->priv && mail_display->priv->display_notify_id) {
- GConfClient *gconf = gconf_client_get_default ();
+ GConfClient *gconf = mail_config_get_gconf_client ();
gconf_client_notify_remove (gconf, mail_display->priv->display_notify_id);
mail_display->priv->display_notify_id = 0;
- g_object_unref (gconf);
}
g_free (mail_display->priv);
@@ -2710,14 +2709,13 @@ mail_display_new (void)
gtk_selection_add_target (mail_display->invisible,
clipboard_atom, GDK_SELECTION_TYPE_STRING, 1);
- gconf = gconf_client_get_default ();
+ gconf = mail_config_get_gconf_client ();
gtk_html_set_animate (GTK_HTML (html), gconf_client_get_bool (gconf, "/apps/evolution/mail/display/animate_images", NULL));
-
+
gconf_client_add_dir (gconf, "/apps/evolution/mail/display",GCONF_CLIENT_PRELOAD_NONE, NULL);
mail_display->priv->display_notify_id = gconf_client_notify_add (gconf, "/apps/evolution/mail/display",
display_notify, mail_display, NULL, NULL);
- g_object_unref (gconf);
-
+
mail_display->scroll = GTK_SCROLLED_WINDOW (scroll);
mail_display->html = GTK_HTML (html);
g_object_ref (mail_display->html);
diff --git a/mail/mail-format.c b/mail/mail-format.c
index ad4bf754c4..9b23d9f195 100644
--- a/mail/mail-format.c
+++ b/mail/mail-format.c
@@ -976,7 +976,7 @@ write_headers (MailDisplayStream *stream, MailDisplay *md, CamelMimeMessage *mes
GConfClient *gconf;
int xmask, i;
- gconf = gconf_client_get_default ();
+ gconf = mail_config_get_gconf_client ();
xmask = gconf_client_get_int (gconf, "/apps/evolution/mail/display/xmailer_mask", NULL);
/* My favorite thing to do... muck around with colors so we respect people's stupid themes.
@@ -1130,7 +1130,7 @@ mail_format_data_wrapper_write_to_stream (CamelDataWrapper *wrapper, MailDisplay
GConfClient *gconf;
char *charset;
- gconf = gconf_client_get_default ();
+ gconf = mail_config_get_gconf_client ();
content_type = camel_data_wrapper_get_mime_type_field (wrapper);
@@ -1236,7 +1236,7 @@ handle_text_plain (CamelMimePart *part, const char *mime_type,
GdkColor colour;
char *buf;
- gconf = gconf_client_get_default ();
+ gconf = mail_config_get_gconf_client ();
flags = CAMEL_MIME_FILTER_TOHTML_CONVERT_NL | CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES;
if (!md->printing) {
diff --git a/mail/mail-preferences.c b/mail/mail-preferences.c
index f2b6685a7f..bd22b41058 100644
--- a/mail/mail-preferences.c
+++ b/mail/mail-preferences.c
@@ -29,7 +29,6 @@
#include "mail-preferences.h"
-#include <gconf/gconf.h>
#include <gal/util/e-iconv.h>
#include <gtkhtml/gtkhtml-properties.h>
#include "widgets/misc/e-charset-picker.h"
@@ -81,7 +80,7 @@ mail_preferences_class_init (MailPreferencesClass *klass)
static void
mail_preferences_init (MailPreferences *preferences)
{
- preferences->gconf = gconf_client_get_default ();
+ preferences->gconf = mail_config_get_gconf_client ();
}
static void
@@ -90,7 +89,6 @@ mail_preferences_finalise (GObject *obj)
MailPreferences *prefs = (MailPreferences *) obj;
g_object_unref (prefs->gui);
- g_object_unref (prefs->gconf);
((GObjectClass *)(parent_class))->finalize (obj);
}
diff --git a/mail/mail-session.c b/mail/mail-session.c
index 081c6aa533..e946b7e1ed 100644
--- a/mail/mail-session.c
+++ b/mail/mail-session.c
@@ -40,6 +40,7 @@
#include "filter/filter-context.h"
#include "filter/filter-filter.h"
#include "mail.h"
+#include "mail-config.h"
#include "mail-session.h"
#include "mail-tools.h"
#include "mail-mt.h"
@@ -815,7 +816,7 @@ main_get_filter_driver (CamelSession *session, const char *type, CamelException
RuleContext *fc;
long notify;
- gconf = gconf_client_get_default ();
+ gconf = mail_config_get_gconf_client ();
user = g_strdup_printf ("%s/filters.xml", evolution_dir);
system = EVOLUTION_PRIVDATADIR "/filtertypes.xml";
diff --git a/mail/mail-tools.c b/mail/mail-tools.c
index a0943e510b..846d0d9dd7 100644
--- a/mail/mail-tools.c
+++ b/mail/mail-tools.c
@@ -45,8 +45,9 @@
#include "e-util/e-meta.h"
-#include "mail-vfolder.h"
#include "mail.h" /*session*/
+#include "mail-config.h"
+#include "mail-vfolder.h"
#include "mail-format.h"
#include "mail-tools.h"
#include "mail-local.h"
@@ -360,7 +361,7 @@ mail_tool_quote_message (CamelMimeMessage *message, const char *fmt, ...)
char *text, *colour;
GConfClient *gconf;
- gconf = gconf_client_get_default ();
+ gconf = mail_config_get_gconf_client ();
contents = camel_medium_get_content_object (CAMEL_MEDIUM (message));
/* We pass "want_plain" for "cite", since if it's HTML, we'll
@@ -430,7 +431,7 @@ mail_tool_forward_message (CamelMimeMessage *message, gboolean quoted)
gboolean send_html;
GConfClient *gconf;
- gconf = gconf_client_get_default ();
+ gconf = mail_config_get_gconf_client ();
send_html = gconf_client_get_bool (gconf, "/apps/evolution/mail/composer/send_html", NULL);
body = mail_get_message_body (CAMEL_DATA_WRAPPER (message), !send_html, quoted);
diff --git a/mail/message-list.c b/mail/message-list.c
index 3f3da9f8d2..1d9ca11aaa 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -2218,7 +2218,7 @@ message_list_set_folder (MessageList *message_list, CamelFolder *camel_folder, g
camel_object_ref (camel_folder);
- gconf = gconf_client_get_default ();
+ 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 && !(camel_folder->folder_flags & CAMEL_FOLDER_IS_TRASH);
@@ -2858,7 +2858,7 @@ mail_regen_list (MessageList *ml, const char *search, const char *hideexpr, Came
}
}
- gconf = gconf_client_get_default ();
+ gconf = mail_config_get_gconf_client ();
#ifndef BROKEN_ETREE
/* this can sometimes crash,so ... */
diff --git a/mail/message-tag-followup.c b/mail/message-tag-followup.c
index 09a0aa6622..6c8472bad5 100644
--- a/mail/message-tag-followup.c
+++ b/mail/message-tag-followup.c
@@ -221,10 +221,9 @@ completed_toggled (GtkToggleButton *button, gpointer user_data)
static int
get_week_start_day (void)
{
- /* FIXME: make sure the gconf key is correct? */
GConfClient *gconf;
- gconf = gconf_client_get_default ();
+ gconf = mail_config_get_gconf_client ();
return gconf_client_get_int (gconf, "/apps/evolution/calendar/display/week_start_day", NULL);
}
@@ -255,9 +254,8 @@ target_date_new (const char *s1, const char *s2, int i1, int i2)
/* Note that this is 0 (Sun) to 6 (Sat), conver to 0 (mon) to 6 (sun) */
start = (get_week_start_day () + 6) % 7;
- /* FIXME: make sure the calendar gconf key is correct */
if (locale_supports_12_hour_format ()) {
- gconf = gconf_client_get_default ();
+ gconf = mail_config_get_gconf_client ();
time_24hour = gconf_client_get_bool (gconf, "/apps/evolution/calendar/display/use_24hour_format", NULL);
}