aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--composer/e-composer-actions.c4
-rw-r--r--composer/e-composer-post-header.c8
-rw-r--r--composer/e-composer-private.c4
-rw-r--r--composer/e-composer-private.h1
-rw-r--r--composer/e-msg-composer.c1
-rw-r--r--e-util/e-util.c35
-rw-r--r--e-util/e-util.h2
-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
-rw-r--r--shell/e-shell-window-actions.c25
-rw-r--r--ui/evolution-mail-reader.ui5
-rw-r--r--ui/evolution-mail.ui122
-rw-r--r--widgets/misc/e-charset-picker.c199
-rw-r--r--widgets/misc/e-charset-picker.h10
22 files changed, 436 insertions, 519 deletions
diff --git a/composer/e-composer-actions.c b/composer/e-composer-actions.c
index 433a17ab66..fc1ec7a475 100644
--- a/composer/e-composer-actions.c
+++ b/composer/e-composer-actions.c
@@ -106,7 +106,7 @@ action_charset_cb (GtkRadioAction *action,
if (action != current)
return;
- charset = gtk_action_get_name (GTK_ACTION (current));
+ charset = g_object_get_data (G_OBJECT (action), "charset");
g_free (composer->priv->charset);
composer->priv->charset = g_strdup (charset);
@@ -686,7 +686,7 @@ e_composer_actions_init (EMsgComposer *composer)
gtk_action_group_set_translation_domain (
action_group, GETTEXT_PACKAGE);
e_charset_add_radio_actions (
- action_group, composer->priv->charset,
+ action_group, "charset-", composer->priv->charset,
G_CALLBACK (action_charset_cb), composer);
gtk_ui_manager_insert_action_group (manager, action_group, 0);
diff --git a/composer/e-composer-post-header.c b/composer/e-composer-post-header.c
index 2ff98d053b..5a5ca2e610 100644
--- a/composer/e-composer-post-header.c
+++ b/composer/e-composer-post-header.c
@@ -393,12 +393,16 @@ e_composer_post_header_set_folder_tree_model (EComposerPostHeader *header,
EMFolderTreeModel *model)
{
g_return_if_fail (E_IS_COMPOSER_POST_HEADER (header));
- g_return_if_fail (EM_IS_FOLDER_TREE_MODEL (model));
+
+ if (model != NULL) {
+ g_return_if_fail (EM_IS_FOLDER_TREE_MODEL (model));
+ g_object_ref (model);
+ }
if (header->priv->model != NULL)
g_object_unref (header->priv->model);
- header->priv->model = g_object_ref (model);
+ header->priv->model = model;
g_object_notify (G_OBJECT (header), "folder-tree-model");
}
diff --git a/composer/e-composer-private.c b/composer/e-composer-private.c
index 0d2995b9b2..0c3cce3512 100644
--- a/composer/e-composer-private.c
+++ b/composer/e-composer-private.c
@@ -29,10 +29,12 @@ composer_setup_charset_menu (EMsgComposer *composer)
guint merge_id;
manager = gtkhtml_editor_get_ui_manager (GTKHTML_EDITOR (composer));
- list = gtk_action_group_list_actions (composer->priv->charset_actions);
path = "/main-menu/edit-menu/pre-spell-check/charset-menu";
merge_id = gtk_ui_manager_new_merge_id (manager);
+ list = gtk_action_group_list_actions (composer->priv->charset_actions);
+ list = g_list_sort (list, (GCompareFunc) e_action_compare_by_label);
+
while (list != NULL) {
GtkAction *action = list->data;
diff --git a/composer/e-composer-private.h b/composer/e-composer-private.h
index f43f2c7eb2..c31fa2751a 100644
--- a/composer/e-composer-private.h
+++ b/composer/e-composer-private.h
@@ -30,6 +30,7 @@
#include "e-composer-autosave.h"
#include "e-composer-header-table.h"
#include "e-util/e-binding.h"
+#include "e-util/e-util.h"
#include "e-util/gconf-bridge.h"
#define E_MSG_COMPOSER_GET_PRIVATE(obj) \
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 87dcabda17..88ac673454 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -66,7 +66,6 @@
#include "e-util/e-error.h"
#include "e-util/e-plugin-ui.h"
#include "e-util/e-util-private.h"
-#include "e-util/e-util.h"
#include "e-signature-combo-box.h"
#include "shell/e-shell.h"
diff --git a/e-util/e-util.c b/e-util/e-util.c
index 373002d4d9..3fce52f9bd 100644
--- a/e-util/e-util.c
+++ b/e-util/e-util.c
@@ -164,6 +164,41 @@ e_load_ui_definition (GtkUIManager *ui_manager,
}
/**
+ * e_action_compare_by_label:
+ * @action1: a #GtkAction
+ * @action2: a #GtkAction
+ *
+ * Compares the labels for @action1 and @action2 using g_utf8_collate().
+ *
+ * Returns: < 0 if @action1 compares before @action2, 0 if they
+ * compare equal, > 0 if @action1 compares after @action2
+ **/
+gint
+e_action_compare_by_label (GtkAction *action1,
+ GtkAction *action2)
+{
+ gchar *label1;
+ gchar *label2;
+ gint result;
+
+ /* XXX This is horribly inefficient but will generally only be
+ * used on short lists of actions during UI construction. */
+
+ if (action1 == action2)
+ return 0;
+
+ g_object_get (action1, "label", &label1, NULL);
+ g_object_get (action2, "label", &label2, NULL);
+
+ result = g_utf8_collate (label1, label2);
+
+ g_free (label1);
+ g_free (label2);
+
+ return result;
+}
+
+/**
* e_action_group_remove_all_actions:
* @action_group: a #GtkActionGroup
*
diff --git a/e-util/e-util.h b/e-util/e-util.h
index 4878178ec6..0d2628bbf0 100644
--- a/e-util/e-util.h
+++ b/e-util/e-util.h
@@ -46,6 +46,8 @@ void e_display_help (GtkWindow *parent,
const gchar *link_id);
guint e_load_ui_definition (GtkUIManager *ui_manager,
const gchar *basename);
+gint e_action_compare_by_label (GtkAction *action1,
+ GtkAction *action2);
void e_action_group_remove_all_actions
(GtkActionGroup *action_group);
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>
diff --git a/shell/e-shell-window-actions.c b/shell/e-shell-window-actions.c
index 707edd8439..dc4307fe5c 100644
--- a/shell/e-shell-window-actions.c
+++ b/shell/e-shell-window-actions.c
@@ -1753,27 +1753,6 @@ static GtkRadioActionEntry shell_gal_view_radio_entries[] = {
-1 }
};
-static gint
-shell_window_compare_actions (GtkAction *action1,
- GtkAction *action2)
-{
- gchar *label1, *label2;
- gint result;
-
- /* XXX This is really inefficient, but we're only sorting
- * a small number of actions (repeatedly, though). */
-
- g_object_get (action1, "label", &label1, NULL);
- g_object_get (action2, "label", &label2, NULL);
-
- result = g_utf8_collate (label1, label2);
-
- g_free (label1);
- g_free (label2);
-
- return result;
-}
-
static void
shell_window_extract_actions (EShellWindow *shell_window,
GList **source_list,
@@ -1914,13 +1893,13 @@ e_shell_window_create_new_menu (EShellWindow *shell_window)
new_item_actions = g_list_sort (
gtk_action_group_list_actions (action_group),
- (GCompareFunc) shell_window_compare_actions);
+ (GCompareFunc) e_action_compare_by_label);
action_group = shell_window->priv->new_source_actions;
new_source_actions = g_list_sort (
gtk_action_group_list_actions (action_group),
- (GCompareFunc) shell_window_compare_actions);
+ (GCompareFunc) e_action_compare_by_label);
/* Give priority to actions that belong to this shell view. */
diff --git a/ui/evolution-mail-reader.ui b/ui/evolution-mail-reader.ui
index da6e2872d1..e5ef5db624 100644
--- a/ui/evolution-mail-reader.ui
+++ b/ui/evolution-mail-reader.ui
@@ -35,7 +35,10 @@
<menuitem action='mail-zoom-100'/>
</menu>
<separator/>
- <menu action='mail-encoding-menu'/>
+ <menu action='mail-encoding-menu'>
+ <menuitem action='mail-charset-default'/>
+ <separator/>
+ </menu>
</placeholder>
</menu>
<placeholder name='custom-menus'>
diff --git a/ui/evolution-mail.ui b/ui/evolution-mail.ui
index e54b6a93ca..665d8900ad 100644
--- a/ui/evolution-mail.ui
+++ b/ui/evolution-mail.ui
@@ -1,29 +1,12 @@
<ui>
<menubar name='main-menu'>
<menu action='file-menu'>
- <placeholder name='file-actions'>
- <menuitem action='mail-save-as'/>
- </placeholder>
- <placeholder name='print-actions'>
- <menuitem action='mail-print-preview'/>
- <menuitem action='mail-print'/>
- </placeholder>
<placeholder name='long-running-actions'>
<menuitem action='mail-empty-trash'/>
<menuitem action='mail-download'/>
</placeholder>
</menu>
<menu action='edit-menu'>
- <placeholder name='edit-actions'>
- <menuitem action='mail-clipboard-copy'/>
- <separator/>
- <menuitem action='mail-select-all'/>
- <separator/>
- <menuitem action='mail-delete'/>
- <menuitem action='mail-undelete'/>
- <separator/>
- <menuitem action='mail-find'/>
- </placeholder>
<placeholder name='administrative-actions'>
<menuitem action='mail-tools-filters'/>
<menuitem action='mail-tools-search-folders'/>
@@ -38,26 +21,16 @@
<menuitem action='mail-view-vertical'/>
</menu>
</placeholder>
- <separator/>
- <menuitem action='mail-threads-group-by'/>
- <menuitem action='mail-threads-expand-all'/>
- <menuitem action='mail-threads-collapse-all'/>
- <separator/>
- <menuitem action='mail-hide-deleted'/>
- <menuitem action='mail-hide-selected'/>
- <menuitem action='mail-hide-read'/>
- <menuitem action='mail-show-hidden'/>
- <separator/>
- <menuitem action='mail-load-images'/>
- <menuitem action='mail-show-all-headers'/>
- <menuitem action='mail-caret-mode'/>
- <menuitem action='mail-show-source'/>
- <menu action='mail-zoom-menu'>
- <menuitem action='mail-zoom-in'/>
- <menuitem action='mail-zoom-out'/>
- <menuitem action='mail-zoom-100'/>
- </menu>
- <menu action='mail-encoding-menu'/>
+ <placeholder name='mail-message-list-actions'>
+ <menuitem action='mail-threads-group-by'/>
+ <menuitem action='mail-threads-expand-all'/>
+ <menuitem action='mail-threads-collapse-all'/>
+ <separator/>
+ <menuitem action='mail-hide-deleted'/>
+ <menuitem action='mail-hide-selected'/>
+ <menuitem action='mail-hide-read'/>
+ <menuitem action='mail-show-hidden'/>
+ </placeholder>
</menu>
<placeholder name='custom-menus'>
<menu action='mail-folder-menu'>
@@ -79,68 +52,7 @@
<separator/>
<menuitem action='mail-folder-properties'/>
</menu>
- <menu action='mail-message-menu'>
- <menuitem action='mail-message-new'/>
- <menuitem action='mail-message-post'/>
- <menuitem action='mail-message-open'/>
- <menuitem action='mail-message-edit'/>
- <menuitem action='mail-add-sender'/>
- <separator/>
- <menu action='mail-goto-menu'>
- <menuitem action='mail-next'/>
- <menuitem action='mail-next-unread'/>
- <menuitem action='mail-next-important'/>
- <menuitem action='mail-next-thread'/>
- <separator/>
- <menuitem action='mail-previous'/>
- <menuitem action='mail-previous-unread'/>
- <menuitem action='mail-previous-important'/>
- </menu>
- <menuitem action='mail-reply-sender'/>
- <menuitem action='mail-reply-list'/>
- <menuitem action='mail-reply-all'/>
- <menuitem action='mail-reply-post'/>
- <menuitem action='mail-forward'/>
- <menu action='mail-forward-as-menu'>
- <menuitem action='mail-forward-attached'/>
- <menuitem action='mail-forward-inline'/>
- <menuitem action='mail-forward-quoted'/>
- <separator/>
- <menuitem action='mail-redirect'/>
- </menu>
- <separator/>
- <menuitem action='mail-copy'/>
- <menuitem action='mail-move'/>
- <separator/>
- <menu action='mail-mark-as-menu'>
- <menuitem action="mail-mark-read"/>
- <menuitem action="mail-mark-unread"/>
- <separator/>
- <menuitem action="mail-mark-important"/>
- <menuitem action="mail-mark-unimportant"/>
- <separator/>
- <menuitem action="mail-mark-junk"/>
- <menuitem action="mail-mark-notjunk"/>
- <separator/>
- <menuitem action="mail-flag-for-followup"/>
- <menuitem action="mail-flag-clear"/>
- <menuitem action="mail-flag-completed"/>
- </menu>
- <menuitem action='mail-filters-apply'/>
- <menuitem action='mail-check-for-junk'/>
- <separator/>
- <menu action='mail-create-rule-menu'>
- <menuitem action='mail-filter-on-subject'/>
- <menuitem action='mail-filter-on-sender'/>
- <menuitem action='mail-filter-on-recipients'/>
- <menuitem action='mail-filter-on-mailing-list'/>
- <separator/>
- <menuitem action='mail-search-folder-from-subject'/>
- <menuitem action='mail-search-folder-from-sender'/>
- <menuitem action='mail-search-folder-from-recipients'/>
- <menuitem action='mail-search-folder-from-mailing-list'/>
- </menu>
- </menu>
+ <menu action='mail-message-menu'/>
</placeholder>
<menu action='search-menu'>
<placeholder name='search-actions'>
@@ -149,18 +61,10 @@
</menu>
</menubar>
<toolbar name='main-toolbar'>
- <toolitem action='mail-reply-sender'/>
- <toolitem action='mail-reply-all'/>
- <toolitem action='mail-forward'/>
- <separator/>
- <toolitem action='mail-print'/>
- <toolitem action='mail-delete'/>
- <toolitem action='mail-mark-junk'/>
- <toolitem action='mail-mark-notjunk'/>
+ <placeholder name='mail-toolbar-common'/>
<toolitem action='mail-stop'/>
<separator/>
- <toolitem action='mail-previous'/>
- <toolitem action='mail-next'/>
+ <placeholder name='mail-toolbar-navigation'/>
</toolbar>
<popup name='mail-folder-popup'>
<menuitem action='mail-folder-new'/>
diff --git a/widgets/misc/e-charset-picker.c b/widgets/misc/e-charset-picker.c
index 03014609ae..1f24397fae 100644
--- a/widgets/misc/e-charset-picker.c
+++ b/widgets/misc/e-charset-picker.c
@@ -440,6 +440,7 @@ e_charset_picker_dialog (const char *title, const char *prompt,
/**
* e_charset_add_radio_actions:
* @action_group: a #GtkActionGroup
+ * @action_prefix: a prefix for action names, or %NULL
* @default_charset: the default character set, or %NULL to use the
* locale character set
* @callback: a callback function for actions in the group, or %NULL
@@ -453,8 +454,9 @@ e_charset_picker_dialog (const char *title, const char *prompt,
* the default will be added next, followed by the remaining character
* sets.
**/
-void
+GSList *
e_charset_add_radio_actions (GtkActionGroup *action_group,
+ const gchar *action_prefix,
const gchar *default_charset,
GCallback callback,
gpointer user_data)
@@ -464,12 +466,10 @@ e_charset_add_radio_actions (GtkActionGroup *action_group,
const gchar *locale_charset;
gint def, ii;
- g_return_if_fail (GTK_IS_ACTION_GROUP (action_group));
+ g_return_val_if_fail (GTK_IS_ACTION_GROUP (action_group), NULL);
- /* XXX I could try to factor out code common to this
- * function and e_charset_picker_bonobo_ui_populate()
- * instead of duplicating it, but I expect the latter
- * function to be obsolete in the foreseeable future. */
+ if (action_prefix == NULL)
+ action_prefix = "";
g_get_charset (&locale_charset);
if (!g_ascii_strcasecmp (locale_charset, "US-ASCII"))
@@ -482,13 +482,18 @@ e_charset_add_radio_actions (GtkActionGroup *action_group,
break;
for (ii = 0; ii < G_N_ELEMENTS (charsets); ii++) {
+ const gchar *charset_name;
+ gchar *action_name;
gchar *escaped_name;
gchar *charset_label;
gchar **str_array;
+ charset_name = charsets[ii].name;
+ action_name = g_strconcat (action_prefix, charset_name, NULL);
+
/* Escape underlines in the character set name so
* they're not treated as GtkLabel mnemonics. */
- str_array = g_strsplit (charsets[ii].name, "_", -1);
+ str_array = g_strsplit (charset_name, "_", -1);
escaped_name = g_strjoinv ("__", str_array);
g_strfreev (str_array);
@@ -506,8 +511,14 @@ e_charset_add_radio_actions (GtkActionGroup *action_group,
else
charset_label = g_strdup (escaped_name);
+ /* XXX Add a tooltip! */
action = gtk_radio_action_new (
- charsets[ii].name, charset_label, NULL, NULL, ii);
+ action_name, charset_label, NULL, NULL, ii);
+
+ /* Character set name is static so no need to free it. */
+ g_object_set_data (
+ G_OBJECT (action), "charset",
+ (gpointer) charset_name);
gtk_radio_action_set_group (action, group);
group = gtk_radio_action_get_group (action);
@@ -521,22 +532,34 @@ e_charset_add_radio_actions (GtkActionGroup *action_group,
g_object_unref (action);
+ g_free (action_name);
g_free (escaped_name);
g_free (charset_label);
}
if (def == G_N_ELEMENTS (charsets)) {
+ const gchar *charset_name;
+ gchar *action_name;
gchar *charset_label;
gchar **str_array;
+ charset_name = default_charset;
+ action_name = g_strconcat (action_prefix, charset_name, NULL);
+
/* Escape underlines in the character set name so
* they're not treated as GtkLabel mnemonics. */
- str_array = g_strsplit (default_charset, "_", -1);
+ str_array = g_strsplit (charset_name, "_", -1);
charset_label = g_strjoinv ("__", str_array);
g_strfreev (str_array);
+ /* XXX Add a tooltip! */
action = gtk_radio_action_new (
- default_charset, charset_label, NULL, NULL, def);
+ action_name, charset_label, NULL, NULL, def);
+
+ /* Character set name is static so no need to free it. */
+ g_object_set_data (
+ G_OBJECT (action), "charset",
+ (gpointer) charset_name);
gtk_radio_action_set_group (action, group);
group = gtk_radio_action_get_group (action);
@@ -550,165 +573,13 @@ e_charset_add_radio_actions (GtkActionGroup *action_group,
g_object_unref (action);
+ g_free (action_name);
g_free (charset_label);
}
/* Any of the actions in the action group will do. */
if (action != NULL)
gtk_radio_action_set_current_value (action, def);
-}
-
-/**
- * e_charset_picker_bonobo_ui_populate:
- * @uic: Bonobo UI Component
- * @path: menu path
- * @default_charset: the default character set, or %NULL to use the
- * locale character set.
- * @cb: Callback function
- * @user_data: data to be passed to the callback.
- *
- * This creates a Bonobo UI menu and fills it in with a selection
- * of available character sets. The @default_charset (or locale character
- * set if @default_charset is %NULL) will be listed first, and selected
- * by default (except that iso-8859-1 will always be used instead of
- * US-ASCII). Any other character sets of the same language class as
- * the default will be listed next, followed by the remaining character
- * sets.
- **/
-void
-e_charset_picker_bonobo_ui_populate (BonoboUIComponent *uic, const char *path,
- const char *default_charset,
- BonoboUIListenerFn cb, gpointer user_data)
-{
- char *encoded_label, *label;
- const char *locale_charset;
- GString *menuitems;
- int def, i;
-
- g_get_charset (&locale_charset);
- if (!g_ascii_strcasecmp (locale_charset, "US-ASCII"))
- locale_charset = "iso-8859-1";
-
- if (!default_charset)
- default_charset = locale_charset;
- for (def = 0; def < num_charsets; def++) {
- if (!g_ascii_strcasecmp (charsets[def].name, default_charset))
- break;
- }
-
- label = g_strdup (_("Ch_aracter Encoding"));
- encoded_label = bonobo_ui_util_encode_str (label);
- menuitems = g_string_new ("");
- g_string_append_printf (menuitems, "<submenu name=\"ECharsetPicker\" label=\"%s\">\n",
- encoded_label);
- g_free (encoded_label);
- g_free (label);
-
- for (i = 0; i < num_charsets; i++) {
- char *command;
- char *charset_name, *u;
-
- /* escape _'s in the charset name so that it doesn't become an underline in a GtkLabel */
- if ((u = strchr (charsets[i].name, '_'))) {
- int extra = 1;
- char *s, *d;
-
- while ((u = strchr (u + 1, '_')))
- extra++;
-
- d = charset_name = g_alloca (strlen (charsets[i].name) + extra + 1);
- s = charsets[i].name;
- while (*s != '\0') {
- if (*s == '_')
- *d++ = '_';
- *d++ = *s++;
- }
- *d = '\0';
- } else {
- charset_name = charsets[i].name;
- }
-
- if (charsets[i].subclass) {
- label = g_strdup_printf ("%s, %s (%s)",
- _(classnames[charsets[i].class]),
- _(charsets[i].subclass),
- charset_name);
- } else if (charsets[i].class) {
- label = g_strdup_printf ("%s (%s)",
- _(classnames[charsets[i].class]),
- charset_name);
- } else {
- label = g_strdup (charset_name);
- }
-
- encoded_label = bonobo_ui_util_encode_str (label);
- g_free (label);
-
- command = g_strdup_printf ("<cmd name=\"Charset-%s\" label=\"%s\" type=\"radio\""
- " group=\"charset_picker\" state=\"%d\"/>\n",
- charsets[i].name, encoded_label, i == def);
-
- bonobo_ui_component_set (uic, "/commands", command, NULL);
- g_free (command);
-
- g_string_append_printf (menuitems, " <menuitem name=\"Charset-%s\" verb=\"\"/>\n",
- charsets[i].name);
-
- g_free (encoded_label);
-
- label = g_strdup_printf ("Charset-%s", charsets[i].name);
- bonobo_ui_component_add_listener (uic, label, cb, user_data);
- g_free (label);
- }
-
- if (def == num_charsets) {
- char *command;
- char *charset_name, *u;
-
- /* escape _'s in the charset name so that it doesn't become an underline in a GtkLabel */
- if ((u = strchr (default_charset, '_'))) {
- int extra = 1;
- char *s, *d;
-
- while ((u = strchr (u + 1, '_')))
- extra++;
-
- d = charset_name = g_alloca (strlen (default_charset) + extra + 1);
- s = (char *) default_charset;
- while (*s != '\0') {
- if (*s == '_')
- *d++ = '_';
- *d++ = *s++;
- }
- *d = '\0';
- } else {
- charset_name = (char *) default_charset;
- }
-
- label = g_strdup (charset_name);
- encoded_label = bonobo_ui_util_encode_str (label);
- g_free (label);
-
- command = g_strdup_printf ("<cmd name=\"Charset-%s\" label=\"%s\" type=\"radio\""
- " group=\"charset_picker\" state=\"1\"/>\n",
- default_charset, encoded_label);
-
- bonobo_ui_component_set (uic, "/commands", command, NULL);
- g_free (command);
-
- g_string_append (menuitems, " <separator/>\n");
- g_string_append_printf (menuitems, " <menuitem name=\"Charset-%s\" verb=\"\"/>\n",
- default_charset);
-
- g_free (encoded_label);
-
- label = g_strdup_printf ("Charset-%s", default_charset);
- bonobo_ui_component_add_listener (uic, label, cb, user_data);
- g_free (label);
- }
-
- g_string_append (menuitems, "</submenu>\n");
- bonobo_ui_component_set (uic, path, menuitems->str, NULL);
- g_string_free (menuitems, TRUE);
+ return group;
}
diff --git a/widgets/misc/e-charset-picker.h b/widgets/misc/e-charset-picker.h
index 7250b10dfb..21643ccf99 100644
--- a/widgets/misc/e-charset-picker.h
+++ b/widgets/misc/e-charset-picker.h
@@ -33,18 +33,12 @@ char * e_charset_picker_dialog (const char *title,
const char *default_charset,
GtkWindow *parent);
-void e_charset_add_radio_actions (GtkActionGroup *action_group,
+GSList * e_charset_add_radio_actions (GtkActionGroup *action_group,
+ const gchar *action_prefix,
const gchar *default_charset,
GCallback callback,
gpointer user_data);
-void e_charset_picker_bonobo_ui_populate
- (BonoboUIComponent *uic,
- const char *path,
- const char *default_charset,
- BonoboUIListenerFn cb,
- gpointer user_data);
-
G_END_DECLS
#endif /* E_CHARSETPICKER_H */