diff options
-rw-r--r-- | doc/reference/shell/tmpl/e-shell-view.sgml | 5 | ||||
-rw-r--r-- | doc/reference/shell/tmpl/e-shell-window.sgml | 5 | ||||
-rw-r--r-- | e-util/e-dialog-utils.c | 26 | ||||
-rw-r--r-- | e-util/e-dialog-utils.h | 2 | ||||
-rw-r--r-- | mail/Makefile.am | 6 | ||||
-rw-r--r-- | mail/e-mail-browser.c | 291 | ||||
-rw-r--r-- | mail/e-mail-browser.h | 69 | ||||
-rw-r--r-- | mail/e-mail-reader.c | 1653 | ||||
-rw-r--r-- | mail/e-mail-reader.h | 85 | ||||
-rw-r--r-- | mail/e-mail-shell-content.c | 120 | ||||
-rw-r--r-- | mail/e-mail-shell-module-settings.c | 12 | ||||
-rw-r--r-- | mail/e-mail-shell-module.c | 106 | ||||
-rw-r--r-- | mail/e-mail-shell-module.h | 2 | ||||
-rw-r--r-- | mail/e-mail-shell-view-actions.c | 1492 | ||||
-rw-r--r-- | mail/e-mail-shell-view-private.c | 3 | ||||
-rw-r--r-- | mail/e-mail-shell-view-private.h | 1 | ||||
-rw-r--r-- | mail/em-folder-view.c | 1109 | ||||
-rw-r--r-- | mail/em-message-browser.c | 2 | ||||
-rw-r--r-- | mail/em-utils.c | 60 | ||||
-rw-r--r-- | mail/em-utils.h | 104 | ||||
-rw-r--r-- | mail/mail-component.c | 195 | ||||
-rw-r--r-- | shell/e-shell-view.c | 21 | ||||
-rw-r--r-- | shell/e-shell-window.c | 24 |
23 files changed, 2741 insertions, 2652 deletions
diff --git a/doc/reference/shell/tmpl/e-shell-view.sgml b/doc/reference/shell/tmpl/e-shell-view.sgml index 1ea1eb6118..4eff37a0eb 100644 --- a/doc/reference/shell/tmpl/e-shell-view.sgml +++ b/doc/reference/shell/tmpl/e-shell-view.sgml @@ -52,6 +52,11 @@ EShellView </para> +<!-- ##### ARG EShellView:shell-module ##### --> +<para> + +</para> + <!-- ##### ARG EShellView:shell-sidebar ##### --> <para> diff --git a/doc/reference/shell/tmpl/e-shell-window.sgml b/doc/reference/shell/tmpl/e-shell-window.sgml index 48f51ef992..0d083b2220 100644 --- a/doc/reference/shell/tmpl/e-shell-window.sgml +++ b/doc/reference/shell/tmpl/e-shell-window.sgml @@ -38,6 +38,11 @@ EShellWindow </para> +<!-- ##### ARG EShellWindow:ui-manager ##### --> +<para> + +</para> + <!-- ##### FUNCTION e_shell_window_new ##### --> <para> diff --git a/e-util/e-dialog-utils.c b/e-util/e-dialog-utils.c index ecf9e7ec1e..a97d2c936f 100644 --- a/e-util/e-dialog-utils.c +++ b/e-util/e-dialog-utils.c @@ -344,29 +344,29 @@ e_file_dialog_save_folder (const char *title) * no signals connected and is not shown. **/ GtkWidget * -e_file_get_save_filesel (GtkWidget *parent, const char *title, const char *name, GtkFileChooserAction action) +e_file_get_save_filesel (GtkWindow *parent, const char *title, const char *name, GtkFileChooserAction action) { GtkWidget *filesel; char *uri; - filesel = gtk_file_chooser_dialog_new (title, - NULL, - action, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - (action == GTK_FILE_CHOOSER_ACTION_OPEN) ? GTK_STOCK_OPEN:GTK_STOCK_SAVE, GTK_RESPONSE_OK, - NULL); + g_return_val_if_fail (GTK_IS_WINDOW (parent), NULL); + + filesel = gtk_file_chooser_dialog_new ( + title, parent, action, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + (action == GTK_FILE_CHOOSER_ACTION_OPEN) ? + GTK_STOCK_OPEN : GTK_STOCK_SAVE, GTK_RESPONSE_OK, NULL); gtk_dialog_set_default_response (GTK_DIALOG (filesel), GTK_RESPONSE_OK); gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (filesel), FALSE); - if (parent) - e_dialog_set_transient_for((GtkWindow *)filesel, parent); - - uri = e_file_get_save_path(); + uri = e_file_get_save_path (); - gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (filesel), uri); + gtk_file_chooser_set_current_folder_uri ( + GTK_FILE_CHOOSER (filesel), uri); if (name && name[0]) - gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (filesel), name); + gtk_file_chooser_set_current_name ( + GTK_FILE_CHOOSER (filesel), name); g_free (uri); diff --git a/e-util/e-dialog-utils.h b/e-util/e-dialog-utils.h index 9d594122e2..9e6e7992c1 100644 --- a/e-util/e-dialog-utils.h +++ b/e-util/e-dialog-utils.h @@ -43,7 +43,7 @@ char *e_file_dialog_save (const char *title, const char *fname) char *e_file_dialog_save_folder (const char *title); -GtkWidget * e_file_get_save_filesel (GtkWidget *parent, const char *title, const char *name, GtkFileChooserAction action); +GtkWidget * e_file_get_save_filesel (GtkWindow *parent, const char *title, const char *name, GtkFileChooserAction action); gboolean e_file_can_save(GtkWindow *parent, const char *uri); gboolean e_file_check_local(const char *name); diff --git a/mail/Makefile.am b/mail/Makefile.am index cebc6ee725..e0e1e5982e 100644 --- a/mail/Makefile.am +++ b/mail/Makefile.am @@ -35,6 +35,12 @@ module_LTLIBRARIES = \ libevolution-module-mail.la libevolution_module_mail_la_SOURCES = \ + e-mail-browser.c \ + e-mail-browser.h \ + e-mail-reader.c \ + e-mail-reader.h \ + e-mail-reader-utils.c \ + e-mail-reader-utils.h \ e-mail-shell-module.c \ e-mail-shell-module.h \ e-mail-shell-module-migrate.c \ diff --git a/mail/e-mail-browser.c b/mail/e-mail-browser.c new file mode 100644 index 0000000000..9334a82aff --- /dev/null +++ b/mail/e-mail-browser.c @@ -0,0 +1,291 @@ +/* + * e-mail-browser.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-browser.h" + +#include <glib/gi18n.h> +#include <camel/camel-folder.h> + +#include "mail/e-mail-reader.h" +#include "mail/e-mail-shell-module.h" +#include "mail/em-folder-tree-model.h" +#include "mail/em-format-html-display.h" +#include "mail/message-list.h" + +#define E_MAIL_BROWSER_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_MAIL_BROWSER, EMailBrowserPrivate)) + +struct _EMailBrowserPrivate { + GtkUIManager *ui_manager; + EShellModule *shell_module; + GtkActionGroup *action_group; +}; + +enum { + PROP_0, + PROP_SHELL_MODULE, + PROP_UI_MANAGER +}; + +static gpointer parent_class; + +static void +mail_browser_set_shell_module (EMailBrowser *browser, + EShellModule *shell_module) +{ + g_return_if_fail (browser->priv->shell_module == NULL); + + browser->priv->shell_module = g_object_ref (shell_module); +} + +static void +mail_browser_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) +{ + switch (property_id) { + case PROP_SHELL_MODULE: + mail_browser_set_shell_module ( + E_MAIL_BROWSER (object), + g_value_get_object (value)); + return; + } + + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +} + +static void +mail_browser_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + switch (property_id) { + case PROP_SHELL_MODULE: + g_value_set_object ( + value, e_mail_browser_get_shell_module ( + E_MAIL_BROWSER (object))); + return; + + case PROP_UI_MANAGER: + g_value_set_object ( + value, e_mail_browser_get_ui_manager ( + E_MAIL_BROWSER (object))); + return; + } + + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +} + +static void +mail_browser_dispose (GObject *object) +{ + EMailBrowserPrivate *priv; + + priv = E_MAIL_BROWSER_GET_PRIVATE (object); + + if (priv->ui_manager != NULL) { + g_object_unref (priv->ui_manager); + priv->ui_manager = NULL; + } + + if (priv->shell_module != NULL) { + g_object_unref (priv->shell_module); + priv->shell_module = NULL; + } + + if (priv->action_group != NULL) { + g_object_unref (priv->action_group); + priv->action_group = NULL; + } + + /* Chain up to parent's dispose() method. */ + G_OBJECT_CLASS (parent_class)->dispose (object); +} + +static void +mail_browser_constructed (GObject *object) +{ +} + +static GtkActionGroup * +mail_browser_get_action_group (EMailReader *reader) +{ + EMailBrowserPrivate *priv; + + priv = E_MAIL_BROWSER_GET_PRIVATE (reader); + + return priv->action_group; +} + +static EMFormatHTMLDisplay * +mail_browser_get_display (EMailReader *reader) +{ +} + +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) +{ +} + +static MessageList * +mail_browser_get_message_list (EMailReader *reader) +{ +} + +static EMFolderTreeModel * +mail_browser_get_tree_model (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); +} + +static GtkWindow * +mail_browser_get_window (EMailReader *reader) +{ + return GTK_WINDOW (reader); +} + +static void +mail_browser_class_init (EMailBrowserClass *class) +{ + GObjectClass *object_class; + + parent_class = g_type_class_peek_parent (class); + g_type_class_add_private (class, sizeof (EMailBrowserPrivate)); + + object_class = G_OBJECT_CLASS (class); + object_class->set_property = mail_browser_set_property; + object_class->get_property = mail_browser_get_property; + object_class->dispose = mail_browser_dispose; + object_class->constructed = mail_browser_constructed; + + g_object_class_install_property ( + object_class, + PROP_SHELL_MODULE, + g_param_spec_object ( + "shell-module", + _("Shell Module"), + _("The mail shell module"), + E_TYPE_SHELL_MODULE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY)); +} + +static void +mail_browser_iface_init (EMailReaderIface *iface) +{ + iface->get_action_group = mail_browser_get_action_group; + iface->get_display = mail_browser_get_display; + 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_message_list = mail_browser_get_message_list; + iface->get_tree_model = mail_browser_get_tree_model; + iface->get_window = mail_browser_get_window; +} + +static void +mail_browser_init (EMailBrowser *browser) +{ + browser->priv = E_MAIL_BROWSER_GET_PRIVATE (browser); + + browser->priv->ui_manager = gtk_ui_manager_new (); + browser->priv->action_group = gtk_action_group_new ("mail-browser"); +} + +GType +e_mail_browser_get_type (void) +{ + static GType type = 0; + + if (G_UNLIKELY (type == 0)) { + static const GTypeInfo type_info = { + sizeof (EMailBrowserClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) mail_browser_class_init, + (GClassFinalizeFunc) NULL, + NULL, /* class_data */ + sizeof (EMailBrowser), + 0, /* n_preallocs */ + (GInstanceInitFunc) mail_browser_init, + NULL /* value_table */ + }; + + static const GInterfaceInfo iface_info = { + (GInterfaceInitFunc) mail_browser_iface_init, + (GInterfaceFinalizeFunc) NULL, + NULL /* interface_data */ + }; + + type = g_type_register_static ( + GTK_TYPE_WINDOW, "EMailBrowser", &type_info, 0); + + g_type_add_interface_static ( + type, E_TYPE_MAIL_BROWSER, &iface_info); + } + + return type; +} + +GtkWidget * +e_mail_browser_new (EShellModule *shell_module) +{ + g_return_val_if_fail (E_IS_SHELL_MODULE (shell_module), NULL); + + return g_object_new ( + E_TYPE_MAIL_BROWSER, + "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) +{ + g_return_val_if_fail (E_IS_MAIL_BROWSER (browser), NULL); + + return browser->priv->ui_manager; +} diff --git a/mail/e-mail-browser.h b/mail/e-mail-browser.h new file mode 100644 index 0000000000..e5096fbe85 --- /dev/null +++ b/mail/e-mail-browser.h @@ -0,0 +1,69 @@ +/* + * e-mail-browser.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_BROWSER_H +#define E_MAIL_BROWSER_H + +#include <gtk/gtk.h> +#include <shell/e-shell-module.h> + +/* Standard GObject macros */ +#define E_TYPE_MAIL_BROWSER \ + (e_mail_browser_get_type ()) +#define E_MAIL_BROWSER(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_MAIL_BROWSER, EMailBrowser)) +#define E_MAIL_BROWSER_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_MAIL_BROWSER, EMailBrowserClass)) +#define E_IS_MAIL_BROWSER(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_MAIL_BROWSER)) +#define E_IS_MAIL_BROWSER_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_MAIL_BROWSER)) +#define E_MAIL_BROWSER_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_MAIL_BROWSER, EMailBrowserClass)) + +G_BEGIN_DECLS + +typedef struct _EMailBrowser EMailBrowser; +typedef struct _EMailBrowserClass EMailBrowserClass; +typedef struct _EMailBrowserPrivate EMailBrowserPrivate; + +struct _EMailBrowser { + GtkWindow parent; + EMailBrowserPrivate *priv; +}; + +struct _EMailBrowserClass { + GtkWindowClass parent_class; +}; + +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 + +#endif /* E_MAIL_BROWSER_H */ diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c new file mode 100644 index 0000000000..ca23deda78 --- /dev/null +++ b/mail/e-mail-reader.c @@ -0,0 +1,1653 @@ +/* + * e-mail-reader.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-reader.h" + +#include <glib/gi18n.h> +#include <gdk/gdkkeysyms.h> +#include <gtkhtml/gtkhtml.h> + +#ifdef HAVE_XFREE +#include <X11/XF86keysym.h> +#endif + +#include "e-util/gconf-bridge.h" + +#include "mail/e-mail-reader-utils.h" +#include "mail/em-composer-utils.h" +#include "mail/em-folder-selector.h" +#include "mail/em-folder-tree.h" +#include "mail/em-utils.h" +#include "mail/mail-autofilter.h" +#include "mail/mail-ops.h" + +/* Remembers the previously selected folder when transferring messages. */ +static gchar *default_xfer_messages_uri; + +static void +action_mail_add_sender_cb (GtkAction *action, + EMailReader *reader) +{ + MessageList *message_list; + CamelMessageInfo *info; + CamelFolder *folder; + GtkWindow *window; + 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); + + uids = message_list_get_selected (message_list); + + if (uids->len != 1) + goto exit; + + info = camel_folder_get_message_info (folder, uids->pdata[0]); + if (info == NULL) + goto exit; + + address = camel_message_info_from (info); + if (address == NULL || *address == '\0') + goto exit; + + em_utils_add_address (window, address); + +exit: + em_utils_uids_free (uids); +} + +static void +action_mail_caret_mode_cb (GtkToggleAction *action, + EMailReader *reader) +{ + EMFormatHTMLDisplay *display; + gboolean active; + + display = e_mail_reader_get_display (reader); + active = gtk_toggle_action_get_active (action); + + em_format_html_display_set_caret_mode (display, active); +} + +static void +action_mail_check_for_junk_cb (GtkAction *action, + EMailReader *reader) +{ + MessageList *message_list; + CamelFolder *folder; + GPtrArray *uids; + + folder = e_mail_reader_get_folder (reader); + message_list = e_mail_reader_get_message_list (reader); + + uids = message_list_get_selected (message_list); + + mail_filter_junk (folder, uids); +} + +static void +action_mail_clipboard_copy_cb (GtkAction *action, + EMailReader *reader) +{ + EMFormatHTMLDisplay *display; + GtkHTML *html; + + display = e_mail_reader_get_display (reader); + html = ((EMFormatHTML *) display)->html; + + gtk_html_copy (html); +} + +static void +action_mail_copy_cb (GtkAction *action, + EMailReader *reader) +{ + MessageList *message_list; + EMFolderTreeModel *model; + CamelFolder *folder; + GtkWidget *folder_tree; + GtkWidget *dialog; + 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); + + folder_tree = em_folder_tree_new_with_model (model); + selected = message_list_get_selected (message_list); + + em_folder_tree_set_excluded ( + EM_FOLDER_TREE (folder_tree), + EMFT_EXCLUDE_NOSELECT | EMFT_EXCLUDE_VIRTUAL | + EMFT_EXCLUDE_VTRASH); + + dialog = em_folder_selector_new ( + EM_FOLDER_TREE (folder_tree), + EM_FOLDER_SELECTOR_CAN_CREATE, + _("Select Folder"), NULL, _("C_opy")); + + if (default_xfer_messages_uri != NULL) + em_folder_selector_set_selected ( + EM_FOLDER_SELECTOR (dialog), + default_xfer_messages_uri); + + if (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_OK) + goto exit; + + uri = em_folder_selector_get_selected_uri ( + EM_FOLDER_SELECTOR (dialog)); + + g_free (default_xfer_messages_uri); + default_xfer_messages_uri = g_strdup (uri); + + if (uri != NULL) { + mail_transfer_messages ( + folder, selected, FALSE, uri, 0, NULL, NULL); + selected = NULL; + } + +exit: + if (selected != NULL) + em_utils_uids_free (selected); + + gtk_widget_destroy (dialog); +} + +static void +action_mail_delete_cb (GtkAction *action, + EMailReader *reader) +{ + guint32 mask = CAMEL_MESSAGE_SEEN | CAMEL_MESSAGE_DELETED; + guint32 set = CAMEL_MESSAGE_SEEN | CAMEL_MESSAGE_DELETED; + + if (!e_mail_reader_confirm_delete (reader)) + return; + + /* FIXME Verify all selected messages are deletable. + * But handle it by disabling this action. */ + + if (e_mail_reader_mark_selected (reader, mask, set) == 1) + e_mail_reader_select_next_message (reader, FALSE); +} + +static void +action_mail_filter_on_mailing_list_cb (GtkAction *action, + EMailReader *reader) +{ + e_mail_reader_create_filter_from_selected (reader, AUTO_MLIST); +} + +static void +action_mail_filter_on_recipients_cb (GtkAction *action, + EMailReader *reader) +{ + e_mail_reader_create_filter_from_selected (reader, AUTO_TO); +} + +static void +action_mail_filter_on_sender_cb (GtkAction *action, + EMailReader *reader) +{ + e_mail_reader_create_filter_from_selected (reader, AUTO_FROM); +} + +static void +action_mail_filter_on_subject_cb (GtkAction *action, + EMailReader *reader) +{ + e_mail_reader_create_filter_from_selected (reader, AUTO_SUBJECT); +} + +static void +action_mail_filters_apply_cb (GtkAction *action, + EMailReader *reader) +{ + MessageList *message_list; + CamelFolder *folder; + GPtrArray *uids; + + folder = e_mail_reader_get_folder (reader); + message_list = e_mail_reader_get_message_list (reader); + + uids = message_list_get_selected (message_list); + + mail_filter_on_demand (folder, uids); +} + +static void +action_mail_find_cb (GtkAction *action, + EMailReader *reader) +{ + /* FIXME */ +} + +static void +action_mail_flag_clear_cb (GtkAction *action, + EMailReader *reader) +{ + EMFormatHTMLDisplay *display; + MessageList *message_list; + CamelFolder *folder; + GtkWindow *window; + GPtrArray *uids; + + display = e_mail_reader_get_display (reader); + folder = e_mail_reader_get_folder (reader); + message_list = e_mail_reader_get_message_list (reader); + window = e_mail_reader_get_window (reader); + + uids = message_list_get_selected (message_list); + + em_utils_flag_for_followup_clear (window, folder, uids); + + em_format_redraw ((EMFormat *) display); +} + +static void +action_mail_flag_completed_cb (GtkAction *action, + EMailReader *reader) +{ + EMFormatHTMLDisplay *display; + MessageList *message_list; + CamelFolder *folder; + GtkWindow *window; + GPtrArray *uids; + + display = e_mail_reader_get_display (reader); + folder = e_mail_reader_get_folder (reader); + message_list = e_mail_reader_get_message_list (reader); + window = e_mail_reader_get_window (reader); + + uids = message_list_get_selected (message_list); + + em_utils_flag_for_followup_completed (window, folder, uids); + + em_format_redraw ((EMFormat *) display); +} + +static void +action_mail_flag_for_followup_cb (GtkAction *action, + EMailReader *reader) +{ + MessageList *message_list; + CamelFolder *folder; + 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); + + uids = message_list_get_selected (message_list); + + em_utils_flag_for_followup (window, folder, uids); +} + +static void +action_mail_forward_cb (GtkAction *action, + EMailReader *reader) +{ + MessageList *message_list; + CamelFolder *folder; + GtkWindow *window; + 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; + + uids = message_list_get_selected (message_list); + + em_utils_forward_messages (folder, uids, folder_uri); +} + +static void +action_mail_forward_attached_cb (GtkAction *action, + EMailReader *reader) +{ + MessageList *message_list; + CamelFolder *folder; + GtkWindow *window; + 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; + + uids = message_list_get_selected (message_list); + + em_utils_forward_attached (folder, uids, folder_uri); +} + +static void +action_mail_forward_inline_cb (GtkAction *action, + EMailReader *reader) +{ + MessageList *message_list; + CamelFolder *folder; + GtkWindow *window; + 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; + + uids = message_list_get_selected (message_list); + + em_utils_forward_inline (folder, uids, folder_uri); +} + +static void +action_mail_forward_quoted_cb (GtkAction *action, + EMailReader *reader) +{ + MessageList *message_list; + CamelFolder *folder; + GtkWindow *window; + 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; + + uids = message_list_get_selected (message_list); + + em_utils_forward_quoted (folder, uids, folder_uri); +} + +static void +action_mail_load_images_cb (GtkAction *action, + EMailReader *reader) +{ + EMFormatHTMLDisplay *display; + + display = e_mail_reader_get_display (reader); + + em_format_html_load_http ((EMFormatHTML *) display); +} + +static void +action_mail_mark_important_cb (GtkAction *action, + EMailReader *reader) +{ + guint32 mask = CAMEL_MESSAGE_FLAGGED | CAMEL_MESSAGE_DELETED; + guint32 set = CAMEL_MESSAGE_FLAGGED; + + e_mail_reader_mark_selected (reader, mask, set); +} + +static void +action_mail_mark_junk_cb (GtkAction *action, + EMailReader *reader) +{ + guint32 mask = CAMEL_MESSAGE_SEEN | CAMEL_MESSAGE_JUNK | + CAMEL_MESSAGE_NOTJUNK | CAMEL_MESSAGE_JUNK_LEARN; + guint32 set = CAMEL_MESSAGE_SEEN | CAMEL_MESSAGE_JUNK | + CAMEL_MESSAGE_JUNK_LEARN; + + if (e_mail_reader_mark_selected (reader, mask, set) == 1) + e_mail_reader_select_next_message (reader, TRUE); +} + +static void +action_mail_mark_notjunk_cb (GtkAction *action, + EMailReader *reader) +{ + guint32 mask = CAMEL_MESSAGE_JUNK | CAMEL_MESSAGE_NOTJUNK | + CAMEL_MESSAGE_JUNK_LEARN; + guint32 set = CAMEL_MESSAGE_NOTJUNK | CAMEL_MESSAGE_JUNK_LEARN; + + if (e_mail_reader_mark_selected (reader, mask, set) == 1) + e_mail_reader_select_next_message (reader, TRUE); +} + +static void +action_mail_mark_read_cb (GtkAction *action, + EMailReader *reader) +{ + guint32 mask = CAMEL_MESSAGE_SEEN; + guint32 set = CAMEL_MESSAGE_SEEN; + + e_mail_reader_mark_selected (reader, mask, set); +} + +static void +action_mail_mark_unimportant_cb (GtkAction *action, + EMailReader *reader) +{ + guint32 mask = CAMEL_MESSAGE_FLAGGED; + guint32 set = 0; + + e_mail_reader_mark_selected (reader, mask, set); +} + +static void +action_mail_mark_unread_cb (GtkAction *action, + EMailReader *reader) +{ + MessageList *message_list; + guint32 mask = CAMEL_MESSAGE_SEEN | CAMEL_MESSAGE_DELETED; + guint32 set = 0; + + message_list = e_mail_reader_get_message_list (reader); + + e_mail_reader_mark_selected (reader, mask, set); + + if (message_list->seen_id != 0) { + g_source_remove (message_list->seen_id); + message_list->seen_id = 0; + } +} + +static void +action_mail_message_edit_cb (GtkAction *action, + EMailReader *reader) +{ + MessageList *message_list; + CamelFolder *folder; + 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; + + uids = message_list_get_selected (message_list); + + em_utils_edit_messages (folder, uids, FALSE); +} + +static void +action_mail_message_new_cb (GtkAction *action, + EMailReader *reader) +{ + GtkWindow *window; + const gchar *folder_uri; + + folder_uri = e_mail_reader_get_folder_uri (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); +} + +static void +action_mail_message_open_cb (GtkAction *action, + EMailReader *reader) +{ + /* FIXME This belongs in EMailShellView */ + e_mail_reader_open_selected (reader); +} + +static void +action_mail_message_post_cb (GtkAction *action, + EMailReader *reader) +{ + CamelFolder *folder; + + folder = e_mail_reader_get_folder (reader); + + em_utils_post_to_folder (folder); +} + +static void +action_mail_move_cb (GtkAction *action, + EMailReader *reader) +{ + MessageList *message_list; + EMFolderTreeModel *model; + CamelFolder *folder; + GtkWidget *folder_tree; + GtkWidget *dialog; + 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); + + folder_tree = em_folder_tree_new_with_model (model); + selected = message_list_get_selected (message_list); + + em_folder_tree_set_excluded ( + EM_FOLDER_TREE (folder_tree), + EMFT_EXCLUDE_NOSELECT | EMFT_EXCLUDE_VIRTUAL | + EMFT_EXCLUDE_VTRASH); + + dialog = em_folder_selector_new ( + EM_FOLDER_TREE (folder_tree), + EM_FOLDER_SELECTOR_CAN_CREATE, + _("Select Folder"), NULL, _("C_opy")); + + if (default_xfer_messages_uri != NULL) + em_folder_selector_set_selected ( + EM_FOLDER_SELECTOR (dialog), + default_xfer_messages_uri); + + if (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_OK) + goto exit; + + uri = em_folder_selector_get_selected_uri ( + EM_FOLDER_SELECTOR (dialog)); + + g_free (default_xfer_messages_uri); + default_xfer_messages_uri = g_strdup (uri); + + if (uri != NULL) { + mail_transfer_messages ( + folder, selected, TRUE, uri, 0, NULL, NULL); + selected = NULL; + } + +exit: + if (selected != NULL) + em_utils_uids_free (selected); + + gtk_widget_destroy (dialog); +} + +static void +action_mail_next_cb (GtkAction *action, + EMailReader *reader) +{ + MessageList *message_list; + MessageListSelectDirection direction; + guint32 flags, mask; + + direction = MESSAGE_LIST_SELECT_NEXT; + flags = 0; + mask = 0; + + message_list = e_mail_reader_get_message_list (reader); + message_list_select (message_list, direction, flags, mask); +} + +static void +action_mail_next_important_cb (GtkAction *action, + EMailReader *reader) +{ + MessageList *message_list; + MessageListSelectDirection direction; + guint32 flags, mask; + + direction = MESSAGE_LIST_SELECT_NEXT | MESSAGE_LIST_SELECT_WRAP; + flags = CAMEL_MESSAGE_FLAGGED; + mask = CAMEL_MESSAGE_FLAGGED; + + message_list = e_mail_reader_get_message_list (reader); + message_list_select (message_list, direction, flags, mask); +} + +static void +action_mail_next_thread_cb (GtkAction *action, + EMailReader *reader) +{ + MessageList *message_list; + + message_list = e_mail_reader_get_message_list (reader); + message_list_select_next_thread (message_list); +} + +static void +action_mail_next_unread_cb (GtkAction *action, + EMailReader *reader) +{ + MessageList *message_list; + MessageListSelectDirection direction; + guint32 flags, mask; + + direction = MESSAGE_LIST_SELECT_NEXT | MESSAGE_LIST_SELECT_WRAP; + flags = 0; + mask = CAMEL_MESSAGE_SEEN; + + message_list = e_mail_reader_get_message_list (reader); + message_list_select (message_list, direction, flags, mask); +} + +static void +action_mail_previous_cb (GtkAction *action, + EMailReader *reader) +{ + MessageList *message_list; + MessageListSelectDirection direction; + guint32 flags, mask; + + direction = MESSAGE_LIST_SELECT_PREVIOUS; + flags = 0; + mask = 0; + + message_list = e_mail_reader_get_message_list (reader); + message_list_select (message_list, direction, flags, mask); +} + +static void +action_mail_previous_important_cb (GtkAction *action, + EMailReader *reader) +{ + MessageList *message_list; + MessageListSelectDirection direction; + guint32 flags, mask; + + direction = MESSAGE_LIST_SELECT_PREVIOUS | MESSAGE_LIST_SELECT_WRAP; + flags = CAMEL_MESSAGE_FLAGGED; + mask = CAMEL_MESSAGE_FLAGGED; + + message_list = e_mail_reader_get_message_list (reader); + message_list_select (message_list, direction, flags, mask); +} + +static void +action_mail_previous_unread_cb (GtkAction *action, + EMailReader *reader) +{ + MessageList *message_list; + MessageListSelectDirection direction; + guint32 flags, mask; + + direction = MESSAGE_LIST_SELECT_PREVIOUS | MESSAGE_LIST_SELECT_WRAP; + flags = 0; + mask = CAMEL_MESSAGE_SEEN; + + message_list = e_mail_reader_get_message_list (reader); + message_list_select (message_list, direction, flags, mask); +} + +static void +action_mail_print_cb (GtkAction *action, + EMailReader *reader) +{ + GtkPrintOperationAction print_action; + + print_action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG; + e_mail_reader_print (reader, print_action); +} + +static void +action_mail_print_preview_cb (GtkAction *action, + EMailReader *reader) +{ + GtkPrintOperationAction print_action; + + print_action = GTK_PRINT_OPERATION_ACTION_PREVIEW; + e_mail_reader_print (reader, print_action); +} + +static void +action_mail_redirect_cb (GtkAction *action, + EMailReader *reader) +{ + MessageList *message_list; + CamelFolder *folder; + 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); + + uid = message_list->cursor_uid; + g_return_if_fail (uid != NULL); + + if (!em_utils_check_user_can_send_mail (window)) + return; + + em_utils_redirect_message_by_uid (folder, uid); +} + +static void +action_mail_reply_all_cb (GtkAction *action, + EMailReader *reader) +{ + e_mail_reader_reply_to_message (reader, REPLY_MODE_ALL); +} + +static void +action_mail_reply_list_cb (GtkAction *action, + EMailReader *reader) +{ + e_mail_reader_reply_to_message (reader, REPLY_MODE_LIST); +} + +static void +action_mail_reply_post_cb (GtkAction *action, + EMailReader *reader) +{ + MessageList *message_list; + CamelFolder *folder; + 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); + + uid = message_list->cursor_uid; + g_return_if_fail (uid != NULL); + + if (!em_utils_check_user_can_send_mail (window)) + return; + + em_utils_post_reply_to_message_by_uid (folder, uid); +} + +static void +action_mail_reply_sender_cb (GtkAction *action, + EMailReader *reader) +{ + e_mail_reader_reply_to_message (reader, REPLY_MODE_SENDER); +} + +static void +action_mail_save_as_cb (GtkAction *action, + EMailReader *reader) +{ + MessageList *message_list; + CamelFolder *folder; + 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); + + uids = message_list_get_selected (message_list); + + em_utils_save_messages (window, folder, uids); +} + +static void +action_mail_search_folder_from_mailing_list_cb (GtkAction *action, + EMailReader *reader) +{ + e_mail_reader_create_vfolder_from_selected (reader, AUTO_MLIST); +} + +static void +action_mail_search_folder_from_recipients_cb (GtkAction *action, + EMailReader *reader) +{ + e_mail_reader_create_vfolder_from_selected (reader, AUTO_TO); +} + +static void +action_mail_search_folder_from_sender_cb (GtkAction *action, + EMailReader *reader) +{ + e_mail_reader_create_vfolder_from_selected (reader, AUTO_FROM); +} + +static void +action_mail_search_folder_from_subject_cb (GtkAction *action, + EMailReader *reader) +{ + e_mail_reader_create_vfolder_from_selected (reader, AUTO_SUBJECT); +} + +static void +action_mail_select_all_cb (GtkAction *action, + EMailReader *reader) +{ + /* FIXME */ +} + +static void +action_mail_show_all_headers_cb (GtkToggleAction *action, + EMailReader *reader) +{ + /* FIXME */ +} + +static void +action_mail_show_source_cb (GtkAction *action, + EMailReader *reader) +{ + /* FIXME */ +} + +static void +action_mail_toggle_important_cb (GtkAction *action, + EMailReader *reader) +{ + MessageList *message_list; + CamelFolder *folder; + GPtrArray *uids; + guint ii; + + folder = e_mail_reader_get_folder (reader); + message_list = e_mail_reader_get_message_list (reader); + + uids = message_list_get_selected (message_list); + + camel_folder_freeze (folder); + + for (ii = 0; ii < uids->len; ii++) { + guint32 flags; + + flags = camel_folder_get_message_flags ( + folder, uids->pdata[ii]); + flags ^= CAMEL_MESSAGE_FLAGGED; + if (flags & CAMEL_MESSAGE_FLAGGED) + flags &= ~CAMEL_MESSAGE_DELETED; + camel_folder_set_message_flags ( + folder, uids->pdata[ii], CAMEL_MESSAGE_FLAGGED | + CAMEL_MESSAGE_DELETED, flags); + } + + camel_folder_thaw (folder); + + message_list_free_uids (message_list, uids); +} + +static void +action_mail_undelete_cb (GtkAction *action, + EMailReader *reader) +{ + guint32 mask = CAMEL_MESSAGE_DELETED; + guint32 set = 0; + + e_mail_reader_mark_selected (reader, mask, set); +} + +static void +action_mail_zoom_100_cb (GtkAction *action, + EMailReader *reader) +{ + EMFormatHTMLDisplay *display; + + display = e_mail_reader_get_display (reader); + + em_format_html_display_zoom_reset (display); +} + +static void +action_mail_zoom_in_cb (GtkAction *action, + EMailReader *reader) +{ + EMFormatHTMLDisplay *display; + + display = e_mail_reader_get_display (reader); + + em_format_html_display_zoom_in (display); +} + +static void +action_mail_zoom_out_cb (GtkAction *action, + EMailReader *reader) +{ + EMFormatHTMLDisplay *display; + + display = e_mail_reader_get_display (reader); + + em_format_html_display_zoom_out (display); +} + +static GtkActionEntry mail_reader_entries[] = { + + { "mail-add-sender", + NULL, + N_("A_dd Sender to Address Book"), + NULL, + N_("Add sender to address book"), + G_CALLBACK (action_mail_add_sender_cb) }, + + { "mail-check-for-junk", + "mail-mark-junk", + N_("Check for _Junk"), + NULL, + N_("Filter the selected messages for junk status"), + G_CALLBACK (action_mail_check_for_junk_cb) }, + + { "mail-clipboard-copy", + GTK_STOCK_COPY, + NULL, + NULL, + N_("Copy selected messages to the clipboard"), + G_CALLBACK (action_mail_clipboard_copy_cb) }, + + { "mail-copy", + "mail-copy", + N_("_Copy to Folder"), + "<Shift><Control>y", + N_("Copy selected messages to another folder"), + G_CALLBACK (action_mail_copy_cb) }, + + { "mail-delete", + "user-trash", + N_("_Delete Message"), + "<Control>d", + N_("Mark the selected messages for deletion"), + G_CALLBACK (action_mail_delete_cb) }, + + { "mail-filter-on-mailing-list", + NULL, + N_("Filter on Mailing _List..."), + NULL, + N_("Create a rule to filter messages to this mailing list"), + G_CALLBACK (action_mail_filter_on_mailing_list_cb) }, + + { "mail-filter-on-recipients", + NULL, + N_("Filter on _Recipients..."), + NULL, + N_("Create a rule to filter messages to these recipients"), + G_CALLBACK (action_mail_filter_on_recipients_cb) }, + + { "mail-filter-on-sender", + NULL, + N_("Filter on Se_nder..."), + NULL, + N_("Create a rule to filter messages from this sender"), + G_CALLBACK (action_mail_filter_on_sender_cb) }, + + { "mail-filter-on-subject", + NULL, + N_("Filter on _Subject..."), + NULL, + N_("Create a rule to filter messages with this subject"), + G_CALLBACK (action_mail_filter_on_subject_cb) }, + + { "mail-filters-apply", + "stock_mail-filters-apply", + N_("A_pply Filters"), + "<Control>y", + N_("Apply filter rules to the selected messages"), + G_CALLBACK (action_mail_filters_apply_cb) }, + + { "mail-find", + GTK_STOCK_FIND, + N_("_Find in Message..."), + "<Shift><Control>f", + N_("Search for text in the body of the displayed message"), + G_CALLBACK (action_mail_find_cb) }, + + { "mail-flag-clear", + NULL, + N_("_Clear Flag"), + NULL, + N_("Remove the follow-up flag from the selected messages"), + G_CALLBACK (action_mail_flag_clear_cb) }, + + { "mail-flag-completed", + NULL, + N_("_Flag Completed"), + NULL, + N_("Set the follow-up flag to completed on the selected messages"), + G_CALLBACK (action_mail_flag_completed_cb) }, + + { "mail-flag-for-followup", + "stock_mail-flag-for-followup", + N_("Follow _Up..."), + "<Shift><Control>g", + N_("Flag the selected messages for follow-up"), + G_CALLBACK (action_mail_flag_for_followup_cb) }, + + { "mail-forward", + "mail-forward", + N_("_Forward"), + "<Control>f", + N_("Forward the selected message to someone"), + G_CALLBACK (action_mail_forward_cb) }, + + { "mail-forward-attached", + NULL, + N_("_Attached"), + NULL, + N_("Forward the selected message to someone as an attachment"), + G_CALLBACK (action_mail_forward_attached_cb) }, + + { "mail-forward-inline", + NULL, + N_("_Inline"), + NULL, + N_("Forward the selected message in the body of a new message"), + G_CALLBACK (action_mail_forward_inline_cb) }, + + { "mail-forward-quoted", + NULL, + N_("_Quoted"), + NULL, + N_("Forward the selected message quoted like a reply"), + G_CALLBACK (action_mail_forward_quoted_cb) }, + + { "mail-load-images", + "image-x-generic", + N_("_Load Images"), + "<Control>i", + N_("Force images in HTML mail to be loaded"), + G_CALLBACK (action_mail_load_images_cb) }, + + { "mail-mark-important", + "mail-mark-important", + N_("_Important"), + NULL, + N_("Mark the selected messages as important"), + G_CALLBACK (action_mail_mark_important_cb) }, + + { "mail-mark-junk", + "mail-mark-junk", + N_("_Junk"), + "<Control>j", + N_("Mark the selected messages as junk"), + G_CALLBACK (action_mail_mark_junk_cb) }, + + { "mail-mark-notjunk", + "mail-mark-notjunk", + N_("_Not Junk"), + "<Shift><Control>j", + N_("Mark the selected messasges as not being junk"), + G_CALLBACK (action_mail_mark_notjunk_cb) }, + + { "mail-mark-read", + "mail-mark-read", + N_("_Read"), + "<Control>k", + N_("Mark the selected messages as having been read"), + G_CALLBACK (action_mail_mark_read_cb) }, + + { "mail-mark-unimportant", + NULL, + N_("Uni_mportant"), + NULL, + N_("Mark the selected messages as unimportant"), + G_CALLBACK (action_mail_mark_unimportant_cb) }, + + { "mail-mark-unread", + "mail-mark-unread", + N_("_Unread"), + "<Shift><Control>k", + N_("Mark the selected messages as not having been read"), + G_CALLBACK (action_mail_mark_unread_cb) }, + + { "mail-message-edit", + NULL, + N_("_Edit as New Message..."), + NULL, + N_("Open the selected messages in the composer for editing"), + G_CALLBACK (action_mail_message_edit_cb) }, + + { "mail-message-new", + "mail-message-new", + N_("Compose _New Message"), + "<Shift><Control>m", + N_("Open a window for composing a mail message"), + G_CALLBACK (action_mail_message_new_cb) }, + + { "mail-message-open", + NULL, + N_("_Open in New Window"), + "<Control>o", + N_("Open the selected messages in a new window"), + G_CALLBACK (action_mail_message_open_cb) }, + + { "mail-message-post", + NULL, + N_("Pos_t New Message to Folder"), + NULL, + N_("Post a message to a public folder"), + G_CALLBACK (action_mail_message_post_cb) }, + + { "mail-move", + "mail-move", + N_("_Move to Folder"), + "<Shift><Control>v", + N_("Move selected messages to another folder"), + G_CALLBACK (action_mail_move_cb) }, + + { "mail-next", + GTK_STOCK_GO_FORWARD, + N_("_Next Message"), + "<Control>Page_Down", + N_("Display the next message"), + G_CALLBACK (action_mail_next_cb) }, + + { "mail-next-important", + NULL, + N_("Next _Important Message"), + NULL, + N_("Display the next important message"), + G_CALLBACK (action_mail_next_important_cb) }, + + { "mail-next-thread", + NULL, + N_("Next _Thread"), + NULL, + N_("Display the next thread"), + G_CALLBACK (action_mail_next_thread_cb) }, + + { "mail-next-unread", + NULL, + N_("Next _Unread Message"), + "<Control>bracketright", + N_("Display the next unread message"), + G_CALLBACK (action_mail_next_unread_cb) }, + + { "mail-previous", + GTK_STOCK_GO_BACK, + N_("_Previous Message"), + "<Control>Page_Up", + N_("Display the previous message"), + G_CALLBACK (action_mail_previous_cb) }, + + { "mail-previous-important", + NULL, + N_("Pr_evious Important Message"), + NULL, + N_("Display the previous important message"), + G_CALLBACK (action_mail_previous_important_cb) }, + + { "mail-previous-unread", + NULL, + N_("P_revious Unread Message"), + "<Control>bracketleft", + N_("Display the previous unread message"), + G_CALLBACK (action_mail_previous_unread_cb) }, + + { "mail-print", + GTK_STOCK_PRINT, + NULL, + NULL, + N_("Print this message"), + G_CALLBACK (action_mail_print_cb) }, + + { "mail-print-preview", + GTK_STOCK_PRINT_PREVIEW, + NULL, + NULL, + N_("Preview the message to be printed"), + G_CALLBACK (action_mail_print_preview_cb) }, + + { "mail-redirect", + NULL, + N_("Re_direct"), + NULL, + N_("Redirect (bounce) the selected message to someone"), + G_CALLBACK (action_mail_redirect_cb) }, + + { "mail-reply-all", + "mail-reply-all", + N_("Reply to _All"), + "<Shift><Control>r", + N_("Compose a reply to all the recipients of the selected message"), + G_CALLBACK (action_mail_reply_all_cb) }, + + { "mail-reply-list", + NULL, + N_("Reply to _List"), + "<Control>l", + N_("Compose a reply to the mailing list of the selected message"), + G_CALLBACK (action_mail_reply_list_cb) }, + + { "mail-reply-post", + NULL, + N_("Post a Repl_y"), + NULL, + N_("Post a reply to a message in a public folder"), + G_CALLBACK (action_mail_reply_post_cb) }, + + { "mail-reply-sender", + "mail-reply-sender", + N_("_Reply to Sender"), + "<Control>r", + N_("Compose a reply to the sender of the selected message"), + G_CALLBACK (action_mail_reply_sender_cb) }, + + { "mail-save-as", + GTK_STOCK_SAVE_AS, + N_("_Save as mbox..."), + NULL, + N_("Save selected messages as an mbox file"), + G_CALLBACK (action_mail_save_as_cb) }, + + { "mail-search-folder-from-mailing-list", + NULL, + N_("Search Folder from Mailing _List..."), + NULL, + N_("Create a search folder for this mailing list"), + G_CALLBACK (action_mail_search_folder_from_mailing_list_cb) }, + + { "mail-search-folder-from-recipients", + NULL, + N_("Search Folder from Recipien_ts..."), + NULL, + N_("Create a search folder for these recipients"), + G_CALLBACK (action_mail_search_folder_from_recipients_cb) }, + + { "mail-search-folder-from-sender", + NULL, + N_("Search Folder from Sen_der..."), + NULL, + N_("Create a search folder for this sender"), + G_CALLBACK (action_mail_search_folder_from_sender_cb) }, + + { "mail-search-folder-from-subject", + NULL, + N_("Search Folder from S_ubject..."), + NULL, + N_("Create a search folder for this subject"), + G_CALLBACK (action_mail_search_folder_from_subject_cb) }, + + { "mail-select-all", + NULL, + N_("Select _All Text"), + "<Shift><Control>x", + N_("Select all the text in a message"), + G_CALLBACK (action_mail_select_all_cb) }, + + { "mail-show-source", + NULL, + N_("_Message Source"), + "<Control>u", + N_("Show the raw email source of the message"), + G_CALLBACK (action_mail_show_source_cb) }, + + { "mail-toggle-important", + NULL, + NULL, /* No menu item; key press only */ + NULL, + NULL, + G_CALLBACK (action_mail_toggle_important_cb) }, + + { "mail-undelete", + NULL, + N_("_Undelete Message"), + "<Shift><Control>d", + N_("Undelete the selected messages"), + G_CALLBACK (action_mail_undelete_cb) }, + + { "mail-zoom-100", + GTK_STOCK_ZOOM_100, + N_("_Normal Size"), + "<Control>0", + N_("Reset the text to its original size"), + G_CALLBACK (action_mail_zoom_100_cb) }, + + { "mail-zoom-in", + GTK_STOCK_ZOOM_IN, + N_("_Zoom In"), + "<Control>plus", + N_("Increase the text size"), + G_CALLBACK (action_mail_zoom_in_cb) }, + + { "mail-zoom-out", + GTK_STOCK_ZOOM_OUT, + N_("Zoom _Out"), + "<Control>minus", + N_("Decrease the text size"), + G_CALLBACK (action_mail_zoom_out_cb) }, + + /*** Menus ***/ + + { "mail-create-rule-menu", + NULL, + N_("Create R_ule"), + NULL, + NULL, + NULL }, + + { "mail-encoding-menu", + NULL, + N_("Ch_aracter Encoding"), + NULL, + NULL, + NULL }, + + { "mail-forward-as-menu", + NULL, + N_("F_orward As..."), + NULL, + NULL, + NULL }, + + { "mail-goto-menu", + GTK_STOCK_JUMP_TO, + N_("_Go To"), + NULL, + NULL, + NULL }, + + { "mail-mark-as-menu", + NULL, + N_("Mar_k As"), + NULL, + NULL, + NULL }, + + { "mail-message-menu", + NULL, + N_("_Message"), + NULL, + NULL, + NULL }, + + { "mail-zoom-menu", + NULL, + N_("_Zoom"), + NULL, + NULL, + NULL } +}; + +static GtkToggleActionEntry mail_reader_toggle_entries[] = { + + { "mail-caret-mode", + NULL, + N_("_Caret Mode"), + "F7", + N_("Show a blinking cursor in the body of displayed messages"), + G_CALLBACK (action_mail_caret_mode_cb), + FALSE }, + + { "mail-show-all-headers", + NULL, + N_("All Message _Headers"), + NULL, + N_("Show messages with all email headers"), + G_CALLBACK (action_mail_show_all_headers_cb), + FALSE } +}; + +static void +mail_reader_double_click_cb (EMailReader *reader, + gint row, + ETreePath path, + gint col, + GdkEvent *event) +{ + /* Ignore double clicks on columns that handle their own state. */ + if (MESSAGE_LIST_COLUMN_IS_ACTIVE (col)) + return; + + e_mail_reader_activate (reader, "mail-message-open"); +} + +static gint +mail_reader_key_press_cb (EMailReader *reader, + gint row, + ETreePath path, + gint col, + GdkEvent *event) +{ + const gchar *action_name; + + if ((event->key.state & GDK_CONTROL_MASK) != 0) + return FALSE; + + switch (event->key.keyval) { + case GDK_Return: + case GDK_KP_Enter: + case GDK_ISO_Enter: + action_name = "mail-message-open"; + break; + +#ifdef HAVE_XFREE + case XF86XK_Reply: + action_name = "mail-reply-all"; + break; + + case XF86XK_MailForward: + action_name = "mail-forward"; + break; +#endif + + case '!': + action_name = "mail-toggle-important"; + break; + + default: + return FALSE; + } + + e_mail_reader_activate (reader, action_name); + + return TRUE; +} + +static void +mail_reader_class_init (EMailReaderIface *iface) +{ +} + +GType +e_mail_reader_get_type (void) +{ + static GType type = 0; + + if (G_UNLIKELY (type == 0)) { + static const GTypeInfo type_info = { + sizeof (EMailReaderIface), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) mail_reader_class_init, + (GClassFinalizeFunc) NULL, + NULL, /* class_data */ + 0, /* instance_size */ + 0, /* n_preallocs */ + NULL, /* instance_init */ + NULL /* value_table */ + }; + + type = g_type_register_static ( + G_TYPE_INTERFACE, "EMailReader", &type_info, 0); + + g_type_interface_add_prerequisite (type, G_TYPE_OBJECT); + } + + return type; +} + +void +e_mail_reader_init (EMailReader *reader) +{ + MessageList *message_list; + GtkActionGroup *action_group; + GConfBridge *bridge; + GtkAction *action; + const gchar *key; + + g_return_if_fail (E_IS_MAIL_READER (reader)); + + action_group = e_mail_reader_get_action_group (reader); + message_list = e_mail_reader_get_message_list (reader); + + gtk_action_group_add_actions ( + action_group, mail_reader_entries, + G_N_ELEMENTS (mail_reader_entries), reader); + gtk_action_group_add_toggle_actions ( + action_group, mail_reader_toggle_entries, + G_N_ELEMENTS (mail_reader_toggle_entries), reader); + + /* Bind GObject properties to GConf keys. */ + + bridge = gconf_bridge_get (); + + key = "/apps/evolution/mail/display/caret_mode"; + action = gtk_action_group_get_action (action_group, "mail-caret-mode"); + gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active"); + + /* Fine tuning. */ + + action = gtk_action_group_get_action (action_group, "mail-delete"); + g_object_set (action, "short-label", _("Delete"), NULL); + + action = gtk_action_group_get_action (action_group, "mail-next"); + g_object_set (action, "short-label", _("Next"), NULL); + + action = gtk_action_group_get_action (action_group, "mail-previous"); + g_object_set (action, "short-label", _("Previous"), NULL); + + action = gtk_action_group_get_action (action_group, "mail-reply"); + g_object_set (action, "short-label", _("Reply"), NULL); + + /* Connect signals. */ + + g_signal_connect_swapped ( + message_list->tree, "double-click", + G_CALLBACK (mail_reader_double_click_cb), reader); + + g_signal_connect_swapped ( + message_list->tree, "key-press", + G_CALLBACK (mail_reader_key_press_cb), reader); +} + +GtkActionGroup * +e_mail_reader_get_action_group (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_action_group != NULL, NULL); + + return iface->get_action_group (reader); +} + +EMFormatHTMLDisplay * +e_mail_reader_get_display (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_display != NULL, NULL); + + return iface->get_display (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) +{ + EMailReaderIface *iface; + + g_return_val_if_fail (E_IS_MAIL_READER (reader), FALSE); + + iface = E_MAIL_READER_GET_IFACE (reader); + g_return_val_if_fail (iface->get_hide_deleted != NULL, FALSE); + + return iface->get_hide_deleted (reader); +} + +MessageList * +e_mail_reader_get_message_list (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_message_list != NULL, NULL); + + return iface->get_message_list (reader); +} + +EShellSettings * +e_mail_reader_get_shell_settings (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); + + return iface->get_shell_settings (reader); +} + +EMFolderTreeModel * +e_mail_reader_get_tree_model (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); + + return iface->get_tree_model (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_window != NULL, NULL); + + return iface->get_window (reader); +} diff --git a/mail/e-mail-reader.h b/mail/e-mail-reader.h new file mode 100644 index 0000000000..8e14c52c60 --- /dev/null +++ b/mail/e-mail-reader.h @@ -0,0 +1,85 @@ +/* + * e-mail-reader.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_READER_H +#define E_MAIL_READER_H + +#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> + +/* Standard GObject macros */ +#define E_TYPE_MAIL_READER \ + (e_mail_reader_get_type ()) +#define E_MAIL_READER(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_MAIL_READER, EMailReader)) +#define E_IS_MAIL_READER(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_MAIL_READER)) +#define E_MAIL_READER_GET_IFACE(obj) \ + (G_TYPE_INSTANCE_GET_INTERFACE \ + ((obj), E_TYPE_MAIL_READER, EMailReaderIface)) + +G_BEGIN_DECLS + +typedef struct _EMailReader EMailReader; +typedef struct _EMailReaderIface EMailReaderIface; + +struct _EMailReaderIface { + GTypeInterface parent_iface; + + /* XXX This is getting kinda bloated. Try to reduce. */ + GtkActionGroup * + (*get_action_group) (EMailReader *reader); + EMFormatHTMLDisplay * + (*get_display) (EMailReader *reader); + CamelFolder * (*get_folder) (EMailReader *reader); + const gchar * (*get_folder_uri) (EMailReader *reader); + gboolean (*get_hide_deleted) (EMailReader *reader); + MessageList * (*get_message_list) (EMailReader *reader); + EShellSettings *(*get_shell_settings) (EMailReader *reader); + EMFolderTreeModel * + (*get_tree_model) (EMailReader *reader); + GtkWindow * (*get_window) (EMailReader *reader); +}; + +GType e_mail_reader_get_type (void); +void e_mail_reader_init (EMailReader *reader); +GtkActionGroup * + e_mail_reader_get_action_group (EMailReader *reader); +EMFormatHTMLDisplay * + e_mail_reader_get_display (EMailReader *reader); +CamelFolder * e_mail_reader_get_folder (EMailReader *reader); +const gchar * e_mail_reader_get_folder_uri (EMailReader *reader); +gboolean e_mail_reader_get_hide_deleted (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); +GtkWindow * e_mail_reader_get_window (EMailReader *reader); + +G_END_DECLS + +#endif /* E_MAIL_READER_H */ diff --git a/mail/e-mail-shell-content.c b/mail/e-mail-shell-content.c index f6b07ea728..271b8b2635 100644 --- a/mail/e-mail-shell-content.c +++ b/mail/e-mail-shell-content.c @@ -34,6 +34,9 @@ #include "em-utils.h" #include "mail-config.h" +#include "e-mail-reader.h" +#include "e-mail-shell-module.h" + #define E_MAIL_SHELL_CONTENT_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE \ ((obj), E_TYPE_MAIL_SHELL_CONTENT, EMailShellContentPrivate)) @@ -359,6 +362,101 @@ mail_shell_content_check_state (EShellContent *shell_content) return state; } +static GtkActionGroup * +mail_shell_content_get_action_group (EMailReader *reader) +{ + EShellContent *shell_content; + EShellWindow *shell_window; + EShellView *shell_view; + + shell_content = E_SHELL_CONTENT (reader); + shell_view = e_shell_content_get_shell_view (shell_content); + shell_window = e_shell_view_get_shell_window (shell_view); + + return e_shell_window_get_action_group (shell_window, "mail"); +} + +static EMFormatHTMLDisplay * +mail_shell_content_get_display (EMailReader *reader) +{ + EMailShellContent *mail_shell_content; + + mail_shell_content = E_MAIL_SHELL_CONTENT (reader); + + return e_mail_shell_content_get_preview_format (mail_shell_content); +} + +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) +{ + /* FIXME */ + return TRUE; +} + +static MessageList * +mail_shell_content_get_message_list (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->list; +} + +static EMFolderTreeModel * +mail_shell_content_get_tree_model (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); +} + +static GtkWindow * +mail_shell_content_get_window (EMailReader *reader) +{ + EShellContent *shell_content; + EShellWindow *shell_window; + EShellView *shell_view; + + shell_content = E_SHELL_CONTENT (reader); + shell_view = e_shell_content_get_shell_view (shell_content); + shell_window = e_shell_view_get_shell_window (shell_view); + + return GTK_WINDOW (shell_window); +} + static void mail_shell_content_class_init (EMailShellContentClass *class) { @@ -401,6 +499,19 @@ mail_shell_content_class_init (EMailShellContentClass *class) } static void +mail_shell_content_iface_init (EMailReaderIface *iface) +{ + iface->get_action_group = mail_shell_content_get_action_group; + iface->get_display = mail_shell_content_get_display; + 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_message_list = mail_shell_content_get_message_list; + iface->get_tree_model = mail_shell_content_get_tree_model; + iface->get_window = mail_shell_content_get_window; +} + +static void mail_shell_content_init (EMailShellContent *mail_shell_content) { mail_shell_content->priv = @@ -430,9 +541,18 @@ e_mail_shell_content_get_type (void) NULL /* value_table */ }; + static const GInterfaceInfo iface_info = { + (GInterfaceInitFunc) mail_shell_content_iface_init, + (GInterfaceFinalizeFunc) NULL, + NULL /* interface_data */ + }; + type = g_type_register_static ( E_TYPE_SHELL_CONTENT, "EMailShellContent", &type_info, 0); + + g_type_add_interface_static ( + type, E_TYPE_MAIL_READER, &iface_info); } return type; diff --git a/mail/e-mail-shell-module-settings.c b/mail/e-mail-shell-module-settings.c index 05754ac854..04388a92f5 100644 --- a/mail/e-mail-shell-module-settings.c +++ b/mail/e-mail-shell-module-settings.c @@ -245,6 +245,18 @@ e_mail_shell_module_init_settings (EShell *shell) e_shell_settings_install_property ( g_param_spec_boolean ( + "mail-prompt-delete-in-vfolder", + NULL, + NULL, + FALSE, + G_PARAM_READWRITE)); + + e_shell_settings_bind_to_gconf ( + shell_settings, "mail-prompt-delete-in-vfolder", + "/apps/evolution/mail/prompts/delete_in_vfolder"); + + e_shell_settings_install_property ( + g_param_spec_boolean ( "mail-show-animated-images", NULL, NULL, diff --git a/mail/e-mail-shell-module.c b/mail/e-mail-shell-module.c index 464349a3a7..c918cf64af 100644 --- a/mail/e-mail-shell-module.c +++ b/mail/e-mail-shell-module.c @@ -38,9 +38,11 @@ #include "em-account-prefs.h" #include "em-composer-prefs.h" +#include "em-composer-utils.h" #include "em-config.h" #include "em-event.h" #include "em-folder-tree-model.h" +#include "em-folder-utils.h" #include "em-format-hook.h" #include "em-format-html-display.h" #include "em-junk-hook.h" @@ -399,14 +401,58 @@ static void action_mail_folder_new_cb (GtkAction *action, EShellWindow *shell_window) { - /* FIXME */ + EMFolderTree *folder_tree = NULL; + EMailShellSidebar *mail_shell_sidebar; + EShellSidebar *shell_sidebar; + EShellView *shell_view; + const gchar *view_name; + + /* Take care not to unnecessarily load the mail shell view. */ + view_name = e_shell_window_get_active_view (shell_window); + if (g_strcmp0 (view_name, MODULE_NAME) != 0) + goto exit; + + shell_view = e_shell_window_get_shell_view (shell_window, view_name); + shell_sidebar = e_shell_view_get_shell_sidebar (shell_view); + + mail_shell_sidebar = E_MAIL_SHELL_SIDEBAR (shell_sidebar); + folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar); + +exit: + em_folder_utils_create_folder (NULL, folder_tree); } static void action_mail_message_new_cb (GtkAction *action, EShellWindow *shell_window) { - /* FIXME */ + GtkWindow *window = GTK_WINDOW (shell_window); + EMailShellSidebar *mail_shell_sidebar; + EShellSidebar *shell_sidebar; + EShellView *shell_view; + EMFolderTree *folder_tree; + const gchar *view_name; + gchar *uri = NULL; + + if (!em_utils_check_user_can_send_mail (window)) + return; + + /* Take care not to unnecessarily load the mail shell view. */ + view_name = e_shell_window_get_active_view (shell_window); + if (g_strcmp0 (view_name, MODULE_NAME) != 0) + goto exit; + + shell_view = e_shell_window_get_shell_view (shell_window, view_name); + shell_sidebar = e_shell_view_get_shell_sidebar (shell_view); + + mail_shell_sidebar = E_MAIL_SHELL_SIDEBAR (shell_sidebar); + folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar); + uri = em_folder_tree_get_selected_uri (folder_tree); + +exit: + em_utils_compose_new_message (uri); + + g_free (uri); } static GtkActionEntry item_entries[] = { @@ -842,11 +888,65 @@ fail: return NULL; } +/* Helper for e_mail_shell_module_remove_store() */ +static void +mail_shell_module_remove_store_cb (CamelStore *store, + gpointer event_data, + gpointer user_data) +{ + camel_service_disconnect (CAMEL_SERVICE (store), TRUE, NULL); + camel_object_unref (store); +} + +void +e_mail_shell_module_remove_store (EShellModule *shell_module, + CamelStore *store) +{ + g_return_if_fail (E_IS_SHELL_MODULE (shell_module)); + g_return_if_fail (CAMEL_IS_STORE (store)); + + /* Because the store hash holds a reference to each store used + * as a key in it, none of them will ever be gc'ed, meaning any + * call to camel_session_get_{service,store} with the same URL + * will always return the same object. So this works. */ + + if (g_hash_table_lookup (store_hash, store) == NULL) + return; + + camel_object_ref (store); + g_hash_table_remove (store_hash, store); + mail_note_store_remove (store); + em_folder_tree_model_remove_store (folder_tree_model, store); + + mail_async_event_emit ( + async_event, MAIL_ASYNC_THREAD, + (MailAsyncFunc) mail_shell_module_remove_store_cb, + store, NULL, NULL); +} + void e_mail_shell_module_remove_store_by_uri (EShellModule *shell_module, const gchar *uri) { - /* FIXME */ + CamelStore *store; + CamelProvider *provider; + + g_return_if_fail (E_IS_SHELL_MODULE (shell_module)); + g_return_if_fail (uri != NULL); + + provider = camel_provider_get (uri, NULL); + if (provider == NULL) + return; + + if (!(provider->flags & CAMEL_PROVIDER_IS_STORAGE)) + return; + + store = (CamelStore *) camel_session_get_service ( + session, uri, CAMEL_PROVIDER_STORE, NULL); + if (store != NULL) { + e_mail_shell_module_remove_store (shell_module, store); + camel_object_unref (store); + } } void diff --git a/mail/e-mail-shell-module.h b/mail/e-mail-shell-module.h index 567e5f2778..d27e35f7d4 100644 --- a/mail/e-mail-shell-module.h +++ b/mail/e-mail-shell-module.h @@ -66,6 +66,8 @@ CamelStore * e_mail_shell_module_load_store_by_uri (EShellModule *shell_module, const gchar *uri, const gchar *name); +void e_mail_shell_module_remove_store(EShellModule *shell_module, + CamelStore *store); void e_mail_shell_module_remove_store_by_uri (EShellModule *shell_module, const gchar *uri); diff --git a/mail/e-mail-shell-view-actions.c b/mail/e-mail-shell-view-actions.c index 83131c2a92..ff0089d2ce 100644 --- a/mail/e-mail-shell-view-actions.c +++ b/mail/e-mail-shell-view-actions.c @@ -21,153 +21,6 @@ #include "e-mail-shell-view-private.h" -/* Remembers the previously selected folder when transferring messages. */ -static gchar *default_xfer_messages_uri; - -static void -action_mail_add_sender_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; - EShellWindow *shell_window; - EShellView *shell_view; - CamelMessageInfo *info; - GPtrArray *uids; - const gchar *address; - - shell_view = E_SHELL_VIEW (mail_shell_view); - shell_window = e_shell_view_get_shell_window (shell_view); - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - - uids = message_list_get_selected (folder_view->list); - - if (uids->len != 1) - goto exit; - - info = camel_folder_get_message_info ( - folder_view->folder, uids->pdata[0]); - if (info == NULL) - goto exit; - - address = camel_message_info_from (info); - if (address == NULL || *address == '\0') - goto exit; - - em_utils_add_address (GTK_WIDGET (shell_window), address); - -exit: - em_utils_uids_free (uids); -} - -static void -action_mail_caret_mode_cb (GtkToggleAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - EMFormatHTMLDisplay *format; - gboolean active; - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - format = e_mail_shell_content_get_preview_format (mail_shell_content); - active = gtk_toggle_action_get_active (action); - - em_format_html_display_set_caret_mode (format, active); -} - -static void -action_mail_check_for_junk_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; - GPtrArray *uids; - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - - uids = message_list_get_selected (folder_view->list); - - mail_filter_junk (folder_view->folder, uids); -} - -static void -action_mail_clipboard_copy_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - GtkWidget *preview; - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - preview = e_mail_shell_content_get_preview_widget (mail_shell_content); - - gtk_html_copy (GTK_HTML (preview)); -} - -static void -action_mail_copy_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - EShellModule *shell_module; - EShellView *shell_view; - EMFolderTreeModel *model; - EMFolderView *folder_view; - GtkWidget *folder_tree; - GtkWidget *dialog; - GPtrArray *selected; - const gchar *uri; - - shell_view = E_SHELL_VIEW (mail_shell_view); - shell_module = e_shell_view_get_shell_module (shell_view); - model = e_mail_shell_module_get_folder_tree_model (shell_module); - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - selected = message_list_get_selected (folder_view->list); - - folder_tree = em_folder_tree_new_with_model (model); - - em_folder_tree_set_excluded ( - EM_FOLDER_TREE (folder_tree), - EMFT_EXCLUDE_NOSELECT | EMFT_EXCLUDE_VIRTUAL | - EMFT_EXCLUDE_VTRASH); - - dialog = em_folder_selector_new ( - EM_FOLDER_TREE (folder_tree), - EM_FOLDER_SELECTOR_CAN_CREATE, - _("Select Folder"), NULL, _("C_opy")); - - if (default_xfer_messages_uri != NULL) - em_folder_selector_set_selected ( - EM_FOLDER_SELECTOR (dialog), - default_xfer_messages_uri); - - if (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_OK) - goto exit; - - uri = em_folder_selector_get_selected_uri ( - EM_FOLDER_SELECTOR (dialog)); - - g_free (default_xfer_messages_uri); - default_xfer_messages_uri = g_strdup (uri); - - if (uri != NULL) { - mail_transfer_messages ( - folder_view->folder, selected, - FALSE, uri, 0, NULL, NULL); - selected = NULL; - } - -exit: - if (selected != NULL) - em_utils_uids_free (selected); - - gtk_widget_destroy (dialog); -} - static void action_mail_create_search_folder_cb (GtkAction *action, EMailShellView *mail_shell_view) @@ -177,14 +30,6 @@ action_mail_create_search_folder_cb (GtkAction *action, } static void -action_mail_delete_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - /* FIXME */ - g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); -} - -static void action_mail_download_cb (GtkAction *action, EMailShellView *mail_shell_view) { @@ -206,136 +51,6 @@ action_mail_empty_trash_cb (GtkAction *action, } static void -action_mail_filter_on_mailing_list_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - e_mail_shell_view_create_filter_from_selected ( - mail_shell_view, AUTO_MLIST); -} - -static void -action_mail_filter_on_recipients_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - e_mail_shell_view_create_filter_from_selected ( - mail_shell_view, AUTO_TO); -} - -static void -action_mail_filter_on_sender_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - e_mail_shell_view_create_filter_from_selected ( - mail_shell_view, AUTO_FROM); -} - -static void -action_mail_filter_on_subject_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - e_mail_shell_view_create_filter_from_selected ( - mail_shell_view, AUTO_SUBJECT); -} - -static void -action_mail_filters_apply_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; - GPtrArray *uids; - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - - uids = message_list_get_selected (folder_view->list); - - mail_filter_on_demand (folder_view->folder, uids); -} - -static void -action_mail_find_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - /* FIXME */ - g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); -} - -static void -action_mail_flag_clear_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - EMFormatHTMLDisplay *format; - EMFolderView *folder_view; - EShellWindow *shell_window; - EShellView *shell_view; - GPtrArray *uids; - - shell_view = E_SHELL_VIEW (mail_shell_view); - shell_window = e_shell_view_get_shell_window (shell_view); - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - format = e_mail_shell_content_get_preview_format (mail_shell_content); - - uids = message_list_get_selected (folder_view->list); - - em_utils_flag_for_followup_clear ( - GTK_WIDGET (shell_window), folder_view->folder, uids); - - em_format_redraw ((EMFormat *) format); -} - -static void -action_mail_flag_completed_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - EMFormatHTMLDisplay *format; - EMFolderView *folder_view; - EShellWindow *shell_window; - EShellView *shell_view; - GPtrArray *uids; - - shell_view = E_SHELL_VIEW (mail_shell_view); - shell_window = e_shell_view_get_shell_window (shell_view); - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - format = e_mail_shell_content_get_preview_format (mail_shell_content); - - uids = message_list_get_selected (folder_view->list); - - em_utils_flag_for_followup_completed ( - GTK_WIDGET (shell_window), folder_view->folder, uids); - - em_format_redraw ((EMFormat *) format); -} - -static void -action_mail_flag_for_followup_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; - EShellWindow *shell_window; - EShellView *shell_view; - GPtrArray *uids; - - shell_view = E_SHELL_VIEW (mail_shell_view); - shell_window = e_shell_view_get_shell_window (shell_view); - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - - uids = message_list_get_selected (folder_view->list); - - em_utils_flag_for_followup ( - GTK_WIDGET (shell_window), folder_view->folder, uids); -} - -static void action_mail_flush_outbox_cb (GtkAction *action, EMailShellView *mail_shell_view) { @@ -531,106 +246,6 @@ action_mail_folder_select_subthread_cb (GtkAction *action, } static void -action_mail_forward_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; - EShellWindow *shell_window; - EShellView *shell_view; - GPtrArray *uids; - - shell_view = E_SHELL_VIEW (mail_shell_view); - shell_window = e_shell_view_get_shell_window (shell_view); - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - - if (!em_utils_check_user_can_send_mail (GTK_WIDGET (shell_window))) - return; - - uids = message_list_get_selected (folder_view->list); - - em_utils_forward_messages ( - folder_view->folder, uids, folder_view->folder_uri); -} - -static void -action_mail_forward_attached_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; - EShellWindow *shell_window; - EShellView *shell_view; - GPtrArray *uids; - - shell_view = E_SHELL_VIEW (mail_shell_view); - shell_window = e_shell_view_get_shell_window (shell_view); - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - - if (!em_utils_check_user_can_send_mail (GTK_WIDGET (shell_window))) - return; - - uids = message_list_get_selected (folder_view->list); - - em_utils_forward_attached ( - folder_view->folder, uids, folder_view->folder_uri); -} - -static void -action_mail_forward_inline_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; - EShellWindow *shell_window; - EShellView *shell_view; - GPtrArray *uids; - - shell_view = E_SHELL_VIEW (mail_shell_view); - shell_window = e_shell_view_get_shell_window (shell_view); - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - - if (!em_utils_check_user_can_send_mail (GTK_WIDGET (shell_window))) - return; - - uids = message_list_get_selected (folder_view->list); - - em_utils_forward_inline ( - folder_view->folder, uids, folder_view->folder_uri); -} - -static void -action_mail_forward_quoted_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; - EShellWindow *shell_window; - EShellView *shell_view; - GPtrArray *uids; - - shell_view = E_SHELL_VIEW (mail_shell_view); - shell_window = e_shell_view_get_shell_window (shell_view); - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - - if (!em_utils_check_user_can_send_mail (GTK_WIDGET (shell_window))) - return; - - uids = message_list_get_selected (folder_view->list); - - em_utils_forward_quoted ( - folder_view->folder, uids, folder_view->folder_uri); -} - -static void action_mail_hide_deleted_cb (GtkToggleAction *action, EMailShellView *mail_shell_view) { @@ -671,331 +286,6 @@ action_mail_hide_selected_cb (GtkAction *action, } static void -action_mail_load_images_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - EMFormatHTMLDisplay *format; - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - format = e_mail_shell_content_get_preview_format (mail_shell_content); - - em_format_html_load_http ((EMFormatHTML *) format); -} - -static void -action_mail_mark_important_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; - guint32 mask, set; - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - - mask = CAMEL_MESSAGE_FLAGGED | CAMEL_MESSAGE_DELETED; - set = CAMEL_MESSAGE_FLAGGED; - - em_folder_view_mark_selected (folder_view, mask, set); -} - -static void -action_mail_mark_junk_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; - guint32 mask, set; - gint count; - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - - mask = CAMEL_MESSAGE_SEEN | CAMEL_MESSAGE_JUNK | - CAMEL_MESSAGE_NOTJUNK | CAMEL_MESSAGE_JUNK_LEARN; - set = CAMEL_MESSAGE_SEEN | CAMEL_MESSAGE_JUNK | - CAMEL_MESSAGE_JUNK_LEARN; - - count = em_folder_view_mark_selected (folder_view, mask, set); - em_folder_view_select_next_message (folder_view, count, TRUE); -} - -static void -action_mail_mark_notjunk_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; - guint32 mask, set; - gint count; - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - - mask = CAMEL_MESSAGE_JUNK | CAMEL_MESSAGE_NOTJUNK | - CAMEL_MESSAGE_JUNK_LEARN; - set = CAMEL_MESSAGE_NOTJUNK | CAMEL_MESSAGE_JUNK_LEARN; - - count = em_folder_view_mark_selected (folder_view, mask, set); - em_folder_view_select_next_message (folder_view, count, TRUE); -} - -static void -action_mail_mark_read_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; - guint32 mask, set; - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - - mask = CAMEL_MESSAGE_SEEN; - set = CAMEL_MESSAGE_SEEN; - - em_folder_view_mark_selected (folder_view, mask, set); -} - -static void -action_mail_mark_unimportant_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; - guint32 mask, set; - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - - mask = CAMEL_MESSAGE_FLAGGED; - set = 0; - - em_folder_view_mark_selected (folder_view, mask, set); -} - -static void -action_mail_mark_unread_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; - guint32 mask, set; - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - - mask = CAMEL_MESSAGE_SEEN | CAMEL_MESSAGE_DELETED; - set = 0; - - em_folder_view_mark_selected (folder_view, mask, set); - - if (folder_view->list->seen_id != 0) { - g_source_remove (folder_view->list->seen_id); - folder_view->list->seen_id = 0; - } -} - -static void -action_mail_message_edit_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; - EShellWindow *shell_window; - EShellView *shell_view; - GPtrArray *uids; - - shell_view = E_SHELL_VIEW (mail_shell_view); - shell_window = e_shell_view_get_shell_window (shell_view); - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - - if (!em_utils_check_user_can_send_mail (GTK_WIDGET (shell_window))) - return; - - uids = message_list_get_selected (folder_view->list); - - em_utils_edit_messages (folder_view->folder, uids, FALSE); -} - -static void -action_mail_message_new_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; - EShellWindow *shell_window; - EShellView *shell_view; - - shell_view = E_SHELL_VIEW (mail_shell_view); - shell_window = e_shell_view_get_shell_window (shell_view); - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - - if (!em_utils_check_user_can_send_mail (GTK_WIDGET (shell_window))) - return; - - em_utils_compose_new_message (folder_view->folder_uri); -} - -static void -action_mail_message_open_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - /* FIXME */ - g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); -} - -static void -action_mail_message_post_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - - em_utils_post_to_folder (folder_view->folder); -} - -static void -action_mail_move_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - EShellModule *shell_module; - EShellView *shell_view; - EMFolderTreeModel *model; - EMFolderView *folder_view; - GtkWidget *folder_tree; - GtkWidget *dialog; - GPtrArray *selected; - const gchar *uri; - - shell_view = E_SHELL_VIEW (mail_shell_view); - shell_module = e_shell_view_get_shell_module (shell_view); - model = e_mail_shell_module_get_folder_tree_model (shell_module); - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - selected = message_list_get_selected (folder_view->list); - - folder_tree = em_folder_tree_new_with_model (model); - - em_folder_tree_set_excluded ( - EM_FOLDER_TREE (folder_tree), - EMFT_EXCLUDE_NOSELECT | EMFT_EXCLUDE_VIRTUAL | - EMFT_EXCLUDE_VTRASH); - - dialog = em_folder_selector_new ( - EM_FOLDER_TREE (folder_tree), - EM_FOLDER_SELECTOR_CAN_CREATE, - _("Select Folder"), NULL, _("_Move")); - - if (default_xfer_messages_uri != NULL) - em_folder_selector_set_selected ( - EM_FOLDER_SELECTOR (dialog), - default_xfer_messages_uri); - - if (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_OK) - goto exit; - - uri = em_folder_selector_get_selected_uri ( - EM_FOLDER_SELECTOR (dialog)); - - g_free (default_xfer_messages_uri); - default_xfer_messages_uri = g_strdup (uri); - - if (uri != NULL) { - mail_transfer_messages ( - folder_view->folder, selected, - TRUE, uri, 0, NULL, NULL); - selected = NULL; - } - -exit: - if (selected != NULL) - em_utils_uids_free (selected); - - gtk_widget_destroy (dialog); -} - -static void -action_mail_next_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - MessageListSelectDirection direction; - EMFolderView *folder_view; - guint32 flags, mask; - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - - direction = MESSAGE_LIST_SELECT_NEXT; - flags = 0; - mask = 0; - - message_list_select (folder_view->list, direction, flags, mask); -} - -static void -action_mail_next_important_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - MessageListSelectDirection direction; - EMFolderView *folder_view; - guint32 flags, mask; - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - - direction = MESSAGE_LIST_SELECT_NEXT | MESSAGE_LIST_SELECT_WRAP; - flags = CAMEL_MESSAGE_FLAGGED; - mask = CAMEL_MESSAGE_FLAGGED; - - message_list_select (folder_view->list, direction, flags, mask); -} - -static void -action_mail_next_thread_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - - message_list_select_next_thread (folder_view->list); -} - -static void -action_mail_next_unread_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - MessageListSelectDirection direction; - EMFolderView *folder_view; - guint32 flags, mask; - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - - direction = MESSAGE_LIST_SELECT_NEXT | MESSAGE_LIST_SELECT_WRAP; - flags = 0; - mask = CAMEL_MESSAGE_SEEN; - - message_list_select (folder_view->list, direction, flags, mask); -} - -static void action_mail_preview_cb (GtkToggleAction *action, EMailShellView *mail_shell_view) { @@ -1010,252 +300,6 @@ action_mail_preview_cb (GtkToggleAction *action, } static void -action_mail_previous_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - MessageListSelectDirection direction; - EMFolderView *folder_view; - guint32 flags, mask; - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - - direction = MESSAGE_LIST_SELECT_PREVIOUS; - flags = 0; - mask = 0; - - message_list_select (folder_view->list, direction, flags, mask); -} - -static void -action_mail_previous_important_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - MessageListSelectDirection direction; - EMFolderView *folder_view; - guint32 flags, mask; - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - - direction = MESSAGE_LIST_SELECT_PREVIOUS | MESSAGE_LIST_SELECT_WRAP; - flags = CAMEL_MESSAGE_FLAGGED; - mask = CAMEL_MESSAGE_FLAGGED; - - message_list_select (folder_view->list, direction, flags, mask); -} - -static void -action_mail_previous_unread_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - MessageListSelectDirection direction; - EMFolderView *folder_view; - guint32 flags, mask; - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - - direction = MESSAGE_LIST_SELECT_PREVIOUS | MESSAGE_LIST_SELECT_WRAP; - flags = 0; - mask = CAMEL_MESSAGE_SEEN; - - message_list_select (folder_view->list, direction, flags, mask); -} - -static void -action_mail_print_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - GtkPrintOperationAction print_action; - EMFolderView *folder_view; - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - - print_action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG; - em_folder_view_print (folder_view, print_action); -} - -static void -action_mail_print_preview_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - GtkPrintOperationAction print_action; - EMFolderView *folder_view; - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - - print_action = GTK_PRINT_OPERATION_ACTION_PREVIEW; - em_folder_view_print (folder_view, print_action); -} - -static void -action_mail_redirect_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; - EShellWindow *shell_window; - EShellView *shell_view; - - shell_view = E_SHELL_VIEW (mail_shell_view); - shell_window = e_shell_view_get_shell_window (shell_view); - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - - if (folder_view->list->cursor_uid == NULL) - return; - - if (!em_utils_check_user_can_send_mail (GTK_WIDGET (shell_window))) - return; - - em_utils_redirect_message_by_uid ( - folder_view->folder, folder_view->list->cursor_uid); -} - -static void -action_mail_reply_all_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - - em_folder_view_message_reply (folder_view, REPLY_MODE_ALL); -} - -static void -action_mail_reply_list_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - - em_folder_view_message_reply (folder_view, REPLY_MODE_LIST); -} - -static void -action_mail_reply_post_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; - EShellWindow *shell_window; - EShellView *shell_view; - - shell_view = E_SHELL_VIEW (mail_shell_view); - shell_window = e_shell_view_get_shell_window (shell_view); - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - - if (folder_view->list->cursor_uid == NULL) - return; - - if (!em_utils_check_user_can_send_mail (GTK_WIDGET (shell_window))) - return; - - em_utils_post_reply_to_message_by_uid ( - folder_view->folder, folder_view->list->cursor_uid); -} - -static void -action_mail_reply_sender_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - - em_folder_view_message_reply (folder_view, REPLY_MODE_SENDER); -} - -static void -action_mail_save_as_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; - EShellWindow *shell_window; - EShellView *shell_view; - GPtrArray *uids; - - shell_view = E_SHELL_VIEW (mail_shell_view); - shell_window = e_shell_view_get_shell_window (shell_view); - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - - uids = message_list_get_selected (folder_view->list); - - em_utils_save_messages ( - GTK_WIDGET (shell_window), folder_view->folder, uids); -} - -static void -action_mail_search_folder_from_mailing_list_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - e_mail_shell_view_create_vfolder_from_selected ( - mail_shell_view, AUTO_MLIST); -} - -static void -action_mail_search_folder_from_recipients_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - e_mail_shell_view_create_vfolder_from_selected ( - mail_shell_view, AUTO_TO); -} - -static void -action_mail_search_folder_from_sender_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - e_mail_shell_view_create_vfolder_from_selected ( - mail_shell_view, AUTO_FROM); -} - -static void -action_mail_search_folder_from_subject_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - e_mail_shell_view_create_vfolder_from_selected ( - mail_shell_view, AUTO_SUBJECT); -} - -static void -action_mail_select_all_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - /* FIXME */ - g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); -} - -static void -action_mail_show_all_headers_cb (GtkToggleAction *action, - EMailShellView *mail_shell_view) -{ - /* FIXME */ - g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); -} - -static void action_mail_show_hidden_cb (GtkAction *action, EMailShellView *mail_shell_view) { @@ -1269,14 +313,6 @@ action_mail_show_hidden_cb (GtkAction *action, } static void -action_mail_show_source_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - /* FIXME */ - g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); -} - -static void action_mail_stop_cb (GtkAction *action, EMailShellView *mail_shell_view) { @@ -1356,23 +392,6 @@ action_mail_tools_subscriptions_cb (GtkAction *action, } static void -action_mail_undelete_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - EMFolderView *folder_view; - guint32 mask, set; - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - - mask = CAMEL_MESSAGE_DELETED; - set = 0; - - em_folder_view_mark_selected (folder_view, mask, set); -} - -static void action_mail_uri_call_to_cb (GtkAction *action, EMailShellView *mail_shell_view) { @@ -1413,45 +432,6 @@ action_mail_uri_to_search_folder_sender_cb (GtkAction *action, } static void -action_mail_zoom_100_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - EMFormatHTMLDisplay *format; - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - format = e_mail_shell_content_get_preview_format (mail_shell_content); - - em_format_html_display_zoom_reset (format); -} - -static void -action_mail_zoom_in_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - EMFormatHTMLDisplay *format; - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - format = e_mail_shell_content_get_preview_format (mail_shell_content); - - em_format_html_display_zoom_in (format); -} - -static void -action_mail_zoom_out_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - EMailShellContent *mail_shell_content; - EMFormatHTMLDisplay *format; - - mail_shell_content = mail_shell_view->priv->mail_shell_content; - format = e_mail_shell_content_get_preview_format (mail_shell_content); - - em_format_html_display_zoom_out (format); -} - -static void action_mail_view_cb (GtkRadioAction *action, GtkRadioAction *current, EMailShellView *mail_shell_view) @@ -1468,34 +448,6 @@ action_mail_view_cb (GtkRadioAction *action, static GtkActionEntry mail_entries[] = { - { "mail-add-sender", - NULL, - N_("A_dd Sender to Address Book"), - NULL, - N_("Add sender to address book"), - G_CALLBACK (action_mail_add_sender_cb) }, - - { "mail-check-for-junk", - "mail-mark-junk", - N_("Check for _Junk"), - NULL, - N_("Filter the selected messages for junk status"), - G_CALLBACK (action_mail_check_for_junk_cb) }, - - { "mail-clipboard-copy", - GTK_STOCK_COPY, - NULL, - NULL, - N_("Copy selected messages to the clipboard"), - G_CALLBACK (action_mail_clipboard_copy_cb) }, - - { "mail-copy", - "mail-copy", - N_("_Copy to Folder"), - "<Shift><Control>y", - N_("Copy selected messages to another folder"), - G_CALLBACK (action_mail_copy_cb) }, - { "mail-create-search-folder", NULL, N_("C_reate Search Folder From Search..."), @@ -1503,13 +455,7 @@ static GtkActionEntry mail_entries[] = { NULL, /* XXX Add a tooltip! */ G_CALLBACK (action_mail_create_search_folder_cb) }, - { "mail-delete", - "user-trash", - N_("_Delete Message"), - "<Control>d", - N_("Mark the selected messages for deletion"), - G_CALLBACK (action_mail_delete_cb) }, - +#if 0 /* XXX Work around one-accelerator-per-action limit. */ { "mail-delete-1", NULL, @@ -1525,6 +471,7 @@ static GtkActionEntry mail_entries[] = { "KP_Delete", NULL, G_CALLBACK (action_mail_delete_cb) }, +#endif { "mail-download", NULL, @@ -1540,69 +487,6 @@ static GtkActionEntry mail_entries[] = { N_("Permanently remove all the deleted messages from all folders"), G_CALLBACK (action_mail_empty_trash_cb) }, - { "mail-filter-on-mailing-list", - NULL, - N_("Filter on Mailing _List..."), - NULL, - N_("Create a rule to filter messages to this mailing list"), - G_CALLBACK (action_mail_filter_on_mailing_list_cb) }, - - { "mail-filter-on-recipients", - NULL, - N_("Filter on _Recipients..."), - NULL, - N_("Create a rule to filter messages to these recipients"), - G_CALLBACK (action_mail_filter_on_recipients_cb) }, - - { "mail-filter-on-sender", - NULL, - N_("Filter on Se_nder..."), - NULL, - N_("Create a rule to filter messages from this sender"), - G_CALLBACK (action_mail_filter_on_sender_cb) }, - - { "mail-filter-on-subject", - NULL, - N_("Filter on _Subject..."), - NULL, - N_("Create a rule to filter messages with this subject"), - G_CALLBACK (action_mail_filter_on_subject_cb) }, - - { "mail-filters-apply", - "stock_mail-filters-apply", - N_("A_pply filters"), - "<Control>y", - N_("Apply filter rules to the selected messages"), - G_CALLBACK (action_mail_filters_apply_cb) }, - - { "mail-find", - GTK_STOCK_FIND, - N_("_Find in Message..."), - "<Shift><Control>f", - N_("Search for text in the body of the displayed message"), - G_CALLBACK (action_mail_find_cb) }, - - { "mail-flag-clear", - NULL, - N_("_Clear Flag"), - NULL, - N_("Remove the follow-up flag from the selected messages"), - G_CALLBACK (action_mail_flag_clear_cb) }, - - { "mail-flag-completed", - NULL, - N_("_Flag Completed"), - NULL, - N_("Set the follow-up flag to completed on the selected messages"), - G_CALLBACK (action_mail_flag_completed_cb) }, - - { "mail-flag-for-followup", - "stock_mail-flag-for-followup", - N_("Follow _Up..."), - "<Shift><Control>g", - N_("Flag the selected messages for follow-up"), - G_CALLBACK (action_mail_flag_for_followup_cb) }, - { "mail-flush-outbox", "mail-send", N_("Fl_ush Outbox"), @@ -1694,34 +578,6 @@ static GtkActionEntry mail_entries[] = { N_("Select all replies to the currently selected message"), G_CALLBACK (action_mail_folder_select_subthread_cb) }, - { "mail-forward", - "mail-forward", - N_("_Forward"), - "<Control>f", - N_("Forward the selected message to someone"), - G_CALLBACK (action_mail_forward_cb) }, - - { "mail-forward-attached", - NULL, - N_("_Attached"), - NULL, - N_("Forward the selected message to someone as an attachment"), - G_CALLBACK (action_mail_forward_attached_cb) }, - - { "mail-forward-inline", - NULL, - N_("_Inline"), - NULL, - N_("Forward the selected message in the body of a new message"), - G_CALLBACK (action_mail_forward_inline_cb) }, - - { "mail-forward-quoted", - NULL, - N_("_Quoted"), - NULL, - N_("Forward the selected message quoted like a reply"), - G_CALLBACK (action_mail_forward_quoted_cb) }, - { "mail-hide-read", NULL, N_("Hide _Read Messages"), @@ -1736,118 +592,7 @@ static GtkActionEntry mail_entries[] = { N_("Temporarily hide the selected messages"), G_CALLBACK (action_mail_hide_selected_cb) }, - { "mail-load-images", - "image-x-generic", - N_("_Load Images"), - "<Control>i", - N_("Force images in HTML mail to be loaded"), - G_CALLBACK (action_mail_load_images_cb) }, - - { "mail-mark-important", - "mail-mark-important", - N_("_Important"), - NULL, - N_("Mark the selected messages as important"), - G_CALLBACK (action_mail_mark_important_cb) }, - - { "mail-mark-junk", - "mail-mark-junk", - N_("_Junk"), - "<Control>j", - N_("Mark the selected messages as junk"), - G_CALLBACK (action_mail_mark_junk_cb) }, - - { "mail-mark-notjunk", - "mail-mark-notjunk", - N_("_Not Junk"), - "<Shift><Control>j", - N_("Mark the selected messages as not being junk"), - G_CALLBACK (action_mail_mark_notjunk_cb) }, - - { "mail-mark-read", - "mail-mark-read", - N_("_Read"), - "<Control>k", - N_("Mark the selected messages as having been read"), - G_CALLBACK (action_mail_mark_read_cb) }, - - { "mail-mark-unimportant", - NULL, - N_("Uni_mportant"), - NULL, - N_("Mark the selected messages as unimportant"), - G_CALLBACK (action_mail_mark_unimportant_cb) }, - - { "mail-mark-unread", - "mail-mark-unread", - N_("_Unread"), - "<Shift><Control>k", - N_("Mark the selected messages as not having been read"), - G_CALLBACK (action_mail_mark_unread_cb) }, - - { "mail-message-edit", - NULL, - N_("_Edit as New Message..."), - NULL, - N_("Open the selected messages in the composer for editing"), - G_CALLBACK (action_mail_message_edit_cb) }, - - { "mail-message-new", - "mail-message-new", - N_("Compose _New Message"), - "<Shift><Control>m", - N_("Open a window for composing a mail message"), - G_CALLBACK (action_mail_message_new_cb) }, - - { "mail-message-open", - NULL, - N_("_Open in New Window"), - "<Control>o", - N_("Open the selected messages in a new window"), - G_CALLBACK (action_mail_message_open_cb) }, - - { "mail-message-post", - NULL, - N_("Pos_t New Message to Folder"), - NULL, - N_("Post a message to a public folder"), - G_CALLBACK (action_mail_message_post_cb) }, - - { "mail-move", - "mail-move", - N_("_Move to Folder"), - "<Shift><Control>v", - N_("Move selected messages to another folder"), - G_CALLBACK (action_mail_move_cb) }, - - { "mail-next", - GTK_STOCK_GO_FORWARD, - N_("_Next Message"), - "<Control>Page_Down", - N_("Display the next message"), - G_CALLBACK (action_mail_next_cb) }, - - { "mail-next-important", - NULL, - N_("Next _Important Message"), - NULL, - N_("Display the next important message"), - G_CALLBACK (action_mail_next_important_cb) }, - - { "mail-next-thread", - NULL, - N_("Next _Thread"), - NULL, - N_("Display the next thread"), - G_CALLBACK (action_mail_next_thread_cb) }, - - { "mail-next-unread", - NULL, - N_("Next _Unread Message"), - "<Control>bracketright", - N_("Display the next unread message"), - G_CALLBACK (action_mail_next_unread_cb) }, - +#if 0 /* XXX Work around one-accelerator-per-action limit. */ { "mail-next-unread-1", NULL, @@ -1864,27 +609,6 @@ static GtkActionEntry mail_entries[] = { NULL, G_CALLBACK (action_mail_next_unread_cb) }, - { "mail-previous", - GTK_STOCK_GO_BACK, - N_("_Previous Message"), - "<Control>Page_Up", - N_("Display the previous message"), - G_CALLBACK (action_mail_previous_cb) }, - - { "mail-previous-important", - NULL, - N_("Pr_evious Important Message"), - NULL, - N_("Display the previous important message"), - G_CALLBACK (action_mail_previous_important_cb) }, - - { "mail-previous-unread", - NULL, - N_("P_revious Unread Message"), - "<Control>bracketleft", - N_("Display the previous unread message"), - G_CALLBACK (action_mail_previous_unread_cb) }, - /* XXX Work around one-accelerator-per-action limit. */ { "mail-previous-unread-1", NULL, @@ -1900,97 +624,7 @@ static GtkActionEntry mail_entries[] = { "<Control>comma", NULL, G_CALLBACK (action_mail_previous_unread_cb) }, - - { "mail-print", - GTK_STOCK_PRINT, - NULL, - NULL, - N_("Print this message"), - G_CALLBACK (action_mail_print_cb) }, - - { "mail-print-preview", - GTK_STOCK_PRINT_PREVIEW, - NULL, - NULL, - N_("Preview the message to be printed"), - G_CALLBACK (action_mail_print_preview_cb) }, - - { "mail-redirect", - NULL, - N_("Re_direct"), - NULL, - N_("Redirect (bounce) the selected message to someone"), - G_CALLBACK (action_mail_redirect_cb) }, - - { "mail-reply-all", - "mail-reply-all", - N_("Reply to _All"), - "<Shift><Control>r", - N_("Compose a reply to all the recipients of the selected message"), - G_CALLBACK (action_mail_reply_all_cb) }, - - { "mail-reply-list", - NULL, - N_("Reply to _List"), - "<Control>l", - N_("Compose a reply to the mailing list of the selected message"), - G_CALLBACK (action_mail_reply_list_cb) }, - - { "mail-reply-post", - NULL, - N_("Post a Repl_y"), - NULL, - N_("Post a reply to a message in a public folder"), - G_CALLBACK (action_mail_reply_post_cb) }, - - { "mail-reply-sender", - "mail-reply-sender", - N_("_Reply to Sender"), - "<Control>r", - N_("Compose a reply to the sender of the selected message"), - G_CALLBACK (action_mail_reply_sender_cb) }, - - { "mail-save-as", - GTK_STOCK_SAVE_AS, - N_("_Save As mbox..."), - NULL, - N_("Save selected message as an mbox file"), - G_CALLBACK (action_mail_save_as_cb) }, - - { "mail-search-folder-from-mailing-list", - NULL, - N_("Search Folder from Mailing _List..."), - NULL, - N_("Create a search folder for this mailing list"), - G_CALLBACK (action_mail_search_folder_from_mailing_list_cb) }, - - { "mail-search-folder-from-recipients", - NULL, - N_("Search Folder from Recipien_ts..."), - NULL, - N_("Create a search folder for these recipients"), - G_CALLBACK (action_mail_search_folder_from_recipients_cb) }, - - { "mail-search-folder-from-sender", - NULL, - N_("Search Folder from Sen_der..."), - NULL, - N_("Create a search folder for this sender"), - G_CALLBACK (action_mail_search_folder_from_sender_cb) }, - - { "mail-search-folder-from-subject", - NULL, - N_("Search Folder from S_ubject..."), - NULL, - N_("Create a search folder for this subject"), - G_CALLBACK (action_mail_search_folder_from_subject_cb) }, - - { "mail-select-all", - NULL, - N_("Select _All Text"), - "<Shift><Control>x", - N_("Select all the text in a message"), - G_CALLBACK (action_mail_select_all_cb) }, +#endif { "mail-show-hidden", NULL, @@ -1999,13 +633,6 @@ static GtkActionEntry mail_entries[] = { N_("Show messages that have been temporarily hidden"), G_CALLBACK (action_mail_show_hidden_cb) }, - { "mail-show-source", - NULL, - N_("_Message Source"), - "<Control>u", - N_("Show the raw email source of the message"), - G_CALLBACK (action_mail_show_source_cb) }, - { "mail-stop", GTK_STOCK_STOP, N_("Cancel"), @@ -2048,13 +675,6 @@ static GtkActionEntry mail_entries[] = { N_("Subscribe or unsubscribe to folders on remote servers"), G_CALLBACK (action_mail_tools_subscriptions_cb) }, - { "mail-undelete", - NULL, - N_("_Undelete Message"), - "<Shift><Control>d", - N_("Undelete the selected messages"), - G_CALLBACK (action_mail_undelete_cb) }, - { "mail-uri-call-to", NULL, N_("C_all To..."), @@ -2090,43 +710,8 @@ static GtkActionEntry mail_entries[] = { NULL, /* XXX Add a tooltip! */ G_CALLBACK (action_mail_uri_to_search_folder_sender_cb) }, - { "mail-zoom-100", - GTK_STOCK_ZOOM_100, - N_("_Normal Size"), - "<Control>0", - N_("Reset the text to its original size"), - G_CALLBACK (action_mail_zoom_100_cb) }, - - { "mail-zoom-in", - GTK_STOCK_ZOOM_IN, - N_("_Zoom In"), - "<Control>plus", - N_("Increase the text size"), - G_CALLBACK (action_mail_zoom_in_cb) }, - - { "mail-zoom-out", - GTK_STOCK_ZOOM_OUT, - N_("Zoom _Out"), - "<Control>minus", - N_("Decreate the text size"), - G_CALLBACK (action_mail_zoom_out_cb) }, - /*** Menus ***/ - { "mail-create-rule-menu", - NULL, - N_("Create R_ule"), - NULL, - NULL, - NULL }, - - { "mail-encoding-menu", - NULL, - N_("Ch_aracter Encoding"), - NULL, - NULL, - NULL }, - { "mail-folder-menu", NULL, N_("F_older"), @@ -2134,20 +719,6 @@ static GtkActionEntry mail_entries[] = { NULL, NULL }, - { "mail-forward-as-menu", - NULL, - N_("F_orward As..."), - NULL, - NULL, - NULL }, - - { "mail-goto-menu", - GTK_STOCK_JUMP_TO, - N_("_Go To"), - NULL, - NULL, - NULL }, - { "mail-label-menu", NULL, N_("_Label"), @@ -2155,20 +726,6 @@ static GtkActionEntry mail_entries[] = { NULL, NULL }, - { "mail-mark-as-menu", - NULL, - N_("Mar_k As"), - NULL, - NULL, - NULL }, - - { "mail-message-menu", - NULL, - N_("_Message"), - NULL, - NULL, - NULL }, - { "mail-preview-menu", NULL, N_("_Preview"), @@ -2181,26 +738,11 @@ static GtkActionEntry mail_entries[] = { N_("Create _Search Folder"), NULL, NULL, - NULL }, - - { "mail-zoom-menu", - NULL, - N_("_Zoom"), - NULL, - NULL, NULL } }; static GtkToggleActionEntry mail_toggle_entries[] = { - { "mail-caret-mode", - NULL, - N_("_Caret Mode"), - "F7", - N_("Show a blinking cursor in the body of displayed messages"), - G_CALLBACK (action_mail_caret_mode_cb), - FALSE }, - { "mail-hide-deleted", NULL, N_("Hide _Deleted Messages"), @@ -2218,14 +760,6 @@ static GtkToggleActionEntry mail_toggle_entries[] = { G_CALLBACK (action_mail_preview_cb), TRUE }, - { "mail-show-all-headers", - NULL, - N_("All Message _Headers"), - NULL, - N_("Show messages with all email headers"), - G_CALLBACK (action_mail_show_all_headers_cb), - FALSE }, - { "mail-threads-group-by", NULL, N_("_Group By Threads"), @@ -2492,10 +1026,6 @@ e_mail_shell_view_actions_init (EMailShellView *mail_shell_view) bridge = gconf_bridge_get (); - object = G_OBJECT (ACTION (MAIL_CARET_MODE)); - key = "/apps/evolution/mail/display/caret_mode"; - gconf_bridge_bind_property (bridge, key, object, "active"); - object = G_OBJECT (ACTION (MAIL_PREVIEW)); key = "/apps/evolution/mail/display/show_preview"; gconf_bridge_bind_property (bridge, key, object, "active"); @@ -2507,18 +1037,4 @@ e_mail_shell_view_actions_init (EMailShellView *mail_shell_view) object = G_OBJECT (ACTION (MAIL_THREADS_GROUP_BY)); key = "/apps/evolution/mail/display/thread_list"; gconf_bridge_bind_property (bridge, key, object, "active"); - - /* Fine tuning. */ - - action = ACTION (MAIL_DELETE); - g_object_set (action, "short-label", _("Delete"), NULL); - - action = ACTION (MAIL_NEXT); - g_object_set (action, "short-label", _("Next"), NULL); - - action = ACTION (MAIL_PREVIOUS); - g_object_set (action, "short-label", _("Previous"), NULL); - - action = ACTION (MAIL_REPLY_SENDER); - g_object_set (action, "short-label", _("Reply"), NULL); } diff --git a/mail/e-mail-shell-view-private.c b/mail/e-mail-shell-view-private.c index 1ead83c162..8dbaf56877 100644 --- a/mail/e-mail-shell-view-private.c +++ b/mail/e-mail-shell-view-private.c @@ -125,6 +125,8 @@ e_mail_shell_view_private_init (EMailShellView *mail_shell_view, { EMailShellViewPrivate *priv = mail_shell_view->priv; + /* Note: EMailShellContent retrieves the "mail" action group + * by name to satisfy its EMailReader interface. */ priv->mail_actions = gtk_action_group_new ("mail"); priv->filter_actions = gtk_action_group_new ("mail-filter"); @@ -186,6 +188,7 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) mail_shell_view); e_mail_shell_view_actions_init (mail_shell_view); + e_mail_reader_init (E_MAIL_READER (mail_shell_content)); /* Restore the previously selected folder. */ folder_tree_model = em_folder_tree_get_model (folder_tree); diff --git a/mail/e-mail-shell-view-private.h b/mail/e-mail-shell-view-private.h index ed379dc9a7..50ccf3000b 100644 --- a/mail/e-mail-shell-view-private.h +++ b/mail/e-mail-shell-view-private.h @@ -31,6 +31,7 @@ #include "e-util/gconf-bridge.h" #include "widgets/menus/gal-view-instance.h" +#include "e-mail-reader.h" #include "em-composer-utils.h" #include "em-folder-properties.h" #include "em-folder-selector.h" diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c index b129d3fba6..5ce7473566 100644 --- a/mail/em-folder-view.c +++ b/mail/em-folder-view.c @@ -112,8 +112,6 @@ static void emfv_list_message_selected(MessageList *ml, const char *uid, EMFolderView *emfv); static void emfv_list_built(MessageList *ml, EMFolderView *emfv); static int emfv_list_right_click(ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, EMFolderView *emfv); -static void emfv_list_double_click(ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, EMFolderView *emfv); -static int emfv_list_key_press(ETree *tree, int row, ETreePath path, int col, GdkEvent *ev, EMFolderView *emfv); static void emfv_list_selection_change(ETree *tree, EMFolderView *emfv); static void emfv_format_link_clicked(EMFormatHTMLDisplay *efhd, const char *uri, EMFolderView *); @@ -271,8 +269,8 @@ emfv_init(GObject *o) /* FIXME: should this hang off message-list instead? */ g_signal_connect(emfv->list->tree, "right_click", G_CALLBACK(emfv_list_right_click), emfv); - g_signal_connect(emfv->list->tree, "double_click", G_CALLBACK(emfv_list_double_click), emfv); - g_signal_connect(emfv->list->tree, "key_press", G_CALLBACK(emfv_list_key_press), emfv); +// g_signal_connect(emfv->list->tree, "double_click", G_CALLBACK(emfv_list_double_click), emfv); +// g_signal_connect(emfv->list->tree, "key_press", G_CALLBACK(emfv_list_key_press), emfv); g_signal_connect(emfv->list->tree, "selection_change", G_CALLBACK(emfv_list_selection_change), emfv); emfv->preview = (EMFormatHTMLDisplay *)em_format_html_display_new(); @@ -663,52 +661,6 @@ emfv_popup_open(EPopup *ep, EPopupItem *pitem, void *data) em_folder_view_open_selected(emfv); } -//static void -//emfv_popup_edit (EPopup *ep, EPopupItem *pitem, void *data) -//{ -// EMFolderView *emfv = data; -// GPtrArray *uids; -// -// if (!em_utils_check_user_can_send_mail((GtkWidget *)emfv)) -// return; -// -// uids = message_list_get_selected(emfv->list); -// em_utils_edit_messages (emfv->folder, uids, FALSE); -//} - -//static void -//emfv_popup_saveas(EPopup *ep, EPopupItem *pitem, void *data) -//{ -// EMFolderView *emfv = data; -// GPtrArray *uids; -// -// uids = message_list_get_selected(emfv->list); -// em_utils_save_messages((GtkWidget *)emfv, emfv->folder, uids); -//} - -//static void -//emfv_view_load_images(BonoboUIComponent *uic, void *data, const char *path) -//{ -// EMFolderView *emfv = data; -// -// if (emfv->preview) -// em_format_html_load_http((EMFormatHTML *)emfv->preview); -//} - -//static void -//emfv_popup_print(EPopup *ep, EPopupItem *pitem, void *data) -//{ -// EMFolderView *emfv = data; -// em_folder_view_print(emfv, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG); -//} - -//static void -//emfv_popup_copy_text(EPopup *ep, EPopupItem *pitem, void *data) -//{ -// EMFolderView *emfv = data; -// gtk_html_copy (((EMFormatHTML *)emfv->preview)->html); -//} - static void emfv_popup_source(EPopup *ep, EPopupItem *pitem, void *data) { @@ -728,312 +680,104 @@ emfv_popup_source(EPopup *ep, EPopupItem *pitem, void *data) message_list_free_uids(emfv->list, uids); } -//static void -//emfv_mail_compose(BonoboUIComponent *uid, void *data, const char *path) -//{ -// EMFolderView *emfv = data; -// -// if (!em_utils_check_user_can_send_mail((GtkWidget *)emfv)) -// return; -// -// em_utils_compose_new_message(emfv->folder_uri); -//} - -//static void -//emfv_popup_reply_sender(EPopup *ep, EPopupItem *pitem, void *data) -//{ -// EMFolderView *emfv = data; -// em_folder_view_message_reply(emfv, REPLY_MODE_SENDER); -//} - -//static void -//emfv_popup_reply_list(EPopup *ep, EPopupItem *pitem, void *data) -//{ -// EMFolderView *emfv = data; -// em_folder_view_message_reply(emfv, REPLY_MODE_LIST); -//} - -//static void -//emfv_popup_reply_all(EPopup *ep, EPopupItem *pitem, void *data) -//{ -// EMFolderView *emfv = data; -// em_folder_view_message_reply(emfv, REPLY_MODE_ALL); -//} - -//static void -//emfv_popup_forward(EPopup *ep, EPopupItem *pitem, void *data) -//{ -// EMFolderView *emfv = data; -// GPtrArray *uids; -// -// if (!em_utils_check_user_can_send_mail((GtkWidget *)emfv)) -// return; -// -// uids = message_list_get_selected(emfv->list); -// em_utils_forward_messages (emfv->folder, uids, emfv->folder_uri); -//} - -//static void -//emfv_popup_flag_followup(EPopup *ep, EPopupItem *pitem, void *data) -//{ -// EMFolderView *emfv = data; -// GPtrArray *uids = message_list_get_selected(emfv->list); -// -// em_utils_flag_for_followup((GtkWidget *)emfv, emfv->folder, uids); -//} - -//static void -//emfv_popup_flag_completed(EPopup *ep, EPopupItem *pitem, void *data) -//{ -// EMFolderView *emfv = data; -// GPtrArray *uids; -// -// uids = message_list_get_selected(emfv->list); -// em_utils_flag_for_followup_completed((GtkWidget *)emfv, emfv->folder, uids); -// -// if (emfv->preview) -// em_format_redraw (emfv->preview); -//} - -//static void -//emfv_popup_flag_clear(EPopup *ep, EPopupItem *pitem, void *data) -//{ -// EMFolderView *emfv = data; -// GPtrArray *uids = message_list_get_selected(emfv->list); -// -// em_utils_flag_for_followup_clear((GtkWidget *)emfv, emfv->folder, uids); -// -// if (emfv->preview) -// em_format_redraw (emfv->preview); -//} - -//static void -//emfv_popup_mark_read(EPopup *ep, EPopupItem *pitem, void *data) -//{ -// EMFolderView *emfv = data; -// em_folder_view_mark_selected(emfv, CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN); -//} +//#define DelInVFolderCheckName "DelInVFolderCheck" +//#define DelInVFolderKey "/apps/evolution/mail/prompts/delete_in_vfolder" //static void -//emfv_popup_mark_unread(EPopup *ep, EPopupItem *pitem, void *data) +//emfv_delete_msg_response (GtkWidget *dialog, int response, gpointer data) //{ -// EMFolderView *emfv = data; -// em_folder_view_mark_selected(emfv, CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_DELETED, 0); -// -// if (emfv->list->seen_id) { -// g_source_remove(emfv->list->seen_id); -// emfv->list->seen_id = 0; +// if (response == GTK_RESPONSE_OK) { +// EMFolderView *emfv = data; +// int count; +// GPtrArray *uids; +// +// if (dialog) { +// GList *children, *l; +// GtkWidget *check = NULL; +// +// children = gtk_container_get_children (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox)); +// for (l = children; l; l = l->next) { +// if (GTK_IS_ALIGNMENT (l->data)) { +// check = gtk_bin_get_child (GTK_BIN (l->data)); +// +// if (check && GTK_IS_CHECK_BUTTON (check) && +// !strcmp (gtk_widget_get_name (check), DelInVFolderCheckName)) +// break; +// +// check = NULL; +// } +// } +// +// if (check) { +// GConfClient *gconf = gconf_client_get_default (); +// gconf_client_set_bool (gconf, DelInVFolderKey, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check)), NULL); +// g_object_unref (gconf); +// } +// +// g_list_free (children); +// } +// +// uids = message_list_get_selected(emfv->list); +// camel_folder_freeze(emfv->folder); +// +// for (count=0; count < uids->len; count++) { +// if (camel_folder_get_message_flags (emfv->folder, uids->pdata[count]) & CAMEL_MESSAGE_USER_NOT_DELETABLE) { +// if (emfv->preview_active) { +// GtkHTMLStream *hstream = gtk_html_begin(((EMFormatHTML *)emfv->preview)->html); +// +// gtk_html_stream_printf(hstream, "<h2>%s</h2><p>%s</p>", +// _("Mail Deletion Failed"), +// _("You do not have sufficient permissions to delete this mail.")); +// gtk_html_stream_close(hstream, GTK_HTML_STREAM_OK); +// } else { +// GtkWidget *w = e_error_new (NULL, "mail:no-delete-permission", "", NULL); +// em_utils_show_error_silent (w); +// } +// +// count = -1; +// break; +// } else +// camel_folder_set_message_flags(emfv->folder, uids->pdata[count], CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_DELETED, CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_DELETED ); +// } +// +// message_list_free_uids(emfv->list, uids); +// camel_folder_thaw(emfv->folder); +// +// em_folder_view_select_next_message (emfv, count, FALSE); // } -//} - -//static void -//emfv_popup_mark_important(EPopup *ep, EPopupItem *pitem, void *data) -//{ -// EMFolderView *emfv = data; -// em_folder_view_mark_selected(emfv, CAMEL_MESSAGE_FLAGGED|CAMEL_MESSAGE_DELETED, CAMEL_MESSAGE_FLAGGED); -//} - -//static void -//emfv_popup_mark_unimportant(EPopup *ep, EPopupItem *pitem, void *data) -//{ -// EMFolderView *emfv = data; -// em_folder_view_mark_selected(emfv, CAMEL_MESSAGE_FLAGGED, 0); -//} - -void -em_folder_view_select_next_message (EMFolderView *emfv, int count, gboolean always_can_previous) -{ - if (emfv && count == 1) { - if (!message_list_select (emfv->list, MESSAGE_LIST_SELECT_NEXT, 0, 0) && (emfv->hide_deleted || always_can_previous)) - message_list_select (emfv->list, MESSAGE_LIST_SELECT_PREVIOUS, 0, 0); - } -} - -//static void -//emfv_popup_mark_junk (EPopup *ep, EPopupItem *pitem, void *data) -//{ -// EMFolderView *emfv = data; -// int count; -// -// count = em_folder_view_mark_selected(emfv, -// CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_JUNK|CAMEL_MESSAGE_NOTJUNK|CAMEL_MESSAGE_JUNK_LEARN, -// CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_JUNK|CAMEL_MESSAGE_JUNK_LEARN); // -// em_folder_view_select_next_message (emfv, count, TRUE); +// if (dialog) +// gtk_widget_destroy (dialog); //} //static void -//emfv_popup_mark_nojunk (EPopup *ep, EPopupItem *pitem, void *data) +//emfv_popup_delete (EPopup *ep, EPopupItem *pitem, void *data) //{ // EMFolderView *emfv = data; -// int count; -// -// count = em_folder_view_mark_selected(emfv, -// CAMEL_MESSAGE_JUNK|CAMEL_MESSAGE_NOTJUNK|CAMEL_MESSAGE_JUNK_LEARN, -// CAMEL_MESSAGE_NOTJUNK|CAMEL_MESSAGE_JUNK_LEARN); -// -// em_folder_view_select_next_message (emfv, count, TRUE); -//} - -#define DelInVFolderCheckName "DelInVFolderCheck" -#define DelInVFolderKey "/apps/evolution/mail/prompts/delete_in_vfolder" - -static void -emfv_delete_msg_response (GtkWidget *dialog, int response, gpointer data) -{ - if (response == GTK_RESPONSE_OK) { - EMFolderView *emfv = data; - int count; - GPtrArray *uids; - - if (dialog) { - GList *children, *l; - GtkWidget *check = NULL; - - children = gtk_container_get_children (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox)); - for (l = children; l; l = l->next) { - if (GTK_IS_ALIGNMENT (l->data)) { - check = gtk_bin_get_child (GTK_BIN (l->data)); - - if (check && GTK_IS_CHECK_BUTTON (check) && - !strcmp (gtk_widget_get_name (check), DelInVFolderCheckName)) - break; - - check = NULL; - } - } - - if (check) { - GConfClient *gconf = gconf_client_get_default (); - gconf_client_set_bool (gconf, DelInVFolderKey, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check)), NULL); - g_object_unref (gconf); - } - - g_list_free (children); - } - - uids = message_list_get_selected(emfv->list); - camel_folder_freeze(emfv->folder); - - for (count=0; count < uids->len; count++) { - if (camel_folder_get_message_flags (emfv->folder, uids->pdata[count]) & CAMEL_MESSAGE_USER_NOT_DELETABLE) { - if (emfv->preview_active) { - GtkHTMLStream *hstream = gtk_html_begin(((EMFormatHTML *)emfv->preview)->html); - - gtk_html_stream_printf(hstream, "<h2>%s</h2><p>%s</p>", - _("Mail Deletion Failed"), - _("You do not have sufficient permissions to delete this mail.")); - gtk_html_stream_close(hstream, GTK_HTML_STREAM_OK); - } else { - GtkWidget *w = e_error_new (NULL, "mail:no-delete-permission", "", NULL); - em_utils_show_error_silent (w); - } - - count = -1; - break; - } else - camel_folder_set_message_flags(emfv->folder, uids->pdata[count], CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_DELETED, CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_DELETED ); - } - - message_list_free_uids(emfv->list, uids); - camel_folder_thaw(emfv->folder); - - em_folder_view_select_next_message (emfv, count, FALSE); - } - - if (dialog) - gtk_widget_destroy (dialog); -} - -static void -emfv_popup_delete (EPopup *ep, EPopupItem *pitem, void *data) -{ - EMFolderView *emfv = data; - GConfClient *gconf = gconf_client_get_default (); - - if (emfv->folder && emfv->folder->parent_store && CAMEL_IS_VEE_STORE (emfv->folder->parent_store) - && !gconf_client_get_bool (gconf, DelInVFolderKey, NULL)) { - GtkWidget *dialog, *checkbox, *align; - - dialog = e_error_new (NULL, "mail:ask-delete-vfolder-msg", emfv->folder->full_name, NULL); - g_signal_connect (dialog, "response", G_CALLBACK (emfv_delete_msg_response), emfv); - checkbox = gtk_check_button_new_with_label (_("Do not ask me again.")); - gtk_widget_set_name (checkbox, DelInVFolderCheckName); - align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0); - gtk_container_add (GTK_CONTAINER (align), checkbox); - gtk_widget_show (checkbox); - gtk_box_pack_end (GTK_BOX (GTK_DIALOG (dialog)->vbox), align, TRUE, TRUE, 6); - gtk_widget_show (align); - gtk_widget_show (dialog); - } else { - emfv_delete_msg_response (NULL, GTK_RESPONSE_OK, emfv); - } - - g_object_unref (gconf); -} -#undef DelInVFolderCheckName -#undef DelInVFolderKey - -//static void -//emfv_popup_undelete(EPopup *ep, EPopupItem *pitem, void *data) -//{ -// EMFolderView *emfv = data; -// em_folder_view_mark_selected(emfv, CAMEL_MESSAGE_DELETED, 0); -//} - -//struct _move_data { -// EMFolderView *emfv; -// GPtrArray *uids; -// int delete; -//}; - -//static char *default_xfer_messages_uri = NULL; - -//static void -//emfv_popup_move_cb(const char *uri, void *data) -//{ -// struct _move_data *d = data; -// -// if (uri) { -// g_free (default_xfer_messages_uri); -// default_xfer_messages_uri = g_strdup (uri); -// mail_transfer_messages(d->emfv->folder, d->uids, d->delete, uri, 0, NULL, NULL); -// } else -// em_utils_uids_free(d->uids); -// -// g_object_unref(d->emfv); -// g_free(d); -//} - -//static void -//emfv_popup_move(EPopup *ep, EPopupItem *pitem, void *data) -//{ -// EMFolderView *emfv = data; -// struct _move_data *d; -// -// d = g_malloc(sizeof(*d)); -// d->emfv = emfv; -// g_object_ref(emfv); -// d->uids = message_list_get_selected(emfv->list); -// d->delete = TRUE; -// -// em_select_folder ((GtkWindow *) emfv, _("Select folder"), _("_Move"), default_xfer_messages_uri, NULL, emfv_popup_move_cb, d); -//} - -//static void -//emfv_popup_copy(EPopup *ep, EPopupItem *pitem, void *data) -//{ -// EMFolderView *emfv = data; -// struct _move_data *d; -// -// d = g_malloc(sizeof(*d)); -// d->emfv = emfv; -// g_object_ref(emfv); -// d->uids = message_list_get_selected(emfv->list); -// d->delete = FALSE; +// GConfClient *gconf = gconf_client_get_default (); +// +// if (emfv->folder && emfv->folder->parent_store && CAMEL_IS_VEE_STORE (emfv->folder->parent_store) +// && !gconf_client_get_bool (gconf, DelInVFolderKey, NULL)) { +// GtkWidget *dialog, *checkbox, *align; +// +// dialog = e_error_new (NULL, "mail:ask-delete-vfolder-msg", emfv->folder->full_name, NULL); +// g_signal_connect (dialog, "response", G_CALLBACK (emfv_delete_msg_response), emfv); +// checkbox = gtk_check_button_new_with_label (_("Do not ask me again.")); +// gtk_widget_set_name (checkbox, DelInVFolderCheckName); +// align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0); +// gtk_container_add (GTK_CONTAINER (align), checkbox); +// gtk_widget_show (checkbox); +// gtk_box_pack_end (GTK_BOX (GTK_DIALOG (dialog)->vbox), align, TRUE, TRUE, 6); +// gtk_widget_show (align); +// gtk_widget_show (dialog); +// } else { +// emfv_delete_msg_response (NULL, GTK_RESPONSE_OK, emfv); +// } // -// em_select_folder ((GtkWindow *) emfv, _("Select folder"), _("C_opy"), default_xfer_messages_uri, NULL, emfv_popup_move_cb, d); +// g_object_unref (gconf); //} +//#undef DelInVFolderCheckName +//#undef DelInVFolderKey static void emfv_set_label (EMFolderView *emfv, const char *label) @@ -1097,93 +841,17 @@ emfv_popup_label_new (EPopup *ep, EPopupItem *pitem, void *data) } } -//static void -//emfv_popup_add_sender(EPopup *ep, EPopupItem *pitem, void *data) -//{ -// EMFolderView *emfv = data; -// GPtrArray *uids = message_list_get_selected(emfv->list); -// CamelMessageInfo *info; -// const char *addr; -// -// if (uids->len == 1 -// && (info = camel_folder_get_message_info(emfv->folder, uids->pdata[0])) != NULL -// && (addr = camel_message_info_from(info)) != NULL -// && addr[0] != 0) -// em_utils_add_address((GtkWidget *)emfv, addr); -// -// em_utils_uids_free(uids); -//} - -//static void -//emfv_popup_apply_filters(EPopup *ep, EPopupItem *pitem, void *data) -//{ -// EMFolderView *emfv = data; -// GPtrArray *uids = message_list_get_selected(emfv->list); -// -// mail_filter_on_demand(emfv->folder, uids); -//} - -//static void -//emfv_popup_filter_junk(EPopup *ep, EPopupItem *pitem, void *data) -//{ -// EMFolderView *emfv = data; -// GPtrArray *uids = message_list_get_selected(emfv->list); -// -// mail_filter_junk(emfv->folder, uids); -//} - -/* filter callbacks, this will eventually be a wizard, see - filter_type_current/vfolder_type_current for implementation */ - -//#define EMFV_POPUP_AUTO_TYPE(autotype, name, type) \ -//static void \ -//name(EPopup *ep, EPopupItem *item, void *data) \ -//{ \ -// EMFolderView *emfv = data; \ -// autotype(emfv, type); \ -//} - -//EMFV_POPUP_AUTO_TYPE(vfolder_type_current, emfv_popup_vfolder_subject, AUTO_SUBJECT) -//EMFV_POPUP_AUTO_TYPE(vfolder_type_current, emfv_popup_vfolder_sender, AUTO_FROM) -//EMFV_POPUP_AUTO_TYPE(vfolder_type_current, emfv_popup_vfolder_recipients, AUTO_TO) -//EMFV_POPUP_AUTO_TYPE(vfolder_type_current, emfv_popup_vfolder_mlist, AUTO_MLIST) - -//EMFV_POPUP_AUTO_TYPE(filter_type_current, emfv_popup_filter_subject, AUTO_SUBJECT) -//EMFV_POPUP_AUTO_TYPE(filter_type_current, emfv_popup_filter_sender, AUTO_FROM) -//EMFV_POPUP_AUTO_TYPE(filter_type_current, emfv_popup_filter_recipients, AUTO_TO) -//EMFV_POPUP_AUTO_TYPE(filter_type_current, emfv_popup_filter_mlist, AUTO_MLIST) - -/* TODO: Move some of these to be 'standard' menu's */ - static EPopupItem emfv_popup_items[] = { -// { E_POPUP_ITEM, "00.emfv.00", N_("_Copy"), emfv_popup_copy_text, NULL, "edit-copy", EM_FOLDER_VIEW_SELECT_DISPLAY|EM_FOLDER_VIEW_SELECT_SELECTION }, { E_POPUP_BAR, "10.emfv", NULL, NULL, NULL, NULL }, -// { E_POPUP_ITEM, "10.emfv.00", N_("_Reply to Sender"), emfv_popup_reply_sender, NULL, "mail-reply-sender", EM_POPUP_SELECT_ONE }, -// { E_POPUP_ITEM, "10.emfv.01", N_("Reply to _All"), emfv_popup_reply_all, NULL, "mail-reply-all", EM_POPUP_SELECT_ONE }, -// { E_POPUP_ITEM, "10.emfv.02", N_("_Forward"), emfv_popup_forward, NULL, "mail-forward", EM_POPUP_SELECT_MANY }, { E_POPUP_BAR, "20.emfv", NULL, NULL, NULL, NULL }, - /* EM_POPUP_EDIT was used here. This is changed to EM_POPUP_SELECT_ONE as Edit-as-new-messaeg need not be restricted to Sent-Items folder alone */ -// { E_POPUP_ITEM, "20.emfv.00", N_("_Edit as New Message..."), emfv_popup_edit, NULL, NULL, EM_POPUP_SELECT_ONE }, -// { E_POPUP_ITEM, "20.emfv.01", N_("_Save As..."), emfv_popup_saveas, NULL, "document-save-as", EM_POPUP_SELECT_MANY }, -// { E_POPUP_ITEM, "20.emfv.02", N_("_Print..."), emfv_popup_print, NULL, "document-print", EM_POPUP_SELECT_ONE }, { E_POPUP_BAR, "40.emfv", NULL, NULL, NULL, NULL }, - { E_POPUP_ITEM, "40.emfv.00", N_("_Delete"), emfv_popup_delete, NULL, "edit-delete", EM_POPUP_SELECT_DELETE|EM_FOLDER_VIEW_SELECT_LISTONLY }, -// { E_POPUP_ITEM, "40.emfv.01", N_("U_ndelete"), emfv_popup_undelete, NULL, NULL, EM_POPUP_SELECT_UNDELETE|EM_FOLDER_VIEW_SELECT_LISTONLY }, -// { E_POPUP_ITEM, "40.emfv.02", N_("_Move to Folder..."), emfv_popup_move, NULL, "mail-move", EM_POPUP_SELECT_MANY|EM_FOLDER_VIEW_SELECT_LISTONLY }, -// { E_POPUP_ITEM, "40.emfv.03", N_("_Copy to Folder..."), emfv_popup_copy, NULL, "mail-copy", EM_POPUP_SELECT_MANY|EM_FOLDER_VIEW_SELECT_LISTONLY }, +// { E_POPUP_ITEM, "40.emfv.00", N_("_Delete"), emfv_popup_delete, NULL, "edit-delete", EM_POPUP_SELECT_DELETE|EM_FOLDER_VIEW_SELECT_LISTONLY }, { E_POPUP_BAR, "50.emfv", NULL, NULL, NULL, NULL }, -// { E_POPUP_ITEM, "50.emfv.00", N_("Mar_k as Read"), emfv_popup_mark_read, NULL, "mail-mark-read", EM_POPUP_SELECT_MARK_READ|EM_FOLDER_VIEW_SELECT_LISTONLY }, -// { E_POPUP_ITEM, "50.emfv.01", N_("Mark as _Unread"), emfv_popup_mark_unread, NULL, "mail-mark-unread", EM_POPUP_SELECT_MARK_UNREAD|EM_FOLDER_VIEW_SELECT_LISTONLY }, -// { E_POPUP_ITEM, "50.emfv.02", N_("Mark as _Important"), emfv_popup_mark_important, NULL, "mail-mark-important", EM_POPUP_SELECT_MARK_IMPORTANT|EM_FOLDER_VIEW_SELECT_LISTONLY }, -// { E_POPUP_ITEM, "50.emfv.03", N_("Mark as Un_important"), emfv_popup_mark_unimportant, NULL, NULL, EM_POPUP_SELECT_MARK_UNIMPORTANT|EM_FOLDER_VIEW_SELECT_LISTONLY }, -// { E_POPUP_ITEM, "50.emfv.04", N_("Mark as _Junk"), emfv_popup_mark_junk, NULL, "mail-mark-junk", EM_POPUP_SELECT_MANY|EM_FOLDER_VIEW_SELECT_LISTONLY|EM_POPUP_SELECT_JUNK }, -// { E_POPUP_ITEM, "50.emfv.05", N_("Mark as _Not Junk"), emfv_popup_mark_nojunk, NULL, "mail-mark-notjunk", EM_POPUP_SELECT_MANY|EM_FOLDER_VIEW_SELECT_LISTONLY|EM_POPUP_SELECT_NOT_JUNK }, -// { E_POPUP_ITEM, "50.emfv.06", N_("Mark for Follo_w Up..."), emfv_popup_flag_followup, NULL, "stock_mail-flag-for-followup", EM_POPUP_SELECT_FLAG_FOLLOWUP|EM_FOLDER_VIEW_SELECT_LISTONLY }, { E_POPUP_SUBMENU, "60.label.00", N_("_Label"), NULL, NULL, NULL, EM_POPUP_SELECT_MANY|EM_FOLDER_VIEW_SELECT_LISTONLY }, { E_POPUP_ITEM, "60.label.00/00.label", N_("_None"), emfv_popup_label_clear, NULL, NULL, EM_POPUP_SELECT_MANY|EM_FOLDER_VIEW_SELECT_LISTONLY }, @@ -1193,25 +861,10 @@ static EPopupItem emfv_popup_items[] = { { E_POPUP_BAR, "70.emfv.06", NULL, NULL, NULL, NULL }, -// { E_POPUP_ITEM, "70.emfv.07", N_("Fla_g Completed"), emfv_popup_flag_completed, NULL, "stock_mail-flag-for-followup-done", EM_POPUP_SELECT_FLAG_COMPLETED|EM_FOLDER_VIEW_SELECT_LISTONLY }, -// { E_POPUP_ITEM, "70.emfv.08", N_("Cl_ear Flag"), emfv_popup_flag_clear, NULL, NULL, EM_POPUP_SELECT_FLAG_CLEAR|EM_FOLDER_VIEW_SELECT_LISTONLY }, { E_POPUP_BAR, "90.filter", NULL, NULL, NULL, NULL }, - { E_POPUP_SUBMENU, "90.filter.00", N_("Crea_te Rule From Message"), NULL, NULL, NULL, EM_POPUP_SELECT_ONE|EM_FOLDER_VIEW_SELECT_LISTONLY }, - /* Translators: The following strings are used while creating a new search folder, to specify what parameter the search folder would be based on. */ -// { E_POPUP_ITEM, "90.filter.00/00.00", N_("Search Folder based on _Subject"), emfv_popup_vfolder_subject, NULL, NULL, EM_POPUP_SELECT_ONE|EM_FOLDER_VIEW_SELECT_LISTONLY }, -// { E_POPUP_ITEM, "90.filter.00/00.01", N_("Search Folder based on Se_nder"), emfv_popup_vfolder_sender, NULL, NULL, EM_POPUP_SELECT_ONE|EM_FOLDER_VIEW_SELECT_LISTONLY }, -// { E_POPUP_ITEM, "90.filter.00/00.02", N_("Search Folder based on _Recipients"), emfv_popup_vfolder_recipients, NULL, NULL, EM_POPUP_SELECT_ONE|EM_FOLDER_VIEW_SELECT_LISTONLY }, -// { E_POPUP_ITEM, "90.filter.00/00.03", N_("Search Folder based on Mailing _List"), -// emfv_popup_vfolder_mlist, NULL, NULL, EM_POPUP_SELECT_ONE|EM_POPUP_SELECT_MAILING_LIST|EM_FOLDER_VIEW_SELECT_LISTONLY }, { E_POPUP_BAR, "90.filter.00/10", NULL, NULL, NULL, NULL }, - /* Translators: The following strings are used while creating a new message filter, to specify what parameter the filter would be based on. */ -// { E_POPUP_ITEM, "90.filter.00/10.00", N_("Filter based on Sub_ject"), emfv_popup_filter_subject, NULL, NULL, EM_POPUP_SELECT_ONE|EM_FOLDER_VIEW_SELECT_LISTONLY }, -// { E_POPUP_ITEM, "90.filter.00/10.01", N_("Filter based on Sen_der"), emfv_popup_filter_sender, NULL, NULL, EM_POPUP_SELECT_ONE|EM_FOLDER_VIEW_SELECT_LISTONLY }, -// { E_POPUP_ITEM, "90.filter.00/10.02", N_("Filter based on Re_cipients"), emfv_popup_filter_recipients, NULL, NULL, EM_POPUP_SELECT_ONE|EM_FOLDER_VIEW_SELECT_LISTONLY }, -// { E_POPUP_ITEM, "90.filter.00/10.03", N_("Filter based on _Mailing List"), -// emfv_popup_filter_mlist, NULL, NULL, EM_POPUP_SELECT_ONE|EM_POPUP_SELECT_MAILING_LIST|EM_FOLDER_VIEW_SELECT_LISTONLY }, }; static enum _e_popup_t @@ -1353,40 +1006,10 @@ from(BonoboUIComponent *uid, void *data, const char *path) \ to(NULL, NULL, data); \ } -//EMFV_MAP_CALLBACK(emfv_add_sender_addressbook, emfv_popup_add_sender) -//EMFV_MAP_CALLBACK(emfv_message_apply_filters, emfv_popup_apply_filters) -//EMFV_MAP_CALLBACK(emfv_message_filter_junk, emfv_popup_filter_junk) -//EMFV_MAP_CALLBACK(emfv_message_copy, emfv_popup_copy) -//EMFV_MAP_CALLBACK(emfv_message_move, emfv_popup_move) -//EMFV_MAP_CALLBACK(emfv_message_forward, emfv_popup_forward) -//EMFV_MAP_CALLBACK(emfv_message_reply_all, emfv_popup_reply_all) -//EMFV_MAP_CALLBACK(emfv_message_reply_list, emfv_popup_reply_list) -//EMFV_MAP_CALLBACK(emfv_message_reply_sender, emfv_popup_reply_sender) -//EMFV_MAP_CALLBACK(emfv_message_mark_read, emfv_popup_mark_read) -//EMFV_MAP_CALLBACK(emfv_message_mark_unread, emfv_popup_mark_unread) -//EMFV_MAP_CALLBACK(emfv_message_mark_important, emfv_popup_mark_important) -//EMFV_MAP_CALLBACK(emfv_message_mark_unimportant, emfv_popup_mark_unimportant) -//EMFV_MAP_CALLBACK(emfv_message_mark_junk, emfv_popup_mark_junk) -//EMFV_MAP_CALLBACK(emfv_message_mark_nojunk, emfv_popup_mark_nojunk) -EMFV_MAP_CALLBACK(emfv_message_delete, emfv_popup_delete) -//EMFV_MAP_CALLBACK(emfv_message_undelete, emfv_popup_undelete) -//EMFV_MAP_CALLBACK(emfv_message_followup_flag, emfv_popup_flag_followup) -//EMFV_MAP_CALLBACK(emfv_message_followup_clear, emfv_popup_flag_clear) -//EMFV_MAP_CALLBACK(emfv_message_followup_completed, emfv_popup_flag_completed) +//EMFV_MAP_CALLBACK(emfv_message_delete, emfv_popup_delete) EMFV_MAP_CALLBACK(emfv_message_open, emfv_popup_open) -//EMFV_MAP_CALLBACK(emfv_message_edit, emfv_popup_edit) -//EMFV_MAP_CALLBACK(emfv_message_saveas, emfv_popup_saveas) -//EMFV_MAP_CALLBACK(emfv_print_message, emfv_popup_print) EMFV_MAP_CALLBACK(emfv_message_source, emfv_popup_source) -//static void -//emfv_empty_trash(BonoboUIComponent *uid, void *data, const char *path) -//{ -// EMFolderView *emfv = data; -// -// em_utils_empty_trash (gtk_widget_get_toplevel ((GtkWidget *) emfv)); -//} - static void prepare_offline(void *key, void *value, void *data) { @@ -1447,211 +1070,6 @@ emfv_select_all_text(BonoboUIComponent *uid, void *data, const char *path) } -//static void -//emfv_mail_next(BonoboUIComponent *uid, void *data, const char *path) -//{ -// EMFolderView *emfv = data; -// -// e_profile_event_emit("goto.next", "", 0); -// -// message_list_select(emfv->list, MESSAGE_LIST_SELECT_NEXT, 0, 0); -//} - -//static void -//emfv_mail_next_flagged(BonoboUIComponent *uid, void *data, const char *path) -//{ -// EMFolderView *emfv = data; -// -// message_list_select(emfv->list, MESSAGE_LIST_SELECT_NEXT|MESSAGE_LIST_SELECT_WRAP, CAMEL_MESSAGE_FLAGGED, CAMEL_MESSAGE_FLAGGED); -//} - -//static void -//emfv_mail_next_unread(BonoboUIComponent *uid, void *data, const char *path) -//{ -// EMFolderView *emfv = data; -// -// gtk_widget_grab_focus((GtkWidget *) emfv->list); -// message_list_select(emfv->list, MESSAGE_LIST_SELECT_NEXT|MESSAGE_LIST_SELECT_WRAP, 0, CAMEL_MESSAGE_SEEN); -//} - -//static void -//emfv_mail_next_thread(BonoboUIComponent *uid, void *data, const char *path) -//{ -// EMFolderView *emfv = data; -// -// message_list_select_next_thread(emfv->list); -//} - -//static void -//emfv_mail_previous(BonoboUIComponent *uid, void *data, const char *path) -//{ -// EMFolderView *emfv = data; -// -// message_list_select(emfv->list, MESSAGE_LIST_SELECT_PREVIOUS, 0, 0); -//} - -//static void -//emfv_mail_previous_flagged(BonoboUIComponent *uid, void *data, const char *path) -//{ -// EMFolderView *emfv = data; -// -// message_list_select(emfv->list, MESSAGE_LIST_SELECT_PREVIOUS|MESSAGE_LIST_SELECT_WRAP, CAMEL_MESSAGE_FLAGGED, CAMEL_MESSAGE_FLAGGED); -//} - -//static void -//emfv_mail_previous_unread(BonoboUIComponent *uid, void *data, const char *path) -//{ -// EMFolderView *emfv = data; -// -// gtk_widget_grab_focus((GtkWidget *) emfv->list); -// message_list_select(emfv->list, MESSAGE_LIST_SELECT_PREVIOUS|MESSAGE_LIST_SELECT_WRAP, 0, CAMEL_MESSAGE_SEEN); -//} - -//static void -//emfv_message_forward_attached (BonoboUIComponent *uic, void *data, const char *path) -//{ -// EMFolderView *emfv = data; -// GPtrArray *uids; -// -// if (!em_utils_check_user_can_send_mail ((GtkWidget *) emfv)) -// return; -// -// uids = message_list_get_selected (emfv->list); -// em_utils_forward_attached (emfv->folder, uids, emfv->folder_uri); -//} - -//static void -//emfv_message_forward_inline (BonoboUIComponent *uic, void *data, const char *path) -//{ -// EMFolderView *emfv = data; -// GPtrArray *uids; -// -// if (!em_utils_check_user_can_send_mail ((GtkWidget *) emfv)) -// return; -// -// uids = message_list_get_selected (emfv->list); -// em_utils_forward_inline (emfv->folder, uids, emfv->folder_uri); -//} - -//static void -//emfv_message_forward_quoted (BonoboUIComponent *uic, void *data, const char *path) -//{ -// EMFolderView *emfv = data; -// GPtrArray *uids; -// -// if (!em_utils_check_user_can_send_mail ((GtkWidget *) emfv)) -// return; -// -// uids = message_list_get_selected (emfv->list); -// em_utils_forward_quoted (emfv->folder, uids, emfv->folder_uri); -//} - -//static void -//emfv_message_redirect (BonoboUIComponent *uic, void *data, const char *path) -//{ -// EMFolderView *emfv = data; -// -// if (emfv->list->cursor_uid == NULL) -// return; -// -// if (!em_utils_check_user_can_send_mail ((GtkWidget *) emfv)) -// return; -// -// em_utils_redirect_message_by_uid (emfv->folder, emfv->list->cursor_uid); -//} - -//static void -//emfv_message_post_reply (BonoboUIComponent *uic, void *data, const char *path) -//{ -// EMFolderView *emfv = data; -// -// if (emfv->list->cursor_uid == NULL) -// return; -// -// if (!em_utils_check_user_can_send_mail ((GtkWidget *) emfv)) -// return; -// -// em_utils_post_reply_to_message_by_uid (emfv->folder, emfv->list->cursor_uid); -//} - -static gboolean -html_contains_nonwhitespace (const char *html, gint len) -{ - const char *p; - gunichar c = 0; - - if (!html || len<=0) - return FALSE; - - p = html; - - while (p && p - html < len) { - c = g_utf8_get_char (p); - if (!c) - break; - - if (c == '<') { - /* skip until next '>' */ - while (c = g_utf8_get_char (p), c && c != '>' && p - html < len) - p = g_utf8_next_char (p); - if (!c) - break; - }else if (c == '&') { - /* sequence ' ' is a space */ - if (g_ascii_strncasecmp (p, " ", 6) == 0) - p = p + 5; - else - break; - }else if (!g_unichar_isspace (c)) { - break; - } - - p = g_utf8_next_char (p); - } - - return p - html < len - 1 && c != 0; -} - -void -em_folder_view_message_reply(EMFolderView *emfv, int mode) -{ - char *html = NULL; - gint len; - - if (emfv->list->cursor_uid == NULL) - return; - - if (!em_utils_check_user_can_send_mail ((GtkWidget *) emfv)) - return; - - if (gtk_html_command(((EMFormatHTML *)emfv->preview)->html, "is-selection-active") - && (html = gtk_html_get_selection_html (((EMFormatHTML *)emfv->preview)->html, &len)) - && len && html[0] && html_contains_nonwhitespace (html, len)) { - CamelMimeMessage *msg, *src; - struct _camel_header_raw *header; - - src = (CamelMimeMessage *)((EMFormat *)emfv->preview)->message; - msg = camel_mime_message_new(); - - /* need to strip content- headers */ - header = ((CamelMimePart *)src)->headers; - while (header) { - if (g_ascii_strncasecmp(header->name, "content-", 8) != 0) - camel_medium_add_header((CamelMedium *)msg, header->name, header->value); - header = header->next; - } - camel_mime_part_set_encoding((CamelMimePart *)msg, CAMEL_TRANSFER_ENCODING_8BIT); - camel_mime_part_set_content((CamelMimePart *)msg, - html, len, "text/html"); - em_utils_reply_to_message (emfv->folder, emfv->list->cursor_uid, msg, mode, NULL); - camel_object_unref(msg); - } else { - em_utils_reply_to_message (emfv->folder, emfv->list->cursor_uid, NULL, mode, (EMFormat *)emfv->preview); - } - - g_free (html); -} - static void emfv_message_search(BonoboUIComponent *uic, void *data, const char *path) { @@ -1668,115 +1086,6 @@ emfv_message_search(BonoboUIComponent *uic, void *data, const char *path) #endif } -//static void -//emfv_print_preview_message(BonoboUIComponent *uic, void *data, const char *path) -//{ -// EMFolderView *emfv = data; -// -// em_folder_view_print(emfv, GTK_PRINT_OPERATION_ACTION_PREVIEW); -//} - -//static void -//emfv_text_zoom_in(BonoboUIComponent *uic, void *data, const char *path) -//{ -// EMFolderView *emfv = data; -// -// if (emfv->preview) -// em_format_html_display_zoom_in(emfv->preview); -//} - -//static void -//emfv_text_zoom_out(BonoboUIComponent *uic, void *data, const char *path) -//{ -// EMFolderView *emfv = data; -// -// if (emfv->preview) -// em_format_html_display_zoom_out(emfv->preview); -//} - -//static void -//emfv_text_zoom_reset(BonoboUIComponent *uic, void *data, const char *path) -//{ -// EMFolderView *emfv = data; -// -// if (emfv->preview) -// em_format_html_display_zoom_reset(emfv->preview); -//} - -/* ********************************************************************** */ - -//struct _filter_data { -// const char *source; -// char *uri; -// int type; -//}; - -//static void -//filter_data_free (struct _filter_data *fdata) -//{ -// g_free (fdata->uri); -// g_free (fdata); -//} - -//static void -//filter_type_got_message (CamelFolder *folder, const char *uid, CamelMimeMessage *msg, void *user_data) -//{ -// struct _filter_data *data = user_data; -// -// if (msg) -// filter_gui_add_from_message (msg, data->source, data->type); -// -// filter_data_free (data); -//} - -//static void -//filter_type_uid (CamelFolder *folder, const char *uid, const char *source, int type) -//{ -// struct _filter_data *data; -// -// data = g_malloc0 (sizeof (*data)); -// data->type = type; -// data->source = source; -// -// mail_get_message (folder, uid, filter_type_got_message, data, mail_msg_unordered_push); -//} - -//static void -//filter_type_current (EMFolderView *emfv, int type) -//{ -// const char *source; -// GPtrArray *uids; -// -// if (em_utils_folder_is_sent (emfv->folder, emfv->folder_uri) -// || em_utils_folder_is_outbox (emfv->folder, emfv->folder_uri)) -// source = FILTER_SOURCE_OUTGOING; -// else -// source = FILTER_SOURCE_INCOMING; -// -// uids = message_list_get_selected (emfv->list); -// -// if (uids->len == 1) -// filter_type_uid (emfv->folder, (char *) uids->pdata[0], source, type); -// -// em_utils_uids_free (uids); -//} - -//EMFV_MAP_CALLBACK(emfv_tools_filter_subject, emfv_popup_filter_subject) -//EMFV_MAP_CALLBACK(emfv_tools_filter_sender, emfv_popup_filter_sender) -//EMFV_MAP_CALLBACK(emfv_tools_filter_recipient, emfv_popup_filter_recipients) -//EMFV_MAP_CALLBACK(emfv_tools_filter_mlist, emfv_popup_filter_mlist) - -//static void -//vfolder_type_got_message (CamelFolder *folder, const char *uid, CamelMimeMessage *msg, void *user_data) -//{ -// struct _filter_data *data = user_data; -// -// if (msg) -// vfolder_gui_add_from_message (msg, data->type, data->uri); -// -// filter_data_free (data); -//} - static void emp_uri_popup_vfolder_sender(EPopup *ep, EPopupItem *pitem, void *data) { @@ -1833,44 +1142,9 @@ emp_uri_popup_vfolder_recipient(EPopup *ep, EPopupItem *pitem, void *data) camel_url_free(url); } -//static void -//vfolder_type_uid (CamelFolder *folder, const char *uid, const char *uri, int type) -//{ -// struct _filter_data *data; -// -// data = g_malloc0 (sizeof (*data)); -// data->type = type; -// data->uri = g_strdup (uri); -// -// mail_get_message (folder, uid, vfolder_type_got_message, data, mail_msg_unordered_push); -//} - -//static void -//vfolder_type_current (EMFolderView *emfv, int type) -//{ -// GPtrArray *uids; -// -// uids = message_list_get_selected (emfv->list); -// -// if (uids->len == 1) { -// /* ensures vfolder is running */ -// vfolder_load_storage (); -// -// vfolder_type_uid (emfv->folder, (char *) uids->pdata[0], emfv->folder_uri, type); -// } -// -// em_utils_uids_free (uids); -//} - -//EMFV_MAP_CALLBACK(emfv_tools_vfolder_subject, emfv_popup_vfolder_subject) -//EMFV_MAP_CALLBACK(emfv_tools_vfolder_sender, emfv_popup_vfolder_sender) -//EMFV_MAP_CALLBACK(emfv_tools_vfolder_recipient, emfv_popup_vfolder_recipients) -//EMFV_MAP_CALLBACK(emfv_tools_vfolder_mlist, emfv_popup_vfolder_mlist) - /* ********************************************************************** */ static BonoboUIVerb emfv_message_verbs[] = { -// BONOBO_UI_UNSAFE_VERB ("EmptyTrash", emfv_empty_trash), BONOBO_UI_UNSAFE_VERB ("PrepareForOffline", emfv_prepare_offline), BONOBO_UI_UNSAFE_VERB ("EditCut", emfv_edit_cut), BONOBO_UI_UNSAFE_VERB ("EditCopy", emfv_edit_copy), @@ -1878,71 +1152,13 @@ static BonoboUIVerb emfv_message_verbs[] = { BONOBO_UI_UNSAFE_VERB ("SelectAllText", emfv_select_all_text), -// BONOBO_UI_UNSAFE_VERB ("MailNext", emfv_mail_next), -// BONOBO_UI_UNSAFE_VERB ("MailNextFlagged", emfv_mail_next_flagged), -// BONOBO_UI_UNSAFE_VERB ("MailNextUnread", emfv_mail_next_unread), -// BONOBO_UI_UNSAFE_VERB ("MailNextThread", emfv_mail_next_thread), -// BONOBO_UI_UNSAFE_VERB ("MailPrevious", emfv_mail_previous), -// BONOBO_UI_UNSAFE_VERB ("MailPreviousFlagged", emfv_mail_previous_flagged), -// BONOBO_UI_UNSAFE_VERB ("MailPreviousUnread", emfv_mail_previous_unread), - -// BONOBO_UI_UNSAFE_VERB ("AddSenderToAddressbook", emfv_add_sender_addressbook), - -// BONOBO_UI_UNSAFE_VERB ("MessageApplyFilters", emfv_message_apply_filters), -// BONOBO_UI_UNSAFE_VERB ("MessageFilterJunk", emfv_message_filter_junk), -// BONOBO_UI_UNSAFE_VERB ("MessageCopy", emfv_message_copy), - BONOBO_UI_UNSAFE_VERB ("MessageDelete", emfv_message_delete), - BONOBO_UI_UNSAFE_VERB ("MessageDeleteKey", emfv_message_delete), -// BONOBO_UI_UNSAFE_VERB ("MessageForward", emfv_message_forward), -// BONOBO_UI_UNSAFE_VERB ("MessageForwardAttached", emfv_message_forward_attached), -// BONOBO_UI_UNSAFE_VERB ("MessageForwardInline", emfv_message_forward_inline), -// BONOBO_UI_UNSAFE_VERB ("MessageForwardQuoted", emfv_message_forward_quoted), -// BONOBO_UI_UNSAFE_VERB ("MessageRedirect", emfv_message_redirect), -// BONOBO_UI_UNSAFE_VERB ("MessageMarkAsRead", emfv_message_mark_read), -// BONOBO_UI_UNSAFE_VERB ("MessageMarkAsUnRead", emfv_message_mark_unread), -// BONOBO_UI_UNSAFE_VERB ("MessageMarkAsImportant", emfv_message_mark_important), -// BONOBO_UI_UNSAFE_VERB ("MessageMarkAsUnimportant", emfv_message_mark_unimportant), -// BONOBO_UI_UNSAFE_VERB ("MessageMarkAsJunk", emfv_message_mark_junk), -// BONOBO_UI_UNSAFE_VERB ("MessageMarkAsNotJunk", emfv_message_mark_nojunk), -// BONOBO_UI_UNSAFE_VERB ("MessageFollowUpFlag", emfv_message_followup_flag), -// BONOBO_UI_UNSAFE_VERB ("MessageFollowUpComplete", emfv_message_followup_completed), -// BONOBO_UI_UNSAFE_VERB ("MessageFollowUpClear", emfv_message_followup_clear), -// BONOBO_UI_UNSAFE_VERB ("MessageMove", emfv_message_move), +// BONOBO_UI_UNSAFE_VERB ("MessageDelete", emfv_message_delete), +// BONOBO_UI_UNSAFE_VERB ("MessageDeleteKey", emfv_message_delete), BONOBO_UI_UNSAFE_VERB ("MessageOpen", emfv_message_open), -// BONOBO_UI_UNSAFE_VERB ("MessagePostReply", emfv_message_post_reply), -// BONOBO_UI_UNSAFE_VERB ("MessageReplyAll", emfv_message_reply_all), -// BONOBO_UI_UNSAFE_VERB ("MessageReplyList", emfv_message_reply_list), -// BONOBO_UI_UNSAFE_VERB ("MessageReplySender", emfv_message_reply_sender), -// BONOBO_UI_UNSAFE_VERB ("MessageEdit", emfv_message_edit), -// BONOBO_UI_UNSAFE_VERB ("MessageSaveAs", emfv_message_saveas), BONOBO_UI_UNSAFE_VERB ("MessageSearch", emfv_message_search), -// BONOBO_UI_UNSAFE_VERB ("MessageUndelete", emfv_message_undelete), - -// BONOBO_UI_UNSAFE_VERB ("PrintMessage", emfv_print_message), -// BONOBO_UI_UNSAFE_VERB ("PrintPreviewMessage", emfv_print_preview_message), - -// BONOBO_UI_UNSAFE_VERB ("TextZoomIn", emfv_text_zoom_in), -// BONOBO_UI_UNSAFE_VERB ("TextZoomOut", emfv_text_zoom_out), -// BONOBO_UI_UNSAFE_VERB ("TextZoomReset", emfv_text_zoom_reset), BONOBO_UI_UNSAFE_VERB ("ViewSource", emfv_message_source), -// BONOBO_UI_UNSAFE_VERB ("MailCompose", emfv_mail_compose), - - /* TODO: This stuff should just be 1 item that runs a wizard */ -// BONOBO_UI_UNSAFE_VERB ("ToolsFilterMailingList", emfv_tools_filter_mlist), -// BONOBO_UI_UNSAFE_VERB ("ToolsFilterRecipient", emfv_tools_filter_recipient), -// BONOBO_UI_UNSAFE_VERB ("ToolsFilterSender", emfv_tools_filter_sender), -// BONOBO_UI_UNSAFE_VERB ("ToolsFilterSubject", emfv_tools_filter_subject), -// BONOBO_UI_UNSAFE_VERB ("ToolsVFolderMailingList", emfv_tools_vfolder_mlist), -// BONOBO_UI_UNSAFE_VERB ("ToolsVFolderRecipient", emfv_tools_vfolder_recipient), -// BONOBO_UI_UNSAFE_VERB ("ToolsVFolderSender", emfv_tools_vfolder_sender), -// BONOBO_UI_UNSAFE_VERB ("ToolsVFolderSubject", emfv_tools_vfolder_subject), - -// BONOBO_UI_UNSAFE_VERB ("ViewLoadImages", emfv_view_load_images), - /* ViewHeaders stuff is a radio */ - /* CaretMode is a toggle */ - BONOBO_UI_VERB_END }; @@ -2111,37 +1327,6 @@ emfv_activate(EMFolderView *emfv, BonoboUIComponent *uic, int act) } } -int -em_folder_view_print (EMFolderView *emfv, GtkPrintOperationAction action) -{ - EMFormatHTMLPrint *efhp; - GPtrArray *uids; - - if (emfv->folder == NULL) - return 0; - - uids = message_list_get_selected (emfv->list); - if (uids->len != 1) - goto exit; - - efhp = em_format_html_print_new ( - (EMFormatHTML *) emfv->preview, action); - em_format_set_session ( - (EMFormat *) efhp, - ((EMFormat *) emfv->preview)->session); - em_format_merge_handler ((EMFormat *) efhp, - (EMFormat *) emfv->preview); - - em_format_html_print_message ( - efhp, emfv->folder, uids->pdata[0]); - g_object_unref (efhp); - -exit: - message_list_free_uids (emfv->list, uids); - - return 0; -} - EMPopupTargetSelect * em_folder_view_get_popup_target(EMFolderView *emfv, EMPopup *emp, int on_display) { @@ -2406,15 +1591,15 @@ emfv_list_built(MessageList *ml, EMFolderView *emfv) } } -static void -emfv_list_double_click(ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, EMFolderView *emfv) -{ - /* Ignore double-clicks on columns that handle thier own state */ - if (MESSAGE_LIST_COLUMN_IS_ACTIVE (col)) - return; - - em_folder_view_open_selected(emfv); -} +//static void +//emfv_list_double_click(ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, EMFolderView *emfv) +//{ +// /* Ignore double-clicks on columns that handle thier own state */ +// if (MESSAGE_LIST_COLUMN_IS_ACTIVE (col)) +// return; +// +// em_folder_view_open_selected(emfv); +//} static int emfv_list_right_click(ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, EMFolderView *emfv) @@ -2424,52 +1609,52 @@ emfv_list_right_click(ETree *tree, gint row, ETreePath path, gint col, GdkEvent return TRUE; } -static int -emfv_list_key_press(ETree *tree, int row, ETreePath path, int col, GdkEvent *ev, EMFolderView *emfv) -{ - GPtrArray *uids; - int i; - guint32 flags; - - if ((ev->key.state & GDK_CONTROL_MASK) != 0) - return FALSE; - - switch (ev->key.keyval) { - case GDK_Return: - case GDK_KP_Enter: - case GDK_ISO_Enter: - em_folder_view_open_selected(emfv); - break; -#ifdef HAVE_XFREE - case XF86XK_Reply: - em_folder_view_message_reply(emfv, REPLY_MODE_ALL); - break; - case XF86XK_MailForward: - uids = message_list_get_selected(emfv->list); - em_utils_forward_messages (emfv->folder, uids, emfv->folder_uri); - break; -#endif /* HAVE_XFREE */ - case '!': - uids = message_list_get_selected(emfv->list); - - camel_folder_freeze(emfv->folder); - for (i = 0; i < uids->len; i++) { - flags = camel_folder_get_message_flags(emfv->folder, uids->pdata[i]) ^ CAMEL_MESSAGE_FLAGGED; - if (flags & CAMEL_MESSAGE_FLAGGED) - flags &= ~CAMEL_MESSAGE_DELETED; - camel_folder_set_message_flags(emfv->folder, uids->pdata[i], - CAMEL_MESSAGE_FLAGGED|CAMEL_MESSAGE_DELETED, flags); - } - camel_folder_thaw(emfv->folder); - - message_list_free_uids(emfv->list, uids); - break; - default: - return FALSE; - } - - return TRUE; -} +//static int +//emfv_list_key_press(ETree *tree, int row, ETreePath path, int col, GdkEvent *ev, EMFolderView *emfv) +//{ +// GPtrArray *uids; +// int i; +// guint32 flags; +// +// if ((ev->key.state & GDK_CONTROL_MASK) != 0) +// return FALSE; +// +// switch (ev->key.keyval) { +// case GDK_Return: +// case GDK_KP_Enter: +// case GDK_ISO_Enter: +// em_folder_view_open_selected(emfv); +// break; +//#ifdef HAVE_XFREE +// case XF86XK_Reply: +// em_folder_view_message_reply(emfv, REPLY_MODE_ALL); +// break; +// case XF86XK_MailForward: +// uids = message_list_get_selected(emfv->list); +// em_utils_forward_messages (emfv->folder, uids, emfv->folder_uri); +// break; +//#endif /* HAVE_XFREE */ +// case '!': +// uids = message_list_get_selected(emfv->list); +// +// camel_folder_freeze(emfv->folder); +// for (i = 0; i < uids->len; i++) { +// flags = camel_folder_get_message_flags(emfv->folder, uids->pdata[i]) ^ CAMEL_MESSAGE_FLAGGED; +// if (flags & CAMEL_MESSAGE_FLAGGED) +// flags &= ~CAMEL_MESSAGE_DELETED; +// camel_folder_set_message_flags(emfv->folder, uids->pdata[i], +// CAMEL_MESSAGE_FLAGGED|CAMEL_MESSAGE_DELETED, flags); +// } +// camel_folder_thaw(emfv->folder); +// +// message_list_free_uids(emfv->list, uids); +// break; +// default: +// return FALSE; +// } +// +// return TRUE; +//} static gboolean emfv_popup_menu (GtkWidget *widget) diff --git a/mail/em-message-browser.c b/mail/em-message-browser.c index c3a427f601..8b3ff99152 100644 --- a/mail/em-message-browser.c +++ b/mail/em-message-browser.c @@ -96,7 +96,7 @@ emmb_set_message (EMFolderView *emfv, folder_view_class = EM_FOLDER_VIEW_CLASS (parent_class); folder_view_class->set_message (emfv, uid, nomarkseen); - f (uid == NULL) { + if (uid == NULL) { gtk_widget_destroy (GTK_WIDGET (emfv)); return; } diff --git a/mail/em-utils.c b/mail/em-utils.c index 5f93e39361..fe51e693ad 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -193,13 +193,14 @@ druid_destroy_cb (gpointer user_data, GObject *deadbeef) * otherwise. **/ gboolean -em_utils_configure_account (GtkWidget *parent) +em_utils_configure_account (GtkWindow *parent) { EMAccountEditor *emae; + g_return_val_if_fail (GTK_IS_WINDOW (parent), FALSE); + emae = em_account_editor_new(NULL, EMAE_DRUID, "org.gnome.evolution.mail.config.accountDruid"); - if (parent != NULL) - e_dialog_set_transient_for((GtkWindow *)emae->editor, parent); + gtk_window_set_transient_for (GTK_WINDOW (emae->editor), parent); g_object_weak_ref((GObject *)emae->editor, (GWeakNotify) druid_destroy_cb, NULL); gtk_widget_show(emae->editor); @@ -223,10 +224,12 @@ em_utils_configure_account (GtkWidget *parent) * or %FALSE otherwise. **/ gboolean -em_utils_check_user_can_send_mail (GtkWidget *parent) +em_utils_check_user_can_send_mail (GtkWindow *parent) { EAccount *account; + g_return_val_if_fail (GTK_IS_WINDOW (parent), FALSE); + if (!mail_config_is_configured ()) { if (!em_utils_configure_account (parent)) return FALSE; @@ -387,12 +390,14 @@ emu_save_get_filename_for_part (CamelMimePart *part) * Saves a mime part to disk (prompting the user for filename). **/ void -em_utils_save_part (GtkWidget *parent, const char *prompt, CamelMimePart *part) +em_utils_save_part (GtkWindow *parent, const char *prompt, CamelMimePart *part) { GtkWidget *file_chooser; const gchar *utf8_filename; gchar *uri = NULL, *filename; + g_return_if_fail (GTK_IS_WINDOW (parent)); + utf8_filename = emu_save_get_filename_for_part (part); filename = g_filename_from_utf8 (utf8_filename, -1, NULL, NULL, NULL); em_filename_make_safe (filename); @@ -502,7 +507,7 @@ get_unique_file_names (GSList *parts) } void -em_utils_save_parts (GtkWidget *parent, const gchar *prompt, GSList *parts) +em_utils_save_parts (GtkWindow *parent, const gchar *prompt, GSList *parts) { GtkWidget *file_chooser; gchar *path_uri; @@ -558,7 +563,7 @@ exit: * Returns %TRUE if saving succeeded, %FALSE otherwise **/ gboolean -em_utils_save_part_to_file(GtkWidget *parent, const char *filename, CamelMimePart *part) +em_utils_save_part_to_file(GtkWindow *parent, const char *filename, CamelMimePart *part) { int done; char *dirname; @@ -569,7 +574,7 @@ em_utils_save_part_to_file(GtkWidget *parent, const char *filename, CamelMimePar dirname = g_path_get_dirname(filename); if (g_mkdir_with_parents(dirname, 0777) == -1) { - GtkWidget *w = e_error_new((GtkWindow *)parent, "mail:no-create-path", filename, g_strerror(errno), NULL); + GtkWidget *w = e_error_new(parent, "mail:no-create-path", filename, g_strerror(errno), NULL); g_free(dirname); em_utils_show_error_silent (w); return FALSE; @@ -578,13 +583,13 @@ em_utils_save_part_to_file(GtkWidget *parent, const char *filename, CamelMimePar if (g_access(filename, F_OK) == 0) { if (g_access(filename, W_OK) != 0) { - e_error_run((GtkWindow *)parent, E_ERROR_ASK_FILE_EXISTS_OVERWRITE, filename, NULL); + e_error_run(parent, E_ERROR_ASK_FILE_EXISTS_OVERWRITE, filename, NULL); return FALSE; } } if (g_stat(filename, &st) != -1 && !S_ISREG(st.st_mode)) { - GtkWidget *w = e_error_new((GtkWindow *)parent, "mail:no-write-path-notfile", filename, NULL); + GtkWidget *w = e_error_new(parent, "mail:no-write-path-notfile", filename, NULL); em_utils_show_error_silent (w); return FALSE; } @@ -637,13 +642,14 @@ emu_save_messages_response(GtkWidget *filesel, int response, struct _save_messag * user for filename). **/ void -em_utils_save_messages (GtkWidget *parent, CamelFolder *folder, GPtrArray *uids) +em_utils_save_messages (GtkWindow *parent, CamelFolder *folder, GPtrArray *uids) { struct _save_messages_data *data; GtkWidget *filesel; char *filename = NULL; CamelMessageInfo *info = NULL; + g_return_if_fail (GTK_IS_WINDOW (parent)); g_return_if_fail (CAMEL_IS_FOLDER (folder)); g_return_if_fail (uids != NULL); @@ -683,7 +689,7 @@ emu_add_address_cb(BonoboListener *listener, const char *name, const CORBA_any * /* one of email or vcard should be always NULL, never both of them */ static void -emu_add_address_or_vcard (struct _GtkWidget *parent, const char *email, const char *vcard) +emu_add_address_or_vcard (GtkWindow *parent, const char *email, const char *vcard) { GtkWidget *win; GtkWidget *control; @@ -706,14 +712,7 @@ emu_add_address_or_vcard (struct _GtkWidget *parent, const char *email, const ch win = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title((GtkWindow *)win, _("Add address")); - if (parent && !GTK_IS_WINDOW (parent)) { - parent = gtk_widget_get_toplevel (parent); - if (!parent || !(GTK_WIDGET_TOPLEVEL (parent))) - parent = NULL; - } - - if (parent) - gtk_window_set_transient_for((GtkWindow *)win, ((GtkWindow *)parent)); + gtk_window_set_transient_for((GtkWindow *)win, parent); gtk_window_set_position((GtkWindow *)win, GTK_WIN_POS_CENTER_ON_PARENT); gtk_window_set_type_hint((GtkWindow *)win, GDK_WINDOW_TYPE_HINT_DIALOG); @@ -744,8 +743,10 @@ emu_add_address_or_vcard (struct _GtkWidget *parent, const char *email, const ch * Add address @email to the addressbook. **/ void -em_utils_add_address (struct _GtkWidget *parent, const char *email) +em_utils_add_address (GtkWindow *parent, const char *email) { + g_return_if_fail (GTK_IS_WINDOW (parent)); + emu_add_address_or_vcard (parent, email, NULL); } @@ -754,8 +755,10 @@ em_utils_add_address (struct _GtkWidget *parent, const char *email) * Adds whole vCard to the addressbook. **/ void -em_utils_add_vcard (struct _GtkWidget *parent, const char *vcard) +em_utils_add_vcard (GtkWindow *parent, const char *vcard) { + g_return_if_fail (GTK_IS_WINDOW (parent)); + emu_add_address_or_vcard (parent, NULL, vcard); } @@ -822,19 +825,18 @@ tag_editor_response (GtkWidget *dialog, int button, struct ted_t *ted) * @folder and @uids. **/ void -em_utils_flag_for_followup (GtkWidget *parent, CamelFolder *folder, GPtrArray *uids) +em_utils_flag_for_followup (GtkWindow *parent, CamelFolder *folder, GPtrArray *uids) { GtkWidget *editor; struct ted_t *ted; int i; + g_return_if_fail (GTK_IS_WINDOW (parent)); g_return_if_fail (CAMEL_IS_FOLDER (folder)); g_return_if_fail (uids != NULL); editor = (GtkWidget *) message_tag_followup_new (); - - if (parent != NULL) - e_dialog_set_transient_for ((GtkWindow *) editor, parent); + gtk_window_set_transient_for (GTK_WINDOW (editor), parent); camel_object_ref (folder); @@ -886,10 +888,11 @@ em_utils_flag_for_followup (GtkWidget *parent, CamelFolder *folder, GPtrArray *u * @folder and @uids. **/ void -em_utils_flag_for_followup_clear (GtkWidget *parent, CamelFolder *folder, GPtrArray *uids) +em_utils_flag_for_followup_clear (GtkWindow *parent, CamelFolder *folder, GPtrArray *uids) { int i; + g_return_if_fail (GTK_IS_WINDOW (parent)); g_return_if_fail (CAMEL_IS_FOLDER (folder)); g_return_if_fail (uids != NULL); @@ -920,11 +923,12 @@ em_utils_flag_for_followup_clear (GtkWidget *parent, CamelFolder *folder, GPtrAr * Flag-for-Followup. **/ void -em_utils_flag_for_followup_completed (GtkWidget *parent, CamelFolder *folder, GPtrArray *uids) +em_utils_flag_for_followup_completed (GtkWindow *parent, CamelFolder *folder, GPtrArray *uids) { char *now; int i; + g_return_if_fail (GTK_IS_WINDOW (parent)); g_return_if_fail (CAMEL_IS_FOLDER (folder)); g_return_if_fail (uids != NULL); diff --git a/mail/em-utils.h b/mail/em-utils.h index 0bce56d7f3..56dd4c6713 100644 --- a/mail/em-utils.h +++ b/mail/em-utils.h @@ -23,79 +23,71 @@ #ifndef __EM_UTILS_H__ #define __EM_UTILS_H__ -#include <glib.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - +#include <gtk/gtk.h> #include <sys/types.h> +#include <camel/camel-exception.h> +#include <camel/camel-folder.h> +#include <camel/camel-internet-address.h> +#include <camel/camel-mime-message.h> +#include <camel/camel-mime-part.h> +#include <camel/camel-stream.h> + +G_BEGIN_DECLS -struct _GtkWidget; -struct _GtkWindow; -struct _CamelFolder; -struct _CamelInternetAddress; -struct _CamelStream; -struct _CamelMimeMessage; -struct _CamelMimePart; -struct _GtkSelectionData; -struct _GtkAdjustment; -struct _CamelException; struct _EMFormat; -gboolean em_utils_prompt_user(struct _GtkWindow *parent, const char *promptkey, const char *tag, const char *arg0, ...); +gboolean em_utils_prompt_user(GtkWindow *parent, const char *promptkey, const char *tag, const char *arg0, ...); GPtrArray *em_utils_uids_copy (GPtrArray *uids); void em_utils_uids_free (GPtrArray *uids); -gboolean em_utils_configure_account (struct _GtkWidget *parent); -gboolean em_utils_check_user_can_send_mail (struct _GtkWidget *parent); +gboolean em_utils_configure_account (GtkWindow *parent); +gboolean em_utils_check_user_can_send_mail (GtkWindow *parent); -void em_utils_edit_filters (struct _GtkWidget *parent); +void em_utils_edit_filters (GtkWidget *parent); void em_filename_make_safe (gchar *string); -void em_utils_edit_vfolders (struct _GtkWidget *parent); +void em_utils_edit_vfolders (GtkWidget *parent); -void em_utils_save_part(struct _GtkWidget *parent, const char *prompt, struct _CamelMimePart *part); -gboolean em_utils_save_part_to_file(struct _GtkWidget *parent, const char *filename, struct _CamelMimePart *part); -void em_utils_save_messages (struct _GtkWidget *parent, struct _CamelFolder *folder, GPtrArray *uids); +void em_utils_save_part(GtkWindow *parent, const char *prompt, CamelMimePart *part); +gboolean em_utils_save_part_to_file(GtkWindow *parent, const char *filename, CamelMimePart *part); +void em_utils_save_messages (GtkWindow *parent, CamelFolder *folder, GPtrArray *uids); -void em_utils_add_address(struct _GtkWidget *parent, const char *email); -void em_utils_add_vcard(struct _GtkWidget *parent, const char *vcard); +void em_utils_add_address(GtkWindow *parent, const char *email); +void em_utils_add_vcard(GtkWindow *parent, const char *vcard); -void em_utils_flag_for_followup (struct _GtkWidget *parent, struct _CamelFolder *folder, GPtrArray *uids); -void em_utils_flag_for_followup_clear (struct _GtkWidget *parent, struct _CamelFolder *folder, GPtrArray *uids); -void em_utils_flag_for_followup_completed (struct _GtkWidget *parent, struct _CamelFolder *folder, GPtrArray *uids); +void em_utils_flag_for_followup (GtkWindow *parent, CamelFolder *folder, GPtrArray *uids); +void em_utils_flag_for_followup_clear (GtkWindow *parent, CamelFolder *folder, GPtrArray *uids); +void em_utils_flag_for_followup_completed (GtkWindow *parent, CamelFolder *folder, GPtrArray *uids); /* This stuff that follows probably doesn't belong here, then again, the stuff above probably belongs elsewhere */ -void em_utils_selection_set_mailbox(struct _GtkSelectionData *data, struct _CamelFolder *folder, GPtrArray *uids); -void em_utils_selection_get_mailbox(struct _GtkSelectionData *data, struct _CamelFolder *folder); -void em_utils_selection_get_message(struct _GtkSelectionData *data, struct _CamelFolder *folder); -/* FIXME: be nice if these also worked on struct _CamelFolder's, no easy way to get uri from folder yet tho */ -void em_utils_selection_set_uidlist(struct _GtkSelectionData *data, const char *uri, GPtrArray *uids); -void em_utils_selection_get_uidlist(struct _GtkSelectionData *data, struct _CamelFolder *dest, int move, struct _CamelException *ex); -void em_utils_selection_set_urilist(struct _GtkSelectionData *data, struct _CamelFolder *folder, GPtrArray *uids); -void em_utils_selection_get_urilist(struct _GtkSelectionData *data, struct _CamelFolder *folder); +void em_utils_selection_set_mailbox(GtkSelectionData *data, CamelFolder *folder, GPtrArray *uids); +void em_utils_selection_get_mailbox(GtkSelectionData *data, CamelFolder *folder); +void em_utils_selection_get_message(GtkSelectionData *data, CamelFolder *folder); +/* FIXME: be nice if these also worked on CamelFolder's, no easy way to get uri from folder yet tho */ +void em_utils_selection_set_uidlist(GtkSelectionData *data, const char *uri, GPtrArray *uids); +void em_utils_selection_get_uidlist(GtkSelectionData *data, CamelFolder *dest, int move, CamelException *ex); +void em_utils_selection_set_urilist(GtkSelectionData *data, CamelFolder *folder, GPtrArray *uids); +void em_utils_selection_get_urilist(GtkSelectionData *data, CamelFolder *folder); -char *em_utils_temp_save_part(struct _GtkWidget *parent, struct _CamelMimePart *part, gboolean mode); -void em_utils_save_parts (struct _GtkWidget *parent, const char *prompt, GSList * parts); +char *em_utils_temp_save_part(GtkWidget *parent, CamelMimePart *part, gboolean mode); +void em_utils_save_parts (GtkWindow *parent, const char *prompt, GSList * parts); -gboolean em_utils_folder_is_drafts(struct _CamelFolder *folder, const char *uri); -gboolean em_utils_folder_is_templates(struct _CamelFolder *folder, const char *uri); -gboolean em_utils_folder_is_sent(struct _CamelFolder *folder, const char *uri); -gboolean em_utils_folder_is_outbox(struct _CamelFolder *folder, const char *uri); +gboolean em_utils_folder_is_drafts(CamelFolder *folder, const char *uri); +gboolean em_utils_folder_is_templates(CamelFolder *folder, const char *uri); +gboolean em_utils_folder_is_sent(CamelFolder *folder, const char *uri); +gboolean em_utils_folder_is_outbox(CamelFolder *folder, const char *uri); -void em_utils_adjustment_page(struct _GtkAdjustment *adj, gboolean down); +void em_utils_adjustment_page(GtkAdjustment *adj, gboolean down); char *em_utils_get_proxy_uri(void); /* FIXME: should this have an override charset? */ -char *em_utils_part_to_html(struct _CamelMimePart *part, ssize_t *len, struct _EMFormat *source); -char *em_utils_message_to_html(struct _CamelMimeMessage *msg, const char *credits, guint32 flags, ssize_t *len, struct _EMFormat *source, const char *append); +char *em_utils_part_to_html(CamelMimePart *part, ssize_t *len, struct _EMFormat *source); +char *em_utils_message_to_html(CamelMimeMessage *msg, const char *credits, guint32 flags, ssize_t *len, struct _EMFormat *source, const char *append); -void em_utils_expunge_folder (struct _GtkWidget *parent, struct _CamelFolder *folder); -void em_utils_empty_trash (struct _GtkWidget *parent); +void em_utils_expunge_folder (GtkWidget *parent, CamelFolder *folder); +void em_utils_empty_trash (GtkWidget *parent); /* returns the folder name portion of an URI */ char *em_utils_folder_name_from_uri (const char *uri); @@ -105,20 +97,18 @@ char *em_uri_from_camel (const char *curi); char *em_uri_to_camel (const char *euri); /* Run errors silently on the status bar */ -void em_utils_show_error_silent (struct _GtkWidget *widget); -void em_utils_show_info_silent (struct _GtkWidget *widget); +void em_utils_show_error_silent (GtkWidget *widget); +void em_utils_show_info_silent (GtkWidget *widget); /* is this address in the addressbook? caches results */ -gboolean em_utils_in_addressbook (struct _CamelInternetAddress *addr, gboolean local_only); -struct _CamelMimePart *em_utils_contact_photo (struct _CamelInternetAddress *addr, gboolean local); +gboolean em_utils_in_addressbook (CamelInternetAddress *addr, gboolean local_only); +CamelMimePart *em_utils_contact_photo (CamelInternetAddress *addr, gboolean local); -const char *em_utils_snoop_type(struct _CamelMimePart *part); +const char *em_utils_snoop_type(CamelMimePart *part); /* clears flag 'get_password_canceled' at every known accounts, so if needed, get_password will show dialog */ void em_utils_clear_get_password_canceled_accounts_flag (void); -#ifdef __cplusplus -} -#endif /* __cplusplus */ +G_END_DECLS #endif /* __EM_UTILS_H__ */ diff --git a/mail/mail-component.c b/mail/mail-component.c index 77d125ce71..7fa34785d8 100644 --- a/mail/mail-component.c +++ b/mail/mail-component.c @@ -97,7 +97,6 @@ #define d(x) -static void create_local_item_cb(EUserCreatableItemsHandler *handler, const char *item_type_name, void *data); static void view_changed_timeout_remove (EComponentView *component_view); #define MAIL_COMPONENT_DEFAULT(mc) if (mc == NULL) mc = mail_component_peek(); @@ -942,44 +941,44 @@ impl_quit(PortableServer_Servant servant, CORBA_Environment *ev) // return list; //} -static int -create_item(const char *type, EMFolderTreeModel *model, const char *uri, gpointer tree) -{ - if (strcmp(type, "message") == 0) { - if (!em_utils_check_user_can_send_mail(NULL)) - return 0; - - em_utils_compose_new_message(uri); - } else if (strcmp(type, "folder") == 0) { - em_folder_utils_create_folder(NULL, tree); - } else - return -1; - - return 0; -} - -static void -create_local_item_cb(EUserCreatableItemsHandler *handler, const char *item_type_name, void *data) -{ - EMFolderTree *tree = data; - char *uri = em_folder_tree_get_selected_uri(tree); - - create_item(item_type_name, em_folder_tree_get_model(tree), uri, (gpointer) tree); - g_free(uri); -} +//static int +//create_item(const char *type, EMFolderTreeModel *model, const char *uri, gpointer tree) +//{ +// if (strcmp(type, "message") == 0) { +// if (!em_utils_check_user_can_send_mail(NULL)) +// return 0; +// +// em_utils_compose_new_message(uri); +// } else if (strcmp(type, "folder") == 0) { +// em_folder_utils_create_folder(NULL, tree); +// } else +// return -1; +// +// return 0; +//} -static void -impl_requestCreateItem (PortableServer_Servant servant, - const CORBA_char *item_type_name, - CORBA_Environment *ev) -{ - MailComponent *mc = MAIL_COMPONENT(bonobo_object_from_servant(servant)); +//static void +//create_local_item_cb(EUserCreatableItemsHandler *handler, const char *item_type_name, void *data) +//{ +// EMFolderTree *tree = data; +// char *uri = em_folder_tree_get_selected_uri(tree); +// +// create_item(item_type_name, em_folder_tree_get_model(tree), uri, (gpointer) tree); +// g_free(uri); +//} - if (create_item(item_type_name, mc->priv->model, NULL, NULL) == -1) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_Component_UnknownType, NULL); - } -} +//static void +//impl_requestCreateItem (PortableServer_Servant servant, +// const CORBA_char *item_type_name, +// CORBA_Environment *ev) +//{ +// MailComponent *mc = MAIL_COMPONENT(bonobo_object_from_servant(servant)); +// +// if (create_item(item_type_name, mc->priv->model, NULL, NULL) == -1) { +// CORBA_exception_set (ev, CORBA_USER_EXCEPTION, +// ex_GNOME_Evolution_Component_UnknownType, NULL); +// } +//} static void handleuri_got_folder(char *uri, CamelFolder *folder, void *data) @@ -1258,12 +1257,12 @@ mail_component_class_init (MailComponentClass *class) mepv->test = impl_mail_test; } -static void -store_hash_free (struct _store_info *si) -{ - si->removed = 1; - store_info_unref(si); -} +//static void +//store_hash_free (struct _store_info *si) +//{ +// si->removed = 1; +// store_info_unref(si); +//} static void mail_component_init (MailComponent *component) @@ -1417,63 +1416,63 @@ struct _CamelSession *mail_component_peek_session(MailComponent *component) // return store; //} -static void -store_disconnect (CamelStore *store, void *event_data, void *user_data) -{ - camel_service_disconnect (CAMEL_SERVICE (store), TRUE, NULL); - camel_object_unref (store); -} - -void -mail_component_remove_store (MailComponent *component, CamelStore *store) -{ - MailComponentPrivate *priv; - - MAIL_COMPONENT_DEFAULT(component); - - priv = component->priv; - - /* Because the store_hash holds a reference to each store - * used as a key in it, none of them will ever be gc'ed, meaning - * any call to camel_session_get_{service,store} with the same - * URL will always return the same object. So this works. - */ - - if (g_hash_table_lookup (priv->store_hash, store) == NULL) - return; - - camel_object_ref (store); - g_hash_table_remove (priv->store_hash, store); - - /* so i guess potentially we could have a race, add a store while one - being removed. ?? */ - mail_note_store_remove (store); - - em_folder_tree_model_remove_store (priv->model, store); - - mail_async_event_emit (priv->async_event, MAIL_ASYNC_THREAD, (MailAsyncFunc) store_disconnect, store, NULL, NULL); -} - -void -mail_component_remove_store_by_uri (MailComponent *component, const char *uri) -{ - CamelProvider *prov; - CamelStore *store; - - MAIL_COMPONENT_DEFAULT(component); - - if (!(prov = camel_provider_get(uri, NULL))) - return; +//static void +//store_disconnect (CamelStore *store, void *event_data, void *user_data) +//{ +// camel_service_disconnect (CAMEL_SERVICE (store), TRUE, NULL); +// camel_object_unref (store); +//} - if (!(prov->flags & CAMEL_PROVIDER_IS_STORAGE)) - return; +//void +//mail_component_remove_store (MailComponent *component, CamelStore *store) +//{ +// MailComponentPrivate *priv; +// +// MAIL_COMPONENT_DEFAULT(component); +// +// priv = component->priv; +// +// /* Because the store_hash holds a reference to each store +// * used as a key in it, none of them will ever be gc'ed, meaning +// * any call to camel_session_get_{service,store} with the same +// * URL will always return the same object. So this works. +// */ +// +// if (g_hash_table_lookup (priv->store_hash, store) == NULL) +// return; +// +// camel_object_ref (store); +// g_hash_table_remove (priv->store_hash, store); +// +// /* so i guess potentially we could have a race, add a store while one +// being removed. ?? */ +// mail_note_store_remove (store); +// +// em_folder_tree_model_remove_store (priv->model, store); +// +// mail_async_event_emit (priv->async_event, MAIL_ASYNC_THREAD, (MailAsyncFunc) store_disconnect, store, NULL, NULL); +//} - store = (CamelStore *) camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, NULL); - if (store != NULL) { - mail_component_remove_store (component, store); - camel_object_unref (store); - } -} +//void +//mail_component_remove_store_by_uri (MailComponent *component, const char *uri) +//{ +// CamelProvider *prov; +// CamelStore *store; +// +// MAIL_COMPONENT_DEFAULT(component); +// +// if (!(prov = camel_provider_get(uri, NULL))) +// return; +// +// if (!(prov->flags & CAMEL_PROVIDER_IS_STORAGE)) +// return; +// +// store = (CamelStore *) camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, NULL); +// if (store != NULL) { +// mail_component_remove_store (component, store); +// camel_object_unref (store); +// } +//} // [KILL-BONOBO] Unused. //int diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c index 9c5ff2b8bb..16c90b6e4e 100644 --- a/shell/e-shell-view.c +++ b/shell/e-shell-view.c @@ -59,6 +59,7 @@ enum { PROP_PAGE_NUM, PROP_TITLE, PROP_SHELL_CONTENT, + PROP_SHELL_MODULE, PROP_SHELL_SIDEBAR, PROP_SHELL_TASKBAR, PROP_SHELL_WINDOW, @@ -231,6 +232,11 @@ shell_view_get_property (GObject *object, E_SHELL_VIEW (object))); return; + case PROP_SHELL_MODULE: + g_value_set_object ( + value, e_shell_view_get_shell_module ( + E_SHELL_VIEW (object))); + case PROP_SHELL_SIDEBAR: g_value_set_object ( value, e_shell_view_get_shell_sidebar ( @@ -446,6 +452,21 @@ shell_view_class_init (EShellViewClass *class) G_PARAM_READABLE)); /** + * EShellView::shell-module + * + * The #EShellModule for this shell view. + **/ + g_object_class_install_property ( + object_class, + PROP_SHELL_MODULE, + g_param_spec_object ( + "shell-module", + _("Shell Module"), + _("The EShellModule for this shell view"), + E_TYPE_SHELL_MODULE, + G_PARAM_READABLE)); + + /** * EShellView:shell-sidebar * * The sidebar widget appears in an #EShellWindow<!-- -->'s diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c index b79417f7ea..af08f4cc4e 100644 --- a/shell/e-shell-window.c +++ b/shell/e-shell-window.c @@ -32,7 +32,8 @@ enum { PROP_0, PROP_ACTIVE_VIEW, PROP_SAFE_MODE, - PROP_SHELL + PROP_SHELL, + PROP_UI_MANAGER }; static gpointer parent_class; @@ -195,6 +196,12 @@ shell_window_get_property (GObject *object, value, e_shell_window_get_shell ( E_SHELL_WINDOW (object))); return; + + case PROP_UI_MANAGER: + g_value_set_object ( + value, e_shell_window_get_ui_manager ( + E_SHELL_WINDOW (object))); + return; } G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -285,6 +292,21 @@ shell_window_class_init (EShellWindowClass *class) E_TYPE_SHELL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + + /** + * EShellWindow:ui-manager + * + * The shell window's #GtkUIManager. + **/ + g_object_class_install_property ( + object_class, + PROP_UI_MANAGER, + g_param_spec_object ( + "ui-manager", + _("UI Manager"), + _("The shell window's GtkUIManager"), + GTK_TYPE_UI_MANAGER, + G_PARAM_READABLE)); } static void |