aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
Diffstat (limited to 'mail')
-rw-r--r--mail/e-mail-browser.c44
-rw-r--r--mail/e-mail-browser.h1
-rw-r--r--mail/e-mail-reader.c258
-rw-r--r--mail/e-mail-reader.h25
-rw-r--r--mail/e-mail-shell-content.c36
-rw-r--r--mail/e-mail-shell-view-actions.c1
-rw-r--r--mail/e-mail-shell-view-private.h4
-rw-r--r--mail/e-mail-shell-view.c30
-rw-r--r--mail/em-folder-view.c126
-rw-r--r--mail/evolution-mail.schemas.in14
10 files changed, 331 insertions, 208 deletions
diff --git a/mail/e-mail-browser.c b/mail/e-mail-browser.c
index 04ea6e1208..13647c1f62 100644
--- a/mail/e-mail-browser.c
+++ b/mail/e-mail-browser.c
@@ -21,6 +21,7 @@
#include "e-mail-browser.h"
+#include <string.h>
#include <glib/gi18n.h>
#include <camel/camel-folder.h>
@@ -220,8 +221,8 @@ mail_browser_get_property (GObject *object,
switch (property_id) {
case PROP_SHELL_MODULE:
g_value_set_object (
- value, e_mail_browser_get_shell_module (
- E_MAIL_BROWSER (object)));
+ value, e_mail_reader_get_shell_module (
+ E_MAIL_READER (object)));
return;
case PROP_UI_MANAGER:
@@ -295,15 +296,19 @@ mail_browser_constructed (GObject *object)
GtkUIManager *ui_manager;
GtkWidget *container;
GtkWidget *widget;
+ const gchar *domain;
+ guint merge_id;
priv = E_MAIL_BROWSER_GET_PRIVATE (object);
reader = E_MAIL_READER (object);
- action_group = priv->action_group;
ui_manager = priv->ui_manager;
+ domain = GETTEXT_PACKAGE;
e_mail_reader_init (reader);
+ action_group = priv->action_group;
+ gtk_action_group_set_translation_domain (action_group, domain);
gtk_action_group_add_actions (
action_group, mail_browser_entries,
G_N_ELEMENTS (mail_browser_entries), object);
@@ -312,6 +317,9 @@ mail_browser_constructed (GObject *object)
e_load_ui_definition (ui_manager, E_MAIL_READER_UI_DEFINITION);
gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, NULL);
+ merge_id = gtk_ui_manager_new_merge_id (ui_manager);
+ e_mail_reader_create_charset_menu (reader, ui_manager, merge_id);
+
accel_group = gtk_ui_manager_get_accel_group (ui_manager);
gtk_window_add_accel_group (GTK_WINDOW (object), accel_group);
@@ -369,16 +377,6 @@ mail_browser_get_action_group (EMailReader *reader)
return priv->action_group;
}
-static CamelFolder *
-mail_browser_get_folder (EMailReader *reader)
-{
-}
-
-static const gchar *
-mail_browser_get_folder_uri (EMailReader *reader)
-{
-}
-
static gboolean
mail_browser_get_hide_deleted (EMailReader *reader)
{
@@ -404,16 +402,14 @@ mail_browser_get_message_list (EMailReader *reader)
return MESSAGE_LIST (priv->message_list);
}
-static EMFolderTreeModel *
-mail_browser_get_tree_model (EMailReader *reader)
+static EShellModule *
+mail_browser_get_shell_module (EMailReader *reader)
{
EMailBrowserPrivate *priv;
- EShellModule *shell_module;
priv = E_MAIL_BROWSER_GET_PRIVATE (reader);
- shell_module = priv->shell_module;
- return e_mail_shell_module_get_folder_tree_model (shell_module);
+ return priv->shell_module;
}
static GtkWindow *
@@ -452,12 +448,10 @@ static void
mail_browser_iface_init (EMailReaderIface *iface)
{
iface->get_action_group = mail_browser_get_action_group;
- iface->get_folder = mail_browser_get_folder;
- iface->get_folder_uri = mail_browser_get_folder_uri;
iface->get_hide_deleted = mail_browser_get_hide_deleted;
iface->get_html_display = mail_browser_get_html_display;
iface->get_message_list = mail_browser_get_message_list;
- iface->get_tree_model = mail_browser_get_tree_model;
+ iface->get_shell_module = mail_browser_get_shell_module;
iface->get_window = mail_browser_get_window;
}
@@ -529,14 +523,6 @@ e_mail_browser_new (EShellModule *shell_module)
"shell-module", shell_module, NULL);
}
-EShellModule *
-e_mail_browser_get_shell_module (EMailBrowser *browser)
-{
- g_return_val_if_fail (E_IS_MAIL_BROWSER (browser), NULL);
-
- return browser->priv->shell_module;
-}
-
GtkUIManager *
e_mail_browser_get_ui_manager (EMailBrowser *browser)
{
diff --git a/mail/e-mail-browser.h b/mail/e-mail-browser.h
index e5096fbe85..5bac3896a8 100644
--- a/mail/e-mail-browser.h
+++ b/mail/e-mail-browser.h
@@ -61,7 +61,6 @@ struct _EMailBrowserClass {
GType e_mail_browser_get_type (void);
GtkWidget * e_mail_browser_new (EShellModule *shell_module);
-EShellModule * e_mail_browser_get_shell_module (EMailBrowser *browser);
GtkUIManager * e_mail_browser_get_ui_manager (EMailBrowser *browser);
G_END_DECLS
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index 702bf624f3..4c09f96c55 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -29,9 +29,12 @@
#include <X11/XF86keysym.h>
#endif
+#include "e-util/e-util.h"
#include "e-util/gconf-bridge.h"
+#include "widgets/misc/e-charset-picker.h"
#include "mail/e-mail-reader-utils.h"
+#include "mail/e-mail-shell-module.h"
#include "mail/em-composer-utils.h"
#include "mail/em-folder-selector.h"
#include "mail/em-folder-tree.h"
@@ -53,10 +56,10 @@ action_mail_add_sender_cb (GtkAction *action,
GPtrArray *uids;
const gchar *address;
- folder = e_mail_reader_get_folder (reader);
message_list = e_mail_reader_get_message_list (reader);
window = e_mail_reader_get_window (reader);
+ folder = message_list->folder;
uids = message_list_get_selected (message_list);
if (uids->len != 1)
@@ -90,6 +93,24 @@ action_mail_caret_mode_cb (GtkToggleAction *action,
}
static void
+action_mail_charset_cb (GtkRadioAction *action,
+ GtkRadioAction *current,
+ EMailReader *reader)
+{
+ EMFormatHTMLDisplay *html_display;
+ const gchar *charset;
+
+ if (action != current)
+ return;
+
+ html_display = e_mail_reader_get_html_display (reader);
+ charset = g_object_get_data (G_OBJECT (action), "charset");
+
+ /* Charset for "Default" action will be NULL. */
+ em_format_set_charset ((EMFormat *) html_display, charset);
+}
+
+static void
action_mail_check_for_junk_cb (GtkAction *action,
EMailReader *reader)
{
@@ -97,9 +118,9 @@ action_mail_check_for_junk_cb (GtkAction *action,
CamelFolder *folder;
GPtrArray *uids;
- folder = e_mail_reader_get_folder (reader);
message_list = e_mail_reader_get_message_list (reader);
+ folder = message_list->folder;
uids = message_list_get_selected (message_list);
mail_filter_junk (folder, uids);
@@ -122,6 +143,7 @@ static void
action_mail_copy_cb (GtkAction *action,
EMailReader *reader)
{
+ EShellModule *shell_module;
MessageList *message_list;
EMFolderTreeModel *model;
CamelFolder *folder;
@@ -130,13 +152,15 @@ action_mail_copy_cb (GtkAction *action,
GPtrArray *selected;
const gchar *uri;
- folder = e_mail_reader_get_folder (reader);
message_list = e_mail_reader_get_message_list (reader);
- model = e_mail_reader_get_tree_model (reader);
+ shell_module = e_mail_reader_get_shell_module (reader);
+ model = e_mail_shell_module_get_folder_tree_model (shell_module);
folder_tree = em_folder_tree_new_with_model (model);
selected = message_list_get_selected (message_list);
+ folder = message_list->folder;
+
em_folder_tree_set_excluded (
EM_FOLDER_TREE (folder_tree),
EMFT_EXCLUDE_NOSELECT | EMFT_EXCLUDE_VIRTUAL |
@@ -227,9 +251,9 @@ action_mail_filters_apply_cb (GtkAction *action,
CamelFolder *folder;
GPtrArray *uids;
- folder = e_mail_reader_get_folder (reader);
message_list = e_mail_reader_get_message_list (reader);
+ folder = message_list->folder;
uids = message_list_get_selected (message_list);
mail_filter_on_demand (folder, uids);
@@ -252,11 +276,11 @@ action_mail_flag_clear_cb (GtkAction *action,
GtkWindow *window;
GPtrArray *uids;
- folder = e_mail_reader_get_folder (reader);
html_display = e_mail_reader_get_html_display (reader);
message_list = e_mail_reader_get_message_list (reader);
window = e_mail_reader_get_window (reader);
+ folder = message_list->folder;
uids = message_list_get_selected (message_list);
em_utils_flag_for_followup_clear (window, folder, uids);
@@ -274,11 +298,11 @@ action_mail_flag_completed_cb (GtkAction *action,
GtkWindow *window;
GPtrArray *uids;
- folder = e_mail_reader_get_folder (reader);
html_display = e_mail_reader_get_html_display (reader);
message_list = e_mail_reader_get_message_list (reader);
window = e_mail_reader_get_window (reader);
+ folder = message_list->folder;
uids = message_list_get_selected (message_list);
em_utils_flag_for_followup_completed (window, folder, uids);
@@ -295,10 +319,10 @@ action_mail_flag_for_followup_cb (GtkAction *action,
GtkWindow *window;
GPtrArray *uids;
- folder = e_mail_reader_get_folder (reader);
message_list = e_mail_reader_get_message_list (reader);
window = e_mail_reader_get_window (reader);
+ folder = message_list->folder;
uids = message_list_get_selected (message_list);
em_utils_flag_for_followup (window, folder, uids);
@@ -314,14 +338,14 @@ action_mail_forward_cb (GtkAction *action,
GPtrArray *uids;
const gchar *folder_uri;
- folder = e_mail_reader_get_folder (reader);
- folder_uri = e_mail_reader_get_folder_uri (reader);
message_list = e_mail_reader_get_message_list (reader);
window = e_mail_reader_get_window (reader);
if (!em_utils_check_user_can_send_mail (window))
return;
+ folder = message_list->folder;
+ folder_uri = message_list->folder_uri;
uids = message_list_get_selected (message_list);
em_utils_forward_messages (folder, uids, folder_uri);
@@ -337,14 +361,14 @@ action_mail_forward_attached_cb (GtkAction *action,
GPtrArray *uids;
const gchar *folder_uri;
- folder = e_mail_reader_get_folder (reader);
- folder_uri = e_mail_reader_get_folder_uri (reader);
message_list = e_mail_reader_get_message_list (reader);
window = e_mail_reader_get_window (reader);
if (!em_utils_check_user_can_send_mail (window))
return;
+ folder = message_list->folder;
+ folder_uri = message_list->folder_uri;
uids = message_list_get_selected (message_list);
em_utils_forward_attached (folder, uids, folder_uri);
@@ -360,14 +384,14 @@ action_mail_forward_inline_cb (GtkAction *action,
GPtrArray *uids;
const gchar *folder_uri;
- folder = e_mail_reader_get_folder (reader);
- folder_uri = e_mail_reader_get_folder_uri (reader);
message_list = e_mail_reader_get_message_list (reader);
window = e_mail_reader_get_window (reader);
if (!em_utils_check_user_can_send_mail (window))
return;
+ folder = message_list->folder;
+ folder_uri = message_list->folder_uri;
uids = message_list_get_selected (message_list);
em_utils_forward_inline (folder, uids, folder_uri);
@@ -383,14 +407,14 @@ action_mail_forward_quoted_cb (GtkAction *action,
GPtrArray *uids;
const gchar *folder_uri;
- folder = e_mail_reader_get_folder (reader);
- folder_uri = e_mail_reader_get_folder_uri (reader);
message_list = e_mail_reader_get_message_list (reader);
window = e_mail_reader_get_window (reader);
if (!em_utils_check_user_can_send_mail (window))
return;
+ folder = message_list->folder;
+ folder_uri = message_list->folder_uri;
uids = message_list_get_selected (message_list);
em_utils_forward_quoted (folder, uids, folder_uri);
@@ -489,13 +513,13 @@ action_mail_message_edit_cb (GtkAction *action,
GtkWindow *window;
GPtrArray *uids;
- folder = e_mail_reader_get_folder (reader);
window = e_mail_reader_get_window (reader);
message_list = e_mail_reader_get_message_list (reader);
if (!em_utils_check_user_can_send_mail (window))
return;
+ folder = message_list->folder;
uids = message_list_get_selected (message_list);
em_utils_edit_messages (folder, uids, FALSE);
@@ -505,16 +529,16 @@ static void
action_mail_message_new_cb (GtkAction *action,
EMailReader *reader)
{
+ MessageList *message_list;
GtkWindow *window;
- const gchar *folder_uri;
- folder_uri = e_mail_reader_get_folder_uri (reader);
+ message_list = e_mail_reader_get_message_list (reader);
window = e_mail_reader_get_window (reader);
if (!em_utils_check_user_can_send_mail (window))
return;
- em_utils_compose_new_message (folder_uri);
+ em_utils_compose_new_message (message_list->folder_uri);
}
static void
@@ -529,17 +553,18 @@ static void
action_mail_message_post_cb (GtkAction *action,
EMailReader *reader)
{
- CamelFolder *folder;
+ MessageList *message_list;
- folder = e_mail_reader_get_folder (reader);
+ message_list = e_mail_reader_get_message_list (reader);
- em_utils_post_to_folder (folder);
+ em_utils_post_to_folder (message_list->folder);
}
static void
action_mail_move_cb (GtkAction *action,
EMailReader *reader)
{
+ EShellModule *shell_module;
MessageList *message_list;
EMFolderTreeModel *model;
CamelFolder *folder;
@@ -548,13 +573,15 @@ action_mail_move_cb (GtkAction *action,
GPtrArray *selected;
const gchar *uri;
- folder = e_mail_reader_get_folder (reader);
message_list = e_mail_reader_get_message_list (reader);
- model = e_mail_reader_get_tree_model (reader);
+ shell_module = e_mail_reader_get_shell_module (reader);
+ model = e_mail_shell_module_get_folder_tree_model (shell_module);
folder_tree = em_folder_tree_new_with_model (model);
selected = message_list_get_selected (message_list);
+ folder = message_list->folder;
+
em_folder_tree_set_excluded (
EM_FOLDER_TREE (folder_tree),
EMFT_EXCLUDE_NOSELECT | EMFT_EXCLUDE_VIRTUAL |
@@ -727,10 +754,10 @@ action_mail_redirect_cb (GtkAction *action,
GtkWindow *window;
const gchar *uid;
- folder = e_mail_reader_get_folder (reader);
message_list = e_mail_reader_get_message_list (reader);
window = e_mail_reader_get_window (reader);
+ folder = message_list->folder;
uid = message_list->cursor_uid;
g_return_if_fail (uid != NULL);
@@ -763,10 +790,10 @@ action_mail_reply_post_cb (GtkAction *action,
GtkWindow *window;
const gchar *uid;
- folder = e_mail_reader_get_folder (reader);
message_list = e_mail_reader_get_message_list (reader);
window = e_mail_reader_get_window (reader);
+ folder = message_list->folder;
uid = message_list->cursor_uid;
g_return_if_fail (uid != NULL);
@@ -792,10 +819,10 @@ action_mail_save_as_cb (GtkAction *action,
GtkWindow *window;
GPtrArray *uids;
- folder = e_mail_reader_get_folder (reader);
message_list = e_mail_reader_get_message_list (reader);
window = e_mail_reader_get_window (reader);
+ folder = message_list->folder;
uids = message_list_get_selected (message_list);
em_utils_save_messages (window, folder, uids);
@@ -840,7 +867,17 @@ static void
action_mail_show_all_headers_cb (GtkToggleAction *action,
EMailReader *reader)
{
- /* FIXME */
+ EMFormatHTMLDisplay *html_display;
+ em_format_mode_t mode;
+
+ html_display = e_mail_reader_get_html_display (reader);
+
+ if (gtk_toggle_action_get_active (action))
+ mode = EM_FORMAT_ALLHEADERS;
+ else
+ mode = EM_FORMAT_NORMAL;
+
+ em_format_set_mode ((EMFormat *) html_display, mode);
}
static void
@@ -859,9 +896,9 @@ action_mail_toggle_important_cb (GtkAction *action,
GPtrArray *uids;
guint ii;
- folder = e_mail_reader_get_folder (reader);
message_list = e_mail_reader_get_message_list (reader);
+ folder = message_list->folder;
uids = message_list_get_selected (message_list);
camel_folder_freeze (folder);
@@ -1449,8 +1486,61 @@ mail_reader_key_press_cb (EMailReader *reader,
}
static void
+mail_reader_set_folder (EMailReader *reader,
+ CamelFolder *folder,
+ const gchar *folder_uri)
+{
+ EMFormatHTMLDisplay *html_display;
+ MessageList *message_list;
+ gboolean outgoing;
+
+ html_display = e_mail_reader_get_html_display (reader);
+ message_list = e_mail_reader_get_message_list (reader);
+
+ outgoing = em_utils_folder_is_drafts (folder, folder_uri) ||
+ em_utils_folder_is_outbox (folder, folder_uri) ||
+ em_utils_folder_is_sent (folder, folder_uri);
+
+ if (message_list->folder != NULL)
+ mail_sync_folder (message_list->folder, NULL, NULL);
+
+ em_format_format ((EMFormat *) html_display, NULL, NULL, NULL);
+ message_list_set_folder (message_list, folder, folder_uri, outgoing);
+}
+
+static void
+mail_reader_init_charset_actions (EMailReader *reader)
+{
+ GtkActionGroup *action_group;
+ GtkRadioAction *default_action;
+ GSList *radio_group;
+
+ action_group = e_mail_reader_get_action_group (reader);
+
+ radio_group = e_charset_add_radio_actions (
+ action_group, "mail-charset-", NULL,
+ G_CALLBACK (action_mail_charset_cb), reader);
+
+ /* XXX Add a tooltip! */
+ default_action = gtk_radio_action_new (
+ "mail-charset-default", _("Default"), NULL, NULL, -1);
+
+ gtk_radio_action_set_group (default_action, radio_group);
+
+ g_signal_connect (
+ default_action, "changed",
+ G_CALLBACK (action_mail_charset_cb), reader);
+
+ gtk_action_group_add_action (
+ action_group, GTK_ACTION (default_action));
+
+ gtk_radio_action_set_current_value (default_action, -1);
+}
+
+static void
mail_reader_class_init (EMailReaderIface *iface)
{
+ iface->set_folder = mail_reader_set_folder;
}
GType
@@ -1488,6 +1578,7 @@ e_mail_reader_init (EMailReader *reader)
GtkActionGroup *action_group;
GConfBridge *bridge;
GtkAction *action;
+ const gchar *action_name;
const gchar *key;
g_return_if_fail (E_IS_MAIL_READER (reader));
@@ -1502,12 +1593,20 @@ e_mail_reader_init (EMailReader *reader)
action_group, mail_reader_toggle_entries,
G_N_ELEMENTS (mail_reader_toggle_entries), reader);
+ mail_reader_init_charset_actions (reader);
+
/* Bind GObject properties to GConf keys. */
bridge = gconf_bridge_get ();
+ action_name = "mail-caret-mode";
key = "/apps/evolution/mail/display/caret_mode";
- action = gtk_action_group_get_action (action_group, "mail-caret-mode");
+ action = gtk_action_group_get_action (action_group, action_name);
+ gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active");
+
+ action_name = "mail-show-all-headers";
+ key = "/apps/evolution/mail/display/show_all_headers";
+ action = gtk_action_group_get_action (action_group, action_name);
gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active");
/* Fine tuning. */
@@ -1548,32 +1647,6 @@ e_mail_reader_get_action_group (EMailReader *reader)
return iface->get_action_group (reader);
}
-CamelFolder *
-e_mail_reader_get_folder (EMailReader *reader)
-{
- EMailReaderIface *iface;
-
- g_return_val_if_fail (E_IS_MAIL_READER (reader), NULL);
-
- iface = E_MAIL_READER_GET_IFACE (reader);
- g_return_val_if_fail (iface->get_folder != NULL, NULL);
-
- return iface->get_folder (reader);
-}
-
-const gchar *
-e_mail_reader_get_folder_uri (EMailReader *reader)
-{
- EMailReaderIface *iface;
-
- g_return_val_if_fail (E_IS_MAIL_READER (reader), NULL);
-
- iface = E_MAIL_READER_GET_IFACE (reader);
- g_return_val_if_fail (iface->get_folder_uri != NULL, NULL);
-
- return iface->get_folder_uri (reader);
-}
-
gboolean
e_mail_reader_get_hide_deleted (EMailReader *reader)
{
@@ -1613,41 +1686,86 @@ e_mail_reader_get_message_list (EMailReader *reader)
return iface->get_message_list (reader);
}
-EShellSettings *
-e_mail_reader_get_shell_settings (EMailReader *reader)
+EShellModule *
+e_mail_reader_get_shell_module (EMailReader *reader)
{
EMailReaderIface *iface;
g_return_val_if_fail (E_IS_MAIL_READER (reader), NULL);
iface = E_MAIL_READER_GET_IFACE (reader);
- g_return_val_if_fail (iface->get_shell_settings != NULL, NULL);
+ g_return_val_if_fail (iface->get_shell_module != NULL, NULL);
- return iface->get_shell_settings (reader);
+ return iface->get_shell_module (reader);
}
-EMFolderTreeModel *
-e_mail_reader_get_tree_model (EMailReader *reader)
+GtkWindow *
+e_mail_reader_get_window (EMailReader *reader)
{
EMailReaderIface *iface;
g_return_val_if_fail (E_IS_MAIL_READER (reader), NULL);
iface = E_MAIL_READER_GET_IFACE (reader);
- g_return_val_if_fail (iface->get_tree_model != NULL, NULL);
+ g_return_val_if_fail (iface->get_window != NULL, NULL);
- return iface->get_tree_model (reader);
+ return iface->get_window (reader);
}
-GtkWindow *
-e_mail_reader_get_window (EMailReader *reader)
+void
+e_mail_reader_set_folder (EMailReader *reader,
+ CamelFolder *folder,
+ const gchar *folder_uri)
{
EMailReaderIface *iface;
- g_return_val_if_fail (E_IS_MAIL_READER (reader), NULL);
+ g_return_if_fail (E_IS_MAIL_READER (reader));
+ g_return_if_fail (CAMEL_IS_FOLDER (folder));
+ g_return_if_fail (folder_uri != NULL);
iface = E_MAIL_READER_GET_IFACE (reader);
- g_return_val_if_fail (iface->get_window != NULL, NULL);
+ g_return_if_fail (iface->set_folder != NULL);
- return iface->get_window (reader);
+ iface->set_folder (reader, folder, folder_uri);
+}
+
+void
+e_mail_reader_create_charset_menu (EMailReader *reader,
+ GtkUIManager *ui_manager,
+ guint merge_id)
+{
+ GtkActionGroup *action_group;
+ GtkAction *action;
+ const gchar *action_name;
+ const gchar *path;
+ GSList *list;
+
+ g_return_if_fail (E_IS_MAIL_READER (reader));
+ g_return_if_fail (GTK_IS_UI_MANAGER (ui_manager));
+
+ action_name = "mail-charset-default";
+ action_group = e_mail_reader_get_action_group (reader);
+ action = gtk_action_group_get_action (action_group, action_name);
+ g_return_if_fail (action != NULL);
+
+ list = gtk_radio_action_get_group (GTK_RADIO_ACTION (action));
+ list = g_slist_copy (list);
+ list = g_slist_remove (list, action);
+ list = g_slist_sort (list, (GCompareFunc) e_action_compare_by_label);
+
+ path = "/main-menu/view-menu/mail-message-view-actions/mail-encoding-menu";
+
+ while (list != NULL) {
+ action = list->data;
+
+ gtk_ui_manager_add_ui (
+ ui_manager, merge_id, path,
+ gtk_action_get_name (action),
+ gtk_action_get_name (action),
+ GTK_UI_MANAGER_AUTO, FALSE);
+
+ list = g_slist_delete_link (list, list);
+ }
+
+ gtk_ui_manager_ensure_update (ui_manager);
}
diff --git a/mail/e-mail-reader.h b/mail/e-mail-reader.h
index 2857192fc4..5dcf8d0266 100644
--- a/mail/e-mail-reader.h
+++ b/mail/e-mail-reader.h
@@ -24,10 +24,9 @@
#include <gtk/gtk.h>
#include <camel/camel-folder.h>
-#include <mail/em-folder-tree-model.h>
#include <mail/em-format-html-display.h>
#include <mail/message-list.h>
-#include <shell/e-shell-settings.h>
+#include <shell/e-shell-module.h>
/* Standard GObject macros */
#define E_TYPE_MAIL_READER \
@@ -53,19 +52,18 @@ typedef struct _EMailReaderIface EMailReaderIface;
struct _EMailReaderIface {
GTypeInterface parent_iface;
- /* XXX This is getting kinda bloated. Try to reduce. */
GtkActionGroup *
(*get_action_group) (EMailReader *reader);
- CamelFolder * (*get_folder) (EMailReader *reader);
- const gchar * (*get_folder_uri) (EMailReader *reader);
gboolean (*get_hide_deleted) (EMailReader *reader);
EMFormatHTMLDisplay *
(*get_html_display) (EMailReader *reader);
MessageList * (*get_message_list) (EMailReader *reader);
- EShellSettings *(*get_shell_settings) (EMailReader *reader);
- EMFolderTreeModel *
- (*get_tree_model) (EMailReader *reader);
+ EShellModule * (*get_shell_module) (EMailReader *reader);
GtkWindow * (*get_window) (EMailReader *reader);
+
+ void (*set_folder) (EMailReader *reader,
+ CamelFolder *folder,
+ const gchar *folder_uri);
};
GType e_mail_reader_get_type (void);
@@ -78,10 +76,15 @@ gboolean e_mail_reader_get_hide_deleted (EMailReader *reader);
EMFormatHTMLDisplay *
e_mail_reader_get_html_display (EMailReader *reader);
MessageList * e_mail_reader_get_message_list (EMailReader *reader);
-EShellSettings *e_mail_reader_get_shell_settings(EMailReader *reader);
-EMFolderTreeModel *
- e_mail_reader_get_tree_model (EMailReader *reader);
+EShellModule * e_mail_reader_get_shell_module (EMailReader *reader);
GtkWindow * e_mail_reader_get_window (EMailReader *reader);
+void e_mail_reader_set_folder (EMailReader *reader,
+ CamelFolder *folder,
+ const gchar *folder_uri);
+void e_mail_reader_create_charset_menu
+ (EMailReader *reader,
+ GtkUIManager *ui_manager,
+ guint merge_id);
G_END_DECLS
diff --git a/mail/e-mail-shell-content.c b/mail/e-mail-shell-content.c
index ebde02755e..c846a83d5d 100644
--- a/mail/e-mail-shell-content.c
+++ b/mail/e-mail-shell-content.c
@@ -376,30 +376,6 @@ mail_shell_content_get_action_group (EMailReader *reader)
return e_shell_window_get_action_group (shell_window, "mail");
}
-static CamelFolder *
-mail_shell_content_get_folder (EMailReader *reader)
-{
- EMailShellContent *mail_shell_content;
- EMFolderView *folder_view;
-
- mail_shell_content = E_MAIL_SHELL_CONTENT (reader);
- folder_view = e_mail_shell_content_get_folder_view (mail_shell_content);
-
- return folder_view->folder;
-}
-
-static const gchar *
-mail_shell_content_get_folder_uri (EMailReader *reader)
-{
- EMailShellContent *mail_shell_content;
- EMFolderView *folder_view;
-
- mail_shell_content = E_MAIL_SHELL_CONTENT (reader);
- folder_view = e_mail_shell_content_get_folder_view (mail_shell_content);
-
- return folder_view->folder_uri;
-}
-
static gboolean
mail_shell_content_get_hide_deleted (EMailReader *reader)
{
@@ -429,18 +405,16 @@ mail_shell_content_get_message_list (EMailReader *reader)
return folder_view->list;
}
-static EMFolderTreeModel *
-mail_shell_content_get_tree_model (EMailReader *reader)
+static EShellModule *
+mail_shell_content_get_shell_module (EMailReader *reader)
{
EShellContent *shell_content;
- EShellModule *shell_module;
EShellView *shell_view;
shell_content = E_SHELL_CONTENT (reader);
shell_view = e_shell_content_get_shell_view (shell_content);
- shell_module = e_shell_view_get_shell_module (shell_view);
- return e_mail_shell_module_get_folder_tree_model (shell_module);
+ return e_shell_view_get_shell_module (shell_view);
}
static GtkWindow *
@@ -502,12 +476,10 @@ static void
mail_shell_content_iface_init (EMailReaderIface *iface)
{
iface->get_action_group = mail_shell_content_get_action_group;
- iface->get_folder = mail_shell_content_get_folder;
- iface->get_folder_uri = mail_shell_content_get_folder_uri;
iface->get_hide_deleted = mail_shell_content_get_hide_deleted;
iface->get_html_display = mail_shell_content_get_html_display;
iface->get_message_list = mail_shell_content_get_message_list;
- iface->get_tree_model = mail_shell_content_get_tree_model;
+ iface->get_shell_module = mail_shell_content_get_shell_module;
iface->get_window = mail_shell_content_get_window;
}
diff --git a/mail/e-mail-shell-view-actions.c b/mail/e-mail-shell-view-actions.c
index ff0089d2ce..5b26c8a67d 100644
--- a/mail/e-mail-shell-view-actions.c
+++ b/mail/e-mail-shell-view-actions.c
@@ -988,7 +988,6 @@ e_mail_shell_view_actions_init (EMailShellView *mail_shell_view)
GtkActionGroup *action_group;
GtkUIManager *ui_manager;
GConfBridge *bridge;
- GtkAction *action;
GObject *object;
const gchar *domain;
const gchar *key;
diff --git a/mail/e-mail-shell-view-private.h b/mail/e-mail-shell-view-private.h
index 50ccf3000b..6c6b9d29fa 100644
--- a/mail/e-mail-shell-view-private.h
+++ b/mail/e-mail-shell-view-private.h
@@ -28,6 +28,7 @@
#include <gtkhtml/gtkhtml.h>
#include <camel/camel-vtrash-folder.h>
+#include "e-util/e-util.h"
#include "e-util/gconf-bridge.h"
#include "widgets/menus/gal-view-instance.h"
@@ -118,6 +119,9 @@ struct _EMailShellViewPrivate {
/* These are just for convenience. */
EMailShellContent *mail_shell_content;
EMailShellSidebar *mail_shell_sidebar;
+
+ /* For UI merging and unmerging. */
+ guint merge_id;
};
void e_mail_shell_view_private_init
diff --git a/mail/e-mail-shell-view.c b/mail/e-mail-shell-view.c
index 6de3896d50..f71f988467 100644
--- a/mail/e-mail-shell-view.c
+++ b/mail/e-mail-shell-view.c
@@ -65,11 +65,38 @@ mail_shell_view_constructed (GObject *object)
}
static void
+mail_shell_view_toggled (EShellView *shell_view)
+{
+ EMailShellViewPrivate *priv;
+ EShellWindow *shell_window;
+ GtkUIManager *ui_manager;
+ const gchar *basename;
+
+ /* Chain up to parent's toggled() method. */
+ E_SHELL_VIEW_CLASS (parent_class)->toggled (shell_view);
+
+ priv = E_MAIL_SHELL_VIEW_GET_PRIVATE (shell_view);
+
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ ui_manager = e_shell_window_get_ui_manager (shell_window);
+ basename = E_MAIL_READER_UI_DEFINITION;
+
+ if (e_shell_view_is_active (shell_view)) {
+ priv->merge_id = e_load_ui_definition (ui_manager, basename);
+ e_mail_reader_create_charset_menu (
+ E_MAIL_READER (priv->mail_shell_content),
+ ui_manager, priv->merge_id);
+ } else
+ gtk_ui_manager_remove_ui (ui_manager, priv->merge_id);
+
+ gtk_ui_manager_ensure_update (ui_manager);
+}
+
+static void
mail_shell_view_update_actions (EShellView *shell_view)
{
EMailShellViewPrivate *priv;
EMailShellSidebar *mail_shell_sidebar;
- EShellContent *shell_content;
EShellSidebar *shell_sidebar;
EShellWindow *shell_window;
EMFolderTree *folder_tree;
@@ -179,6 +206,7 @@ mail_shell_view_class_init (EMailShellViewClass *class,
shell_view_class->type_module = type_module;
shell_view_class->new_shell_content = e_mail_shell_content_new;
shell_view_class->new_shell_sidebar = e_mail_shell_sidebar_new;
+ shell_view_class->toggled = mail_shell_view_toggled;
shell_view_class->update_actions = mail_shell_view_update_actions;
}
diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c
index 5ce7473566..3433453889 100644
--- a/mail/em-folder-view.c
+++ b/mail/em-folder-view.c
@@ -1210,61 +1210,61 @@ emfv_enable_menus(EMFolderView *emfv)
g_string_free(name, TRUE);
}
-static void
-emfv_view_mode(BonoboUIComponent *uic, const char *path, Bonobo_UIComponent_EventType type, const char *state, void *data)
-{
- EMFolderView *emfv = data;
- int i;
-
- if (type != Bonobo_UIComponent_STATE_CHANGED)
- return;
-
- /* TODO: I don't like this stuff much, is there any way we can move listening for such events
- elsehwere? Probably not I guess, unless there's a EMFolderViewContainer for bonobo usage
- of a folder view */
-
- i = state[0] != '0';
-
- em_format_set_mode((EMFormat *)emfv->preview, i);
-
- if (EM_FOLDER_VIEW_GET_CLASS (emfv)->update_message_style) {
- GConfClient *gconf = mail_config_get_gconf_client ();
-
- gconf_client_set_int (gconf, "/apps/evolution/mail/display/message_style", i, NULL);
- }
-}
-
-static void
-emfv_caret_mode(BonoboUIComponent *uic, const char *path, Bonobo_UIComponent_EventType type, const char *state, void *data)
-{
- EMFolderView *emfv = data;
-
- if (type != Bonobo_UIComponent_STATE_CHANGED)
- return;
-
- em_format_html_display_set_caret_mode(emfv->preview, state[0] != '0');
-
- gconf_client_set_bool(mail_config_get_gconf_client(), "/apps/evolution/mail/display/caret_mode", state[0] != '0', NULL);
-}
-
-static void
-emfv_charset_changed(BonoboUIComponent *uic, const char *path, Bonobo_UIComponent_EventType type, const char *state, void *data)
-{
- EMFolderView *emfv = data;
-
- if (type != Bonobo_UIComponent_STATE_CHANGED)
- return;
+//static void
+//emfv_view_mode(BonoboUIComponent *uic, const char *path, Bonobo_UIComponent_EventType type, const char *state, void *data)
+//{
+// EMFolderView *emfv = data;
+// int i;
+//
+// if (type != Bonobo_UIComponent_STATE_CHANGED)
+// return;
+//
+// /* TODO: I don't like this stuff much, is there any way we can move listening for such events
+// elsehwere? Probably not I guess, unless there's a EMFolderViewContainer for bonobo usage
+// of a folder view */
+//
+// i = state[0] != '0';
+//
+// em_format_set_mode((EMFormat *)emfv->preview, i);
+//
+// if (EM_FOLDER_VIEW_GET_CLASS (emfv)->update_message_style) {
+// GConfClient *gconf = mail_config_get_gconf_client ();
+//
+// gconf_client_set_int (gconf, "/apps/evolution/mail/display/message_style", i, NULL);
+// }
+//}
- /* menu items begin with "Charset-" = 8 characters */
- if (state[0] != '0' && strlen(path) > 8) {
- path += 8;
- /* default charset used in mail view */
- if (!strcmp(path, _("Default")))
- path = NULL;
+//static void
+//emfv_caret_mode(BonoboUIComponent *uic, const char *path, Bonobo_UIComponent_EventType type, const char *state, void *data)
+//{
+// EMFolderView *emfv = data;
+//
+// if (type != Bonobo_UIComponent_STATE_CHANGED)
+// return;
+//
+// em_format_html_display_set_caret_mode(emfv->preview, state[0] != '0');
+//
+// gconf_client_set_bool(mail_config_get_gconf_client(), "/apps/evolution/mail/display/caret_mode", state[0] != '0', NULL);
+//}
- em_format_set_charset((EMFormat *)emfv->preview, path);
- }
-}
+//static void
+//emfv_charset_changed(BonoboUIComponent *uic, const char *path, Bonobo_UIComponent_EventType type, const char *state, void *data)
+//{
+// EMFolderView *emfv = data;
+//
+// if (type != Bonobo_UIComponent_STATE_CHANGED)
+// return;
+//
+// /* menu items begin with "Charset-" = 8 characters */
+// if (state[0] != '0' && strlen(path) > 8) {
+// path += 8;
+// /* default charset used in mail view */
+// if (!strcmp(path, _("Default")))
+// path = NULL;
+//
+// em_format_set_charset((EMFormat *)emfv->preview, path);
+// }
+//}
static void
emfv_activate(EMFolderView *emfv, BonoboUIComponent *uic, int act)
@@ -1285,21 +1285,21 @@ emfv_activate(EMFolderView *emfv, BonoboUIComponent *uic, int act)
if (emfv->menu)
e_menu_activate((EMenu *)emfv->menu, uic, act);
- state = emfv->preview->caret_mode;
- bonobo_ui_component_set_prop(uic, "/commands/CaretMode", "state", state?"1":"0", NULL);
- bonobo_ui_component_add_listener(uic, "CaretMode", emfv_caret_mode, emfv);
+// state = emfv->preview->caret_mode;
+// bonobo_ui_component_set_prop(uic, "/commands/CaretMode", "state", state?"1":"0", NULL);
+// bonobo_ui_component_add_listener(uic, "CaretMode", emfv_caret_mode, emfv);
- style = ((EMFormat *)emfv->preview)->mode?EM_FORMAT_ALLHEADERS:EM_FORMAT_NORMAL;
- if (style)
- bonobo_ui_component_set_prop(uic, "/commands/ViewFullHeaders", "state", "1", NULL);
- bonobo_ui_component_add_listener(uic, "ViewFullHeaders", emfv_view_mode, emfv);
- em_format_set_mode((EMFormat *)emfv->preview, style);
+// style = ((EMFormat *)emfv->preview)->mode?EM_FORMAT_ALLHEADERS:EM_FORMAT_NORMAL;
+// if (style)
+// bonobo_ui_component_set_prop(uic, "/commands/ViewFullHeaders", "state", "1", NULL);
+// bonobo_ui_component_add_listener(uic, "ViewFullHeaders", emfv_view_mode, emfv);
+// em_format_set_mode((EMFormat *)emfv->preview, style);
if (emfv->folder)
bonobo_ui_component_set_prop(uic, "/commands/MessageEdit", "sensitive", "0", NULL);
- /* default charset used in mail view */
- e_charset_picker_bonobo_ui_populate (uic, "/menu/View", _("Default"), emfv_charset_changed, emfv);
+// /* default charset used in mail view */
+// e_charset_picker_bonobo_ui_populate (uic, "/menu/View", _("Default"), emfv_charset_changed, emfv);
emfv_enable_menus(emfv);
if (emfv->statusbar_active)
diff --git a/mail/evolution-mail.schemas.in b/mail/evolution-mail.schemas.in
index 246cc79439..d74295f669 100644
--- a/mail/evolution-mail.schemas.in
+++ b/mail/evolution-mail.schemas.in
@@ -354,6 +354,20 @@
</schema>
<schema>
+ <key>/schema/apps/evolution/mail/display/show_all_headers</key>
+ <applyto>/apps/evolution/mail/display/show_all_headers</applyto>
+ <owner>evolution-mail</owner>
+ <type>bool</type>
+ <default>false</default>
+ <locale name="C">
+ <short>Show all message headers</short>
+ <long>
+ Show all the headers when viewing a messages.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
<key>/schemas/apps/evolution/mail/display/headers</key>
<applyto>/apps/evolution/mail/display/headers</applyto>
<owner>evolution-mail</owner>