diff options
author | Matthew Barnes <mbarnes@src.gnome.org> | 2008-12-14 10:14:41 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2008-12-14 10:14:41 +0800 |
commit | b7333387e8bd19299794e6485e3407d03c2eb73f (patch) | |
tree | eb849e5f839738b0acdce5b4ba519eac521cf1d6 /mail | |
parent | d158af8cdfa6e4bf85c1e74769e8d61bc469494c (diff) | |
download | gsoc2013-evolution-b7333387e8bd19299794e6485e3407d03c2eb73f.tar gsoc2013-evolution-b7333387e8bd19299794e6485e3407d03c2eb73f.tar.gz gsoc2013-evolution-b7333387e8bd19299794e6485e3407d03c2eb73f.tar.bz2 gsoc2013-evolution-b7333387e8bd19299794e6485e3407d03c2eb73f.tar.lz gsoc2013-evolution-b7333387e8bd19299794e6485e3407d03c2eb73f.tar.xz gsoc2013-evolution-b7333387e8bd19299794e6485e3407d03c2eb73f.tar.zst gsoc2013-evolution-b7333387e8bd19299794e6485e3407d03c2eb73f.zip |
- Fix NetworkManager connection tracking.
- Implement offline preparation as an EActivity that gets broadcast in
a signal to shell modules. Offline preparations are complete when the
last EActivity reference is dropped.
- Bind some of the composer preferences to EShellSettings properties.
svn path=/branches/kill-bonobo/; revision=36875
Diffstat (limited to 'mail')
-rw-r--r-- | mail/Makefile.am | 2 | ||||
-rw-r--r-- | mail/e-mail-shell-module-settings.c | 416 | ||||
-rw-r--r-- | mail/e-mail-shell-module-settings.h | 33 | ||||
-rw-r--r-- | mail/e-mail-shell-module.c | 291 | ||||
-rw-r--r-- | mail/em-account-editor.c | 17 | ||||
-rw-r--r-- | mail/em-composer-prefs.c | 151 | ||||
-rw-r--r-- | mail/em-composer-prefs.h | 16 | ||||
-rw-r--r-- | mail/mail-component.c | 78 | ||||
-rw-r--r-- | mail/mail-send-recv.c | 15 | ||||
-rw-r--r-- | mail/mail-send-recv.h | 2 |
10 files changed, 629 insertions, 392 deletions
diff --git a/mail/Makefile.am b/mail/Makefile.am index d3ed2750f8..5db45237cc 100644 --- a/mail/Makefile.am +++ b/mail/Makefile.am @@ -39,6 +39,8 @@ libevolution_module_mail_la_SOURCES = \ e-mail-shell-module.h \ e-mail-shell-module-migrate.c \ e-mail-shell-module-migrate.h \ + e-mail-shell-module-settings.c \ + e-mail-shell-module-settings.h \ e-mail-shell-content.c \ e-mail-shell-content.h \ e-mail-shell-sidebar.c \ diff --git a/mail/e-mail-shell-module-settings.c b/mail/e-mail-shell-module-settings.c new file mode 100644 index 0000000000..05754ac854 --- /dev/null +++ b/mail/e-mail-shell-module-settings.c @@ -0,0 +1,416 @@ +/* + * e-mail-shell-module-settings.c + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#include "e-mail-shell-module-settings.h" + +void +e_mail_shell_module_init_settings (EShell *shell) +{ + EShellSettings *shell_settings; + + shell_settings = e_shell_get_settings (shell); + + /* XXX Default values should match the GConf schema. + * Yes it's redundant, but we're stuck with GConf. */ + + /*** Mail Preferences ***/ + + e_shell_settings_install_property ( + g_param_spec_boolean ( + "mail-address-compress", + NULL, + NULL, + FALSE, + G_PARAM_READWRITE)); + + e_shell_settings_bind_to_gconf ( + shell_settings, "mail-address-compress", + "/apps/evolution/mail/display/address_compress"); + + e_shell_settings_install_property ( + g_param_spec_int ( + "mail-address-count", + NULL, + NULL, + G_MININT, + G_MAXINT, + 0, + G_PARAM_READWRITE)); + + e_shell_settings_bind_to_gconf ( + shell_settings, "mail-address-count", + "/apps/evolution/mail/display/address_count"); + + e_shell_settings_install_property ( + g_param_spec_string ( + "mail-citation-color", + NULL, + NULL, + "#737373", + G_PARAM_READWRITE)); + + e_shell_settings_bind_to_gconf ( + shell_settings, "mail-citation-color", + "/apps/evolution/mail/display/citation_colour"); + + e_shell_settings_install_property ( + g_param_spec_boolean ( + "mail-check-for-junk", + NULL, + NULL, + FALSE, + G_PARAM_READWRITE)); + + e_shell_settings_bind_to_gconf ( + shell_settings, "mail-check-for-junk", + "/apps/evolution/mail/junk/check_incoming"); + + e_shell_settings_install_property ( + g_param_spec_boolean ( + "mail-confirm-expunge", + NULL, + NULL, + FALSE, + G_PARAM_READWRITE)); + + e_shell_settings_bind_to_gconf ( + shell_settings, "mail-confirm-expunge", + "/apps/evolution/mail/prompts/expunge"); + + e_shell_settings_install_property ( + g_param_spec_boolean ( + "mail-confirm-unwanted-html", + NULL, + NULL, + FALSE, + G_PARAM_READWRITE)); + + e_shell_settings_bind_to_gconf ( + shell_settings, "mail-confirm-unwanted-html", + "/apps/evolution/mail/prompts/unwanted_html"); + + e_shell_settings_install_property ( + g_param_spec_boolean ( + "mail-empty-trash-on-exit", + NULL, + NULL, + FALSE, + G_PARAM_READWRITE)); + + e_shell_settings_bind_to_gconf ( + shell_settings, "mail-empty-trash-on-exit", + "/apps/evolution/mail/trash/empty_on_exit"); + + e_shell_settings_install_property ( + g_param_spec_boolean ( + "mail-enable-search-folders", + NULL, + NULL, + FALSE, + G_PARAM_READWRITE)); + + e_shell_settings_bind_to_gconf ( + shell_settings, "mail-enable-search-folders", + "/apps/evolution/mail/display/enable_vfolders"); + + e_shell_settings_install_property ( + g_param_spec_string ( + "mail-font-monospace", + NULL, + NULL, + "", + G_PARAM_READWRITE)); + + e_shell_settings_bind_to_gconf ( + shell_settings, "mail-font-monospace", + "/apps/evolution/mail/display/fonts/monospace"); + + e_shell_settings_install_property ( + g_param_spec_string ( + "mail-font-variable", + NULL, + NULL, + "", + G_PARAM_READWRITE)); + + e_shell_settings_bind_to_gconf ( + shell_settings, "mail-font-variable", + "/apps/evolution/mail/display/fonts/variable"); + + e_shell_settings_install_property ( + g_param_spec_boolean ( + "mail-force-message-limit", + NULL, + NULL, + FALSE, + G_PARAM_READWRITE)); + + e_shell_settings_bind_to_gconf ( + shell_settings, "mail-force-message-limit", + "/apps/evolution/mail/display/force_message_limit"); + + e_shell_settings_install_property ( + g_param_spec_boolean ( + "mail-magic-spacebar", + NULL, + NULL, + FALSE, + G_PARAM_READWRITE)); + + e_shell_settings_bind_to_gconf ( + shell_settings, "mail-magic-spacebar", + "/apps/evolution/mail/display/magic_spacebar"); + + e_shell_settings_install_property ( + g_param_spec_boolean ( + "mail-mark-citations", + NULL, + NULL, + FALSE, + G_PARAM_READWRITE)); + + e_shell_settings_bind_to_gconf ( + shell_settings, "mail-mark-citations", + "/apps/evolution/mail/display/mark_citations"); + + e_shell_settings_install_property ( + g_param_spec_boolean ( + "mail-mark-seen", + NULL, + NULL, + FALSE, + G_PARAM_READWRITE)); + + e_shell_settings_bind_to_gconf ( + shell_settings, "mail-mark-seen", + "/apps/evolution/mail/display/mark_seen"); + + e_shell_settings_install_property ( + g_param_spec_int ( + "mail-mark-seen-timeout", + NULL, + NULL, + G_MININT, + G_MAXINT, + 0, + G_PARAM_READWRITE)); + + e_shell_settings_bind_to_gconf ( + shell_settings, "mail-mark-seen-timeout", + "/apps/evolution/mail/display/mark_seen_timeout"); + + e_shell_settings_install_property ( + g_param_spec_int ( + "mail-message-text-part-limit", + NULL, + NULL, + G_MININT, + G_MAXINT, + 0, + G_PARAM_READWRITE)); + + e_shell_settings_bind_to_gconf ( + shell_settings, "mail-message-text-part-limit", + "/apps/evolution/mail/display/message_text_part_limit"); + + e_shell_settings_install_property ( + g_param_spec_boolean ( + "mail-only-local-photos", + NULL, + NULL, + FALSE, + G_PARAM_READWRITE)); + + e_shell_settings_bind_to_gconf ( + shell_settings, "mail-only-local-photos", + "/apps/evolution/mail/display/photo_local"); + + e_shell_settings_install_property ( + g_param_spec_boolean ( + "mail-show-animated-images", + NULL, + NULL, + FALSE, + G_PARAM_READWRITE)); + + e_shell_settings_bind_to_gconf ( + shell_settings, "mail-show-animated-images", + "/apps/evolution/mail/display/animated_images"); + + e_shell_settings_install_property ( + g_param_spec_boolean ( + "mail-show-sender-photo", + NULL, + NULL, + FALSE, + G_PARAM_READWRITE)); + + e_shell_settings_bind_to_gconf ( + shell_settings, "mail-show-sender-photo", + "/apps/evolution/mail/display/sender_photo"); + + e_shell_settings_install_property ( + g_param_spec_boolean ( + "mail-use-custom-fonts", + NULL, + NULL, + FALSE, + G_PARAM_READWRITE)); + + e_shell_settings_bind_to_gconf ( + shell_settings, "mail-use-custom-fonts", + "/apps/evolution/mail/display/fonts/use_custom"); + + + /*** Composer Preferences ***/ + + e_shell_settings_install_property ( + g_param_spec_boolean ( + "composer-format-html", + NULL, + NULL, + FALSE, + G_PARAM_READWRITE)); + + e_shell_settings_bind_to_gconf ( + shell_settings, "composer-format-html", + "/apps/evolution/mail/composer/send_html"); + + e_shell_settings_install_property ( + g_param_spec_boolean ( + "composer-inline-spelling", + NULL, + NULL, + FALSE, + G_PARAM_READWRITE)); + + e_shell_settings_bind_to_gconf ( + shell_settings, "composer-inline-spelling", + "/apps/evolution/mail/composer/inline_spelling"); + + e_shell_settings_install_property ( + g_param_spec_boolean ( + "composer-magic-links", + NULL, + NULL, + FALSE, + G_PARAM_READWRITE)); + + e_shell_settings_bind_to_gconf ( + shell_settings, "composer-magic-links", + "/apps/evolution/mail/composer/magic_links"); + + e_shell_settings_install_property ( + g_param_spec_boolean ( + "composer-magic-smileys", + NULL, + NULL, + FALSE, + G_PARAM_READWRITE)); + + e_shell_settings_bind_to_gconf ( + shell_settings, "composer-magic-smileys", + "/apps/evolution/mail/composer/magic_smileys"); + + e_shell_settings_install_property ( + g_param_spec_boolean ( + "composer-outlook-filenames", + NULL, + NULL, + FALSE, + G_PARAM_READWRITE)); + + e_shell_settings_bind_to_gconf ( + shell_settings, "composer-outlook-filenames", + "/apps/evolution/mail/composer/outlook_filenames"); + + e_shell_settings_install_property ( + g_param_spec_boolean ( + "composer-prompt-only-bcc", + NULL, + NULL, + FALSE, + G_PARAM_READWRITE)); + + e_shell_settings_bind_to_gconf ( + shell_settings, "composer-prompt-only-bcc", + "/apps/evolution/mail/prompts/only_bcc"); + + e_shell_settings_install_property ( + g_param_spec_boolean ( + "composer-prompt-empty-subject", + NULL, + NULL, + FALSE, + G_PARAM_READWRITE)); + + e_shell_settings_bind_to_gconf ( + shell_settings, "composer-prompt-empty-subject", + "/apps/evolution/mail/prompts/empty_subject"); + + e_shell_settings_install_property ( + g_param_spec_boolean ( + "composer-reply-start-bottom", + NULL, + NULL, + FALSE, + G_PARAM_READWRITE)); + + e_shell_settings_bind_to_gconf ( + shell_settings, "composer-reply-start-bottom", + "/apps/evolution/mail/composer/reply_start_bottom"); + + e_shell_settings_install_property ( + g_param_spec_boolean ( + "composer-request-receipt", + NULL, + NULL, + FALSE, + G_PARAM_READWRITE)); + + e_shell_settings_bind_to_gconf ( + shell_settings, "composer-request-receipt", + "/apps/evolution/mail/composer/request_receipt"); + + e_shell_settings_install_property ( + g_param_spec_string ( + "composer-spell-color", + NULL, + NULL, + "#ff0000", + G_PARAM_READWRITE)); + + e_shell_settings_bind_to_gconf ( + shell_settings, "composer-spell-color", + "/apps/evolution/mail/composer/spell_color"); + + e_shell_settings_install_property ( + g_param_spec_boolean ( + "composer-top-signature", + NULL, + NULL, + FALSE, + G_PARAM_READWRITE)); + + e_shell_settings_bind_to_gconf ( + shell_settings, "composer-top-signature", + "/apps/evolution/mail/composer/top_signature"); +} diff --git a/mail/e-mail-shell-module-settings.h b/mail/e-mail-shell-module-settings.h new file mode 100644 index 0000000000..a5528463c7 --- /dev/null +++ b/mail/e-mail-shell-module-settings.h @@ -0,0 +1,33 @@ +/* + * e-mail-shell-module-settings.h + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#ifndef E_MAIL_SHELL_MODULE_SETTINGS_H +#define E_MAIL_SHELL_MODULE_SETTINGS_H + +#include <shell/e-shell.h> + +G_BEGIN_DECLS + +void e_mail_shell_module_init_settings (EShell *shell); + +G_END_DECLS + +#endif /* E_MAIL_SHELL_MODULE_SETTINGS_H */ diff --git a/mail/e-mail-shell-module.c b/mail/e-mail-shell-module.c index 51d109e1e1..04446b1e73 100644 --- a/mail/e-mail-shell-module.c +++ b/mail/e-mail-shell-module.c @@ -32,6 +32,7 @@ #include "e-mail-shell-view.h" #include "e-mail-shell-module.h" #include "e-mail-shell-module-migrate.h" +#include "e-mail-shell-module-settings.h" #include "em-account-prefs.h" #include "em-composer-prefs.h" @@ -43,10 +44,13 @@ #include "em-junk-hook.h" #include "em-mailer-prefs.h" #include "em-network-prefs.h" +#include "em-utils.h" #include "mail-config.h" #include "mail-folder-cache.h" #include "mail-mt.h" +#include "mail-send-recv.h" #include "mail-session.h" +#include "mail-vfolder.h" #include "importers/mail-importer.h" #define MODULE_NAME "mail" @@ -445,7 +449,7 @@ mail_shell_module_init_preferences (EShell *shell) "composer", "preferences-composer", _("Composer Preferences"), - em_composer_prefs_new (), + em_composer_prefs_new (shell), 400); e_preferences_window_add_page ( @@ -457,267 +461,6 @@ mail_shell_module_init_preferences (EShell *shell) 500); } -static void -mail_shell_module_init_settings (EShell *shell) -{ - EShellSettings *shell_settings; - - shell_settings = e_shell_get_settings (shell); - - /* XXX Default values should match the GConf schema. - * Yes it's redundant, but we're stuck with GConf. */ - - /*** Mail Preferences ***/ - - e_shell_settings_install_property ( - g_param_spec_boolean ( - "mail-address-compress", - NULL, - NULL, - FALSE, - G_PARAM_READWRITE)); - - e_shell_settings_install_property ( - g_param_spec_int ( - "mail-address-count", - NULL, - NULL, - G_MININT, - G_MAXINT, - 0, - G_PARAM_READWRITE)); - - e_shell_settings_install_property ( - g_param_spec_string ( - "mail-citation-color", - NULL, - NULL, - "#737373", - G_PARAM_READWRITE)); - - e_shell_settings_install_property ( - g_param_spec_boolean ( - "mail-check-for-junk", - NULL, - NULL, - FALSE, - G_PARAM_READWRITE)); - - e_shell_settings_install_property ( - g_param_spec_boolean ( - "mail-confirm-expunge", - NULL, - NULL, - FALSE, - G_PARAM_READWRITE)); - - e_shell_settings_install_property ( - g_param_spec_boolean ( - "mail-confirm-unwanted-html", - NULL, - NULL, - FALSE, - G_PARAM_READWRITE)); - - e_shell_settings_install_property ( - g_param_spec_boolean ( - "mail-empty-trash-on-exit", - NULL, - NULL, - FALSE, - G_PARAM_READWRITE)); - - e_shell_settings_install_property ( - g_param_spec_boolean ( - "mail-enable-search-folders", - NULL, - NULL, - FALSE, - G_PARAM_READWRITE)); - - e_shell_settings_install_property ( - g_param_spec_string ( - "mail-font-monospace", - NULL, - NULL, - "", - G_PARAM_READWRITE)); - - e_shell_settings_install_property ( - g_param_spec_string ( - "mail-font-variable", - NULL, - NULL, - "", - G_PARAM_READWRITE)); - - e_shell_settings_install_property ( - g_param_spec_boolean ( - "mail-force-message-limit", - NULL, - NULL, - FALSE, - G_PARAM_READWRITE)); - - e_shell_settings_install_property ( - g_param_spec_boolean ( - "mail-magic-spacebar", - NULL, - NULL, - FALSE, - G_PARAM_READWRITE)); - - e_shell_settings_install_property ( - g_param_spec_boolean ( - "mail-mark-citations", - NULL, - NULL, - FALSE, - G_PARAM_READWRITE)); - - e_shell_settings_install_property ( - g_param_spec_boolean ( - "mail-mark-seen", - NULL, - NULL, - FALSE, - G_PARAM_READWRITE)); - - e_shell_settings_install_property ( - g_param_spec_int ( - "mail-mark-seen-timeout", - NULL, - NULL, - G_MININT, - G_MAXINT, - 0, - G_PARAM_READWRITE)); - - e_shell_settings_install_property ( - g_param_spec_int ( - "mail-message-text-part-limit", - NULL, - NULL, - G_MININT, - G_MAXINT, - 0, - G_PARAM_READWRITE)); - - e_shell_settings_install_property ( - g_param_spec_boolean ( - "mail-only-local-photos", - NULL, - NULL, - FALSE, - G_PARAM_READWRITE)); - - e_shell_settings_install_property ( - g_param_spec_boolean ( - "mail-show-animated-images", - NULL, - NULL, - FALSE, - G_PARAM_READWRITE)); - - e_shell_settings_install_property ( - g_param_spec_boolean ( - "mail-show-sender-photo", - NULL, - NULL, - FALSE, - G_PARAM_READWRITE)); - - e_shell_settings_install_property ( - g_param_spec_boolean ( - "mail-use-custom-fonts", - NULL, - NULL, - FALSE, - G_PARAM_READWRITE)); - - /* Bind shell settings to GConf keys. */ - - e_shell_settings_bind_to_gconf ( - shell_settings, "mail-address-compress", - "/apps/evolution/mail/display/address_compress"); - - e_shell_settings_bind_to_gconf ( - shell_settings, "mail-address-count", - "/apps/evolution/mail/display/address_count"); - - e_shell_settings_bind_to_gconf ( - shell_settings, "mail-citation-color", - "/apps/evolution/mail/display/citation_colour"); - - e_shell_settings_bind_to_gconf ( - shell_settings, "mail-check-for-junk", - "/apps/evolution/mail/junk/check_incoming"); - - e_shell_settings_bind_to_gconf ( - shell_settings, "mail-confirm-expunge", - "/apps/evolution/mail/prompts/expunge"); - - e_shell_settings_bind_to_gconf ( - shell_settings, "mail-confirm-unwanted-html", - "/apps/evolution/mail/prompts/unwanted_html"); - - e_shell_settings_bind_to_gconf ( - shell_settings, "mail-empty-trash-on-exit", - "/apps/evolution/mail/trash/empty_on_exit"); - - e_shell_settings_bind_to_gconf ( - shell_settings, "mail-enable-search-folders", - "/apps/evolution/mail/display/enable_vfolders"); - - e_shell_settings_bind_to_gconf ( - shell_settings, "mail-font-monospace", - "/apps/evolution/mail/display/fonts/monospace"); - - e_shell_settings_bind_to_gconf ( - shell_settings, "mail-font-variable", - "/apps/evolution/mail/display/fonts/variable"); - - e_shell_settings_bind_to_gconf ( - shell_settings, "mail-force-message-limit", - "/apps/evolution/mail/display/force_message_limit"); - - e_shell_settings_bind_to_gconf ( - shell_settings, "mail-magic-spacebar", - "/apps/evolution/mail/display/magic_spacebar"); - - e_shell_settings_bind_to_gconf ( - shell_settings, "mail-mark-citations", - "/apps/evolution/mail/display/mark_citations"); - - e_shell_settings_bind_to_gconf ( - shell_settings, "mail-mark-seen", - "/apps/evolution/mail/display/mark_seen"); - - e_shell_settings_bind_to_gconf ( - shell_settings, "mail-mark-seen-timeout", - "/apps/evolution/mail/display/mark_seen_timeout"); - - e_shell_settings_bind_to_gconf ( - shell_settings, "mail-message-text-part-limit", - "/apps/evolution/mail/display/message_text_part_limit"); - - e_shell_settings_bind_to_gconf ( - shell_settings, "mail-only-local-photos", - "/apps/evolution/mail/display/photo_local"); - - e_shell_settings_bind_to_gconf ( - shell_settings, "mail-show-animated-images", - "/apps/evolution/mail/display/animated_images"); - - e_shell_settings_bind_to_gconf ( - shell_settings, "mail-show-sender-photo", - "/apps/evolution/mail/display/sender_photo"); - - e_shell_settings_bind_to_gconf ( - shell_settings, "mail-use-custom-fonts", - "/apps/evolution/mail/display/fonts/use_custom"); -} - static gboolean mail_shell_module_handle_uri_cb (EShell *shell, const gchar *uri, @@ -728,6 +471,15 @@ mail_shell_module_handle_uri_cb (EShell *shell, } static void +mail_shell_module_send_receive_cb (EShell *shell, + GtkWindow *parent, + EShellModule *shell_module) +{ + em_utils_clear_get_password_canceled_accounts_flag (); + mail_send_receive (parent); +} + +static void mail_shell_module_window_weak_notify_cb (EShell *shell, GObject *where_the_object_was) { @@ -779,6 +531,7 @@ e_shell_module_init (GTypeModule *type_module) { EShell *shell; EShellModule *shell_module; + gboolean enable_search_folders; shell_module = E_SHELL_MODULE (type_module); shell = e_shell_module_get_shell (shell_module); @@ -811,6 +564,11 @@ e_shell_module_init (GTypeModule *type_module) shell_module); g_signal_connect ( + shell, "send-receive", + G_CALLBACK (mail_shell_module_send_receive_cb), + shell_module); + + g_signal_connect ( shell, "window-created", G_CALLBACK (mail_shell_module_window_created_cb), shell_module); @@ -823,8 +581,15 @@ e_shell_module_init (GTypeModule *type_module) /* Initialize settings before initializing preferences, * since the preferences bind to the shell settings. */ - mail_shell_module_init_settings (shell); + e_mail_shell_module_init_settings (shell); mail_shell_module_init_preferences (shell); + + g_object_get ( + e_shell_get_settings (shell), + "mail-enable-search-folders", + &enable_search_folders, NULL); + if (enable_search_folders) + vfolder_load_storage (); } /******************************** Public API *********************************/ diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c index 62f1b89d6b..866d503292 100644 --- a/mail/em-account-editor.c +++ b/mail/em-account-editor.c @@ -661,10 +661,19 @@ emae_signaturetype_changed(GtkComboBox *dropdown, EMAccountEditor *emae) static void emae_signature_new(GtkWidget *w, EMAccountEditor *emae) { - /* TODO: why is this in composer prefs? apart from it being somewhere to put it? */ - em_composer_prefs_new_signature((GtkWindow *)gtk_widget_get_toplevel(w), - gconf_client_get_bool(mail_config_get_gconf_client(), - "/apps/evolution/mail/composer/send_html", NULL)); + EShell *shell; + EShellSettings *shell_settings; + GtkWidget *parent; + gboolean html_mode; + + shell = e_shell_get_default (); + shell_settings = e_shell_get_settings (shell); + parent = gtk_widget_get_toplevel (w); + + g_object_get ( + shell_settings, "composer-format-html", &html_mode, NULL); + + em_composer_prefs_new_signature (GTK_WINDOW (parent), html_mode); } static GtkWidget * diff --git a/mail/em-composer-prefs.c b/mail/em-composer-prefs.c index 0b19cc24bf..dfc50edf0e 100644 --- a/mail/em-composer-prefs.c +++ b/mail/em-composer-prefs.c @@ -30,6 +30,7 @@ #include <unistd.h> #include <fcntl.h> +#include "e-util/e-binding.h" #include "e-util/e-signature.h" #include "e-util/e-signature-list.h" #include "e-util/gconf-bridge.h" @@ -37,12 +38,11 @@ #include "em-composer-prefs.h" #include "composer/e-msg-composer.h" -#include <bonobo/bonobo-generic-factory.h> - #include <camel/camel-iconv.h> #include <misc/e-gui-utils.h> +#include <glib/gi18n.h> #include <glib/gstdio.h> #include <gdk/gdkkeysyms.h> @@ -59,6 +59,38 @@ static gpointer parent_class; +static gboolean +transform_color_to_string (const GValue *src_value, + GValue *dst_value, + gpointer user_data) +{ + const GdkColor *color; + gchar *string; + + color = g_value_get_boxed (src_value); + string = gdk_color_to_string (color); + g_value_set_string (dst_value, string); + g_free (string); + + return TRUE; +} + +static gboolean +transform_string_to_color (const GValue *src_value, + GValue *dst_value, + gpointer user_data) +{ + GdkColor color; + const gchar *string; + gboolean success; + + string = g_value_get_string (src_value); + if (gdk_color_parse (string, &color)) + g_value_set_boxed (dst_value, &color); + + return success; +} + static void composer_prefs_dispose (GObject *object) { @@ -539,25 +571,6 @@ url_requested (GtkHTML *html, } static void -spell_color_set (GtkColorButton *color_button, - EMComposerPrefs *prefs) -{ - GConfClient *client; - const gchar *key; - GdkColor color; - gchar *string; - - gtk_color_button_get_color (color_button, &color); - string = gdk_color_to_string (&color); - - client = mail_config_get_gconf_client (); - key = "/apps/evolution/mail/composer/spell_color"; - gconf_client_set_string (client, key, string, NULL); - - g_free (string); -} - -static void spell_language_toggled_cb (GtkCellRendererToggle *renderer, const gchar *path_string, EMComposerPrefs *prefs) @@ -621,9 +634,6 @@ spell_setup (EMComposerPrefs *prefs) GList *active_languages; GConfClient *client; GtkListStore *store; - GdkColor color; - const gchar *key; - gchar *string; client = mail_config_get_gconf_client (); store = GTK_LIST_STORE (prefs->language_model); @@ -652,16 +662,6 @@ spell_setup (EMComposerPrefs *prefs) } g_list_free (active_languages); - - key = "/apps/evolution/mail/composer/spell_color"; - string = gconf_client_get_string (client, key, NULL); - if (string == NULL || !gdk_color_parse (string, &color)) - gdk_color_parse ("Red", &color); - gtk_color_button_set_color (GTK_COLOR_BUTTON (prefs->color), &color); - - g_signal_connect ( - prefs->color, "color_set", - G_CALLBACK (spell_color_set), prefs); } static gint @@ -832,9 +832,11 @@ sig_tree_event_cb (GtkTreeView *tree_view, } static void -em_composer_prefs_construct (EMComposerPrefs *prefs) +em_composer_prefs_construct (EMComposerPrefs *prefs, + EShell *shell) { GtkWidget *toplevel, *widget, *menu, *info_pixmap; + EShellSettings *shell_settings; GtkDialog *dialog; GladeXML *gui; GtkTreeView *view; @@ -855,6 +857,7 @@ em_composer_prefs_construct (EMComposerPrefs *prefs) bridge = gconf_bridge_get (); client = mail_config_get_gconf_client (); + shell_settings = e_shell_get_settings (shell); gladefile = g_build_filename (EVOLUTION_GLADEDIR, "mail-config.glade", @@ -881,57 +884,50 @@ em_composer_prefs_construct (EMComposerPrefs *prefs) /* General tab */ /* Default Behavior */ - key = "/apps/evolution/mail/composer/send_html"; widget = glade_xml_get_widget (gui, "chkSendHTML"); - if (!gconf_client_key_is_writable (client, key, NULL)) - gtk_widget_set_sensitive (widget, FALSE); - gconf_bridge_bind_property (bridge, key, G_OBJECT (widget), "active"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "composer-format-html", + G_OBJECT (widget), "active"); - key = "/apps/evolution/mail/prompts/empty_subject"; widget = glade_xml_get_widget (gui, "chkPromptEmptySubject"); - if (!gconf_client_key_is_writable (client, key, NULL)) - gtk_widget_set_sensitive (widget, FALSE); - gconf_bridge_bind_property (bridge, key, G_OBJECT (widget), "active"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "composer-prompt-empty-subject", + G_OBJECT (widget), "active"); - key = "/apps/evolution/mail/prompts/only_bcc"; widget = glade_xml_get_widget (gui, "chkPromptBccOnly"); - if (!gconf_client_key_is_writable (client, key, NULL)) - gtk_widget_set_sensitive (widget, FALSE); - gconf_bridge_bind_property (bridge, key, G_OBJECT (widget), "active"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "composer-prompt-only-bcc", + G_OBJECT (widget), "active"); - key = "/apps/evolution/mail/composer/magic_smileys"; widget = glade_xml_get_widget (gui, "chkAutoSmileys"); - if (!gconf_client_key_is_writable (client, key, NULL)) - gtk_widget_set_sensitive (widget, FALSE); - gconf_bridge_bind_property (bridge, key, G_OBJECT (widget), "active"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "composer-magic-smileys", + G_OBJECT (widget), "active"); - key = "/apps/evolution/mail/composer/request_receipt"; widget = glade_xml_get_widget (gui, "chkRequestReceipt"); - if (!gconf_client_key_is_writable (client, key, NULL)) - gtk_widget_set_sensitive (widget, FALSE); - gconf_bridge_bind_property (bridge, key, G_OBJECT (widget), "active"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "composer-request-receipt", + G_OBJECT (widget), "active"); - key = "/apps/evolution/mail/composer/reply_start_bottom"; widget = glade_xml_get_widget (gui, "chkReplyStartBottom"); - if (!gconf_client_key_is_writable (client, key, NULL)) - gtk_widget_set_sensitive (widget, FALSE); - gconf_bridge_bind_property (bridge, key, G_OBJECT (widget), "active"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "composer-reply-start-bottom", + G_OBJECT (widget), "active"); - key = "/apps/evolution/mail/composer/outlook_filenames"; widget = glade_xml_get_widget (gui, "chkOutlookFilenames"); - if (!gconf_client_key_is_writable (client, key, NULL)) - gtk_widget_set_sensitive (widget, FALSE); - gconf_bridge_bind_property (bridge, key, G_OBJECT (widget), "active"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "composer-outlook-filenames", + G_OBJECT (widget), "active"); - key = "/apps/evolution/mail/composer/top_signature"; widget = glade_xml_get_widget (gui, "chkTopSignature"); - if (!gconf_client_key_is_writable (client, key, NULL)) - gtk_widget_set_sensitive (widget, FALSE); - gconf_bridge_bind_property (bridge, key, G_OBJECT (widget), "active"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "composer-top-signature", + G_OBJECT (widget), "active"); - key = "/apps/evolution/mail/composer/inline_spelling"; widget = glade_xml_get_widget (gui, "chkEnableSpellChecking"); - gconf_bridge_bind_property (bridge, key, G_OBJECT (widget), "active"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "composer-inline-spelling", + G_OBJECT (widget), "active"); prefs->charset = GTK_OPTION_MENU ( glade_xml_get_widget (gui, "omenuCharset1")); @@ -947,8 +943,6 @@ em_composer_prefs_construct (EMComposerPrefs *prefs) g_free (buf); /* Spell Checking */ - widget = glade_xml_get_widget (gui, "colorButtonSpellCheckColor"); - prefs->color = GTK_COLOR_BUTTON (widget); widget = glade_xml_get_widget (gui, "listSpellCheckLanguage"); view = GTK_TREE_VIEW (widget); store = gtk_list_store_new ( @@ -976,6 +970,15 @@ em_composer_prefs_construct (EMComposerPrefs *prefs) gtk_image_set_from_stock ( GTK_IMAGE (info_pixmap), GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_BUTTON); + + widget = glade_xml_get_widget (gui, "colorButtonSpellCheckColor"); + e_mutual_binding_new_full ( + G_OBJECT (shell_settings), "composer-spell-color", + G_OBJECT (widget), "color", + transform_string_to_color, + transform_color_to_string, + NULL, NULL); + spell_setup (prefs); /* Forwards and Replies */ @@ -1094,12 +1097,14 @@ em_composer_prefs_construct (EMComposerPrefs *prefs) } GtkWidget * -em_composer_prefs_new (void) +em_composer_prefs_new (EShell *shell) { EMComposerPrefs *prefs; + g_return_val_if_fail (E_IS_SHELL (shell), NULL); + prefs = g_object_new (EM_TYPE_COMPOSER_PREFS, NULL); - em_composer_prefs_construct (prefs); + em_composer_prefs_construct (prefs, shell); return GTK_WIDGET (prefs); } diff --git a/mail/em-composer-prefs.h b/mail/em-composer-prefs.h index 6fcab979f4..0906253af6 100644 --- a/mail/em-composer-prefs.h +++ b/mail/em-composer-prefs.h @@ -20,10 +20,12 @@ * */ -#ifndef __EM_COMPOSER_PREFS_H__ -#define __EM_COMPOSER_PREFS_H__ +#ifndef EM_COMPOSER_PREFS_H +#define EM_COMPOSER_PREFS_H #include <gtk/gtk.h> +#include <glade/glade.h> +#include <shell/e-shell.h> /* Standard GObject macros */ #define EM_TYPE_COMPOSER_PREFS \ @@ -50,19 +52,17 @@ typedef struct _EMComposerPrefs EMComposerPrefs; typedef struct _EMComposerPrefsClass EMComposerPrefsClass; struct _ESignature; -struct _GladeXML; struct _EMComposerPrefs { GtkVBox parent; - struct _GladeXML *gui; + GladeXML *gui; /* General tab */ /* Default Behavior */ GtkOptionMenu *charset; - GtkColorButton *color; GtkTreeModel *language_model; /* Forwards and Replies */ @@ -81,7 +81,7 @@ struct _EMComposerPrefs { GtkButton *sig_delete; struct _GtkHTML *sig_preview; - struct _GladeXML *sig_script_gui; + GladeXML *sig_script_gui; GtkWidget *sig_script_dialog; guint sig_added_id; @@ -94,7 +94,7 @@ struct _EMComposerPrefsClass { }; GType em_composer_prefs_get_type (void); -GtkWidget * em_composer_prefs_new (void); +GtkWidget * em_composer_prefs_new (EShell *shell); void em_composer_prefs_new_signature (GtkWindow *parent, gboolean html_mode); @@ -104,4 +104,4 @@ void em_composer_prefs_new_signature (GtkWindow *parent, G_END_DECLS -#endif /* __EM_COMPOSER_PREFS_H__ */ +#endif /* EM_COMPOSER_PREFS_H */ diff --git a/mail/mail-component.c b/mail/mail-component.c index e9c7de3173..890046e48c 100644 --- a/mail/mail-component.c +++ b/mail/mail-component.c @@ -375,40 +375,40 @@ struct _MailComponentPrivate { // } //} -static void -mc_startup(MailComponent *mc) -{ - static int started = 0; - GConfClient *gconf; - - if (started) - return; - started = 1; - - mc_setup_local_store(mc); - load_accounts(mc, mail_config_get_accounts()); - - gconf = mail_config_get_gconf_client(); - - if (gconf_client_get_bool (gconf, "/apps/evolution/mail/display/enable_vfolders", NULL)) - vfolder_load_storage(); -} - -static void -folder_selected_cb (EMFolderTree *emft, const char *path, const char *uri, guint32 flags, EMFolderView *view) -{ - EMFolderTreeModel *model; - - if ((flags & CAMEL_FOLDER_NOSELECT) || !path) { - em_folder_view_set_folder (view, NULL, NULL); - } else { - model = em_folder_tree_get_model (emft); - em_folder_tree_model_set_selected (model, uri); - em_folder_tree_model_save_state (model); +//static void +//mc_startup(MailComponent *mc) +//{ +// static int started = 0; +// GConfClient *gconf; +// +// if (started) +// return; +// started = 1; +// +// mc_setup_local_store(mc); +// load_accounts(mc, mail_config_get_accounts()); +// +// gconf = mail_config_get_gconf_client(); +// +// if (gconf_client_get_bool (gconf, "/apps/evolution/mail/display/enable_vfolders", NULL)) +// vfolder_load_storage(); +//} - em_folder_view_set_folder_uri (view, uri); - } -} +//static void +//folder_selected_cb (EMFolderTree *emft, const char *path, const char *uri, guint32 flags, EMFolderView *view) +//{ +// EMFolderTreeModel *model; +// +// if ((flags & CAMEL_FOLDER_NOSELECT) || !path) { +// em_folder_view_set_folder (view, NULL, NULL); +// } else { +// model = em_folder_tree_get_model (emft); +// em_folder_tree_model_set_selected (model, uri); +// em_folder_tree_model_save_state (model); +// +// em_folder_view_set_folder_uri (view, uri); +// } +//} static int check_autosave(void *data) @@ -1061,12 +1061,12 @@ impl_handleURI (PortableServer_Servant servant, const char *uri, CORBA_Environme } } -static void -impl_sendAndReceive (PortableServer_Servant servant, CORBA_Environment *ev) -{ - em_utils_clear_get_password_canceled_accounts_flag (); - mail_send_receive (); -} +//static void +//impl_sendAndReceive (PortableServer_Servant servant, CORBA_Environment *ev) +//{ +// em_utils_clear_get_password_canceled_accounts_flag (); +// mail_send_receive (); +//} //static void //impl_upgradeFromVersion (PortableServer_Servant servant, const short major, const short minor, const short revision, CORBA_Environment *ev) diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c index 87948fdf53..70b69f0c97 100644 --- a/mail/mail-send-recv.c +++ b/mail/mail-send-recv.c @@ -362,7 +362,10 @@ get_receive_type(const char *url) } static struct _send_data * -build_dialog (EAccountList *accounts, CamelFolder *outbox, const char *destination) +build_dialog (GtkWindow *parent, + EAccountList *accounts, + CamelFolder *outbox, + const gchar *destination) { GtkDialog *gd; GtkWidget *table; @@ -382,7 +385,10 @@ build_dialog (EAccountList *accounts, CamelFolder *outbox, const char *destinati EIterator *iter; EMEventTargetSendReceive *target; - gd = (GtkDialog *)(send_recv_dialog = gtk_dialog_new_with_buttons(_("Send & Receive Mail"), NULL, GTK_DIALOG_NO_SEPARATOR, NULL)); + send_recv_dialog = gtk_dialog_new_with_buttons ( + _("Send & Receive Mail"), parent, + GTK_DIALOG_NO_SEPARATOR, NULL); + gd = GTK_DIALOG (send_recv_dialog); gtk_window_set_modal ((GtkWindow *) gd, FALSE); gconf_bridge_bind_window_size ( @@ -904,7 +910,7 @@ receive_update_got_store (char *uri, CamelStore *store, void *data) } GtkWidget * -mail_send_receive (void) +mail_send_receive (GtkWindow *parent) { CamelFolder *outbox_folder; struct _send_data *data; @@ -931,7 +937,8 @@ mail_send_receive (void) outbox_folder = e_mail_shell_module_get_folder ( mail_shell_module, E_MAIL_FOLDER_OUTBOX); - data = build_dialog (accounts, outbox_folder, account->transport->url); + data = build_dialog ( + parent, accounts, outbox_folder, account->transport->url); scan = data->infos; while (scan) { struct _send_info *info = scan->data; diff --git a/mail/mail-send-recv.h b/mail/mail-send-recv.h index 4fc4e991ec..92daaa5cd7 100644 --- a/mail/mail-send-recv.h +++ b/mail/mail-send-recv.h @@ -29,7 +29,7 @@ G_BEGIN_DECLS /* send/receive all uri's */ -GtkWidget * mail_send_receive (void); +GtkWidget * mail_send_receive (GtkWindow *parent); /* receive a single uri */ void mail_receive_uri (const gchar *uri, |