aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2003-01-08 09:39:21 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2003-01-08 09:39:21 +0800
commitfb6caf533c7629ff9a7ffbdfa1eafd9afd5e7817 (patch)
tree032f32319f3465855cce2e52944838c9b63a471b /mail
parent235dc4e759f1781b34a985233c6b707613db41ad (diff)
downloadgsoc2013-evolution-fb6caf533c7629ff9a7ffbdfa1eafd9afd5e7817.tar
gsoc2013-evolution-fb6caf533c7629ff9a7ffbdfa1eafd9afd5e7817.tar.gz
gsoc2013-evolution-fb6caf533c7629ff9a7ffbdfa1eafd9afd5e7817.tar.bz2
gsoc2013-evolution-fb6caf533c7629ff9a7ffbdfa1eafd9afd5e7817.tar.lz
gsoc2013-evolution-fb6caf533c7629ff9a7ffbdfa1eafd9afd5e7817.tar.xz
gsoc2013-evolution-fb6caf533c7629ff9a7ffbdfa1eafd9afd5e7817.tar.zst
gsoc2013-evolution-fb6caf533c7629ff9a7ffbdfa1eafd9afd5e7817.zip
Use gconf to get the paned size. (folder_browser_set_message_preview):
2003-01-07 Jeffrey Stedfast <fejj@ximian.com> * folder-browser.c (save_cursor_pos): Use gconf to get the paned size. (folder_browser_set_message_preview): Same. (folder_browser_toggle_hide_deleted): Use gconf to set the hide-deleted state. (folder_browser_set_message_display_style): Same but for the message_display_style. (fb_resize_cb): Save the paned_size via gconf. (paned_size_changed): Callback for when the paned_size gets changed. Change the folder-browser's paned size to the new setting. (folder_browser_gui_init): Listen to changes to the paned_size and also get the initial size from gconf. * message-list.c (message_list_set_folder): Use gconf. (regen_list_regen): Use gconf. * message-browser.c (transfer_msg_done): Use gconf to get the hide_deleted setting. * mail-account-gui.c (sig_add_new_signature): Use gconf. * folder-browser-ui.c (folder_browser_ui_add_list): Use gconf. * folder-browser.c (save_cursor_pos): Use gconf. (folder_browser_set_message_preview): Same. (folder_browser_toggle_hide_deleted): Here too. (folder_browser_set_message_display_style): And here. (folder_browser_gui_init): Here too. (done_message_selected): And here. * mail-config.c (mail_config_get_thread_subject): Removed. (mail_config_set_thread_subject): Removed. (mail_config_get_empty_trash_on_exit): Removed. (mail_config_set_empty_trash_on_exit): Removed. (mail_config_get_last_filesel_dir): Removed. (mail_config_set_last_filesel_dir): Removed. (mail_config_get_hide_deleted): Removed. (mail_config_set_hide_deleted): Removed. (mail_config_get_paned_size): Removed. (mail_config_set_paned_size): Removed. (mail_config_get_send_html): Removed. (mail_config_set_send_html): Removed. (mail_config_get_confirm_unwanted_html): Removed. (mail_config_set_confirm_unwanted_html): Removed. (mail_config_get_citation_highlight): Removed. (mail_config_set_citation_highlight): Removed. (mail_config_get_citation_color): Removed. (mail_config_set_citation_color): Removed. (mail_config_get_do_seen_timeout): Removed. (mail_config_set_do_seen_timeout): Removed. (mail_config_get_mark_as_seen_timeout): Removed. (mail_config_set_mark_as_seen_timeout): Removed. (mail_config_get_prompt_empty_subject): Removed. (mail_config_set_prompt_empty_subject): Removed. (mail_config_get_prompt_only_bcc): Removed. (mail_config_set_prompt_only_bcc): Removed. (mail_config_get_confirm_expunge): Removed. (mail_config_set_confirm_expunge): Removed. (mail_config_get_confirm_goto_next_folder): Removed. (mail_config_set_confirm_goto_next_folder): Removed. (mail_config_get_goto_next_folder): Removed. (mail_config_set_goto_next_folder): Removed. (mail_config_get_http_mode): Removed. (mail_config_set_http_mode): Removed. (mail_config_get_default_forward_style): Removed. (mail_config_set_default_forward_style): Removed. (mail_config_get_default_reply_style): Removed. (mail_config_set_default_reply_style): Removed. (mail_config_get_message_display_style): Removed. (mail_config_set_message_display_style): Removed. (mail_config_get_default_charset): Removed. (mail_config_set_default_charset): Removed. (mail_config_get_x_mailer_display_style): Removed. (mail_config_set_x_mailer_display_style): Removed. * subscribe-dialog.c (populate_store_list): Use the list of accounts. We can't get the list of sources anymore. (populate_store_foreach): Updated. * mail-callbacks.c (guess_me_from_accounts): Use account->enabled. (mail_generate_reply): Same. (empty_trash): Here too. * mail-accounts.c (account_delete_clicked): Use account->enabled rather than source->enabled. (account_able_clicked): Same. (account_cursor_change): Here too. (mail_accounts_load): And here. * component-factory.c (owner_unset_cb): Use gconf empty-on-exit settings. (mail_load_storages): Use account->enabled rather than account->source->enabled. The struct changed. * mail-composer-prefs.c (sig_add): Get the send_html pref from gconf. * message-tag-followup.c (target_date_new): Use gconf. * mail-config.c (mail_config_get_week_start_day): Removed. * mail-tools.c (mail_tool_quote_message): Use gconf here too, but we don't need to parse the colour - just use it as a raw string. (mail_tool_forward_message): Use gconf. * mail-format.c (mail_format_data_wrapper_write_to_stream): Use gconf. (write_headers): Use gconf. (handle_text_plain): Same. * mail-display.c (mail_text_write): Updated to use gconf and parse GdkColour strings. (on_url_requested): Updated to use gconf. * mail-callbacks.c (ask_confirm_for_unwanted_html_mail): Use gconf rather than the old mail-config APIs which will be removed. (ask_confirm_for_empty_subject): Same. (ask_confirm_for_only_bcc): Here too. (composer_get_message): And here. (create_msg_composer): Same. (transfer_msg_done): Again here. (delete_msg): Here too. (confirm_expunge): And finally here. * mail-config.c (mail_config_write): Use gconf. (mail_config_get_sources): Removed. * mail-account-gui.c (mail_account_gui_save): No need to save enabled-state anymore for a source. * mail-config-druid.c (wizard_finish_cb): Instead of setting account->source->enabled to TRUE, just set account->enabled to TRUE. The structures changed a bit. * mail-send-recv.c (mail_send_receive): Get the list of accounts instead of sources, and pass them along to build_dialogue. I'm trying to get rid of the mail_config_get_sources() api. (mail_autoreceive_setup): Here too. * mail-config.c (mail_config_get_filter_log): Removed. (mail_config_set_filter_log): Removed. (mail_config_get_filter_log_path): Removed. (mail_config_set_filter_log_path): Removed. (mail_config_get_new_mail_notify): Removed. (mail_config_set_new_mail_notify): Removed. (mail_config_get_new_mail_notify_sound_file): Removed. (mail_config_set_new_mail_notify_sound_file): Removed. * mail-session.c (main_get_filter_driver): Updated to use the gconf settings. svn path=/trunk/; revision=19271
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog152
-rw-r--r--mail/component-factory.c16
-rw-r--r--mail/evolution-mail.schemas20
-rw-r--r--mail/folder-browser-ui.c8
-rw-r--r--mail/folder-browser.c89
-rw-r--r--mail/folder-browser.h2
-rw-r--r--mail/mail-account-gui.c15
-rw-r--r--mail/mail-accounts.c14
-rw-r--r--mail/mail-callbacks.c264
-rw-r--r--mail/mail-composer-prefs.c8
-rw-r--r--mail/mail-config-druid.c3
-rw-r--r--mail/mail-config.c1630
-rw-r--r--mail/mail-config.h84
-rw-r--r--mail/mail-display.c56
-rw-r--r--mail/mail-format.c64
-rw-r--r--mail/mail-preferences.c4
-rw-r--r--mail/mail-send-recv.c83
-rw-r--r--mail/mail-session.c39
-rw-r--r--mail/mail-tools.c48
-rw-r--r--mail/message-browser.c15
-rw-r--r--mail/message-list.c55
-rw-r--r--mail/message-tag-followup.c37
-rw-r--r--mail/subscribe-dialog.c27
23 files changed, 1099 insertions, 1634 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 2fe35beccc..920f60478a 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,155 @@
+2003-01-07 Jeffrey Stedfast <fejj@ximian.com>
+
+ * folder-browser.c (save_cursor_pos): Use gconf to get the paned
+ size.
+ (folder_browser_set_message_preview): Same.
+ (folder_browser_toggle_hide_deleted): Use gconf to set the
+ hide-deleted state.
+ (folder_browser_set_message_display_style): Same but for the
+ message_display_style.
+ (fb_resize_cb): Save the paned_size via gconf.
+ (paned_size_changed): Callback for when the paned_size gets
+ changed. Change the folder-browser's paned size to the new
+ setting.
+ (folder_browser_gui_init): Listen to changes to the paned_size and
+ also get the initial size from gconf.
+
+ * message-list.c (message_list_set_folder): Use gconf.
+ (regen_list_regen): Use gconf.
+
+ * message-browser.c (transfer_msg_done): Use gconf to get the
+ hide_deleted setting.
+
+ * mail-account-gui.c (sig_add_new_signature): Use gconf.
+
+ * folder-browser-ui.c (folder_browser_ui_add_list): Use gconf.
+
+ * folder-browser.c (save_cursor_pos): Use gconf.
+ (folder_browser_set_message_preview): Same.
+ (folder_browser_toggle_hide_deleted): Here too.
+ (folder_browser_set_message_display_style): And here.
+ (folder_browser_gui_init): Here too.
+ (done_message_selected): And here.
+
+ * mail-config.c (mail_config_get_thread_subject): Removed.
+ (mail_config_set_thread_subject): Removed.
+ (mail_config_get_empty_trash_on_exit): Removed.
+ (mail_config_set_empty_trash_on_exit): Removed.
+ (mail_config_get_last_filesel_dir): Removed.
+ (mail_config_set_last_filesel_dir): Removed.
+ (mail_config_get_hide_deleted): Removed.
+ (mail_config_set_hide_deleted): Removed.
+ (mail_config_get_paned_size): Removed.
+ (mail_config_set_paned_size): Removed.
+ (mail_config_get_send_html): Removed.
+ (mail_config_set_send_html): Removed.
+ (mail_config_get_confirm_unwanted_html): Removed.
+ (mail_config_set_confirm_unwanted_html): Removed.
+ (mail_config_get_citation_highlight): Removed.
+ (mail_config_set_citation_highlight): Removed.
+ (mail_config_get_citation_color): Removed.
+ (mail_config_set_citation_color): Removed.
+ (mail_config_get_do_seen_timeout): Removed.
+ (mail_config_set_do_seen_timeout): Removed.
+ (mail_config_get_mark_as_seen_timeout): Removed.
+ (mail_config_set_mark_as_seen_timeout): Removed.
+ (mail_config_get_prompt_empty_subject): Removed.
+ (mail_config_set_prompt_empty_subject): Removed.
+ (mail_config_get_prompt_only_bcc): Removed.
+ (mail_config_set_prompt_only_bcc): Removed.
+ (mail_config_get_confirm_expunge): Removed.
+ (mail_config_set_confirm_expunge): Removed.
+ (mail_config_get_confirm_goto_next_folder): Removed.
+ (mail_config_set_confirm_goto_next_folder): Removed.
+ (mail_config_get_goto_next_folder): Removed.
+ (mail_config_set_goto_next_folder): Removed.
+ (mail_config_get_http_mode): Removed.
+ (mail_config_set_http_mode): Removed.
+ (mail_config_get_default_forward_style): Removed.
+ (mail_config_set_default_forward_style): Removed.
+ (mail_config_get_default_reply_style): Removed.
+ (mail_config_set_default_reply_style): Removed.
+ (mail_config_get_message_display_style): Removed.
+ (mail_config_set_message_display_style): Removed.
+ (mail_config_get_default_charset): Removed.
+ (mail_config_set_default_charset): Removed.
+ (mail_config_get_x_mailer_display_style): Removed.
+ (mail_config_set_x_mailer_display_style): Removed.
+
+ * subscribe-dialog.c (populate_store_list): Use the list of
+ accounts. We can't get the list of sources anymore.
+ (populate_store_foreach): Updated.
+
+ * mail-callbacks.c (guess_me_from_accounts): Use account->enabled.
+ (mail_generate_reply): Same.
+ (empty_trash): Here too.
+
+ * mail-accounts.c (account_delete_clicked): Use account->enabled
+ rather than source->enabled.
+ (account_able_clicked): Same.
+ (account_cursor_change): Here too.
+ (mail_accounts_load): And here.
+
+ * component-factory.c (owner_unset_cb): Use gconf empty-on-exit
+ settings.
+ (mail_load_storages): Use account->enabled rather than
+ account->source->enabled. The struct changed.
+
+ * mail-composer-prefs.c (sig_add): Get the send_html pref from gconf.
+
+ * message-tag-followup.c (target_date_new): Use gconf.
+
+ * mail-config.c (mail_config_get_week_start_day): Removed.
+
+ * mail-tools.c (mail_tool_quote_message): Use gconf here too, but
+ we don't need to parse the colour - just use it as a raw string.
+ (mail_tool_forward_message): Use gconf.
+
+ * mail-format.c (mail_format_data_wrapper_write_to_stream): Use gconf.
+ (write_headers): Use gconf.
+ (handle_text_plain): Same.
+
+ * mail-display.c (mail_text_write): Updated to use gconf and parse
+ GdkColour strings.
+ (on_url_requested): Updated to use gconf.
+
+ * mail-callbacks.c (ask_confirm_for_unwanted_html_mail): Use gconf
+ rather than the old mail-config APIs which will be removed.
+ (ask_confirm_for_empty_subject): Same.
+ (ask_confirm_for_only_bcc): Here too.
+ (composer_get_message): And here.
+ (create_msg_composer): Same.
+ (transfer_msg_done): Again here.
+ (delete_msg): Here too.
+ (confirm_expunge): And finally here.
+
+ * mail-config.c (mail_config_write): Use gconf.
+ (mail_config_get_sources): Removed.
+
+ * mail-account-gui.c (mail_account_gui_save): No need to save
+ enabled-state anymore for a source.
+
+ * mail-config-druid.c (wizard_finish_cb): Instead of setting
+ account->source->enabled to TRUE, just set account->enabled to
+ TRUE. The structures changed a bit.
+
+ * mail-send-recv.c (mail_send_receive): Get the list of accounts
+ instead of sources, and pass them along to build_dialogue. I'm
+ trying to get rid of the mail_config_get_sources() api.
+ (mail_autoreceive_setup): Here too.
+
+ * mail-config.c (mail_config_get_filter_log): Removed.
+ (mail_config_set_filter_log): Removed.
+ (mail_config_get_filter_log_path): Removed.
+ (mail_config_set_filter_log_path): Removed.
+ (mail_config_get_new_mail_notify): Removed.
+ (mail_config_set_new_mail_notify): Removed.
+ (mail_config_get_new_mail_notify_sound_file): Removed.
+ (mail_config_set_new_mail_notify_sound_file): Removed.
+
+ * mail-session.c (main_get_filter_driver): Updated to use the
+ gconf settings.
+
2003-01-07 Dan Winship <danw@ximian.com>
* mail-account-gui.c (mail_account_gui_auto_detect_extra_conf,
diff --git a/mail/component-factory.c b/mail/component-factory.c
index 43b3076752..2e2cdb4c2c 100644
--- a/mail/component-factory.c
+++ b/mail/component-factory.c
@@ -24,11 +24,14 @@
#include <config.h>
#endif
+#include <string.h>
+
+#include <gconf/gconf.h>
+#include <gconf/gconf-client.h>
+
#include <bonobo/bonobo-generic-factory.h>
#include <gal/widgets/e-gui-utils.h>
-#include <string.h>
-
#include "camel.h"
#include "Evolution.h"
@@ -938,12 +941,15 @@ static struct {
static void
owner_unset_cb (EvolutionShellComponent *shell_component, gpointer user_data)
{
+ GConfClient *gconf;
int i;
+ gconf = gconf_client_get_default ();
+
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);
- if (mail_config_get_empty_trash_on_exit ())
+ if (gconf_client_get_bool (gconf, "/apps/evolution/mail/trash/empty_on_exit", NULL))
empty_trash (NULL, NULL, NULL);
unref_standard_folders ();
@@ -952,7 +958,7 @@ owner_unset_cb (EvolutionShellComponent *shell_component, gpointer user_data)
global_shell_client = NULL;
mail_session_set_interactive (FALSE);
- g_object_unref((search_context));
+ g_object_unref (search_context);
search_context = NULL;
g_timeout_add(100, idle_quit, NULL);
@@ -1491,7 +1497,7 @@ mail_load_storages (GNOME_Evolution_Shell shell, const GSList *sources)
continue;
/* don't auto-connect here; the shell will tell us to goOnline */
- if (account->source->enabled)
+ if (account->enabled)
mail_load_storage_by_uri (shell, service->url, name);
}
}
diff --git a/mail/evolution-mail.schemas b/mail/evolution-mail.schemas
index c4184e5345..3e7969948b 100644
--- a/mail/evolution-mail.schemas
+++ b/mail/evolution-mail.schemas
@@ -104,15 +104,15 @@
<!-- Display Settings -->
<schema>
- <key>/schemas/apps/evolution/mail/display/highlight_citations</key>
- <applyto>/apps/evolution/mail/display/highlight_citations</applyto>
+ <key>/schemas/apps/evolution/mail/display/mark_citations</key>
+ <applyto>/apps/evolution/mail/display/mark_citations</applyto>
<owner>evolution-mail</owner>
<type>bool</type>
<default>true</default>
<locale name="C">
- <short>Highlight citations in the message "Preview"</short>
+ <short>Mark citations in the message "Preview"</short>
<long>
- Highlight citations in the message "Preview".
+ Mark citations in the message "Preview".
</long>
</locale>
</schema>
@@ -149,8 +149,8 @@
</schema>
<schema>
- <key>/schemas/apps/evolution/mail/display/xmailer_display_style</key>
- <applyto>/apps/evolution/mail/display/xmailer_display_style</applyto>
+ <key>/schemas/apps/evolution/mail/display/xmailer_mask</key>
+ <applyto>/apps/evolution/mail/display/xmailer_mask</applyto>
<owner>evolution-mail</owner>
<type>long</type>
<default>0</default>
@@ -219,15 +219,15 @@
</schema>
<schema>
- <key>/schemas/apps/evolution/mail/display/preview_size</key>
- <applyto>/apps/evolution/mail/display/preview_size</applyto>
+ <key>/schemas/apps/evolution/mail/display/paned_size</key>
+ <applyto>/apps/evolution/mail/display/paned_size</applyto>
<owner>evolution-mail</owner>
<type>long</type>
<default>122</default>
<locale name="C">
- <short>Size of the "Preview" pane</short>
+ <short>Height of the message-list pane</short>
<long>
- Size of the "Preview" pane.
+ Height of the message-list pane.
</long>
</locale>
</schema>
diff --git a/mail/folder-browser-ui.c b/mail/folder-browser-ui.c
index b3ac053794..a9d6edfdf7 100644
--- a/mail/folder-browser-ui.c
+++ b/mail/folder-browser-ui.c
@@ -28,6 +28,9 @@
#include <string.h>
+#include <gconf/gconf.h>
+#include <gconf/gconf-client.h>
+
#include <libgnome/gnome-util.h> /* gnome_util_prepend_user_home */
#include <bonobo/bonobo-exception.h>
@@ -371,7 +374,7 @@ folder_browser_ui_setup_view_menus (FolderBrowser *fb)
gal_view_collection_load (collection);
}
- id = mail_config_folder_to_safe_url(fb->folder);
+ id = mail_config_folder_to_safe_url (fb->folder);
fb->view_instance = gal_view_instance_new (collection, id);
g_free (id);
@@ -549,6 +552,7 @@ void
folder_browser_ui_add_list (FolderBrowser *fb)
{
BonoboUIComponent *uic = fb->uicomp;
+ GConfClient *gconf;
int state;
if (fb->sensitise_state) {
@@ -563,7 +567,7 @@ folder_browser_ui_add_list (FolderBrowser *fb)
fbui_sensitise_item (fb, "HideDeleted", FALSE);
state = FALSE;
} else {
- state = mail_config_get_hide_deleted ();
+ state = !gconf_client_get_bool (gconf, "/apps/evolution/mail/display/show_deleted", NULL);
}
bonobo_ui_component_set_prop (uic, "/commands/HideDeleted", "state", state ? "1" : "0", NULL);
diff --git a/mail/folder-browser.c b/mail/folder-browser.c
index 0dad15eaeb..bd442c4523 100644
--- a/mail/folder-browser.c
+++ b/mail/folder-browser.c
@@ -37,6 +37,9 @@
#include <gal/widgets/e-gui-utils.h>
#include <gal/widgets/e-popup-menu.h>
+#include <gconf/gconf.h>
+#include <gconf/gconf-client.h>
+
#include <libgnomeui/gnome-dialog-util.h>
#include <libgnomeui/gnome-pixmap.h>
@@ -1064,7 +1067,8 @@ save_cursor_pos (FolderBrowser *fb)
{
ETreePath node;
GtkAdjustment *adj;
- int row, y, height;
+ int row, y, height, paned_size;
+ GConfClient *gconf;
node = e_tree_get_cursor (fb->message_list->tree);
if (!node)
@@ -1078,8 +1082,11 @@ 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 ();
+ paned_size = gconf_client_get_int (gconf, "/apps/evolution/mail/display/paned_size", NULL);
+
adj = e_scroll_frame_get_vadjustment (E_SCROLL_FRAME (fb->message_list));
- y += adj->value - ((mail_config_get_paned_size () - height) / 2);
+ y += adj->value - ((paned_size - height) / 2);
return y;
}
@@ -1101,7 +1108,8 @@ static gboolean do_message_selected(FolderBrowser *fb);
void
folder_browser_set_message_preview (FolderBrowser *folder_browser, gboolean show_message_preview)
{
- int y;
+ GConfClient *gconf;
+ int paned_size, y;
if (folder_browser->preview_shown == show_message_preview
|| folder_browser->message_list == NULL)
@@ -1109,9 +1117,12 @@ folder_browser_set_message_preview (FolderBrowser *folder_browser, gboolean show
folder_browser->preview_shown = show_message_preview;
+ gconf = gconf_client_get_default ();
+ paned_size = gconf_client_get_int (gconf, "/apps/evolution/mail/display/paned_size", NULL);
+
if (show_message_preview) {
y = save_cursor_pos (folder_browser);
- e_paned_set_position (E_PANED (folder_browser->vpaned), mail_config_get_paned_size ());
+ e_paned_set_position (E_PANED (folder_browser->vpaned), paned_size);
gtk_widget_show (GTK_WIDGET (folder_browser->mail_display));
do_message_selected (folder_browser);
set_cursor_pos (folder_browser, y);
@@ -1119,7 +1130,7 @@ folder_browser_set_message_preview (FolderBrowser *folder_browser, gboolean show
e_paned_set_position (E_PANED (folder_browser->vpaned), 10000);
gtk_widget_hide (GTK_WIDGET (folder_browser->mail_display));
mail_display_set_message (folder_browser->mail_display, NULL, NULL, NULL);
- folder_browser_ui_message_loaded(folder_browser);
+ folder_browser_ui_message_loaded (folder_browser);
}
}
@@ -1289,13 +1300,20 @@ folder_browser_toggle_hide_deleted (BonoboUIComponent *component,
gpointer user_data)
{
FolderBrowser *fb = user_data;
+ GConfClient *gconf;
if (type != Bonobo_UIComponent_STATE_CHANGED
|| fb->message_list == NULL)
return;
- if (!(fb->folder && (fb->folder->folder_flags & CAMEL_FOLDER_IS_TRASH)))
- mail_config_set_hide_deleted (atoi (state));
+ gconf = gconf_client_get_default ();
+
+ /* FIXME: we should listen for changes to this, so when it changes for one folder all folders get updated */
+ if (!(fb->folder && (fb->folder->folder_flags & CAMEL_FOLDER_IS_TRASH))) {
+ gconf_client_set_bool (gconf, "/apps/evolution/mail/display/show_deleted",
+ atoi (state), NULL);
+ }
+
message_list_set_hidedeleted (fb->message_list, atoi (state));
}
@@ -1308,20 +1326,25 @@ folder_browser_set_message_display_style (BonoboUIComponent *component
{
extern char *message_display_styles[];
FolderBrowser *fb = user_data;
+ GConfClient *gconf;
int i;
+ /* FIXME: we should listen for changes to this, so when it changes for one folder all folders get updated */
+
if (type != Bonobo_UIComponent_STATE_CHANGED
|| atoi (state) == 0
|| fb->message_list == NULL)
return;
+ gconf = gconf_client_get_default ();
+
for (i = 0; i < MAIL_CONFIG_DISPLAY_MAX; i++) {
if (strstr (message_display_styles[i], path)) {
fb->mail_display->display_style = i;
mail_display_redisplay (fb->mail_display, TRUE);
if (fb->pref_master)
- mail_config_set_message_display_style (i);
+ gconf_client_set_int (gconf, "/apps/evolution/mail/display/message_style", i, NULL);
return;
}
}
@@ -2296,9 +2319,27 @@ on_cursor_activated (ETree *tree, int row, ETreePath path, gpointer user_data)
static void
fb_resize_cb (GtkWidget *w, GtkAllocation *a, FolderBrowser *fb)
-{
+{
+ GConfClient *gconf;
+
+ gconf = gconf_client_get_default ();
+
if (GTK_WIDGET_REALIZED (w) && fb->preview_shown)
- mail_config_set_paned_size (a->height);
+ gconf_client_set_int (gconf, "/apps/evolution/mail/display/paned_size", a->height, NULL);
+}
+
+static void
+paned_size_changed (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data)
+{
+ FolderBrowser *fb = user_data;
+ int paned_size;
+
+ g_signal_handler_block (fb->message_list, fb->resize_id);
+
+ paned_size = gconf_client_get_int (client, "/apps/evolution/mail/display/paned_size", NULL);
+ e_paned_set_position (E_PANED (fb->vpaned), paned_size);
+
+ g_signal_handler_unblock (fb->message_list, fb->resize_id);
}
static void
@@ -2306,6 +2347,8 @@ folder_browser_gui_init (FolderBrowser *fb)
{
extern RuleContext *search_context;
ESelectionModel *esm;
+ GConfClient *gconf;
+ int paned_size;
/* The panned container */
fb->vpaned = e_vpaned_new ();
@@ -2350,11 +2393,21 @@ folder_browser_gui_init (FolderBrowser *fb)
e_paned_add1 (E_PANED (fb->vpaned), GTK_WIDGET (fb->message_list));
gtk_widget_show (GTK_WIDGET (fb->message_list));
- g_signal_connect (fb->message_list, "size_allocate",
- G_CALLBACK (fb_resize_cb), fb);
+ fb->resize_id = g_signal_connect (fb->message_list, "size_allocate",
+ G_CALLBACK (fb_resize_cb), fb);
+
+ /* listen for updates */
+ gconf_client_add_dir (gconf, "/apps/evolution/mail/display/paned_size",
+ GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
+
+ gconf_client_notify_add (gconf, "/apps/evolution/mail/display/paned_size",
+ paned_size_changed, fb, NULL, NULL);
+
+ gconf = gconf_client_get_default ();
+ paned_size = gconf_client_get_int (gconf, "/apps/evolution/mail/display/paned_size", NULL);
e_paned_add2 (E_PANED (fb->vpaned), GTK_WIDGET (fb->mail_display));
- e_paned_set_position (E_PANED (fb->vpaned), mail_config_get_paned_size ());
+ e_paned_set_position (E_PANED (fb->vpaned), paned_size);
gtk_widget_show (GTK_WIDGET (fb->mail_display));
gtk_widget_show (GTK_WIDGET (fb));
}
@@ -2381,11 +2434,17 @@ done_message_selected (CamelFolder *folder, const char *uid, CamelMimeMessage *m
{
FolderBrowser *fb = data;
CamelMessageInfo *info;
- int timeout = mail_config_get_mark_as_seen_timeout ();
+ GConfClient *gconf;
+ int timeout;
+
+ gconf = gconf_client_get_default ();
if (folder != fb->folder || fb->mail_display == NULL)
return;
+ gconf = gconf_client_get_default ();
+ timeout = gconf_client_get_int (gconf, "/apps/evolution/mail/display/mark_seen_timeout", NULL);
+
info = camel_folder_get_message_info (fb->folder, uid);
mail_display_set_message (fb->mail_display, (CamelMedium *) msg, fb->folder, info);
if (info)
@@ -2414,7 +2473,7 @@ done_message_selected (CamelFolder *folder, const char *uid, CamelMimeMessage *m
if (fb->seen_id)
gtk_timeout_remove (fb->seen_id);
- if (mail_config_get_do_seen_timeout () && msg) {
+ if (msg && gconf_client_get_bool (gconf, "/apps/evolution/mail/display/mark_seen", NULL)) {
if (timeout > 0)
fb->seen_id = gtk_timeout_add (timeout, do_mark_seen, fb);
else
diff --git a/mail/folder-browser.h b/mail/folder-browser.h
index dd8486bc1c..dd83d05d87 100644
--- a/mail/folder-browser.h
+++ b/mail/folder-browser.h
@@ -59,6 +59,8 @@ struct _FolderBrowser {
guint loading_id;
guint seen_id;
+ gulong resize_id;
+
/* a folder we are expunging, dont use other than to compare the pointer value */
CamelFolder *expunging;
diff --git a/mail/mail-account-gui.c b/mail/mail-account-gui.c
index 95bbdff447..73a341fa57 100644
--- a/mail/mail-account-gui.c
+++ b/mail/mail-account-gui.c
@@ -30,6 +30,9 @@
#include <string.h>
#include <stdarg.h>
+#include <gconf/gconf.h>
+#include <gconf/gconf-client.h>
+
#include <gal/widgets/e-gui-utils.h>
#include "evolution-folder-selector-button.h"
@@ -1259,12 +1262,18 @@ sig_switch_to_list (GtkWidget *w, MailAccountGui *gui)
static void
sig_add_new_signature (GtkWidget *w, MailAccountGui *gui)
{
+ GConfClient *gconf;
+ gboolean send_html;
+
if (!gui->dialog)
return;
sig_switch_to_list (w, gui);
- gui->def_signature = mail_composer_prefs_new_signature (NULL, mail_config_get_send_html (), NULL);
+ gconf = gconf_client_get_default ();
+ send_html = gconf_client_get_bool (gconf, "/apps/evolution/mail/composer/send_html", NULL);
+
+ gui->def_signature = mail_composer_prefs_new_signature (NULL, send_html, NULL);
gui->auto_signature = FALSE;
gtk_option_menu_set_history (GTK_OPTION_MENU (gui->sig_option_menu), sig_gui_get_index (gui));
@@ -1814,7 +1823,6 @@ mail_account_gui_save (MailAccountGui *gui)
CamelURL *source_url = NULL, *url;
const char *new_name;
gboolean is_storage;
- gboolean enabled;
if (!mail_account_gui_identity_complete (gui, NULL) ||
!mail_account_gui_source_complete (gui, NULL) ||
@@ -1853,7 +1861,6 @@ mail_account_gui_save (MailAccountGui *gui)
account->id->def_signature = gui->def_signature;
account->id->auto_signature = gui->auto_signature;
- enabled = account->source && account->source->enabled;
service_destroy (account->source);
account->source = g_new0 (MailConfigService, 1);
save_service (&gui->source, gui->extra_config, account->source);
@@ -1862,8 +1869,6 @@ mail_account_gui_save (MailAccountGui *gui)
source_url = provider ? camel_url_new (account->source->url, NULL) : NULL;
}
- account->source->enabled = enabled;
-
account->source->auto_check = gtk_toggle_button_get_active (gui->source_auto_check);
if (account->source->auto_check)
account->source->auto_check_time = gtk_spin_button_get_value_as_int (gui->source_auto_check_min);
diff --git a/mail/mail-accounts.c b/mail/mail-accounts.c
index f9f802a2c3..7c8008eb0e 100644
--- a/mail/mail-accounts.c
+++ b/mail/mail-accounts.c
@@ -234,7 +234,7 @@ account_delete_clicked (GtkButton *button, gpointer user_data)
int len;
/* remove it from the folder-tree in the shell */
- if (account->source && account->source->url && account->source->enabled)
+ if (account->enabled && account->source && account->source->url)
mail_remove_storage_by_uri (account->source->url);
/* remove it from the config file */
@@ -285,7 +285,7 @@ static void
account_able_clicked (GtkButton *button, gpointer user_data)
{
MailAccountsTab *prefs = user_data;
- const MailConfigAccount *account = NULL;
+ MailConfigAccount *account = NULL;
GtkTreeSelection *selection;
GtkTreeModel *model;
GtkTreeIter iter;
@@ -293,15 +293,15 @@ account_able_clicked (GtkButton *button, gpointer user_data)
selection = gtk_tree_view_get_selection (prefs->table);
if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
gtk_tree_model_get (model, &iter, 3, &account, -1);
- account->source->enabled = !account->source->enabled;
- gtk_list_store_set ((GtkListStore *) model, &iter, 0, account->source->enabled, -1);
+ account->enabled = !account->enabled;
+ gtk_list_store_set ((GtkListStore *) model, &iter, 0, account->enabled, -1);
}
if (account) {
/* if the account got disabled, remove it from the
folder-tree, otherwise add it to the folder-tree */
if (account->source->url) {
- if (account->source->enabled)
+ if (account->enabled)
mail_load_storage_by_uri (prefs->shell, account->source->url, account->name);
else
mail_remove_storage_by_uri (account->source->url);
@@ -331,7 +331,7 @@ account_cursor_change (GtkTreeSelection *selection, MailAccountsTab *prefs)
state = gtk_tree_selection_get_selected (selection, &model, &iter);
if (state) {
gtk_tree_model_get (model, &iter, 3, &account, -1);
- if (account->source && account->source->enabled)
+ if (account->source && account->enabled)
gtk_button_set_label (prefs->mail_able, _("Disable"));
else
gtk_button_set_label (prefs->mail_able, _("Enable"));
@@ -379,7 +379,7 @@ mail_accounts_load (MailAccountsTab *prefs)
}
gtk_list_store_set (model, &iter,
- 0, account->source->enabled,
+ 0, account->enabled,
1, val,
2, url && url->protocol ? url->protocol : (char *) _("None"),
3, account,
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index 1401364ed6..847e5bd39a 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -31,8 +31,12 @@
#include <time.h>
#include <errno.h>
+
#include <gtkhtml/gtkhtml.h>
+#include <gconf/gconf.h>
+#include <gconf/gconf-client.h>
+
#include <gtk/gtkmessagedialog.h>
#include <libgnomeprint/gnome-print-master.h>
@@ -240,10 +244,13 @@ static gboolean
ask_confirm_for_unwanted_html_mail (EMsgComposer *composer, EDestination **recipients)
{
gboolean show_again, res;
+ GConfClient *gconf;
GString *str;
int i;
-
- if (!mail_config_get_confirm_unwanted_html ())
+
+ gconf = gconf_client_get_default ();
+
+ if (!gconf_client_get_bool (gconf, "/apps/evolution/mail/prompts/unwanted_html", NULL))
return TRUE;
/* FIXME: this wording sucks */
@@ -260,10 +267,11 @@ ask_confirm_for_unwanted_html_mail (EMsgComposer *composer, EDestination **recip
}
g_string_append (str, _("Send anyway?"));
- res = e_question((GtkWindow *)composer, GTK_RESPONSE_YES, &show_again, "%s", str->str);
- g_string_free(str, TRUE);
- mail_config_set_confirm_unwanted_html (show_again);
-
+ res = e_question ((GtkWindow *) composer, GTK_RESPONSE_YES, &show_again, "%s", str->str);
+ g_string_free (str, TRUE);
+
+ gconf_client_set_bool (gconf, "/apps/evolution/mail/prompts/unwanted_html", show_again, NULL);
+
return res;
}
@@ -272,13 +280,17 @@ ask_confirm_for_empty_subject (EMsgComposer *composer)
{
gboolean show_again, res;
GtkWidget *mbox, *check;
+ GConfClient *gconf;
+
+ gconf = gconf_client_get_default ();
- if (!mail_config_get_prompt_empty_subject ())
+ if (gconf_client_get_bool (gconf, "/apps/evolution/mail/prompts/empty_subject", NULL))
return TRUE;
-
- res = e_question((GtkWindow *)composer, GTK_RESPONSE_YES, &show_again,
- _("This message has no subject.\nReally send?"));
- mail_config_set_prompt_empty_subject (show_again);
+
+ res = e_question ((GtkWindow *) composer, GTK_RESPONSE_YES, &show_again,
+ _("This message has no subject.\nReally send?"));
+
+ gconf_client_set_bool (gconf, "/apps/evolution/mail/prompts/empty_subject", show_again, NULL);
return res;
}
@@ -288,8 +300,11 @@ ask_confirm_for_only_bcc (EMsgComposer *composer, gboolean hidden_list_case)
{
gboolean show_again, res;
const char *first_text;
+ GConfClient *gconf;
- if (!mail_config_get_prompt_only_bcc ())
+ gconf = gconf_client_get_default ();
+
+ if (!gconf_client_get_bool (gconf, "/apps/evolution/mail/prompts/only_bcc", NULL))
return TRUE;
/* If the user is mailing a hidden contact list, it is possible for
@@ -305,13 +320,13 @@ ask_confirm_for_only_bcc (EMsgComposer *composer, gboolean hidden_list_case)
} else {
first_text = _("This message contains only Bcc recipients.");
}
-
- res = e_question((GtkWindow *)composer, GTK_RESPONSE_YES, &show_again,
- "%s\n%s", first_text,
- _("It is possible that the mail server may reveal the recipients "
- "by adding an Apparently-To header.\nSend anyway?"));
- mail_config_set_prompt_only_bcc (show_again);
+ res = e_question ((GtkWindow *) composer, GTK_RESPONSE_YES, &show_again,
+ "%s\n%s", first_text,
+ _("It is possible that the mail server may reveal the recipients "
+ "by adding an Apparently-To header.\nSend anyway?"));
+
+ gconf_client_set_bool (gconf, "/apps/evolution/mail/prompts/only_bcc", show_again, NULL);
return res;
}
@@ -394,10 +409,14 @@ composer_get_message (EMsgComposer *composer, gboolean post, gboolean save_html_
const MailConfigAccount *account;
CamelMimeMessage *message = NULL;
EDestination **recipients, **recipients_bcc;
- char *subject;
- int i;
+ gboolean send_html, confirm_html;
int hidden = 0, shown = 0;
int num = 0, num_bcc = 0;
+ GConfClient *gconf;
+ char *subject;
+ int i;
+
+ gconf = gconf_client_get_default ();
/* 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
@@ -431,13 +450,14 @@ composer_get_message (EMsgComposer *composer, gboolean post, gboolean save_html_
if (addr && addr[0])
num_bcc++;
}
+
e_destination_freev (recipients_bcc);
}
/* I'm sensing a lack of love, er, I mean recipients. */
if (num == 0 && !post) {
- e_notice((GtkWindow *)composer, GTK_MESSAGE_WARNING,
- _("You must specify recipients in order to send this message."));
+ e_notice ((GtkWindow *) composer, GTK_MESSAGE_WARNING,
+ _("You must specify recipients in order to send this message."));
goto finished;
}
@@ -447,15 +467,17 @@ composer_get_message (EMsgComposer *composer, gboolean post, gboolean save_html_
goto finished;
}
+ send_html = gconf_client_get_bool (gconf, "/apps/evolution/mail/composer/send_html", NULL);
+ confirm_html = gconf_client_get_bool (gconf, "/apps/evolution/mail/prompts/unwanted_html", NULL);
+
/* Only show this warning if our default is to send html. If it isn't, we've
manually switched into html mode in the composer and (presumably) had a good
reason for doing this. */
- if (e_msg_composer_get_send_html (composer) && mail_config_get_send_html ()
- && mail_config_get_confirm_unwanted_html ()) {
+ if (e_msg_composer_get_send_html (composer) && send_html && confirm_html) {
gboolean html_problem = FALSE;
if (recipients) {
- for (i = 0; recipients[i] != NULL && !html_problem; ++i) {
+ for (i = 0; recipients[i] != NULL && !html_problem; i++) {
if (!e_destination_get_html_mail_pref (recipients[i]))
html_problem = TRUE;
}
@@ -725,16 +747,17 @@ static GtkWidget *
create_msg_composer (const MailConfigAccount *account, gboolean post, const char *url)
{
EMsgComposer *composer;
+ GConfClient *gconf;
gboolean send_html;
/* Make sure that we've actually been passed in an account. If one has
* not been passed in, grab the default account.
*/
- if (account == NULL) {
+ if (account == NULL)
account = mail_config_get_default_account ();
- }
- send_html = mail_config_get_send_html ();
+ gconf = gconf_client_get_default ();
+ send_html = gconf_client_get_bool (gconf, "/apps/evolution/mail/composer/send_html", NULL);
if (post)
composer = e_msg_composer_new_post ();
@@ -900,7 +923,7 @@ guess_me_from_accounts (const CamelInternetAddress *to, const CamelInternetAddre
* account always takes precedence no matter what.
*/
acnt = g_hash_table_lookup (account_hash, account->id->address);
- if (acnt && acnt != def && !acnt->source->enabled && account->source->enabled) {
+ if (acnt && acnt != def && !acnt->enabled && account->enabled) {
g_hash_table_remove (account_hash, acnt->id->address);
acnt = NULL;
}
@@ -955,9 +978,12 @@ mail_generate_reply (CamelFolder *folder, CamelMimeMessage *message, const char
EDestination **tov, **ccv;
EMsgComposer *composer;
CamelMimePart *part;
+ GConfClient *gconf;
time_t date;
char *url;
+ gconf = gconf_client_get_default ();
+
if (mode == REPLY_POST) {
composer = e_msg_composer_new_post ();
if (composer != NULL) {
@@ -997,7 +1023,7 @@ mail_generate_reply (CamelFolder *folder, CamelMimeMessage *message, const char
* account always takes precedence no matter what.
*/
acnt = g_hash_table_lookup (account_hash, account->id->address);
- if (acnt && acnt != def && !acnt->source->enabled && account->source->enabled) {
+ if (acnt && acnt != def && !acnt->enabled && account->enabled) {
g_hash_table_remove (account_hash, acnt->id->address);
acnt = NULL;
}
@@ -1126,7 +1152,7 @@ mail_generate_reply (CamelFolder *folder, CamelMimeMessage *message, const char
}
/* set body text here as we want all ignored words to take effect */
- switch (mail_config_get_default_reply_style ()) {
+ switch (gconf_client_get_int (gconf, "/apps/evolution/mail/format/reply_style", NULL)) {
case MAIL_CONFIG_REPLY_DO_NOT_QUOTE:
/* do nothing */
break;
@@ -1454,7 +1480,11 @@ forward_attached (GtkWidget *widget, gpointer user_data)
void
forward (GtkWidget *widget, gpointer user_data)
{
- MailConfigForwardStyle style = mail_config_get_default_forward_style ();
+ MailConfigForwardStyle style;
+ GConfClient *gconf;
+
+ gconf = gconf_client_get_default ();
+ style = gconf_client_get_int (gconf, "/apps/evolution/mail/format/forward_style", NULL);
if (style == MAIL_CONFIG_FORWARD_ATTACHED)
forward_attached (widget, user_data);
@@ -1600,16 +1630,20 @@ static void
transfer_msg_done (gboolean ok, void *data)
{
FolderBrowser *fb = data;
+ gboolean hide_deleted;
+ GConfClient *gconf;
int row;
if (ok && !FOLDER_BROWSER_IS_DESTROYED (fb)) {
+ gconf = gconf_client_get_default ();
+ hide_deleted = !gconf_client_get_bool (gconf, "/apps/evolution/mail/display/show_deleted", NULL);
+
row = e_tree_row_of_node (fb->message_list->tree,
e_tree_get_cursor (fb->message_list->tree));
/* If this is the last message and deleted messages
are hidden, select the previous */
- if ((row + 1 == e_tree_row_count (fb->message_list->tree))
- && mail_config_get_hide_deleted ())
+ if ((row + 1 == e_tree_row_count (fb->message_list->tree)) && hide_deleted)
message_list_select (fb->message_list, MESSAGE_LIST_SELECT_PREVIOUS,
0, CAMEL_MESSAGE_DELETED, FALSE);
else
@@ -2481,11 +2515,15 @@ void
delete_msg (GtkWidget *button, gpointer user_data)
{
FolderBrowser *fb = FOLDER_BROWSER (user_data);
+ gboolean hide_deleted;
+ GConfClient *gconf;
int deleted, row;
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);
@@ -2494,10 +2532,11 @@ 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));
+ hide_deleted = !gconf_client_get_bool (gconf, "/apps/evolution/mail/display/show_deleted", NULL);
+
/* If this is the last message and deleted messages
are hidden, select the previous */
- if ((row + 1 == e_tree_row_count (fb->message_list->tree))
- && mail_config_get_hide_deleted ())
+ if ((row + 1 == e_tree_row_count (fb->message_list->tree)) && hide_deleted)
message_list_select (fb->message_list, MESSAGE_LIST_SELECT_PREVIOUS,
0, CAMEL_MESSAGE_DELETED, FALSE);
else
@@ -2512,127 +2551,6 @@ undelete_msg (GtkWidget *button, gpointer user_data)
flag_messages (FOLDER_BROWSER (user_data), CAMEL_MESSAGE_DELETED, 0);
}
-
-#if 0
-static gboolean
-confirm_goto_next_folder (FolderBrowser *fb)
-{
- gboolean res, show_again;
-
- if (!mail_config_get_confirm_goto_next_folder ())
- return mail_config_get_goto_next_folder ();
-
- /*gtk_window_set_title((GtkWindow *)dialog, _("Go to next folder with unread messages?"));*/
-
- res = e_question(FB_WINDOW(fb), GTK_RESPONSE_YES, &show_again,
- _("There are no more new messages in this folder.\n"
- "Would you like to go to the next folder?"));
- mail_config_set_confirm_goto_next_folder(show_again);
- mail_config_set_goto_next_folder (res);
-
- return res;
-}
-
-static CamelFolderInfo *
-find_current_folder (CamelFolderInfo *root, const char *current_uri)
-{
- CamelFolderInfo *node, *current = NULL;
-
- node = root;
- while (node) {
- if (!strcmp (current_uri, node->url)) {
- current = node;
- break;
- }
-
- current = find_current_folder (node->child, current_uri);
- if (current)
- break;
-
- node = node->sibling;
- }
-
- return current;
-}
-
-static CamelFolderInfo *
-find_next_folder_r (CamelFolderInfo *node)
-{
- CamelFolderInfo *next;
-
- while (node) {
- if (node->unread_message_count > 0)
- return node;
-
- next = find_next_folder_r (node->child);
- if (next)
- return next;
-
- node = node->sibling;
- }
-
- return NULL;
-}
-
-static CamelFolderInfo *
-find_next_folder (CamelFolderInfo *current)
-{
- CamelFolderInfo *next;
-
- /* first search subfolders... */
- next = find_next_folder_r (current->child);
- if (next)
- return next;
-
- /* now search siblings... */
- next = find_next_folder_r (current->sibling);
- if (next)
- return next;
-
- /* now go up one level (if we can) and search... */
- if (current->parent && current->parent->sibling) {
- return find_next_folder_r (current->parent->sibling);
- } else {
- return NULL;
- }
-}
-
-static void
-do_evil_kludgy_goto_next_folder_hack (FolderBrowser *fb)
-{
- CamelFolderInfo *root, *current, *node;
- CORBA_Environment ev;
- CamelStore *store;
-
- store = camel_folder_get_parent_store (fb->folder);
-
- /* FIXME: loop over all available mail stores? */
-
- root = camel_store_get_folder_info (store, "", CAMEL_STORE_FOLDER_INFO_RECURSIVE |
- CAMEL_STORE_FOLDER_INFO_SUBSCRIBED, NULL);
-
- if (!root)
- return;
-
- current = find_current_folder (root, fb->uri);
- g_assert (current != NULL);
-
- node = find_next_folder (current);
- if (node) {
- g_warning ("doin' my thang...");
- CORBA_exception_init (&ev);
- GNOME_Evolution_ShellView_changeCurrentView (fb->shell_view, "evolution:/local/Inbox", &ev);
- if (ev._major != CORBA_NO_EXCEPTION)
- g_warning ("got an exception");
- CORBA_exception_free (&ev);
- } else {
- g_warning ("can't find a folder with unread mail?");
- }
-
- camel_store_free_folder_info (store, root);
-}
-#endif
-
void
next_msg (GtkWidget *button, gpointer user_data)
{
@@ -2652,12 +2570,7 @@ next_unread_msg (GtkWidget *button, gpointer user_data)
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
- if (!message_list_select (fb->message_list, MESSAGE_LIST_SELECT_NEXT, 0, CAMEL_MESSAGE_SEEN, TRUE)) {
-#if 0
- if (confirm_goto_next_folder (fb))
- do_evil_kludgy_goto_next_folder_hack (fb);
-#endif
- }
+ message_list_select (fb->message_list, MESSAGE_LIST_SELECT_NEXT, 0, CAMEL_MESSAGE_SEEN, TRUE);
}
void
@@ -2735,17 +2648,20 @@ static gboolean
confirm_expunge (FolderBrowser *fb)
{
gboolean res, show_again;
-
- if (!mail_config_get_confirm_expunge ())
+ GConfClient *gconf;
+
+ gconf = gconf_client_get_default ();
+
+ if (!gconf_client_get_bool (gconf, "/apps/evolution/mail/prompts/expunge", NULL))
return TRUE;
-
- res = e_question(FB_WINDOW(fb), GTK_RESPONSE_NO, &show_again,
- _("This operation will permanently erase all messages marked as\n"
- "deleted. If you continue, you will not be able to recover these messages.\n"
- "\nReally erase these messages?"));
-
- mail_config_set_confirm_expunge(show_again);
-
+
+ res = e_question (FB_WINDOW (fb), GTK_RESPONSE_NO, &show_again,
+ _("This operation will permanently erase all messages marked as\n"
+ "deleted. If you continue, you will not be able to recover these messages.\n"
+ "\nReally erase these messages?"));
+
+ gconf_client_set_bool (gconf, "/apps/evolution/mail/prompts/expunge", show_again, NULL);
+
return res;
}
@@ -3255,7 +3171,7 @@ empty_trash (BonoboUIComponent *uih, void *user_data, const char *path)
account = accounts->data;
/* make sure this is a valid source */
- if (account->source && account->source->enabled && account->source->url) {
+ if (account->source && account->enabled && account->source->url) {
provider = camel_session_get_provider (session, account->source->url, &ex);
if (provider) {
/* make sure this store is a remote store */
diff --git a/mail/mail-composer-prefs.c b/mail/mail-composer-prefs.c
index ccf856294a..dd86cfe39f 100644
--- a/mail/mail-composer-prefs.c
+++ b/mail/mail-composer-prefs.c
@@ -277,7 +277,13 @@ sig_delete (GtkWidget *widget, MailComposerPrefs *prefs)
static void
sig_add (GtkWidget *widget, MailComposerPrefs *prefs)
{
- mail_composer_prefs_new_signature (prefs, mail_config_get_send_html (), NULL);
+ GConfClient *gconf;
+ gboolean send_html;
+
+ gconf = gconf_client_get_default ();
+ send_html = gconf_client_get_bool (gconf, "/apps/evolution/mail/composer/send_html", NULL);
+
+ mail_composer_prefs_new_signature (prefs, send_html, NULL);
}
static void
diff --git a/mail/mail-config-druid.c b/mail/mail-config-druid.c
index a198952358..a529b47220 100644
--- a/mail/mail-config-druid.c
+++ b/mail/mail-config-druid.c
@@ -947,8 +947,7 @@ wizard_finish_cb (EvolutionWizard *wizard,
/* problem. Um, how to keep the druid alive? */
return;
- if (gui->account->source)
- gui->account->source->enabled = TRUE;
+ gui->account->enabled = TRUE;
/* Write out the config info */
mail_config_write ();
diff --git a/mail/mail-config.c b/mail/mail-config.c
index 1b02e462f1..14c0f9e5aa 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -37,7 +37,12 @@
#include <gtk/gtkdialog.h>
#include <gtkhtml/gtkhtml.h>
#include <glade/glade.h>
-#include <e-util/e-config-listener.h>
+
+#include <gconf/gconf.h>
+#include <gconf/gconf-client.h>
+
+#include <libxml/tree.h>
+#include <libxml/parser.h>
#include <bonobo/bonobo-object.h>
#include <bonobo/bonobo-generic-factory.h>
@@ -68,59 +73,24 @@ MailConfigLabel label_defaults[5] = {
};
typedef struct {
- EConfigListener *db;
+ GConfClient *gconf;
gboolean corrupt;
- gboolean show_preview;
- gboolean thread_list;
- gboolean hide_deleted;
- int paned_size;
- gboolean send_html;
- gboolean confirm_unwanted_html;
- gboolean citation_highlight;
- guint32 citation_color;
- gboolean prompt_empty_subject;
- gboolean prompt_only_bcc;
- gboolean confirm_expunge;
- gboolean confirm_goto_next_folder;
- gboolean goto_next_folder;
- gboolean do_seen_timeout;
- int seen_timeout;
- gboolean empty_trash_on_exit;
-
- gboolean thread_subject;
-
GSList *accounts;
int default_account;
- MailConfigHTTPMode http_mode;
- MailConfigForwardStyle default_forward_style;
- MailConfigReplyStyle default_reply_style;
- MailConfigDisplayStyle message_display_style;
- MailConfigXMailerDisplayStyle x_mailer_display_style;
- char *default_charset;
-
GHashTable *threaded_hash;
GHashTable *preview_hash;
- gboolean filter_log;
- char *filter_log_path;
-
- MailConfigNewMailNotify notify;
- char *notify_filename;
-
- char *last_filesel_dir;
-
GList *signature_list;
int signatures;
MailConfigLabel labels[5];
-
+
gboolean signature_info;
-
+
/* readonly fields from calendar */
- int week_start_day;
int time_24hour;
} MailConfig;
@@ -207,7 +177,6 @@ service_copy (const MailConfigService *source)
new->keep_on_server = source->keep_on_server;
new->auto_check = source->auto_check;
new->auto_check_time = source->auto_check_time;
- new->enabled = source->enabled;
new->save_passwd = source->save_passwd;
return new;
@@ -227,7 +196,7 @@ service_destroy (MailConfigService *source)
void
service_destroy_each (gpointer item, gpointer data)
{
- service_destroy ((MailConfigService *)item);
+ service_destroy ((MailConfigService *) item);
}
/* Account */
@@ -241,6 +210,8 @@ account_copy (const MailConfigAccount *account)
new = g_new0 (MailConfigAccount, 1);
new->name = g_strdup (account->name);
+ new->enabled = account->enabled;
+
new->id = identity_copy (account->id);
new->source = service_copy (account->source);
new->transport = service_copy (account->transport);
@@ -293,7 +264,327 @@ account_destroy (MailConfigAccount *account)
void
account_destroy_each (gpointer item, gpointer data)
{
- account_destroy ((MailConfigAccount *)item);
+ account_destroy ((MailConfigAccount *) item);
+}
+
+
+static gboolean
+xml_get_bool (xmlNodePtr node, const char *name)
+{
+ gboolean bool = FALSE;
+ char *buf;
+
+ if ((buf = xmlGetProp (node, name))) {
+ bool = (!strcmp (buf, "true") || !strcmp (buf, "yes"));
+ xmlFree (buf);
+ }
+
+ return bool;
+}
+
+static int
+xml_get_int (xmlNodePtr node, const char *name)
+{
+ int number = 0;
+ char *buf;
+
+ if ((buf = xmlGetProp (node, name))) {
+ number = strtol (buf, NULL, 10);
+ xmlFree (buf);
+ }
+
+ return number;
+}
+
+static char *
+xml_get_prop (xmlNodePtr node, const char *name)
+{
+ char *buf, *val;
+
+ buf = xmlGetProp (node, name);
+ val = g_strdup (buf);
+ g_free (buf);
+
+ return val;
+}
+
+static char *
+xml_get_content (xmlNodePtr node)
+{
+ char *buf, *val;
+
+ buf = xmlNodeGetContent (node);
+ val = g_strdup (buf);
+ xmlFree (buf);
+
+ return val;
+}
+
+static MailConfigSignature *
+lookup_signature (int i)
+{
+ MailConfigSignature *sig;
+ GList *l;
+
+ if (i == -1)
+ return NULL;
+
+ for (l = config->signature_list; l; l = l->next) {
+ sig = (MailConfigSignature *) l->data;
+ if (sig->id == i)
+ return sig;
+ }
+
+ return NULL;
+}
+
+static MailConfigAccount *
+account_new_from_xml (char *in)
+{
+ MailConfigAccount *account;
+ xmlNodePtr node, cur;
+ xmlDocPtr doc;
+ char *buf;
+
+ if (!(doc = xmlParseDoc (in)))
+ return NULL;
+
+ node = doc->children;
+ if (strcmp (node->name, "account") != 0) {
+ xmlFreeDoc (doc);
+ return NULL;
+ }
+
+ account = g_new0 (MailConfigAccount, 1);
+ account->name = xml_get_prop (node, "name");
+ account->enabled = xml_get_bool (node, "enabled");
+
+ node = node->children;
+ while (node != NULL) {
+ if (!strcmp (node->name, "identity")) {
+ account->id = g_new0 (MailConfigIdentity, 1);
+
+ cur = node->children;
+ while (cur != NULL) {
+ if (!strcmp (cur->name, "name")) {
+ account->id->name = xml_get_content (cur);
+ } else if (!strcmp (cur->name, "addr-spec")) {
+ account->id->address = xml_get_content (cur);
+ } else if (!strcmp (cur->name, "reply-to")) {
+ account->id->reply_to = xml_get_content (cur);
+ } else if (!strcmp (cur->name, "organization")) {
+ account->id->organization = xml_get_content (cur);
+ } else if (!strcmp (cur->name, "signature")) {
+ account->id->auto_signature = xml_get_bool (cur, "auto");
+ account->id->def_signature = lookup_signature (xml_get_int (cur, "default"));
+ }
+
+ cur = cur->next;
+ }
+ } else if (!strcmp (node->name, "source")) {
+ account->source = g_new0 (MailConfigService, 1);
+ account->source->save_passwd = xml_get_bool (node, "save-passwd");
+ account->source->keep_on_server = xml_get_bool (node, "keep-on-server");
+ account->source->auto_check = xml_get_bool (node, "auto-check");
+
+ /* FIXME: account->source->auto_check_time */
+
+ cur = node->children;
+ while (cur != NULL) {
+ if (!strcmp (cur->name, "url")) {
+ account->source->url = xml_get_content (cur);
+ break;
+ }
+ cur = cur->next;
+ }
+ } else if (!strcmp (node->name, "transport")) {
+ account->transport = g_new0 (MailConfigService, 1);
+ account->transport->save_passwd = xml_get_bool (node, "save-passwd");
+
+ cur = node->children;
+ while (cur != NULL) {
+ if (!strcmp (cur->name, "url")) {
+ account->transport->url = xml_get_content (cur);
+ break;
+ }
+ cur = cur->next;
+ }
+ } else if (!strcmp (node->name, "drafts-folder")) {
+ account->drafts_folder_uri = xml_get_content (node);
+ } else if (!strcmp (node->name, "sent-folder")) {
+ account->sent_folder_uri = xml_get_content (node);
+ } else if (!strcmp (node->name, "auto-cc")) {
+ account->always_cc = xml_get_bool (node, "always");
+ account->cc_addrs = xml_get_content (node);
+ } else if (!strcmp (node->name, "auto-bcc")) {
+ account->always_cc = xml_get_bool (node, "always");
+ account->bcc_addrs = xml_get_content (node);
+ } else if (!strcmp (node->name, "pgp")) {
+ account->pgp_encrypt_to_self = xml_get_bool (node, "encrypt-to-self");
+ account->pgp_always_trust = xml_get_bool (node, "always-trust");
+ account->pgp_always_sign = xml_get_bool (node, "always-sign");
+ account->pgp_no_imip_sign = !xml_get_bool (node, "sign-imip");
+
+ if (node->children) {
+ cur = node->children;
+ while (cur != NULL) {
+ if (!strcmp (cur->name, "key-id")) {
+ account->pgp_key = xml_get_content (cur);
+ break;
+ }
+
+ cur = cur->next;
+ }
+ }
+ } else if (!strcmp (node->name, "smime")) {
+ account->smime_encrypt_to_self = xml_get_bool (node, "encrypt-to-self");
+ account->smime_always_sign = xml_get_bool (node, "always-sign");
+
+ if (node->children) {
+ cur = node->children;
+ while (cur != NULL) {
+ if (!strcmp (cur->name, "key-id")) {
+ account->smime_key = xml_get_content (cur);
+ break;
+ }
+
+ cur = cur->next;
+ }
+ }
+ }
+
+ node = node->next;
+ }
+
+ xmlFreeDoc (doc);
+
+ return account;
+}
+
+static char *
+account_to_xml (MailConfigAccount *account)
+{
+ xmlNodePtr root, node, id, src, xport;
+ char *xmlbuf, *tmp, buf[20];
+ xmlDocPtr doc;
+ int n;
+
+ doc = xmlNewDoc ("1.0");
+
+ root = xmlNewDocNode (doc, NULL, "account", NULL);
+ xmlDocSetRootElement (doc, root);
+
+ xmlSetProp (root, "name", account->name);
+ xmlSetProp (root, "enabled", account->enabled ? "true" : "false");
+
+ id = xmlNewChild (root, NULL, "identity", NULL);
+ if (account->id->name)
+ xmlNewTextChild (id, NULL, "name", account->id->name);
+ if (account->id->address)
+ xmlNewTextChild (id, NULL, "addr-spec", account->id->address);
+ if (account->id->reply_to)
+ xmlNewTextChild (id, NULL, "reply-to", account->id->reply_to);
+ if (account->id->organization)
+ xmlNewTextChild (id, NULL, "organization", account->id->organization);
+
+ node = xmlNewChild (id, NULL, "signature", NULL);
+ xmlSetProp (node, "auto", account->id->auto_signature ? "true" : "false");
+ sprintf (buf, "%d", account->id->def_signature);
+ xmlSetProp (node, "default", buf);
+
+ src = xmlNewChild (root, NULL, "source", NULL);
+ xmlSetProp (src, "save-passwd", account->source->save_passwd ? "true" : "false");
+ xmlSetProp (src, "keep-on-server", account->source->keep_on_server ? "true" : "false");
+ xmlSetProp (src, "auto-check", account->source->auto_check ? "true" : "false");
+ if (account->source->url)
+ xmlNewTextChild (src, NULL, "url", account->source->url);
+
+ /* FIXME: save auto-check timeout value */
+
+ xport = xmlNewChild (root, NULL, "transport", NULL);
+ xmlSetProp (xport, "save-passwd", account->transport->save_passwd ? "true" : "false");
+ if (account->transport->url)
+ xmlNewTextChild (xport, NULL, "url", account->transport->url);
+
+ xmlNewTextChild (root, NULL, "drafts-folder", account->drafts_folder_uri);
+ xmlNewTextChild (root, NULL, "sent-folder", account->sent_folder_uri);
+
+ node = xmlNewChild (root, NULL, "auto-cc", NULL);
+ xmlSetProp (node, "always", account->always_cc ? "true" : "false");
+ if (account->cc_addrs)
+ xmlNewTextChild (node, NULL, "recipients", account->cc_addrs);
+
+ node = xmlNewChild (root, NULL, "auto-bcc", NULL);
+ xmlSetProp (node, "always", account->always_bcc ? "true" : "false");
+ if (account->bcc_addrs)
+ xmlNewTextChild (node, NULL, "recipients", account->bcc_addrs);
+
+ node = xmlNewChild (root, NULL, "pgp", NULL);
+ xmlSetProp (node, "encrypt-to-self", account->pgp_encrypt_to_self ? "true" : "false");
+ xmlSetProp (node, "always-trust", account->pgp_always_trust ? "true" : "false");
+ xmlSetProp (node, "always-sign", account->pgp_always_sign ? "true" : "false");
+ xmlSetProp (node, "sign-imip", !account->pgp_no_imip_sign ? "true" : "false");
+ if (account->pgp_key)
+ xmlNewTextChild (node, NULL, "key-id", account->pgp_key);
+
+ node = xmlNewChild (root, NULL, "smime", NULL);
+ xmlSetProp (node, "encrypt-to-self", account->smime_encrypt_to_self ? "true" : "false");
+ xmlSetProp (node, "always-sign", account->smime_always_sign ? "true" : "false");
+ if (account->smime_key)
+ xmlNewTextChild (node, NULL, "key-id", account->smime_key);
+
+ xmlDocDumpMemory (doc, &xmlbuf, &n);
+ xmlFreeDoc (doc);
+
+ if (!(tmp = realloc (xmlbuf, n + 1))) {
+ g_free (xmlbuf);
+ return NULL;
+ }
+
+ xmlbuf[n] = '\0';
+
+ return xmlbuf;
+}
+
+static void
+accounts_changed (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data)
+{
+ GSList *list, *l, *tail, *n;
+
+ if (config->accounts != NULL) {
+ l = config->accounts;
+ while (l != NULL) {
+ n = l->next;
+ account_destroy ((MailConfigAccount *) l->data);
+ g_slist_free_1 (l);
+ l = n;
+ }
+
+ config->accounts = NULL;
+ }
+
+ tail = (GSList *) &config->accounts;
+
+ list = gconf_client_get_list (config->gconf, "/apps/evolution/mail/accounts",
+ GCONF_VALUE_STRING, NULL);
+
+ l = list;
+ while (l != NULL) {
+ MailConfigAccount *account;
+
+ if ((account = account_new_from_xml ((char *) l->data))) {
+ n = g_slist_alloc ();
+ n->data = account;
+ n->next = NULL;
+
+ tail->next = n;
+ tail = n;
+ }
+
+ n = l->next;
+ g_slist_free_1 (l);
+ l = n;
+ }
}
/* Config struct routines */
@@ -304,7 +595,13 @@ mail_config_init (void)
return;
config = g_new0 (MailConfig, 1);
- config->db = e_config_listener_new();
+ config->gconf = gconf_client_get_default ();
+
+ gconf_client_add_dir (config->gconf, "/apps/evolution/mail/accounts",
+ GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
+
+ gconf_client_notify_add (config->gconf, "/apps/evolution/mail/accounts",
+ accounts_changed, NULL, NULL, NULL);
config_read ();
}
@@ -312,28 +609,21 @@ mail_config_init (void)
void
mail_config_clear (void)
{
+ GSList *list, *l, *n;
int i;
if (!config)
return;
- if (config->accounts) {
- g_slist_foreach (config->accounts, account_destroy_each, NULL);
- g_slist_free (config->accounts);
- config->accounts = NULL;
+ l = config->accounts;
+ while (l != NULL) {
+ n = l->next;
+ account_destroy ((MailConfigAccount *) l->data);
+ g_slist_free_1 (l);
+ l = n;
}
- g_free (config->default_charset);
- config->default_charset = NULL;
-
- g_free (config->filter_log_path);
- config->filter_log_path = NULL;
-
- g_free (config->notify_filename);
- config->notify_filename = NULL;
-
- g_free (config->last_filesel_dir);
- config->last_filesel_dir = NULL;
+ config->accounts = NULL;
for (i = 0; i < 5; i++) {
g_free (config->labels[i].name);
@@ -344,7 +634,7 @@ mail_config_clear (void)
}
static MailConfigSignature *
-config_read_signature (gint i)
+config_read_signature (int i)
{
MailConfigSignature *sig;
char *path, *val;
@@ -352,7 +642,9 @@ config_read_signature (gint i)
sig = g_new0 (MailConfigSignature, 1);
sig->id = i;
-
+
+#warning "need to rewrite the config_read_signature()"
+#if 0
path = g_strdup_printf ("/apps/Evolution/Mail/Signatures/name_%d", i);
val = e_config_listener_get_string (config->db, path);
g_free (path);
@@ -376,10 +668,11 @@ config_read_signature (gint i)
sig->script = val;
else
g_free (val);
-
+
path = g_strdup_printf ("/apps/Evolution/Mail/Signatures/html_%d", i);
sig->html = e_config_listener_get_boolean_with_default (config->db, path, FALSE, NULL);
g_free (path);
+#endif
return sig;
}
@@ -388,183 +681,74 @@ static void
config_read_signatures ()
{
MailConfigSignature *sig;
- gint i;
-
+ int i;
+
config->signature_list = NULL;
+ config->signatures = 0;
+
+#warning "need to rewrite config_read_signatures()"
+#if 0
config->signatures = e_config_listener_get_long_with_default (config->db, "/apps/Evolution/Mail/Signatures/num", 0, NULL);
-
+
for (i = 0; i < config->signatures; i ++) {
sig = config_read_signature (i);
config->signature_list = g_list_append (config->signature_list, sig);
}
+#endif
}
static void
config_write_signature (MailConfigSignature *sig, gint i)
{
+#warning "need to rewrite config_write_signature()"
+#if 0
char *path;
-
+
printf ("config_write_signature i: %d id: %d\n", i, sig->id);
-
+
path = g_strdup_printf ("/apps/Evolution/Mail/Signatures/name_%d", i);
e_config_listener_set_string (config->db, path, sig->name ? sig->name : "");
g_free (path);
-
+
path = g_strdup_printf ("/apps/Evolution/Mail/Signatures/filename_%d", i);
e_config_listener_set_string (config->db, path, sig->filename ? sig->filename : "");
g_free (path);
-
+
path = g_strdup_printf ("/apps/Evolution/Mail/Signatures/script_%d", i);
e_config_listener_set_string (config->db, path, sig->script ? sig->script : "");
g_free (path);
-
+
path = g_strdup_printf ("/apps/Evolution/Mail/Signatures/html_%d", i);
e_config_listener_set_boolean (config->db, path, sig->html);
g_free (path);
+#endif
}
static void
config_write_signatures_num ()
{
- e_config_listener_set_long (config->db, "/apps/Evolution/Mail/Signatures/num", config->signatures);
+#warning "need to rewrite config_write_signatures_num()"
+ /*e_config_listener_set_long (config->db, "/apps/Evolution/Mail/Signatures/num", config->signatures);*/
}
static void
config_write_signatures ()
{
GList *l;
- gint id;
-
+ int id;
+
for (id = 0, l = config->signature_list; l; l = l->next, id ++) {
config_write_signature ((MailConfigSignature *) l->data, id);
}
-
- config_write_signatures_num ();
-}
-
-static MailConfigSignature *
-lookup_signature (gint i)
-{
- MailConfigSignature *sig;
- GList *l;
-
- if (i == -1)
- return NULL;
-
- for (l = config->signature_list; l; l = l->next) {
- sig = (MailConfigSignature *) l->data;
- if (sig->id == i)
- return sig;
- }
-
- return NULL;
-}
-
-static void
-config_write_imported_signature (gchar *filename, gint i, gboolean html)
-{
- MailConfigSignature *sig = g_new0 (MailConfigSignature, 1);
- gchar *name;
-
- name = strrchr (filename, '/');
- if (!name)
- name = filename;
- else
- name ++;
-
- sig->name = g_strdup (name);
- sig->filename = filename;
- sig->html = html;
-
- config_write_signature (sig, i);
- signature_destroy (sig);
-}
-
-static void
-config_import_old_signatures ()
-{
- int num;
-
- num = e_config_listener_get_long_with_default (config->db, "/apps/Evolution/Mail/Signatures/num", -1, NULL);
- if (num == -1) {
- /* there are no signatures defined
- * look for old config to create new ones from old ones
- */
- GHashTable *cache;
- int i, accounts;
-
- cache = g_hash_table_new (g_str_hash, g_str_equal);
- accounts = e_config_listener_get_long_with_default (config->db, "/apps/Evolution/Mail/Accounts/num", 0, NULL);
- num = 0;
- for (i = 0; i < accounts; i ++) {
- char *path, *val;
-
- /* read text signature file */
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_signature_%d", i);
- val = e_config_listener_get_string (config->db, path);
- g_free (path);
- if (val && *val) {
- gpointer orig_key, node_val;
- int id;
-
- if (g_hash_table_lookup_extended (cache, val, &orig_key, &node_val)) {
- id = GPOINTER_TO_INT (node_val);
- } else {
- g_hash_table_insert (cache, g_strdup (val), GINT_TO_POINTER (num));
- config_write_imported_signature (val, num, FALSE);
- id = num;
- num ++;
- }
-
- /* set new text signature to this identity */
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_signature_text_%d", i);
- e_config_listener_set_long (config->db, path, id);
- g_free (path);
- } else
- g_free (val);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_has_html_signature_%d", i);
- if (e_config_listener_get_boolean_with_default (config->db, path, FALSE, NULL)) {
- g_free (path);
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_html_signature_%d", i);
- val = e_config_listener_get_string (config->db, path);
- if (val && *val) {
- gpointer orig_key, node_val;
- int id;
-
- if (g_hash_table_lookup_extended (cache, val, &orig_key, &node_val)) {
- id = GPOINTER_TO_INT (node_val);
- } else {
- g_hash_table_insert (cache, g_strdup (val), GINT_TO_POINTER (num));
- config_write_imported_signature (val, num, TRUE);
- id = num;
- num ++;
- }
-
- /* set new html signature to this identity */
- g_free (path);
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_signature_html_%d", i);
- e_config_listener_set_long (config->db, path, id);
- } else
- g_free (val);
- }
- g_free (path);
- }
- e_config_listener_set_long (config->db, "/apps/Evolution/Mail/Signatures/num", num);
- g_hash_table_destroy (cache);
- }
+ config_write_signatures_num ();
}
-/* copied from calendar-config */
-static gboolean
-locale_supports_12_hour_format(void)
+void
+mail_config_write_account_sig (MailConfigAccount *account, int id)
{
- char s[16];
- time_t t = 0;
-
- strftime(s, sizeof s, "%p", gmtime (&t));
- return s[0] != '\0';
+ /* FIXME: what is this supposed to do? */
+ ;
}
static void
@@ -575,564 +759,58 @@ config_read (void)
mail_config_clear ();
- config_import_old_signatures ();
config_read_signatures ();
- len = e_config_listener_get_long_with_default (config->db,
- "/apps/Evolution/Mail/Accounts/num", 0, NULL);
-
- for (i = 0; i < len; i++) {
- MailConfigAccount *account;
- MailConfigIdentity *id;
- MailConfigService *source;
- MailConfigService *transport;
-
- account = g_new0 (MailConfigAccount, 1);
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_name_%d", i);
- val = e_config_listener_get_string (config->db, path);
- g_free (path);
- if (val && *val) {
- account->name = val;
- } else {
- g_free (val);
- account->name = g_strdup_printf (_("Account %d"), i + 1);
- config->corrupt = TRUE;
- }
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_drafts_folder_uri_%d", i);
- val = e_config_listener_get_string (config->db, path);
- g_free (path);
- if (val && *val)
- account->drafts_folder_uri = val;
- else
- g_free (val);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_sent_folder_uri_%d", i);
- val = e_config_listener_get_string (config->db, path);
- g_free (path);
- if (val && *val)
- account->sent_folder_uri = val;
- else
- g_free (val);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_always_cc_%d", i);
- account->always_cc = e_config_listener_get_boolean_with_default (
- config->db, path, FALSE, NULL);
- g_free (path);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_always_cc_addrs_%d", i);
- val = e_config_listener_get_string (config->db, path);
- g_free (path);
- if (val && *val)
- account->cc_addrs = val;
- else
- g_free (val);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_always_bcc_%d", i);
- account->always_bcc = e_config_listener_get_boolean_with_default (
- config->db, path, FALSE, NULL);
- g_free (path);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_always_bcc_addrs_%d", i);
- val = e_config_listener_get_string (config->db, path);
- g_free (path);
- if (val && *val)
- account->bcc_addrs = val;
- else
- g_free (val);
-
- /* get the pgp info */
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_pgp_key_%d", i);
- val = e_config_listener_get_string (config->db, path);
- g_free (path);
- if (val && *val)
- account->pgp_key = val;
- else
- g_free (val);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_pgp_always_sign_%d", i);
- account->pgp_always_sign = e_config_listener_get_boolean_with_default (
- config->db, path, FALSE, NULL);
- g_free (path);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_pgp_no_imip_sign_%d", i);
- account->pgp_no_imip_sign = e_config_listener_get_boolean_with_default (
- config->db, path, FALSE, NULL);
- g_free (path);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_pgp_encrypt_to_self_%d", i);
- account->pgp_encrypt_to_self = e_config_listener_get_boolean_with_default (
- config->db, path, TRUE, NULL);
- g_free (path);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_pgp_always_trust_%d", i);
- account->pgp_always_trust = e_config_listener_get_boolean_with_default (
- config->db, path, FALSE, NULL);
- g_free (path);
-
- /* get the s/mime info */
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_smime_key_%d", i);
- val = e_config_listener_get_string (config->db, path);
- g_free (path);
- if (val && *val)
- account->smime_key = val;
- else
- g_free (val);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_smime_always_sign_%d", i);
- account->smime_always_sign = e_config_listener_get_boolean_with_default (
- config->db, path, FALSE, NULL);
- g_free (path);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_smime_encrypt_to_self_%d", i);
- account->smime_encrypt_to_self = e_config_listener_get_boolean_with_default (
- config->db, path, TRUE, NULL);
- g_free (path);
-
- /* get the identity info */
- id = g_new0 (MailConfigIdentity, 1);
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_name_%d", i);
- id->name = e_config_listener_get_string (config->db, path);
- g_free (path);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_address_%d", i);
- id->address = e_config_listener_get_string (config->db, path);
- g_free (path);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_reply_to_%d", i);
- id->reply_to = e_config_listener_get_string (config->db, path);
- g_free (path);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_organization_%d", i);
- id->organization = e_config_listener_get_string (config->db, path);
- g_free (path);
-
- /* id signatures */
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_def_signature_%d", i);
- id->def_signature = lookup_signature (e_config_listener_get_long_with_default (config->db, path, -1, NULL));
- g_free (path);
-
- /* autogenerated signature */
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_autogenerated_signature_%d", i);
- id->auto_signature = e_config_listener_get_boolean_with_default (config->db, path, TRUE, NULL);
- g_free (path);
-
- /* get the source */
- source = g_new0 (MailConfigService, 1);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/source_url_%d", i);
- val = e_config_listener_get_string (config->db, path);
- g_free (path);
- if (val && *val)
- source->url = val;
- else
- g_free (val);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/source_keep_on_server_%d", i);
- source->keep_on_server = e_config_listener_get_boolean (config->db, path);
- g_free (path);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/source_auto_check_%d", i);
- source->auto_check = e_config_listener_get_boolean_with_default (
- config->db, path, FALSE, NULL);
- g_free (path);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/source_auto_check_time_%d", i);
- source->auto_check_time = e_config_listener_get_long_with_default (
- config->db, path, -1, NULL);
-
- if (source->auto_check && source->auto_check_time <= 0) {
- source->auto_check_time = 5;
- source->auto_check = FALSE;
- }
-
- g_free (path);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/source_enabled_%d", i);
- source->enabled = e_config_listener_get_boolean_with_default (
- config->db, path, TRUE, NULL);
- g_free (path);
-
- path = g_strdup_printf
- ("/apps/Evolution/Mail/Accounts/source_save_passwd_%d", i);
- source->save_passwd = e_config_listener_get_boolean_with_default (
- config->db, path, TRUE, NULL);
- g_free (path);
-
- /* get the transport */
- transport = g_new0 (MailConfigService, 1);
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/transport_url_%d", i);
- val = e_config_listener_get_string (config->db, path);
- g_free (path);
- if (val && *val)
- transport->url = val;
- else
- g_free (val);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/transport_save_passwd_%d", i);
- transport->save_passwd = e_config_listener_get_boolean (config->db, path);
- g_free (path);
-
- account->id = id;
- account->source = source;
- account->transport = transport;
-
- config->accounts = g_slist_append (config->accounts, account);
- }
-
- default_num = e_config_listener_get_long_with_default (config->db,
- "/apps/Evolution/Mail/Accounts/default_account", 0, NULL);
+ accounts_changed (config->gconf, 0, NULL, NULL);
+ default_num = gconf_client_get_int (config->gconf, "/apps/evolution/mail/default_account", NULL);
mail_config_set_default_account_num (default_num);
-
- /* Format */
- config->send_html = e_config_listener_get_boolean_with_default (config->db,
- "/apps/Evolution/Mail/Format/send_html", FALSE, NULL);
-
- /* Confirm Sending Unwanted HTML */
- config->confirm_unwanted_html = e_config_listener_get_boolean_with_default (config->db,
- "/apps/Evolution/Mail/Format/confirm_unwanted_html", TRUE, NULL);
-
- /* Citation */
- config->citation_highlight = e_config_listener_get_boolean_with_default (
- config->db, "/apps/Evolution/Mail/Display/citation_highlight", TRUE, NULL);
-
- config->citation_color = e_config_listener_get_long_with_default (
- config->db, "/apps/Evolution/Mail/Display/citation_color", 0x737373, NULL);
-
- /* Mark as seen toggle */
- config->do_seen_timeout = e_config_listener_get_boolean_with_default (
- config->db, "/apps/Evolution/Mail/Display/do_seen_timeout", TRUE, NULL);
-
- /* Mark as seen timeout */
- config->seen_timeout = e_config_listener_get_long_with_default (config->db,
- "/apps/Evolution/Mail/Display/seen_timeout", 1500, NULL);
-
- /* Show Messages Threaded */
- config->thread_list = e_config_listener_get_boolean_with_default (
- config->db, "/apps/Evolution/Mail/Display/thread_list", FALSE, NULL);
-
- config->thread_subject = e_config_listener_get_boolean_with_default (
- config->db, "/apps/Evolution/Mail/Display/thread_subject", FALSE, NULL);
-
- config->show_preview = e_config_listener_get_boolean_with_default (
- config->db, "/apps/Evolution/Mail/Display/preview_pane", TRUE, NULL);
-
- /* Hide deleted automatically */
- config->hide_deleted = e_config_listener_get_boolean_with_default (
- config->db, "/apps/Evolution/Mail/Display/hide_deleted", FALSE, NULL);
-
- /* Size of vpaned in mail view */
- config->paned_size = e_config_listener_get_long_with_default (config->db,
- "/apps/Evolution/Mail/Display/paned_size", 200, NULL);
-
- /* Goto next folder when user has reached the bottom of the message-list */
- config->goto_next_folder = e_config_listener_get_boolean_with_default (
- config->db, "/apps/Evolution/Mail/MessageList/goto_next_folder", FALSE, NULL);
-
- /* Empty Subject */
- config->prompt_empty_subject = e_config_listener_get_boolean_with_default (
- config->db, "/apps/Evolution/Mail/Prompts/empty_subject", TRUE, NULL);
-
- /* Only Bcc */
- config->prompt_only_bcc = e_config_listener_get_boolean_with_default (
- config->db, "/apps/Evolution/Mail/Prompts/only_bcc", TRUE, NULL);
-
- /* Expunge */
- config->confirm_expunge = e_config_listener_get_boolean_with_default (
- config->db, "/apps/Evolution/Mail/Prompts/confirm_expunge", TRUE, NULL);
-
- /* Goto next folder */
- config->confirm_goto_next_folder = e_config_listener_get_boolean_with_default (
- config->db, "/apps/Evolution/Mail/Prompts/confirm_goto_next_folder", TRUE, NULL);
-
- /* HTTP images */
- config->http_mode = e_config_listener_get_long_with_default (config->db,
- "/apps/Evolution/Mail/Display/http_images", MAIL_CONFIG_HTTP_NEVER, NULL);
-
- /* Forwarding */
- config->default_forward_style = e_config_listener_get_long_with_default (
- config->db, "/apps/Evolution/Mail/Format/default_forward_style",
- MAIL_CONFIG_FORWARD_ATTACHED, NULL);
-
- /* Replying */
- config->default_reply_style = e_config_listener_get_long_with_default (
- config->db, "/apps/Evolution/Mail/Format/default_reply_style",
- MAIL_CONFIG_REPLY_QUOTED, NULL);
-
- /* Message Display */
- config->message_display_style = e_config_listener_get_long_with_default (
- config->db, "/apps/Evolution/Mail/Format/message_display_style",
- MAIL_CONFIG_DISPLAY_NORMAL, NULL);
-
- /* Default charset */
- config->default_charset = e_config_listener_get_string (config->db,
- "/apps/Evolution/Mail/Format/default_charset");
-
- if (!config->default_charset) {
- const char *def;
-
- g_get_charset (&def);
- config->default_charset = g_strdup(def);
- if (!config->default_charset ||
- !g_strcasecmp (config->default_charset, "US-ASCII"))
- config->default_charset = g_strdup ("ISO-8859-1");
- else
- config->default_charset = g_strdup (config->default_charset);
- }
-
- /* Trash folders */
- config->empty_trash_on_exit = e_config_listener_get_boolean_with_default (
- config->db, "/apps/Evolution/Mail/Trash/empty_on_exit", FALSE, NULL);
-
- /* Filter logging */
- config->filter_log = e_config_listener_get_boolean_with_default (
- config->db, "/apps/Evolution/Mail/Filters/log", FALSE, NULL);
-
- config->filter_log_path = e_config_listener_get_string (
- config->db, "/apps/Evolution/Mail/Filters/log_path");
-
- /* New Mail Notification */
- config->notify = e_config_listener_get_long_with_default (
- config->db, "/apps/Evolution/Mail/Notify/new_mail_notification",
- MAIL_CONFIG_NOTIFY_NOT, NULL);
-
- config->notify_filename = e_config_listener_get_string (
- config->db, "/apps/Evolution/Mail/Notify/new_mail_notification_sound_file");
-
- /* X-Mailer header display */
- config->x_mailer_display_style = e_config_listener_get_long_with_default (
- config->db, "/apps/Evolution/Mail/Display/x_mailer_display_style",
- MAIL_CONFIG_XMAILER_NONE, NULL);
-
- /* last filesel dir */
- config->last_filesel_dir = e_config_listener_get_string (
- config->db, "/apps/Evolution/Mail/Filesel/last_filesel_dir");
-
- /* Color labels */
- /* Note: we avoid having to malloc/free 10 times this way... */
- path = g_malloc (sizeof ("/apps/Evolution/Mail/Labels/") + sizeof ("label_#") + 1);
- strcpy (path, "/apps/Evolution/Mail/Labels/label_#");
- p = path + strlen (path) - 1;
- for (i = 0; i < 5; i++) {
- *p = '0' + i;
- val = e_config_listener_get_string (config->db, path);
- if (!(val && *val)) {
- g_free (val);
- val = NULL;
- }
- config->labels[i].name = val;
- }
- strcpy (path, "/apps/Evolution/Mail/Labels/color_#");
- p = path + strlen (path) - 1;
- for (i = 0; i < 5; i++) {
- *p = '0' + i;
- config->labels[i].color = e_config_listener_get_long_with_default (config->db, path,
- label_defaults[i].color, NULL);
- }
- g_free (path);
-
- config->week_start_day = e_config_listener_get_long_with_default(config->db, "/apps/Evolution/Calendar/Display/WeekStartDay", 1, NULL);
- if (locale_supports_12_hour_format()) {
- config->time_24hour = e_config_listener_get_boolean_with_default(config->db, "/apps/Evolution/Calendar/Display/Use24HourFormat", FALSE, NULL);
- } else {
- config->time_24hour = TRUE;
- }
-}
-
-#define e_config_listener_set_string_wrapper(db, path, val) e_config_listener_set_string (db, path, val ? val : "")
-
-void
-mail_config_write_account_sig (MailConfigAccount *account, gint i)
-{
- char *path;
-
- mail_config_init ();
-
- if (i == -1) {
- GSList *link;
-
- link = g_slist_find (config->accounts, account);
- if (!link) {
- g_warning ("Can't find account in accounts list");
- return;
- }
- i = g_slist_position (config->accounts, link);
- }
-
- /* id signatures */
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_def_signature_%d", i);
- e_config_listener_set_long (config->db, path, account->id->def_signature
- ? account->id->def_signature->id : -1);
- g_free (path);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_autogenerated_signature_%d", i);
- e_config_listener_set_boolean (config->db, path, account->id->auto_signature);
- g_free (path);
}
void
mail_config_write (void)
{
- CORBA_Environment ev;
- int len, i, default_num;
-
- /* Accounts */
+ GSList *list, *l, *tail, *n;
+ int default_num, i;
+ char *xmlbuf;
if (!config)
return;
-
-#if 0
- /* FIXME: remove, do we need to do anything about this with e-config-listner? */
- CORBA_exception_init (&ev);
- Bonobo_ConfigDatabase_removeDir (config->db, "/apps/Evolution/Mail/Accounts", &ev);
- CORBA_exception_init (&ev);
- Bonobo_ConfigDatabase_removeDir (config->db, "/apps/Evolution/News/Sources", &ev);
- CORBA_exception_init (&ev);
- Bonobo_ConfigDatabase_sync (config->db, &ev);
-#endif
-
- config_write_signatures ();
- len = g_slist_length (config->accounts);
- e_config_listener_set_long (config->db,
- "/apps/Evolution/Mail/Accounts/num", len);
+ config_write_signatures ();
+ /* Accounts */
default_num = mail_config_get_default_account_num ();
- e_config_listener_set_long (config->db, "/apps/Evolution/Mail/Accounts/default_account", default_num);
+ gconf_client_set_int (config->gconf, "/apps/evolution/mail/default_account", default_num, NULL);
- for (i = 0; i < len; i++) {
- MailConfigAccount *account;
- char *path;
-
- account = g_slist_nth_data (config->accounts, i);
-
- /* account info */
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_name_%d", i);
- e_config_listener_set_string_wrapper (config->db, path, account->name);
- g_free (path);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_drafts_folder_uri_%d", i);
- e_config_listener_set_string_wrapper (config->db, path, account->drafts_folder_uri);
- g_free (path);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_sent_folder_uri_%d", i);
- e_config_listener_set_string_wrapper (config->db, path, account->sent_folder_uri);
- g_free (path);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_always_cc_%d", i);
- e_config_listener_set_boolean (config->db, path, account->always_cc);
- g_free (path);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_always_cc_addrs_%d", i);
- e_config_listener_set_string_wrapper (config->db, path, account->cc_addrs);
- g_free (path);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_always_bcc_%d", i);
- e_config_listener_set_boolean (config->db, path, account->always_bcc);
- g_free (path);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_always_bcc_addrs_%d", i);
- e_config_listener_set_string_wrapper (config->db, path, account->bcc_addrs);
- g_free (path);
-
- /* account pgp options */
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_pgp_key_%d", i);
- e_config_listener_set_string_wrapper (config->db, path, account->pgp_key);
- g_free (path);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_pgp_always_sign_%d", i);
- e_config_listener_set_boolean (config->db, path, account->pgp_always_sign);
- g_free (path);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_pgp_no_imip_sign_%d", i);
- e_config_listener_set_boolean (config->db, path, account->pgp_no_imip_sign);
- g_free (path);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_pgp_encrypt_to_self_%d", i);
- e_config_listener_set_boolean (config->db, path, account->pgp_encrypt_to_self);
- g_free (path);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_pgp_always_trust_%d", i);
- e_config_listener_set_boolean (config->db, path, account->pgp_always_trust);
- g_free (path);
-
- /* account s/mime options */
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_smime_key_%d", i);
- e_config_listener_set_string_wrapper (config->db, path, account->smime_key);
- g_free (path);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_smime_always_sign_%d", i);
- e_config_listener_set_boolean (config->db, path, account->smime_always_sign);
- g_free (path);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/account_smime_encrypt_to_self_%d", i);
- e_config_listener_set_boolean (config->db, path, account->smime_encrypt_to_self);
- g_free (path);
-
- /* identity info */
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_name_%d", i);
- e_config_listener_set_string_wrapper (config->db, path, account->id->name);
- g_free (path);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_address_%d", i);
- e_config_listener_set_string_wrapper (config->db, path, account->id->address);
- g_free (path);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_reply_to_%d", i);
- e_config_listener_set_string_wrapper (config->db, path, account->id->reply_to);
- g_free (path);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_organization_%d", i);
- e_config_listener_set_string_wrapper (config->db, path, account->id->organization);
- g_free (path);
-
- mail_config_write_account_sig (account, i);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/identity_autogenerated_signature_%d", i);
- e_config_listener_set_boolean (config->db, path, account->id->auto_signature);
- g_free (path);
-
- /* source info */
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/source_url_%d", i);
- e_config_listener_set_string_wrapper (config->db, path, account->source->url);
- g_free (path);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/source_keep_on_server_%d", i);
- e_config_listener_set_boolean (config->db, path, account->source->keep_on_server);
- g_free (path);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/source_auto_check_%d", i);
- e_config_listener_set_boolean (config->db, path, account->source->auto_check);
- g_free (path);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/source_auto_check_time_%d", i);
- e_config_listener_set_long (config->db, path, account->source->auto_check_time);
- g_free (path);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/source_enabled_%d", i);
- e_config_listener_set_boolean (config->db, path, account->source->enabled);
- g_free (path);
-
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/source_save_passwd_%d", i);
- e_config_listener_set_boolean (config->db, path, account->source->save_passwd);
- g_free (path);
-
- /* transport info */
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/transport_url_%d", i);
- e_config_listener_set_string_wrapper (config->db, path, account->transport->url);
- g_free (path);
+ list = NULL;
+ tail = (GSList *) &list;
+
+ l = config->accounts;
+ while (l != NULL) {
+ if ((xmlbuf = account_to_xml ((MailConfigAccount *) l->data))) {
+ n = g_slist_alloc ();
+ n->data = xmlbuf;
+ n->next = NULL;
+
+ tail->next = n;
+ tail = n;
+ }
- path = g_strdup_printf ("/apps/Evolution/Mail/Accounts/transport_save_passwd_%d", i);
- e_config_listener_set_boolean (config->db, path, account->transport->save_passwd);
- g_free (path);
+ l = l->next;
}
-
-#if 0
- CORBA_exception_init (&ev);
- Bonobo_ConfigDatabase_sync (config->db, &ev);
- CORBA_exception_free (&ev);
-#endif
+
+ gconf_client_set_list (config->gconf, "/apps/evolution/mail/accounts", GCONF_VALUE_STRING, list, NULL);
+
+ l = list;
+ while (l != NULL) {
+ n = l->next;
+ g_free (l->data);
+ g_slist_free_1 (l);
+ l = n;
+ }
+
+ gconf_client_suggest_sync (config->gconf, NULL);
}
static gboolean
@@ -1141,11 +819,14 @@ hash_save_state (gpointer key, gpointer value, gpointer user_data)
char *path;
gboolean bool = GPOINTER_TO_INT (value);
+#warning "need to rewrite hash_save_state(), probably shouldn't use gconf tho"
+#if 0
path = g_strconcat ("/apps/Evolution/Mail/", (char *)user_data, "/", (char *)key,
NULL);
e_config_listener_set_boolean (config->db, path, bool);
g_free (path);
g_free (key);
+#endif
return TRUE;
}
@@ -1153,7 +834,6 @@ hash_save_state (gpointer key, gpointer value, gpointer user_data)
void
mail_config_write_on_exit (void)
{
- CORBA_Environment ev;
MailConfigAccount *account;
const GSList *accounts;
char *path, *p;
@@ -1164,102 +844,6 @@ mail_config_write_on_exit (void)
config_write_timeout = 0;
mail_config_write ();
}
-
- /* Show Messages Threaded */
- e_config_listener_set_boolean (config->db, "/apps/Evolution/Mail/Display/thread_list", config->thread_list);
-
- e_config_listener_set_boolean (config->db, "/apps/Evolution/Mail/Display/thread_subject", config->thread_subject);
-
- /* Show Message Preview */
- e_config_listener_set_boolean (config->db, "/apps/Evolution/Mail/Display/preview_pane",config->show_preview);
-
- /* Hide deleted automatically */
- e_config_listener_set_boolean (config->db, "/apps/Evolution/Mail/Display/hide_deleted", config->hide_deleted);
-
- /* Size of vpaned in mail view */
- e_config_listener_set_long (config->db, "/apps/Evolution/Mail/Display/paned_size", config->paned_size);
-
- /* Mark as seen toggle */
- e_config_listener_set_boolean (config->db, "/apps/Evolution/Mail/Display/do_seen_timeout", config->do_seen_timeout);
- /* Mark as seen timeout */
- e_config_listener_set_long (config->db, "/apps/Evolution/Mail/Display/seen_timeout", config->seen_timeout);
-
- /* Format */
- e_config_listener_set_boolean (config->db, "/apps/Evolution/Mail/Format/send_html", config->send_html);
-
- /* Confirm Sending Unwanted HTML */
- e_config_listener_set_boolean (config->db, "/apps/Evolution/Mail/Format/confirm_unwanted_html", config->confirm_unwanted_html);
-
- /* Citation */
- e_config_listener_set_boolean (config->db, "/apps/Evolution/Mail/Display/citation_highlight", config->citation_highlight);
-
- e_config_listener_set_long (config->db, "/apps/Evolution/Mail/Display/citation_color", config->citation_color);
-
- /* Goto next folder */
- e_config_listener_set_boolean (config->db, "/apps/Evolution/Mail/MessageList/goto_next_folder", config->goto_next_folder);
-
- /* Empty Subject */
- e_config_listener_set_boolean (config->db, "/apps/Evolution/Mail/Prompts/empty_subject", config->prompt_empty_subject);
-
- /* Only Bcc */
- e_config_listener_set_boolean (config->db, "/apps/Evolution/Mail/Prompts/only_bcc", config->prompt_only_bcc);
-
- /* Expunge */
- e_config_listener_set_boolean (config->db, "/apps/Evolution/Mail/Prompts/confirm_expunge", config->confirm_expunge);
-
- /* Goto next folder */
- e_config_listener_set_boolean (config->db, "/apps/Evolution/Mail/Prompts/confirm_goto_next_folder", config->confirm_goto_next_folder);
-
- /* HTTP images */
- e_config_listener_set_long (config->db, "/apps/Evolution/Mail/Display/http_images", config->http_mode);
-
- /* Forwarding */
- e_config_listener_set_long (config->db, "/apps/Evolution/Mail/Format/default_forward_style", config->default_forward_style);
-
- /* Replying */
- e_config_listener_set_long (config->db, "/apps/Evolution/Mail/Format/default_reply_style", config->default_reply_style);
-
- /* Message Display */
- e_config_listener_set_long (config->db, "/apps/Evolution/Mail/Format/message_display_style", config->message_display_style);
-
- /* Default charset */
- e_config_listener_set_string_wrapper (config->db, "/apps/Evolution/Mail/Format/default_charset", config->default_charset);
-
- /* Trash folders */
- e_config_listener_set_boolean (config->db, "/apps/Evolution/Mail/Trash/empty_on_exit", config->empty_trash_on_exit);
-
- /* Filter logging */
- e_config_listener_set_boolean (config->db, "/apps/Evolution/Mail/Filters/log", config->filter_log);
-
- e_config_listener_set_string_wrapper (config->db, "/apps/Evolution/Mail/Filters/log_path", config->filter_log_path);
-
- /* New Mail Notification */
- e_config_listener_set_long (config->db, "/apps/Evolution/Mail/Notify/new_mail_notification", config->notify);
-
- e_config_listener_set_string_wrapper (config->db, "/apps/Evolution/Mail/Notify/new_mail_notification_sound_file", config->notify_filename);
-
- /* X-Mailer Display */
- e_config_listener_set_long (config->db, "/apps/Evolution/Mail/Display/x_mailer_display_style", config->x_mailer_display_style);
-
- /* last filesel dir */
- e_config_listener_set_string_wrapper (config->db, "/apps/Evolution/Mail/Filesel/last_filesel_dir", config->last_filesel_dir);
-
- /* Color labels */
- /* Note: we avoid having to malloc/free 10 times this way... */
- path = g_malloc (sizeof ("/apps/Evolution/Mail/Labels/") + sizeof ("label_#") + 1);
- strcpy (path, "/apps/Evolution/Mail/Labels/label_#");
- p = path + strlen (path) - 1;
- for (i = 0; i < 5; i++) {
- *p = '0' + i;
- e_config_listener_set_string_wrapper (config->db, path, config->labels[i].name);
- }
- strcpy (path, "/apps/Evolution/Mail/Labels/color_#");
- p = path + strlen (path) - 1;
- for (i = 0; i < 5; i++) {
- *p = '0' + i;
- e_config_listener_set_long (config->db, path, config->labels[i].color);
- }
- g_free (path);
/* Message Threading */
if (config->threaded_hash)
@@ -1268,17 +852,12 @@ mail_config_write_on_exit (void)
/* Message Preview */
if (config->preview_hash)
g_hash_table_foreach_remove (config->preview_hash, hash_save_state, "Preview");
-
-#if 0
- CORBA_exception_init (&ev);
- Bonobo_ConfigDatabase_sync (config->db, &ev);
- CORBA_exception_free (&ev);
-#endif
+
/* Passwords */
/* then we make sure the ones we want to remember are in the
session cache */
- accounts = mail_config_get_accounts ();
+ accounts = config->accounts;
for ( ; accounts; accounts = accounts->next) {
char *passwd;
account = accounts->data;
@@ -1301,7 +880,7 @@ mail_config_write_on_exit (void)
e_passwords_clear_component_passwords ("Mail");
/* then we remember them */
- accounts = mail_config_get_accounts ();
+ accounts = config->accounts;
for ( ; accounts; accounts = accounts->next) {
account = accounts->data;
if (account->source->save_passwd && account->source->url)
@@ -1346,32 +925,10 @@ uri_to_key (const char *uri)
}
gboolean
-mail_config_get_thread_subject (void)
-{
- return config->thread_subject;
-}
-
-void
-mail_config_set_thread_subject (gboolean thread_subject)
-{
- config->thread_subject = thread_subject;
-}
-
-gboolean
-mail_config_get_empty_trash_on_exit (void)
-{
- return config->empty_trash_on_exit;
-}
-
-void
-mail_config_set_empty_trash_on_exit (gboolean value)
-{
- config->empty_trash_on_exit = value;
-}
-
-gboolean
mail_config_get_show_preview (const char *uri)
{
+#warning "FIXME: need to rework how we save state, probably shouldn't use gconf"
+#if 0
if (uri && *uri) {
gpointer key, val;
char *dbkey;
@@ -1398,10 +955,11 @@ mail_config_get_show_preview (const char *uri)
return GPOINTER_TO_INT (val);
}
}
+#endif
/* return the default value */
- return config->show_preview;
+ return gconf_client_get_bool (config->gconf, "/apps/evolution/mail/display/show_preview", NULL);
}
void
@@ -1422,13 +980,14 @@ mail_config_set_show_preview (const char *uri, gboolean value)
g_hash_table_insert (config->preview_hash, dbkey,
GINT_TO_POINTER (value));
}
- } else
- config->show_preview = value;
+ }
}
gboolean
mail_config_get_thread_list (const char *uri)
{
+#warning "FIXME: need to rework how we save state, probably shouldn't use gconf"
+#if 0
if (uri && *uri) {
gpointer key, val;
char *dbkey;
@@ -1455,10 +1014,11 @@ mail_config_get_thread_list (const char *uri)
return GPOINTER_TO_INT (val);
}
}
+#endif
/* return the default value */
- return config->thread_list;
+ return gconf_client_get_bool (config->gconf, "/apps/evolution/mail/display/thread_list", NULL);
}
void
@@ -1479,303 +1039,7 @@ mail_config_set_thread_list (const char *uri, gboolean value)
g_hash_table_insert (config->threaded_hash, dbkey,
GINT_TO_POINTER (value));
}
- } else
- config->thread_list = value;
-}
-
-gboolean
-mail_config_get_filter_log (void)
-{
- return config->filter_log;
-}
-
-void
-mail_config_set_filter_log (gboolean value)
-{
- config->filter_log = value;
-}
-
-const char *
-mail_config_get_filter_log_path (void)
-{
- return config->filter_log_path;
-}
-
-void
-mail_config_set_filter_log_path (const char *path)
-{
- g_free (config->filter_log_path);
- config->filter_log_path = g_strdup (path);
-}
-
-const char *
-mail_config_get_last_filesel_dir (void)
-{
- if (config->last_filesel_dir)
- return config->last_filesel_dir;
- else
- return g_get_home_dir ();
-}
-
-void
-mail_config_set_last_filesel_dir (const char *path)
-{
- g_free (config->last_filesel_dir);
- config->last_filesel_dir = g_strdup (path);
-}
-
-gboolean
-mail_config_get_hide_deleted (void)
-{
- return config->hide_deleted;
-}
-
-void
-mail_config_set_hide_deleted (gboolean value)
-{
- config->hide_deleted = value;
-}
-
-int
-mail_config_get_paned_size (void)
-{
- return config->paned_size;
-}
-
-void
-mail_config_set_paned_size (int value)
-{
- config->paned_size = value;
-}
-
-gboolean
-mail_config_get_send_html (void)
-{
- return config->send_html;
-}
-
-void
-mail_config_set_send_html (gboolean send_html)
-{
- config->send_html = send_html;
-}
-
-gboolean
-mail_config_get_confirm_unwanted_html (void)
-{
- return config->confirm_unwanted_html;
-}
-
-void
-mail_config_set_confirm_unwanted_html (gboolean confirm)
-{
- config->confirm_unwanted_html = confirm;
-}
-
-gboolean
-mail_config_get_citation_highlight (void)
-{
- return config->citation_highlight;
-}
-
-void
-mail_config_set_citation_highlight (gboolean citation_highlight)
-{
- config->citation_highlight = citation_highlight;
-}
-
-guint32
-mail_config_get_citation_color (void)
-{
- return config->citation_color;
-}
-
-void
-mail_config_set_citation_color (guint32 citation_color)
-{
- config->citation_color = citation_color;
-}
-
-gboolean
-mail_config_get_do_seen_timeout (void)
-{
- return config->do_seen_timeout;
-}
-
-void
-mail_config_set_do_seen_timeout (gboolean do_seen_timeout)
-{
- config->do_seen_timeout = do_seen_timeout;
-}
-
-int
-mail_config_get_mark_as_seen_timeout (void)
-{
- return config->seen_timeout;
-}
-
-void
-mail_config_set_mark_as_seen_timeout (int timeout)
-{
- config->seen_timeout = timeout;
-}
-
-gboolean
-mail_config_get_prompt_empty_subject (void)
-{
- return config->prompt_empty_subject;
-}
-
-void
-mail_config_set_prompt_empty_subject (gboolean value)
-{
- config->prompt_empty_subject = value;
-}
-
-gboolean
-mail_config_get_prompt_only_bcc (void)
-{
- return config->prompt_only_bcc;
-}
-
-void
-mail_config_set_prompt_only_bcc (gboolean value)
-{
- config->prompt_only_bcc = value;
-}
-
-gboolean
-mail_config_get_confirm_expunge (void)
-{
- return config->confirm_expunge;
-}
-
-void
-mail_config_set_confirm_expunge (gboolean value)
-{
- config->confirm_expunge = value;
-}
-
-gboolean
-mail_config_get_confirm_goto_next_folder (void)
-{
- return config->confirm_goto_next_folder;
-}
-
-void
-mail_config_set_confirm_goto_next_folder (gboolean value)
-{
- config->confirm_goto_next_folder = value;
-}
-
-gboolean
-mail_config_get_goto_next_folder (void)
-{
- return config->goto_next_folder;
-}
-
-void
-mail_config_set_goto_next_folder (gboolean value)
-{
- config->goto_next_folder = value;
-}
-
-MailConfigHTTPMode
-mail_config_get_http_mode (void)
-{
- return config->http_mode;
-}
-
-void
-mail_config_set_http_mode (MailConfigHTTPMode mode)
-{
- config->http_mode = mode;
-}
-
-MailConfigForwardStyle
-mail_config_get_default_forward_style (void)
-{
- return config->default_forward_style;
-}
-
-void
-mail_config_set_default_forward_style (MailConfigForwardStyle style)
-{
- config->default_forward_style = style;
-}
-
-MailConfigReplyStyle
-mail_config_get_default_reply_style (void)
-{
- return config->default_reply_style;
-}
-
-void
-mail_config_set_default_reply_style (MailConfigReplyStyle style)
-{
- config->default_reply_style = style;
-}
-
-MailConfigDisplayStyle
-mail_config_get_message_display_style (void)
-{
- return config->message_display_style;
-}
-
-void
-mail_config_set_message_display_style (MailConfigDisplayStyle style)
-{
- config->message_display_style = style;
-}
-
-const char *
-mail_config_get_default_charset (void)
-{
- return config->default_charset;
-}
-
-void
-mail_config_set_default_charset (const char *charset)
-{
- g_free (config->default_charset);
- config->default_charset = g_strdup (charset);
-}
-
-MailConfigNewMailNotify
-mail_config_get_new_mail_notify (void)
-{
- return config->notify;
-}
-
-void
-mail_config_set_new_mail_notify (MailConfigNewMailNotify type)
-{
- config->notify = type;
-}
-
-const char *
-mail_config_get_new_mail_notify_sound_file (void)
-{
- return config->notify_filename;
-}
-
-void
-mail_config_set_new_mail_notify_sound_file (const char *filename)
-{
- g_free (config->notify_filename);
- config->notify_filename = g_strdup (filename);
-}
-
-MailConfigXMailerDisplayStyle
-mail_config_get_x_mailer_display_style (void)
-{
- return config->x_mailer_display_style;
-}
-
-void
-mail_config_set_x_mailer_display_style (MailConfigXMailerDisplayStyle style)
-{
- config->x_mailer_display_style = style;
+ }
}
const char *
@@ -2197,25 +1461,6 @@ mail_config_uri_deleted(GCompareFunc uri_cmp, const char *uri)
mail_config_write();
}
-GSList *
-mail_config_get_sources (void)
-{
- const GSList *accounts;
- GSList *sources = NULL;
-
- accounts = mail_config_get_accounts ();
- while (accounts) {
- const MailConfigAccount *account = accounts->data;
-
- if (account->source)
- sources = g_slist_append (sources, account->source);
-
- accounts = accounts->next;
- }
-
- return sources;
-}
-
void
mail_config_service_set_save_passwd (MailConfigService *service, gboolean save_passwd)
{
@@ -2398,6 +1643,7 @@ impl_GNOME_Evolution_MailConfig_addAccount (PortableServer_Servant servant,
mail_account = g_new0 (MailConfigAccount, 1);
mail_account->name = g_strdup (account->name);
+ mail_account->enabled = source.enabled;
/* Copy ID */
id = account->id;
@@ -2421,7 +1667,6 @@ impl_GNOME_Evolution_MailConfig_addAccount (PortableServer_Servant servant,
mail_service->auto_check = source.auto_check;
mail_service->auto_check_time = source.auto_check_time;
mail_service->save_passwd = source.save_passwd;
- mail_service->enabled = source.enabled;
mail_account->source = mail_service;
@@ -2438,13 +1683,12 @@ impl_GNOME_Evolution_MailConfig_addAccount (PortableServer_Servant servant,
mail_service->auto_check = transport.auto_check;
mail_service->auto_check_time = transport.auto_check_time;
mail_service->save_passwd = transport.save_passwd;
- mail_service->enabled = transport.enabled;
mail_account->transport = mail_service;
/* Add new account */
mail_config_add_account (mail_account);
-
+
/* Don't write out the config right away in case the remote
* component is creating or removing multiple accounts.
*/
@@ -2713,6 +1957,7 @@ mail_config_signature_emit_event (MailConfigSigEvent event, MailConfigSignature
gchar *
mail_config_signature_run_script (gchar *script)
{
+ GConfClient *gconf;
int result, status;
int in_fds[2];
pid_t pid;
@@ -2722,6 +1967,8 @@ mail_config_signature_run_script (gchar *script)
return NULL;
}
+ gconf = gconf_client_get_default ();
+
if (!(pid = fork ())) {
/* child process */
int maxfd, i;
@@ -2781,7 +2028,8 @@ mail_config_signature_run_script (gchar *script)
filtered_stream = camel_stream_filter_new_with_stream (stream);
camel_object_unref (stream);
- charset = mail_config_get_default_charset ();
+ /* FIXME: if the composer ever gets it's own charset setting, use that instead? */
+ charset = gconf_client_get_string (gconf, "/apps/evolution/mail/format/charset", NULL);
charenc = (CamelMimeFilter *) camel_mime_filter_charset_new_convert (charset, "utf-8");
camel_stream_filter_add (filtered_stream, charenc);
camel_object_unref (charenc);
@@ -2830,12 +2078,6 @@ mail_config_signature_set_html (MailConfigSignature *sig, gboolean html)
}
int
-mail_config_get_week_start_day(void)
-{
- return config->week_start_day;
-}
-
-int
mail_config_get_time_24hour(void)
{
return config->time_24hour;
diff --git a/mail/mail-config.h b/mail/mail-config.h
index 3b8732b97b..792cdc89ca 100644
--- a/mail/mail-config.h
+++ b/mail/mail-config.h
@@ -55,12 +55,13 @@ typedef struct {
gboolean auto_check;
int auto_check_time;
gboolean save_passwd;
- gboolean enabled;
} MailConfigService;
typedef struct {
char *name;
+ gboolean enabled;
+
MailConfigIdentity *id;
MailConfigService *source;
MailConfigService *transport;
@@ -157,17 +158,6 @@ void mail_config_write_on_exit (void);
gboolean mail_config_is_configured (void);
gboolean mail_config_is_corrupt (void);
-gboolean mail_config_get_filter_log (void);
-void mail_config_set_filter_log (gboolean value);
-const char *mail_config_get_filter_log_path (void);
-void mail_config_set_filter_log_path (const char *path);
-
-const char *mail_config_get_last_filesel_dir (void);
-void mail_config_set_last_filesel_dir (const char *path);
-
-gboolean mail_config_get_empty_trash_on_exit (void);
-void mail_config_set_empty_trash_on_exit (gboolean value);
-
gboolean mail_config_get_thread_list (const char *uri);
void mail_config_set_thread_list (const char *uri, gboolean value);
@@ -177,73 +167,15 @@ void mail_config_set_thread_subject (gboolean thread_subject);
gboolean mail_config_get_show_preview (const char *uri);
void mail_config_set_show_preview (const char *uri, gboolean value);
-gboolean mail_config_get_hide_deleted (void);
-void mail_config_set_hide_deleted (gboolean value);
-
int mail_config_get_paned_size (void);
void mail_config_set_paned_size (int size);
-gboolean mail_config_get_send_html (void);
-void mail_config_set_send_html (gboolean send_html);
-
-gboolean mail_config_get_confirm_unwanted_html (void);
-void mail_config_set_confirm_unwanted_html (gboolean html_warning);
-
-gboolean mail_config_get_citation_highlight (void);
-void mail_config_set_citation_highlight (gboolean);
-
-guint32 mail_config_get_citation_color (void);
-void mail_config_set_citation_color (guint32);
-
const char *mail_config_get_label_name (int label);
void mail_config_set_label_name (int label, const char *name);
guint32 mail_config_get_label_color (int label);
void mail_config_set_label_color (int label, guint32 color);
const char *mail_config_get_label_color_string (int label);
-gint mail_config_get_do_seen_timeout (void);
-void mail_config_set_do_seen_timeout (gboolean do_seen_timeout);
-
-int mail_config_get_mark_as_seen_timeout (void);
-void mail_config_set_mark_as_seen_timeout (int timeout);
-
-gboolean mail_config_get_prompt_empty_subject (void);
-void mail_config_set_prompt_empty_subject (gboolean value);
-
-gboolean mail_config_get_prompt_only_bcc (void);
-void mail_config_set_prompt_only_bcc (gboolean value);
-
-gboolean mail_config_get_confirm_expunge (void);
-void mail_config_set_confirm_expunge (gboolean value);
-
-gboolean mail_config_get_confirm_goto_next_folder (void);
-void mail_config_set_confirm_goto_next_folder (gboolean value);
-gboolean mail_config_get_goto_next_folder (void);
-void mail_config_set_goto_next_folder (gboolean value);
-
-MailConfigHTTPMode mail_config_get_http_mode (void);
-void mail_config_set_http_mode (MailConfigHTTPMode);
-
-MailConfigForwardStyle mail_config_get_default_forward_style (void);
-void mail_config_set_default_forward_style (MailConfigForwardStyle style);
-
-MailConfigReplyStyle mail_config_get_default_reply_style (void);
-void mail_config_set_default_reply_style (MailConfigReplyStyle style);
-
-MailConfigDisplayStyle mail_config_get_message_display_style (void);
-void mail_config_set_message_display_style (MailConfigDisplayStyle style);
-
-MailConfigNewMailNotify mail_config_get_new_mail_notify (void);
-void mail_config_set_new_mail_notify (MailConfigNewMailNotify type);
-const char *mail_config_get_new_mail_notify_sound_file (void);
-void mail_config_set_new_mail_notify_sound_file (const char *filename);
-
-MailConfigXMailerDisplayStyle mail_config_get_x_mailer_display_style (void);
-void mail_config_set_x_mailer_display_style (MailConfigXMailerDisplayStyle style);
-
-const char *mail_config_get_default_charset (void);
-void mail_config_set_default_charset (const char *charset);
-
void mail_config_service_set_save_passwd (MailConfigService *service, gboolean save_passwd);
gboolean mail_config_find_account (const MailConfigAccount *account);
@@ -269,9 +201,6 @@ void mail_config_uri_deleted(GCompareFunc uri_cmp, const char *uri);
GtkType evolution_mail_config_get_type (void);
-/* convenience functions to help ease the transition over to the new codebase */
-GSList *mail_config_get_sources (void);
-
/* static utility functions */
char *mail_config_folder_to_cachename (CamelFolder *folder, const char *prefix);
char *mail_config_folder_to_safe_url (CamelFolder *folder);
@@ -282,7 +211,7 @@ gboolean mail_config_check_service (const char *url, CamelProviderType type, GLi
gboolean evolution_mail_config_factory_init (void);
-GList * mail_config_get_signature_list (void);
+GList *mail_config_get_signature_list (void);
MailConfigSignature *mail_config_signature_add (gboolean html, const gchar *script);
void mail_config_signature_delete (MailConfigSignature *sig);
void mail_config_signature_write (MailConfigSignature *sig);
@@ -304,11 +233,8 @@ void mail_config_signature_register_client (MailConfigSignatureClient client, gp
void mail_config_signature_unregister_client (MailConfigSignatureClient client, gpointer data);
void mail_config_signature_emit_event (MailConfigSigEvent event, MailConfigSignature *sig);
-void mail_config_write_account_sig (MailConfigAccount *account, gint i);
-gchar * mail_config_signature_run_script (gchar *script);
-
-int mail_config_get_week_start_day(void);
-int mail_config_get_time_24hour(void);
+void mail_config_write_account_sig (MailConfigAccount *account, int i);
+char *mail_config_signature_run_script (char *script);
#ifdef __cplusplus
}
diff --git a/mail/mail-display.c b/mail/mail-display.c
index 164372ae5c..122dd04e14 100644
--- a/mail/mail-display.c
+++ b/mail/mail-display.c
@@ -38,6 +38,9 @@
#include <gtk/gtkinvisible.h>
#include <libgnome/gnome-program.h>
+#include <gconf/gconf.h>
+#include <gconf/gconf-client.h>
+
#include <libgnomevfs/gnome-vfs-mime-handlers.h>
#include <libgnomevfs/gnome-vfs.h>
#include <bonobo/bonobo-control-frame.h>
@@ -235,18 +238,19 @@ make_safe_filename (const char *prefix,CamelMimePart *part)
static void
save_data_cb (GtkWidget *widget, gpointer user_data)
{
- GtkFileSelection *file_select = (GtkFileSelection *)
- gtk_widget_get_ancestor (widget, GTK_TYPE_FILE_SELECTION);
+ GtkFileSelection *file_select;
+ GConfClient *gconf;
char *dir;
+ file_select = (GtkFileSelection *) gtk_widget_get_ancestor (widget, GTK_TYPE_FILE_SELECTION);
+
/* uh, this doesn't really feel right, but i dont know what to do better */
gtk_widget_hide (GTK_WIDGET (file_select));
- write_data_to_file (user_data, gtk_file_selection_get_filename (file_select),
- FALSE);
+ write_data_to_file (user_data, gtk_file_selection_get_filename (file_select), FALSE);
/* preserve the pathname */
dir = g_path_get_dirname (gtk_file_selection_get_filename (file_select));
- mail_config_set_last_filesel_dir (dir);
+ gconf_client_set_string (gconf, "/apps/evolution/mail/save_dir", dir, NULL);
g_free (dir);
gtk_widget_destroy (GTK_WIDGET (file_select));
@@ -307,11 +311,15 @@ static void
save_part (CamelMimePart *part)
{
GtkFileSelection *file_select;
- char *filename, *base;
+ char *filename, *dir, *base;
+ GConfClient *gconf;
camel_object_ref (CAMEL_OBJECT (part));
- filename = make_safe_filename (mail_config_get_last_filesel_dir (), part);
+ gconf = gconf_client_get_default ();
+ dir = gconf_client_get_string (gconf, "/apps/evolution/mail/save_dir", NULL);
+ filename = make_safe_filename (dir, part);
+ g_free (dir);
file_select = GTK_FILE_SELECTION (
gtk_file_selection_new (_("Save Attachment")));
@@ -1191,10 +1199,13 @@ on_url_requested (GtkHTML *html, const char *url, GtkHTMLStream *handle,
gpointer user_data)
{
MailDisplay *md = user_data;
+ GConfClient *gconf;
GHashTable *urls;
CamelMedium *medium;
GByteArray *ba;
+ gconf = gconf_client_get_default ();
+
urls = g_datalist_get_data (md->data, "part_urls");
g_return_if_fail (urls != NULL);
@@ -1252,10 +1263,13 @@ on_url_requested (GtkHTML *html, const char *url, GtkHTMLStream *handle,
/* See if it's something we can load. */
if (strncmp (url, "http:", 5) == 0 || strncmp (url, "https:", 6) == 0) {
- if (mail_config_get_http_mode () == MAIL_CONFIG_HTTP_ALWAYS ||
+ int http_mode;
+
+ http_mode = gconf_client_get_int (gconf, "/apps/evolution/mail/display/load_http_images", NULL);
+ if (http_mode == MAIL_CONFIG_HTTP_ALWAYS ||
g_datalist_get_data (md->data, "load_images")) {
fetch_remote (md, url, html, handle);
- } else if (mail_config_get_http_mode () == MAIL_CONFIG_HTTP_SOMETIMES &&
+ } else if (http_mode == MAIL_CONFIG_HTTP_SOMETIMES &&
!g_datalist_get_data (md->data, "checking_from")) {
const CamelInternetAddress *from;
const char *name, *addr;
@@ -1264,7 +1278,7 @@ on_url_requested (GtkHTML *html, const char *url, GtkHTMLStream *handle,
g_datalist_set_data (md->data, "checking_from", GINT_TO_POINTER (1));
/* Make sure we aren't deal w/ some sort of a
- pathological message w/o a From: header */
+ pathological message w/o a From: header */
if (from != NULL && camel_internet_address_get (from, 0, &name, &addr))
e_book_query_address_default (addr, ebook_callback, md);
else
@@ -1666,17 +1680,27 @@ mail_text_write (MailDisplayStream *stream, MailDisplay *md, CamelMimePart *part
{
CamelStreamFilter *filtered_stream;
CamelMimeFilter *html_filter;
- guint32 flags;
+ GConfClient *gconf;
+ guint32 flags, rgb;
+ GdkColor colour;
+ char *buf;
+
+ gconf = gconf_client_get_default ();
flags = CAMEL_MIME_FILTER_TOHTML_CONVERT_NL | CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES;
if (!printing)
flags |= CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS | CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES;
- if (!printing && mail_config_get_citation_highlight ())
+ if (!printing && gconf_client_get_bool (gconf, "/apps/evolution/mail/display/mark_citations", NULL))
flags |= CAMEL_MIME_FILTER_TOHTML_MARK_CITATION;
- html_filter = camel_mime_filter_tohtml_new (flags, mail_config_get_citation_color ());
+ buf = gconf_client_get_string (gconf, "/apps/evolution/mail/display/citation_colour", NULL);
+ gdk_color_parse (buf ? buf : "#737373", &colour);
+ g_free (buf);
+
+ rgb = ((colour.red & 0xff00) << 8) | (colour.green & 0xff00) | ((colour.blue & 0xff00) >> 8);
+ html_filter = camel_mime_filter_tohtml_new (flags, rgb);
filtered_stream = camel_stream_filter_new_with_stream ((CamelStream *) stream);
camel_stream_filter_add (filtered_stream, html_filter);
camel_object_unref (html_filter);
@@ -1971,6 +1995,8 @@ static void
mail_display_init (GObject *object)
{
MailDisplay *mail_display = MAIL_DISPLAY (object);
+ GConfClient *gconf;
+ int style;
mail_display->scroll = NULL;
mail_display->html = NULL;
@@ -1988,7 +2014,9 @@ mail_display_init (GObject *object)
g_object_ref (mail_display->invisible);
gtk_object_sink ((GtkObject *) mail_display->invisible);
- mail_display->display_style = mail_config_get_message_display_style ();
+ gconf = gconf_client_get_default ();
+ style = gconf_client_get_int (gconf, "/apps/evolution/mail/format/message_display_style", NULL);
+ mail_display->display_style = style;
mail_display->printing = FALSE;
diff --git a/mail/mail-format.c b/mail/mail-format.c
index fefa9ef721..d1583db0fb 100644
--- a/mail/mail-format.c
+++ b/mail/mail-format.c
@@ -30,6 +30,9 @@
#include <ctype.h>
#include <fcntl.h>
+#include <gconf/gconf.h>
+#include <gconf/gconf-client.h>
+
#include <libgnome/gnome-util.h>
#include <libgnomevfs/gnome-vfs-mime-handlers.h>
#include <gal/util/e-iconv.h>
@@ -913,8 +916,7 @@ write_default_header (CamelMimeMessage *message, MailDisplay *md,
static gboolean
write_xmailer_header (CamelMimeMessage *message, MailDisplay *md,
- MailDisplayStream *stream,
- MailConfigXMailerDisplayStyle xm)
+ MailDisplayStream *stream, int xmask)
{
const char *xmailer, *evolution;
@@ -926,11 +928,11 @@ write_xmailer_header (CamelMimeMessage *message, MailDisplay *md,
}
evolution = strstr (xmailer, "Evolution");
- if ((xm & MAIL_CONFIG_XMAILER_OTHER) ||
- (evolution && (xm & MAIL_CONFIG_XMAILER_EVO)))
+ if ((xmask & MAIL_CONFIG_XMAILER_OTHER) ||
+ (evolution && (xmask & MAIL_CONFIG_XMAILER_EVO)))
write_text_header (stream, _("Mailer"), xmailer, WRITE_BOLD);
- return evolution != NULL && (xm & MAIL_CONFIG_XMAILER_RUPERT_APPROVED);
+ return evolution != NULL && (xmask & MAIL_CONFIG_XMAILER_RUPERT_APPROVED);
}
#define COLOR_IS_LIGHT(r, g, b) ((r + g + b) > (128 * 3))
@@ -938,12 +940,15 @@ write_xmailer_header (CamelMimeMessage *message, MailDisplay *md,
static void
write_headers (MailDisplayStream *stream, MailDisplay *md, CamelMimeMessage *message)
{
- MailConfigXMailerDisplayStyle xm = mail_config_get_x_mailer_display_style ();
gboolean full = (md->display_style == MAIL_CONFIG_DISPLAY_FULL_HEADERS);
char bgcolor[7], fontcolor[7];
GtkStyle *style = NULL;
gboolean evo_icon = FALSE;
- int i;
+ GConfClient *gconf;
+ int xmask, i;
+
+ gconf = gconf_client_get_default ();
+ 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.
However, we only do this if we are rendering to the screen -- we ignore the theme
@@ -1026,8 +1031,8 @@ write_headers (MailDisplayStream *stream, MailDisplay *md, CamelMimeMessage *mes
} else {
for (i = 0; i < sizeof (default_headers) / sizeof (default_headers[0]); i++)
write_default_header (message, md, stream, i, 0);
- if (xm != MAIL_CONFIG_XMAILER_NONE)
- evo_icon = write_xmailer_header (message, md, stream, xm);
+ if (xmask != MAIL_CONFIG_XMAILER_NONE)
+ evo_icon = write_xmailer_header (message, md, stream, xmask);
}
/* Close off the internal header table */
@@ -1092,7 +1097,10 @@ mail_format_data_wrapper_write_to_stream (CamelDataWrapper *wrapper, MailDisplay
if (wrapper->rawtext || (mail_display && mail_display->charset)) {
CamelMimeFilterCharset *filter;
- const char *charset;
+ GConfClient *gconf;
+ char *charset;
+
+ gconf = gconf_client_get_default ();
if (!wrapper->rawtext) {
/* data wrapper had been successfully converted to UTF-8 using the mime
@@ -1102,31 +1110,35 @@ mail_format_data_wrapper_write_to_stream (CamelDataWrapper *wrapper, MailDisplay
/* get the original charset of the mime part */
content_type = camel_data_wrapper_get_mime_type_field (wrapper);
- charset = content_type ? header_content_type_param (content_type, "charset") : NULL;
+ charset = (char *) (content_type ? header_content_type_param (content_type, "charset") : NULL);
if (!charset)
- charset = mail_config_get_default_charset ();
+ charset = gconf_client_get_string (gconf, "/apps/evolution/mail/format/charset", NULL);
+ else
+ charset = g_strdup (charset);
/* since the content is already in UTF-8, we need to decode into the
original charset before we can convert back to UTF-8 using the charset
the user is overriding with... */
- filter = camel_mime_filter_charset_new_convert ("utf-8", charset);
- if (filter) {
+ if ((filter = camel_mime_filter_charset_new_convert ("utf-8", charset))) {
camel_stream_filter_add (filtered_stream, CAMEL_MIME_FILTER (filter));
camel_object_unref (filter);
}
+
+ g_free (charset);
}
/* find out the charset the user wants to override to */
if (mail_display && mail_display->charset)
charset = mail_display->charset;
else
- charset = mail_config_get_default_charset ();
+ charset = gconf_client_get_string (gconf, "/apps/evolution/mail/format/charset", NULL);
- filter = camel_mime_filter_charset_new_convert (charset, "utf-8");
- if (filter) {
+ if ((filter = camel_mime_filter_charset_new_convert (charset, "utf-8"))) {
camel_stream_filter_add (filtered_stream, CAMEL_MIME_FILTER (filter));
camel_object_unref (filter);
}
+
+ g_free (charset);
}
written = camel_data_wrapper_write_to_stream (wrapper, CAMEL_STREAM (filtered_stream));
@@ -1185,16 +1197,26 @@ handle_text_plain (CamelMimePart *part, const char *mime_type,
CamelStreamFilter *filtered_stream;
CamelMimeFilter *html_filter;
CamelDataWrapper *wrapper;
- guint32 flags, colour = 0;
CamelContentType *type;
const char *format;
+ GConfClient *gconf;
+ guint32 flags, rgb = 0;
+ GdkColor colour;
+ char *buf;
+
+ gconf = gconf_client_get_default ();
flags = CAMEL_MIME_FILTER_TOHTML_CONVERT_NL | CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES;
if (!md->printing) {
flags |= CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS | CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES;
- if (mail_config_get_citation_highlight ()) {
+ if (gconf_client_get_bool (gconf, "/apps/evolution/mail/display/mark_citations", NULL)) {
flags |= CAMEL_MIME_FILTER_TOHTML_MARK_CITATION;
- colour = mail_config_get_citation_color ();
+
+ buf = gconf_client_get_string (gconf, "/apps/evolution/mail/display/citation_colour", NULL);
+ gdk_color_parse (buf ? buf : "#737373", &colour);
+ g_free (buf);
+
+ rgb = ((colour.red & 0xff00) << 8) | (colour.green & 0xff00) | ((colour.blue & 0xff00) >> 8);
}
}
@@ -1204,7 +1226,7 @@ handle_text_plain (CamelMimePart *part, const char *mime_type,
if (format && !strcasecmp (format, "flowed"))
flags |= CAMEL_MIME_FILTER_TOHTML_FORMAT_FLOWED;
- html_filter = camel_mime_filter_tohtml_new (flags, colour);
+ html_filter = camel_mime_filter_tohtml_new (flags, rgb);
filtered_stream = camel_stream_filter_new_with_stream ((CamelStream *) stream);
camel_stream_filter_add (filtered_stream, html_filter);
camel_object_unref (html_filter);
diff --git a/mail/mail-preferences.c b/mail/mail-preferences.c
index 1d13e17ae9..b10c006d22 100644
--- a/mail/mail-preferences.c
+++ b/mail/mail-preferences.c
@@ -237,7 +237,7 @@ mail_preferences_construct (MailPreferences *prefs)
g_free (buf);
prefs->citation_highlight = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkHighlightCitations"));
- bool = gconf_client_get_bool (prefs->gconf, "/apps/evolution/mail/display/highlight_citations", NULL);
+ bool = gconf_client_get_bool (prefs->gconf, "/apps/evolution/mail/display/mark_citations", NULL);
gtk_toggle_button_set_active (prefs->citation_highlight, bool);
g_signal_connect (prefs->citation_highlight, "toggled", G_CALLBACK (toggle_button_toggled), prefs);
@@ -402,7 +402,7 @@ mail_preferences_apply (MailPreferences *prefs)
gconf_client_set_string (prefs->gconf, "/apps/evolution/mail/format/charset", string, NULL);
g_free (string);
- gconf_client_set_bool (prefs->gconf, "/apps/evolution/mail/display/highlight_citations",
+ gconf_client_set_bool (prefs->gconf, "/apps/evolution/mail/display/mark_citations",
gtk_toggle_button_get_active (prefs->citation_highlight), NULL);
rgb = colorpicker_get_color (prefs->citation_color);
diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c
index fc8b05a750..81f2eaf8c2 100644
--- a/mail/mail-send-recv.c
+++ b/mail/mail-send-recv.c
@@ -280,11 +280,11 @@ static send_info_t get_receive_type(const char *url)
}
static struct _send_data *
-build_dialogue (GSList *sources, CamelFolder *outbox, const char *destination)
+build_dialogue (const GSList *accounts, CamelFolder *outbox, const char *destination)
{
GtkDialog *gd;
GtkTable *table;
- int row;
+ int row, num_sources;
GList *list = NULL;
struct _send_data *data;
GtkWidget *send_icon, *recv_icon;
@@ -294,7 +294,8 @@ build_dialogue (GSList *sources, CamelFolder *outbox, const char *destination)
GtkHSeparator *line;
struct _send_info *info;
char *pretty_url;
-
+ const GSList *l;
+
gd = (GtkDialog *)send_recv_dialogue = gtk_dialog_new_with_buttons(_("Send & Receive Mail"), NULL, 0, NULL);
stop = (GtkButton *)gtk_button_new_from_stock(GTK_STOCK_CANCEL);
gtk_button_set_label(stop, _("Cancel All"));
@@ -302,18 +303,31 @@ build_dialogue (GSList *sources, CamelFolder *outbox, const char *destination)
g_object_set(gd, "resizable", FALSE, NULL);
gnome_window_icon_set_from_file (GTK_WINDOW (gd), EVOLUTION_ICONSDIR "/send-receive.xpm");
- table = (GtkTable *)gtk_table_new (g_slist_length (sources), 4, FALSE);
+ num_sources = 0;
+ l = accounts;
+ while (l != NULL) {
+ MailConfigAccount *account = l->data;
+
+ if (account->source && account->source->url)
+ num_sources++;
+
+ l = l->next;
+ }
+
+ table = (GtkTable *)gtk_table_new (num_sources, 4, FALSE);
gtk_box_pack_start (GTK_BOX (gd->vbox), GTK_WIDGET (table), TRUE, TRUE, 0);
-
+
/* must bet setup after send_recv_dialogue as it may re-trigger send-recv button */
data = setup_send_data ();
row = 0;
- while (sources) {
- MailConfigService *source = sources->data;
+ while (accounts) {
+ MailConfigAccount *account = accounts->data;
+ MailConfigService *source;
- if (!source->url || !source->enabled) {
- sources = sources->next;
+ source = account->source;
+ if (!account->enabled || !source || !source->url) {
+ accounts = accounts->next;
continue;
}
@@ -324,12 +338,13 @@ build_dialogue (GSList *sources, CamelFolder *outbox, const char *destination)
type = get_receive_type (source->url);
if (type == SEND_INVALID) {
- sources = sources->next;
+ accounts = accounts->next;
continue;
}
info = g_malloc0 (sizeof (*info));
info->type = type;
+
d(printf("adding source %s\n", source->url));
info->uri = g_strdup (source->url);
@@ -342,7 +357,7 @@ build_dialogue (GSList *sources, CamelFolder *outbox, const char *destination)
list = g_list_prepend (list, info);
} else if (info->bar != NULL) {
/* incase we get the same source pop up again */
- sources = sources->next;
+ accounts = accounts->next;
continue;
} else if (info->timeout_id == 0)
info->timeout_id = gtk_timeout_add (STATUS_TIMEOUT, operation_status_timeout, info);
@@ -375,7 +390,7 @@ build_dialogue (GSList *sources, CamelFolder *outbox, const char *destination)
info->data = data;
g_signal_connect(stop, "clicked", G_CALLBACK(receive_cancel), info);
- sources = sources->next;
+ accounts = accounts->next;
row = row + 2;
}
@@ -650,12 +665,12 @@ receive_update_got_store (char *uri, CamelStore *store, void *data)
void mail_send_receive (void)
{
- GSList *sources;
+ const GSList *accounts;
GList *scan;
struct _send_data *data;
extern CamelFolder *outbox_folder;
const MailConfigAccount *account;
-
+
if (send_recv_dialogue != NULL) {
if (GTK_WIDGET_REALIZED(send_recv_dialogue)) {
gdk_window_show(send_recv_dialogue->window);
@@ -667,18 +682,18 @@ void mail_send_receive (void)
if (!camel_session_is_online (session))
return;
- sources = mail_config_get_sources();
- if (!sources)
+ if (!(accounts = mail_config_get_accounts ()))
return;
- account = mail_config_get_default_account();
+
+ account = mail_config_get_default_account ();
if (!account || !account->transport)
return;
- data = build_dialogue(sources, outbox_folder, account->transport->url);
+ data = build_dialogue (accounts, outbox_folder, account->transport->url);
scan = data->infos;
while (scan) {
struct _send_info *info = scan->data;
-
+
switch(info->type) {
case SEND_RECEIVE:
mail_fetch_mail(info->uri, info->keep,
@@ -748,26 +763,28 @@ void
mail_autoreceive_setup (void)
{
GHashTable *set_hash;
- GSList *sources;
-
- sources = mail_config_get_sources();
+ const GSList *accounts;
- if (!sources)
+ if (!(accounts = mail_config_get_accounts ()))
return;
-
+
if (auto_active == NULL)
auto_active = g_hash_table_new(g_str_hash, g_str_equal);
-
+
set_hash = g_hash_table_new(g_str_hash, g_str_equal);
g_hash_table_foreach(auto_active, (GHFunc)auto_setup_set, set_hash);
-
- while (sources) {
- MailConfigService *source = sources->data;
- if (source->url && source->auto_check && source->enabled) {
+
+ while (accounts) {
+ MailConfigAccount *account = accounts->data;
+ MailConfigService *source;
+
+ source = account->source;
+
+ if (account->enabled && source && source->url && source->auto_check) {
struct _auto_data *info;
-
+
d(printf("setting up auto-receive mail for : %s\n", source->url));
-
+
g_hash_table_remove(set_hash, source->url);
info = g_hash_table_lookup(auto_active, source->url);
if (info) {
@@ -789,8 +806,8 @@ mail_autoreceive_setup (void)
/*mail_receive_uri(source->url, source->keep_on_server);*/
}
}
-
- sources = sources->next;
+
+ accounts = accounts->next;
}
g_hash_table_foreach(set_hash, (GHFunc)auto_clean_set, auto_active);
diff --git a/mail/mail-session.c b/mail/mail-session.c
index 6682bbba58..05375d992f 100644
--- a/mail/mail-session.c
+++ b/mail/mail-session.c
@@ -29,6 +29,9 @@
#include <gtk/gtkdialog.h>
#include <gtk/gtkstock.h>
+#include <gconf/gconf.h>
+#include <gconf/gconf-client.h>
+
#include <libgnome/gnome-config.h>
#include <libgnome/gnome-sound.h>
@@ -746,10 +749,14 @@ static CamelFilterDriver *
main_get_filter_driver (CamelSession *session, const char *type, CamelException *ex)
{
CamelFilterDriver *driver;
- RuleContext *fc;
GString *fsearch, *faction;
FilterRule *rule = NULL;
char *user, *system;
+ GConfClient *gconf;
+ RuleContext *fc;
+ long notify;
+
+ gconf = gconf_client_get_default ();
user = g_strdup_printf ("%s/filters.xml", evolution_dir);
system = EVOLUTION_DATADIR "/evolution/filtertypes.xml";
@@ -760,16 +767,19 @@ main_get_filter_driver (CamelSession *session, const char *type, CamelException
driver = camel_filter_driver_new (session);
camel_filter_driver_set_folder_func (driver, get_folder, NULL);
- if (mail_config_get_filter_log ()) {
+ if (gconf_client_get_bool (gconf, "/apps/evolution/mail/filters/log", NULL)) {
MailSession *ms = (MailSession *) session;
if (ms->filter_logfile == NULL) {
- const char *filename;
+ char *filename;
- filename = mail_config_get_filter_log_path ();
- if (filename)
+ filename = gconf_client_get_string (gconf, "/apps/evolution/mail/filters/logfile", NULL);
+ if (filename) {
ms->filter_logfile = fopen (filename, "a+");
+ g_free (filename);
+ }
}
+
if (ms->filter_logfile)
camel_filter_driver_set_logfile (driver, ms->filter_logfile);
}
@@ -786,19 +796,26 @@ main_get_filter_driver (CamelSession *session, const char *type, CamelException
/* FIXME: we need a way to distinguish between filtering new
mail and re-filtering a folder because both use the
"incoming" filter type */
- if (mail_config_get_new_mail_notify () && !strcmp (type, "incoming")) {
+ notify = gconf_client_get_bool (gconf, "/apps/evolution/mail/notify/type", NULL);
+ if (notify != MAIL_CONFIG_NOTIFY_NOT && !strcmp (type, "incoming")) {
+ char *filename;
+
g_string_truncate (faction, 0);
g_string_append (faction, "(only-once \"new-mail-notification\" ");
- switch (mail_config_get_new_mail_notify ()) {
+ switch (notify) {
+ case MAIL_CONFIG_NOTIFY_PLAY_SOUND:
+ filename = gconf_client_get_string (gconf, "/apps/evolution/mail/notify/sound", NULL);
+ if (filename) {
+ g_string_append_printf (faction, "\"(play-sound \\\"%s\\\")\"", filename);
+ g_free (filename);
+ break;
+ }
+ /* fall through */
case MAIL_CONFIG_NOTIFY_BEEP:
g_string_append (faction, "\"(beep)\"");
break;
- case MAIL_CONFIG_NOTIFY_PLAY_SOUND:
- g_string_append_printf (faction, "\"(play-sound \\\"%s\\\")\"",
- mail_config_get_new_mail_notify_sound_file ());
- break;
default:
break;
}
diff --git a/mail/mail-tools.c b/mail/mail-tools.c
index 96141e91ad..83abe3e1a2 100644
--- a/mail/mail-tools.c
+++ b/mail/mail-tools.c
@@ -32,6 +32,9 @@
#include <errno.h>
#include <string.h>
+#include <gconf/gconf.h>
+#include <gconf/gconf-client.h>
+
#include <camel/camel.h>
#include <camel/camel-vee-folder.h>
@@ -52,12 +55,13 @@
CamelFolder *
mail_tool_get_local_inbox (CamelException *ex)
{
- gchar *url;
CamelFolder *folder;
-
+ char *url;
+
url = g_strdup_printf("file://%s/local/Inbox", evolution_dir);
folder = mail_tool_uri_to_folder (url, 0, ex);
g_free (url);
+
return folder;
}
@@ -66,14 +70,14 @@ mail_tool_get_inbox (const gchar *url, CamelException *ex)
{
CamelStore *store;
CamelFolder *folder;
-
+
store = camel_session_get_store (session, url, ex);
if (!store)
return NULL;
-
+
folder = camel_store_get_inbox (store, ex);
camel_object_unref (store);
-
+
return folder;
}
@@ -82,20 +86,20 @@ mail_tool_get_trash (const gchar *url, int connect, CamelException *ex)
{
CamelStore *store;
CamelFolder *trash;
-
+
if (connect)
store = camel_session_get_store (session, url, ex);
else
- store = (CamelStore *)camel_session_get_service(session, url, CAMEL_PROVIDER_STORE, ex);
-
+ store = (CamelStore *) camel_session_get_service (session, url, CAMEL_PROVIDER_STORE, ex);
+
if (!store)
return NULL;
- if (connect || ((CamelService *)store)->status == CAMEL_SERVICE_CONNECTED)
+ if (connect || ((CamelService *) store)->status == CAMEL_SERVICE_CONNECTED)
trash = camel_store_get_trash (store, ex);
else
trash = NULL;
-
+
camel_object_unref (store);
return trash;
@@ -344,7 +348,10 @@ mail_tool_quote_message (CamelMimeMessage *message, const char *fmt, ...)
{
CamelDataWrapper *contents;
gboolean want_plain;
- gchar *text;
+ char *text, *colour;
+ GConfClient *gconf;
+
+ gconf = gconf_client_get_default ();
contents = camel_medium_get_content_object (CAMEL_MEDIUM (message));
/* We pass "want_plain" for "cite", since if it's HTML, we'll
@@ -378,16 +385,21 @@ mail_tool_quote_message (CamelMimeMessage *message, const char *fmt, ...)
va_end (ap);
}
+ colour = gconf_client_get_string (gconf, "/apps/evolution/mail/display/citation_colour", NULL);
+
ret_text = g_strdup_printf ("%s<!--+GtkHTML:<DATA class=\"ClueFlow\" key=\"orig\" value=\"1\">-->"
- "<font color=\"%06x\">\n%s%s%s</font>"
+ "<font color=\"%s\">\n%s%s%s</font>"
"<!--+GtkHTML:<DATA class=\"ClueFlow\" clear=\"orig\">-->",
credits ? credits : "",
- mail_config_get_citation_color (),
+ colour ? colour : "#737373",
want_plain ? "" : "<blockquote type=cite><i>",
text,
want_plain ? "" : "</i></blockquote>");
+
g_free (text);
+ g_free (colour);
g_free (credits);
+
return ret_text;
}
@@ -406,13 +418,17 @@ gchar *
mail_tool_forward_message (CamelMimeMessage *message, gboolean quoted)
{
char *title, *body, *ret;
+ gboolean send_html;
+ GConfClient *gconf;
- body = mail_get_message_body (CAMEL_DATA_WRAPPER (message),
- !mail_config_get_send_html (),
- quoted);
+ gconf = gconf_client_get_default ();
+ 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);
title = _("Forwarded Message");
ret = g_strdup_printf ("-----%s-----<br>%s", title, body ? body : "");
g_free (body);
+
return ret;
}
diff --git a/mail/message-browser.c b/mail/message-browser.c
index 2aa53dac8d..5a9c74fc6e 100644
--- a/mail/message-browser.c
+++ b/mail/message-browser.c
@@ -24,6 +24,9 @@
#include <config.h>
#endif
+#include <gconf/gconf.h>
+#include <gconf/gconf-client.h>
+
#include <gal/util/e-util.h>
#include <bonobo/bonobo-exception.h>
@@ -65,7 +68,7 @@ message_browser_destroy (GtkObject *object)
MessageBrowser *message_browser;
message_browser = MESSAGE_BROWSER (object);
-
+
if (message_browser->fb) {
g_signal_handlers_disconnect_matched(message_browser->fb, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, message_browser);
g_object_unref((message_browser->fb));
@@ -94,18 +97,22 @@ static void
transfer_msg_done (gboolean ok, void *data)
{
MessageBrowser *mb = data;
+ gboolean hide_deleted;
+ GConfClient *gconf;
int row;
#warning "GTK_OBJECT_DESTROYED"
/*if (ok && !GTK_OBJECT_DESTROYED (mb)) {*/
if (ok) {
+ gconf = gconf_client_get_default ();
+ hide_deleted = !gconf_client_get_bool (gconf, "/apps/evolution/mail/display/show_deleted", NULL);
+
row = e_tree_row_of_node (mb->fb->message_list->tree,
e_tree_get_cursor (mb->fb->message_list->tree));
/* If this is the last message and deleted messages
are hidden, select the previous */
- if ((row + 1 == e_tree_row_count (mb->fb->message_list->tree))
- && mail_config_get_hide_deleted ())
+ if ((row + 1 == e_tree_row_count (mb->fb->message_list->tree)) && hide_deleted)
message_list_select (mb->fb->message_list, MESSAGE_LIST_SELECT_PREVIOUS,
0, CAMEL_MESSAGE_DELETED, FALSE);
else
@@ -113,7 +120,7 @@ transfer_msg_done (gboolean ok, void *data)
0, 0, FALSE);
}
- g_object_unref((mb));
+ g_object_unref (mb);
}
static void
diff --git a/mail/message-list.c b/mail/message-list.c
index e9f8856000..522a9a11c9 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -32,6 +32,9 @@
#include <glib/gunicode.h>
+#include <gconf/gconf.h>
+#include <gconf/gconf-client.h>
+
#include <gal/util/e-util.h>
#include <gal/widgets/e-gui-utils.h>
#include <gal/e-table/e-cell-text.h>
@@ -2101,20 +2104,22 @@ message_changed (CamelObject *o, gpointer event_data, gpointer user_data)
void
message_list_set_folder (MessageList *message_list, CamelFolder *camel_folder, gboolean outgoing)
{
+ gboolean hide_deleted;
+ GConfClient *gconf;
CamelException ex;
-
+
g_return_if_fail (message_list != NULL);
g_return_if_fail (IS_MESSAGE_LIST (message_list));
-
+
if (message_list->folder == camel_folder)
return;
-
+
camel_exception_init (&ex);
-
+
/* cancel any outstanding regeneration requests */
if (message_list->regen) {
GList *l = message_list->regen;
-
+
while (l) {
struct _mail_msg *mm = l->data;
@@ -2123,8 +2128,8 @@ message_list_set_folder (MessageList *message_list, CamelFolder *camel_folder, g
l = l->next;
}
}
-
- clear_tree(message_list);
+
+ clear_tree (message_list);
if (message_list->folder) {
hide_save_state(message_list);
@@ -2134,41 +2139,41 @@ message_list_set_folder (MessageList *message_list, CamelFolder *camel_folder, g
message_changed, message_list);
camel_object_unref (message_list->folder);
}
-
+
if (message_list->thread_tree) {
camel_folder_thread_messages_unref(message_list->thread_tree);
message_list->thread_tree = NULL;
}
-
+
message_list->folder = camel_folder;
-
+
if (message_list->cursor_uid) {
g_free(message_list->cursor_uid);
message_list->cursor_uid = NULL;
g_signal_emit(message_list, message_list_signals[MESSAGE_SELECTED], 0, NULL);
}
-
+
if (camel_folder) {
/* Setup the strikeout effect for non-trash folders */
if (!(camel_folder->folder_flags & CAMEL_FOLDER_IS_TRASH)) {
ECell *cell;
-
+
cell = e_table_extras_get_cell (message_list->extras, "render_date");
g_object_set (cell,
"strikeout_column", COL_DELETED,
NULL);
-
+
cell = e_table_extras_get_cell (message_list->extras, "render_text");
g_object_set (cell,
"strikeout_column", COL_DELETED,
NULL);
-
+
cell = e_table_extras_get_cell (message_list->extras, "render_size");
g_object_set (cell,
"strikeout_column", COL_DELETED,
NULL);
}
-
+
/* Build the etree suitable for this folder */
message_list_setup_etree (message_list, outgoing);
@@ -2179,8 +2184,10 @@ message_list_set_folder (MessageList *message_list, CamelFolder *camel_folder, g
camel_object_ref (camel_folder);
- message_list->hidedeleted = mail_config_get_hide_deleted ()
- && !(camel_folder->folder_flags & CAMEL_FOLDER_IS_TRASH);
+ /* FIXME: probably listen for updates to show_deleted? */
+ gconf = gconf_client_get_default ();
+ 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);
hide_load_state (message_list);
mail_regen_list (message_list, message_list->search, NULL, NULL);
@@ -2194,7 +2201,7 @@ on_cursor_activated_idle (gpointer data)
{
MessageList *message_list = data;
ESelectionModel *esm = e_tree_get_selection_model (message_list->tree);
- gint selected = e_selection_model_selected_count (esm);
+ int selected = e_selection_model_selected_count (esm);
if (selected == 1 && message_list->cursor_uid) {
d(printf ("emitting cursor changed signal, for uid %s\n", message_list->cursor_uid));
@@ -2594,7 +2601,9 @@ regen_list_regen (struct _mail_msg *mm)
{
struct _regen_list_msg *m = (struct _regen_list_msg *)mm;
GPtrArray *uids, *uidnew, *showuids, *searchuids = NULL;
+ gboolean thread_subject;
CamelMessageInfo *info;
+ GConfClient *gconf;
int i;
/* if we have hidedeleted on, use a search to find it out, merge with existing search if set */
@@ -2696,15 +2705,17 @@ regen_list_regen (struct _mail_msg *mm)
}
MESSAGE_LIST_UNLOCK(m->ml, hide_lock);
-
+
+ gconf = gconf_client_get_default ();
+ thread_subject = gconf_client_get_bool (gconf, "/apps/evolution/mail/display/thread_subject", NULL);
+
if (!camel_operation_cancel_check(mm->cancel)) {
/* update/build a new tree */
if (m->dotree) {
if (m->tree)
- camel_folder_thread_messages_apply(m->tree, showuids);
+ camel_folder_thread_messages_apply (m->tree, showuids);
else
- m->tree = camel_folder_thread_messages_new (m->folder, showuids,
- mail_config_get_thread_subject ());
+ m->tree = camel_folder_thread_messages_new (m->folder, showuids, thread_subject);
} else {
m->summary = g_ptr_array_new ();
for (i = 0; i < showuids->len; i++) {
diff --git a/mail/message-tag-followup.c b/mail/message-tag-followup.c
index e333cc0408..59ebf29f13 100644
--- a/mail/message-tag-followup.c
+++ b/mail/message-tag-followup.c
@@ -40,6 +40,9 @@
#include <glade/glade.h>
+#include <gconf/gconf.h>
+#include <gconf/gconf-client.h>
+
#include <libgnomeui/gnome-window-icon.h>
#include <libgnomeui/gnome-pixmap.h>
@@ -215,23 +218,51 @@ completed_toggled (GtkToggleButton *button, gpointer user_data)
followup->completed_date = 0;
}
+static int
+get_week_start_day (void)
+{
+ /* FIXME: make sure the gconf key is correct? */
+ GConfClient *gconf;
+
+ gconf = gconf_client_get_default ();
+ return gconf_client_get_int (gconf, "/apps/evolution/calendar/display/week_start_day", NULL);
+}
+
+static gboolean
+locale_supports_12_hour_format (void)
+{
+ char s[16];
+ time_t t = 0;
+
+ strftime(s, sizeof s, "%p", gmtime (&t));
+ return s[0] != '\0';
+}
+
GtkWidget *target_date_new (const char *s1, const char *s2, int i1, int i2);
GtkWidget *
target_date_new (const char *s1, const char *s2, int i1, int i2)
{
+ gboolean time_24hour = TRUE;
+ GConfClient *gconf;
GtkWidget *widget;
int start;
-
+
widget = e_date_edit_new ();
e_date_edit_set_show_date (E_DATE_EDIT (widget), TRUE);
e_date_edit_set_show_time (E_DATE_EDIT (widget), TRUE);
/* Note that this is 0 (Sun) to 6 (Sat), conver to 0 (mon) to 6 (sun) */
- start = (mail_config_get_week_start_day() + 6) % 7;
+ 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 ();
+ time_24hour = gconf_client_get_bool (gconf, "/apps/evolution/calendar/display/use_24hour_format", NULL);
+ }
e_date_edit_set_week_start_day (E_DATE_EDIT (widget), start);
- e_date_edit_set_use_24_hour_format (E_DATE_EDIT (widget), mail_config_get_time_24hour ());
+ e_date_edit_set_use_24_hour_format (E_DATE_EDIT (widget), time_24hour);
e_date_edit_set_allow_no_date_set (E_DATE_EDIT (widget), TRUE);
e_date_edit_set_time_popup_range (E_DATE_EDIT (widget), 0, 24);
diff --git a/mail/subscribe-dialog.c b/mail/subscribe-dialog.c
index 93e73c31f0..ba53617715 100644
--- a/mail/subscribe-dialog.c
+++ b/mail/subscribe-dialog.c
@@ -1377,14 +1377,14 @@ sc_filter_toggled (GtkWidget *widget, gpointer user_data)
}
static void
-populate_store_foreach (MailConfigService *service, SubscribeDialog *sc)
+populate_store_foreach (MailConfigAccount *account, SubscribeDialog *sc)
{
- StoreData *sd;
-
- if (service->url == NULL || service->enabled == FALSE)
+ StoreData *sd;
+
+ if (!account->enabled || !account->source || !account->source->url)
return;
-
- sd = store_data_new (service->url);
+
+ sd = store_data_new (account->source->url);
sc->priv->store_list = g_list_prepend (sc->priv->store_list, sd);
}
@@ -1515,14 +1515,13 @@ got_sd_store (StoreData *sd, CamelStore *store, gpointer data)
static void
populate_store_list (SubscribeDialog *sc)
{
- GSList *sources;
- GList *iter;
- GtkWidget *menu;
- GtkWidget *omenu;
-
- sources = mail_config_get_sources ();
- g_slist_foreach (sources, (GFunc) populate_store_foreach, sc);
- g_slist_free (sources);
+ const GSList *accounts;
+ GList *iter;
+ GtkWidget *menu;
+ GtkWidget *omenu;
+
+ accounts = mail_config_get_accounts ();
+ g_slist_foreach ((GSList *) accounts, (GFunc) populate_store_foreach, sc);
menu = gtk_menu_new ();