aboutsummaryrefslogblamecommitdiffstats
path: root/mail/e-mail-shell-view-actions.c
blob: ff0089d2cef13cf21006a1920cbc0d111a883fcd (plain) (tree)






















                                                                               








                                                                            










                                                                            






                                                                  


           


                                                             
                     


           


                                                            










                                                                                





                                                              









                                                                                





                                                               













                                                                                













                                                                            










                                                                                





                                                           










                                                                                





                                                                  




















                                                                                





                                                               









                                                                                





                                                              









                                                                                













                                                                            






                                                                                





                                                                        






                                                                                


           

                                                             
 

                                                                            


           

                                                          
 






                                                                                


                                                     


           

                                                              
 

                                              

                        



                                                                                

                                                         


           

                                                        
 

                                              
 

                                                                       
 

                                                     





                                                            






                                                                                


           


                                                     
                           





                                                                     






                                                                                





                                                                   






                                                                                













                                                                            






                                                                  





                                                                     
                                                      





                                                                    











                                                                  


           







































                                                                               















                                                                           





                                                             
 
     














                                                               
      














                                                                             






                                                     



















































































                                                                               













                                                                          
     















                                                               














                                                               
      







                                                                




































                                                             
                                  



                                                                      


































                                                                       

                       






                             






                            






                              




                                           




                                                     
















                                                            













































































































































































































































































                                                                         
                                                        
                                                       




                                                                   
 
/*
 * e-mail-shell-view-actions.c
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) version 3.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with the program; if not, see <http://www.gnu.org/licenses/>  
 *
 *
 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
 *
 */

#include "e-mail-shell-view-private.h"

static void
action_mail_create_search_folder_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)
{
    /* FIXME */
    g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action)));
}

static void
action_mail_empty_trash_cb (GtkAction *action,
                            EMailShellView *mail_shell_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);

    em_utils_empty_trash (GTK_WIDGET (shell_window));
}

static void
action_mail_flush_outbox_cb (GtkAction *action,
                             EMailShellView *mail_shell_view)
{
    mail_send ();
}

static void
action_mail_folder_copy_cb (GtkAction *action,
                            EMailShellView *mail_shell_view)
{
    EMailShellSidebar *mail_shell_sidebar;
    CamelFolderInfo *folder_info;
    EMFolderTree *folder_tree;

    mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
    folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
    folder_info = em_folder_tree_get_selected_folder_info (folder_tree);
    g_return_if_fail (folder_info != NULL);

    /* XXX Leaking folder_info? */
    em_folder_utils_copy_folder (folder_info, FALSE);
}

static void
action_mail_folder_delete_cb (GtkAction *action,
                              EMailShellView *mail_shell_view)
{
    EMailShellSidebar *mail_shell_sidebar;
    EMFolderTree *folder_tree;
    CamelFolder *folder;

    mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
    folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
    folder = em_folder_tree_get_selected_folder (folder_tree);
    g_return_if_fail (folder != NULL);

    em_folder_utils_delete_folder (folder);
}

static void
action_mail_folder_expunge_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);
    g_return_if_fail (folder_view->folder != NULL);

    em_utils_expunge_folder (
        GTK_WIDGET (shell_window), folder_view->folder);
}

static void
action_mail_folder_mark_all_as_read_cb (GtkAction *action,
                                        EMailShellView *mail_shell_view)
{
    /* FIXME */
    g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action)));
}

static void
action_mail_folder_move_cb (GtkAction *action,
                            EMailShellView *mail_shell_view)
{
    EMailShellSidebar *mail_shell_sidebar;
    CamelFolderInfo *folder_info;
    EMFolderTree *folder_tree;

    mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
    folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
    folder_info = em_folder_tree_get_selected_folder_info (folder_tree);
    g_return_if_fail (folder_info != NULL);

    /* XXX Leaking folder_info? */
    em_folder_utils_copy_folder (folder_info, TRUE);
}

static void
action_mail_folder_new_cb (GtkAction *action,
                           EMailShellView *mail_shell_view)
{
    EMailShellSidebar *mail_shell_sidebar;
    CamelFolderInfo *folder_info;
    EMFolderTree *folder_tree;

    mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
    folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
    folder_info = em_folder_tree_get_selected_folder_info (folder_tree);
    g_return_if_fail (folder_info != NULL);

    em_folder_utils_create_folder (folder_info, folder_tree);
    camel_folder_info_free (folder_info);
}

static void
action_mail_folder_properties_cb (GtkAction *action,
                                  EMailShellView *mail_shell_view)
{
    EMailShellSidebar *mail_shell_sidebar;
    EMFolderTree *folder_tree;
    EShellView *shell_view;
    GtkTreeSelection *selection;
    GtkTreeView *tree_view;
    GtkTreeModel *model;
    GtkTreeIter iter;
    gchar *uri;

    shell_view = E_SHELL_VIEW (mail_shell_view);
    mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
    folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);

    tree_view = GTK_TREE_VIEW (folder_tree);
    selection = gtk_tree_view_get_selection (tree_view);
    if (!gtk_tree_selection_get_selected (selection, &model, &iter))
        return;

    gtk_tree_model_get (model, &iter, COL_STRING_URI, &uri, -1);
    em_folder_properties_show (shell_view, NULL, uri);
    g_free (uri);
}

static void
action_mail_folder_refresh_cb (GtkAction *action,
                               EMailShellView *mail_shell_view)
{
    EMailShellSidebar *mail_shell_sidebar;
    EMFolderTree *folder_tree;
    CamelFolder *folder;

    mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
    folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
    folder = em_folder_tree_get_selected_folder (folder_tree);
    g_return_if_fail (folder != NULL);

    mail_refresh_folder (folder, NULL, NULL);
}

static void
action_mail_folder_rename_cb (GtkAction *action,
                              EMailShellView *mail_shell_view)
{
    EMailShellSidebar *mail_shell_sidebar;
    EMFolderTree *folder_tree;
    CamelFolder *folder;

    mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
    folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
    folder = em_folder_tree_get_selected_folder (folder_tree);
    g_return_if_fail (folder != NULL);

    em_folder_utils_rename_folder (folder);
}

static void
action_mail_folder_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_folder_select_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_thread (folder_view->list);
}

static void
action_mail_folder_select_subthread_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_subthread (folder_view->list);
}

static void
action_mail_hide_deleted_cb (GtkToggleAction *action,
                             EMailShellView *mail_shell_view)
{
    /* FIXME */
    g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action)));
}

static void
action_mail_hide_read_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_hide_add (
        folder_view->list,
        "(match-all (system-flag \"seen\"))",
        ML_HIDE_SAME, ML_HIDE_SAME);
}

static void
action_mail_hide_selected_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);
    message_list_hide_uids (folder_view->list, uids);
    message_list_free_uids (folder_view->list, uids);
}

static void
action_mail_preview_cb (GtkToggleAction *action,
                        EMailShellView *mail_shell_view)
{
    EMailShellContent *mail_shell_content;
    gboolean preview_visible;

    mail_shell_content = mail_shell_view->priv->mail_shell_content;
    preview_visible = gtk_toggle_action_get_active (action);

    e_mail_shell_content_set_preview_visible (
        mail_shell_content, preview_visible);
}

static void
action_mail_show_hidden_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_hide_clear (folder_view->list);
}

static void
action_mail_stop_cb (GtkAction *action,
                     EMailShellView *mail_shell_view)
{
    mail_cancel_all ();
}

static void
action_mail_threads_collapse_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);

    message_list_set_threaded_collapse_all (folder_view->list);
}

static void
action_mail_threads_expand_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);

    message_list_set_threaded_expand_all (folder_view->list);
}

static void
action_mail_threads_group_by_cb (GtkToggleAction *action,
                                 EMailShellView *mail_shell_view)
{
    /* FIXME */
    g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action)));
}

static void
action_mail_tools_filters_cb (GtkAction *action,
                              EMailShellView *mail_shell_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);

    em_utils_edit_filters (GTK_WIDGET (shell_window));
}

static void
action_mail_tools_search_folders_cb (GtkAction *action,
                                     EMailShellView *mail_shell_view)
{
    vfolder_edit (E_SHELL_VIEW (mail_shell_view));
}

static void
action_mail_tools_subscriptions_cb (GtkAction *action,
                                    EMailShellView *mail_shell_view)
{
    EShellWindow *shell_window;
    EShellView *shell_view;
    GtkWidget *dialog;

    shell_view = E_SHELL_VIEW (mail_shell_view);
    shell_window = e_shell_view_get_shell_window (shell_view);

    dialog = em_subscribe_editor_new ();
    gtk_window_set_transient_for (
        GTK_WINDOW (dialog), GTK_WINDOW (shell_window));
    gtk_dialog_run (GTK_DIALOG (dialog));
    /* XXX Dialog destroys itself. */
}

static void
action_mail_uri_call_to_cb (GtkAction *action,
                            EMailShellView *mail_shell_view)
{
    /* FIXME */
    g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action)));
}

static void
action_mail_uri_copy_cb (GtkAction *action,
                         EMailShellView *mail_shell_view)
{
    /* FIXME */
    g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action)));
}

static void
action_mail_uri_copy_address_cb (GtkAction *action,
                                 EMailShellView *mail_shell_view)
{
    /* FIXME */
    g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action)));
}

static void
action_mail_uri_to_search_folder_recipient_cb (GtkAction *action,
                                               EMailShellView *mail_shell_view)
{
    /* FIXME */
    g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action)));
}

static void
action_mail_uri_to_search_folder_sender_cb (GtkAction *action,
                                            EMailShellView *mail_shell_view)
{
    /* FIXME */
    g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action)));
}

static void
action_mail_view_cb (GtkRadioAction *action,
                     GtkRadioAction *current,
                     EMailShellView *mail_shell_view)
{
    EMailShellContent *mail_shell_content;
    gboolean vertical_view;

    mail_shell_content = mail_shell_view->priv->mail_shell_content;
    vertical_view = (gtk_radio_action_get_current_value (action) == 1);

    e_mail_shell_content_set_vertical_view (
        mail_shell_content, vertical_view);
}

static GtkActionEntry mail_entries[] = {

    { "mail-create-search-folder",
      NULL,
      N_("C_reate Search Folder From Search..."),
      NULL,
      NULL,  /* XXX Add a tooltip! */
      G_CALLBACK (action_mail_create_search_folder_cb) },

#if 0
    /* XXX Work around one-accelerator-per-action limit. */
    { "mail-delete-1",
      NULL,
      NULL,
      "Delete",
      NULL,
      G_CALLBACK (action_mail_delete_cb) },

    /* XXX Work around one-accelerator-per-action limit. */
    { "mail-delete-2",
      NULL,
      NULL,
      "KP_Delete",
      NULL,
      G_CALLBACK (action_mail_delete_cb) },
#endif

    { "mail-download",
      NULL,
      N_("_Download Messages for Offline Usage"),
      NULL,
      N_("Download messages of accounts and folders marked for offline"),
      G_CALLBACK (action_mail_download_cb) },

    { "mail-empty-trash",
      NULL,
      N_("Empty _Trash"),
      NULL,
      N_("Permanently remove all the deleted messages from all folders"),
      G_CALLBACK (action_mail_empty_trash_cb) },

    { "mail-flush-outbox",
      "mail-send",
      N_("Fl_ush Outbox"),
      NULL,
      NULL,  /* XXX Add a tooltip! */
      G_CALLBACK (action_mail_flush_outbox_cb) },

    { "mail-folder-copy",
      "folder-copy",
      N_("_Copy Folder To..."),
      NULL,
      N_("Copy the selected folder into another folder"),
      G_CALLBACK (action_mail_folder_copy_cb) },

    { "mail-folder-delete",
      GTK_STOCK_DELETE,
      NULL,
      NULL,
      N_("Permanently remove this folder"),
      G_CALLBACK (action_mail_folder_delete_cb) },

    { "mail-folder-expunge",
      NULL,
      N_("E_xpunge"),
      "<Control>e",
      N_("Permanently remove all deleted messages from this folder"),
      G_CALLBACK (action_mail_folder_expunge_cb) },

    { "mail-folder-mark-all-as-read",
      "mail-read",
      N_("Mar_k All Messages as Read"),
      NULL,
      N_("Mark all messages in the folder as read"),
      G_CALLBACK (action_mail_folder_mark_all_as_read_cb) },

    { "mail-folder-move",
      "folder-move",
      N_("_Move Folder To..."),
      NULL,
      N_("Move the selected folder into another folder"),
      G_CALLBACK (action_mail_folder_move_cb) },

    { "mail-folder-new",
      "folder-new",
      N_("_New..."),
      NULL,
      N_("Create a new folder for storing mail"),
      G_CALLBACK (action_mail_folder_new_cb) },

    { "mail-folder-properties",
      GTK_STOCK_PROPERTIES,
      NULL,
      NULL,
      N_("Change the properties of this folder"),
      G_CALLBACK (action_mail_folder_properties_cb) },

    { "mail-folder-refresh",
      GTK_STOCK_REFRESH,
      NULL,
      "F5",
      N_("Refresh the folder"),
      G_CALLBACK (action_mail_folder_refresh_cb) },

    { "mail-folder-rename",
      NULL,
      N_("_Rename..."),
      "F2",
      N_("Change the name of this folder"),
      G_CALLBACK (action_mail_folder_rename_cb) },

    { "mail-folder-select-all",
      NULL,
      N_("Select _All Messages"),
      "<Control>a",
      N_("Select all visible messages"),
      G_CALLBACK (action_mail_folder_select_all_cb) },

    { "mail-folder-select-thread",
      NULL,
      N_("Select Message _Thread"),
      "<Control>h",
      N_("Select all messages in the same thread as the selected message"),
      G_CALLBACK (action_mail_folder_select_thread_cb) },

    { "mail-folder-select-subthread",
      NULL,
      N_("Select Message S_ubthread"),
      "<Shift><Control>h",
      N_("Select all replies to the currently selected message"),
      G_CALLBACK (action_mail_folder_select_subthread_cb) },

    { "mail-hide-read",
      NULL,
      N_("Hide _Read Messages"),
      NULL,
      N_("Temporarily hide all messages that have already been read"),
      G_CALLBACK (action_mail_hide_read_cb) },

    { "mail-hide-selected",
      NULL,
      N_("Hide S_elected Messages"),
      NULL,
      N_("Temporarily hide the selected messages"),
      G_CALLBACK (action_mail_hide_selected_cb) },

#if 0
    /* XXX Work around one-accelerator-per-action limit. */
    { "mail-next-unread-1",
      NULL,
      NULL,
      "period",
      NULL,
      G_CALLBACK (action_mail_next_unread_cb) },

    /* XXX Work around one-accelerator-per-action limit. */
    { "mail-next-unread-2",
      NULL,
      NULL,
      "<Control>period",
      NULL,
      G_CALLBACK (action_mail_next_unread_cb) },

    /* XXX Work around one-accelerator-per-action limit. */
    { "mail-previous-unread-1",
      NULL,
      NULL,
      "comma",
      NULL,
      G_CALLBACK (action_mail_previous_unread_cb) },

    /* XXX Work around one-accelerator-per-action limit. */
    { "mail-previous-unread-2",
      NULL,
      NULL,
      "<Control>comma",
      NULL,
      G_CALLBACK (action_mail_previous_unread_cb) },
#endif

    { "mail-show-hidden",
      NULL,
      N_("Show Hidde_n Messages"),
      NULL,
      N_("Show messages that have been temporarily hidden"),
      G_CALLBACK (action_mail_show_hidden_cb) },

    { "mail-stop",
      GTK_STOCK_STOP,
      N_("Cancel"),
      NULL,
      N_("Cancel the current mail operation"),
      G_CALLBACK (action_mail_stop_cb) },

    { "mail-threads-collapse-all",
      NULL,
      N_("Collapse All _Threads"),
      "<Shift><Control>b",
      N_("Collapse all message threads"),
      G_CALLBACK (action_mail_threads_collapse_all_cb) },

    { "mail-threads-expand-all",
      NULL,
      N_("E_xpand All Threads"),
      NULL,
      N_("Expand all message threads"),
      G_CALLBACK (action_mail_threads_expand_all_cb) },

    { "mail-tools-filters",
      NULL,
      N_("_Message Filters"),
      NULL,
      N_("Create or edit rules for filtering new mail"),
      G_CALLBACK (action_mail_tools_filters_cb) },

    { "mail-tools-search-folders",
      NULL,
      N_("Search F_olders"),
      NULL,
      N_("Create or edit search folder definitions"),
      G_CALLBACK (action_mail_tools_search_folders_cb) },

    { "mail-tools-subscriptions",
      NULL,
      N_("_Subscriptions..."),
      NULL,
      N_("Subscribe or unsubscribe to folders on remote servers"),
      G_CALLBACK (action_mail_tools_subscriptions_cb) },

    { "mail-uri-call-to",
      NULL,
      N_("C_all To..."),
      NULL,
      NULL,  /* XXX Add a tooltip! */
      G_CALLBACK (action_mail_uri_call_to_cb) },

    { "mail-uri-copy",
      GTK_STOCK_COPY,
      N_("_Copy Link Location"),
      NULL,
      NULL,  /* XXX Add a tooltip! */
      G_CALLBACK (action_mail_uri_copy_cb) },

    { "mail-uri-copy-address",
      GTK_STOCK_COPY,
      N_("Copy _Email Address"),
      NULL,
      NULL,  /* XXX Add a tooltip! */
      G_CALLBACK (action_mail_uri_copy_address_cb) },

    { "mail-uri-to-search-folder-recipient",
      NULL,
      N_("_To This Address"),
      NULL,
      NULL,  /* XXX Add a tooltip! */
      G_CALLBACK (action_mail_uri_to_search_folder_recipient_cb) },

    { "mail-uri-to-search-folder-sender",
      NULL,
      N_("_From This Address"),
      NULL,
      NULL,  /* XXX Add a tooltip! */
      G_CALLBACK (action_mail_uri_to_search_folder_sender_cb) },

    /*** Menus ***/

    { "mail-folder-menu",
      NULL,
      N_("F_older"),
      NULL,
      NULL,
      NULL },

    { "mail-label-menu",
      NULL,
      N_("_Label"),
      NULL,
      NULL,
      NULL },

    { "mail-preview-menu",
      NULL,
      N_("_Preview"),
      NULL,
      NULL,
      NULL },

    { "mail-uri-to-search-folder-menu",
      NULL,
      N_("Create _Search Folder"),
      NULL,
      NULL,
      NULL }
};

static GtkToggleActionEntry mail_toggle_entries[] = {

    { "mail-hide-deleted",
      NULL,
      N_("Hide _Deleted Messages"),
      NULL,
      N_("Hide deleted messages rather than displaying "
         "them with a line through them"),
      G_CALLBACK (action_mail_hide_deleted_cb),
      TRUE },

    { "mail-preview",
      NULL,
      N_("Show Message _Preview"),
      "<Control>m",
      N_("Show message preview pane"),
      G_CALLBACK (action_mail_preview_cb),
      TRUE },

    { "mail-threads-group-by",
      NULL,
      N_("_Group By Threads"),
      "<Control>t",
      N_("Threaded message list"),
      G_CALLBACK (action_mail_threads_group_by_cb),
      FALSE }
};

static GtkRadioActionEntry mail_view_entries[] = {

    /* This action represents the initial active mail view.
     * It should not be visible in the UI, nor should it be
     * possible to switch to it from another shell view. */
    { "mail-view-internal",
      NULL,
      NULL,
      NULL,
      NULL,
      -1 },

    { "mail-view-classic",
      NULL,
      N_("_Classic View"),
      NULL,
      N_("Show message preview below the message list"),
      0 },

    { "mail-view-vertical",
      NULL,
      N_("_Vertical View"),
      NULL,
      N_("Show message preview alongside the message list"),
      1 }
};

static GtkRadioActionEntry mail_filter_entries[] = {

    { "mail-filter-all-messages",
      NULL,
      N_("All Messages"),
      NULL,
      NULL,  /* XXX Add a tooltip! */
      MAIL_FILTER_ALL_MESSAGES },

    { "mail-filter-important-messages",
      "emblem-important",
      N_("Important Messages"),
      NULL,
      NULL,  /* XXX Add a tooltip! */
      MAIL_FILTER_IMPORTANT_MESSAGES },

    { "mail-filter-label-important",
      NULL,
      N_("Important"),
      NULL,
      NULL,  /* XXX Add a tooltip! */
      MAIL_FILTER_LABEL_IMPORTANT },

    { "mail-filter-label-later",
      NULL,
      N_("Later"),
      NULL,
      NULL,  /* XXX Add a tooltip! */
      MAIL_FILTER_LABEL_LATER },

    { "mail-filter-label-personal",
      NULL,
      N_("Personal"),
      NULL,
      NULL,  /* XXX Add a tooltip! */
      MAIL_FILTER_LABEL_PERSONAL },

    { "mail-filter-label-to-do",
      NULL,
      N_("To Do"),
      NULL,
      NULL,  /* XXX Add a tooltip! */
      MAIL_FILTER_LABEL_TO_DO },

    { "mail-filter-label-work",
      NULL,
      N_("Work"),
      NULL,
      NULL,  /* XXX Add a tooltip! */
      MAIL_FILTER_LABEL_WORK },

    { "mail-filter-last-5-days-messages",
      NULL,
      N_("Last 5 Days' Messages"),
      NULL,
      NULL,  /* XXX Add a tooltip! */
      MAIL_FILTER_LAST_5_DAYS_MESSAGES },

    { "mail-filter-messages-not-junk",
      "mail-mark-notjunk",
      N_("Messages Not Junk"),
      NULL,
      NULL,  /* XXX Add a tooltip! */
      MAIL_FILTER_MESSAGES_NOT_JUNK },

    { "mail-filter-messages-with-attachments",
      "mail-attachment",
      N_("Messages with Attachments"),
      NULL,
      NULL,  /* XXX Add a tooltip! */
      MAIL_FILTER_MESSAGES_WITH_ATTACHMENTS },

    { "mail-filter-no-label",
      NULL,
      N_("No Label"),
      NULL,
      NULL,  /* XXX Add a tooltip! */
      MAIL_FILTER_NO_LABEL },

    { "mail-filter-read-messages",
      "mail-read",
      N_("Read Messages"),
      NULL,
      NULL,  /* XXX Add a tooltip! */
      MAIL_FILTER_READ_MESSAGES },

    { "mail-filter-recent-messages",
      NULL,
      N_("Recent Messages"),
      NULL,
      NULL,  /* XXX Add a tooltip! */
      MAIL_FILTER_RECENT_MESSAGES },

    { "mail-filter-unread-messages",
      "mail-unread",
      N_("Unread Messages"),
      NULL,
      NULL,  /* XXX Add a tooltip! */
      MAIL_FILTER_UNREAD_MESSAGES }
};

static GtkRadioActionEntry mail_search_entries[] = {

    { "mail-search-body-contains",
      NULL,
      N_("Body contains"),
      NULL,
      NULL,  /* XXX Add a tooltip! */
      MAIL_SEARCH_BODY_CONTAINS },

    { "mail-search-message-contains",
      NULL,
      N_("Message contains"),
      NULL,
      NULL,  /* XXX Add a tooltip! */
      MAIL_SEARCH_MESSAGE_CONTAINS },

    { "mail-search-recipients-contain",
      NULL,
      N_("Recipients contain"),
      NULL,
      NULL,  /* XXX Add a tooltip! */
      MAIL_SEARCH_RECIPIENTS_CONTAIN },

    { "mail-search-sender-contains",
      NULL,
      N_("Sender contains"),
      NULL,
      NULL,  /* XXX Add a tooltip! */
      MAIL_SEARCH_SENDER_CONTAINS },

    { "mail-search-subject-contains",
      NULL,
      N_("Subject contains"),
      NULL,
      NULL,  /* XXX Add a tooltip! */
      MAIL_SEARCH_SUBJECT_CONTAINS },

    { "mail-search-subject-or-recipients-contains",
      NULL,
      N_("Subject or Recipients contains"),
      NULL,
      NULL,  /* XXX Add a tooltip! */
      MAIL_SEARCH_SUBJECT_OR_RECIPIENTS_CONTAINS },

    { "mail-search-subject-or-sender-contains",
      NULL,
      N_("Subject or Sender contains"),
      NULL,
      NULL,  /* XXX Add a tooltip! */
      MAIL_SEARCH_SUBJECT_OR_SENDER_CONTAINS }
};

static GtkRadioActionEntry mail_scope_entries[] = {

    { "mail-scope-all-accounts",
      NULL,
      N_("All Accounts"),
      NULL,
      NULL,  /* XXX Add a tooltip! */
      MAIL_SCOPE_ALL_ACCOUNTS },

    { "mail-scope-current-account",
      NULL,
      N_("Current Account"),
      NULL,
      NULL,  /* XXX Add a tooltip! */
      MAIL_SCOPE_CURRENT_ACCOUNT },

    { "mail-scope-current-folder",
      NULL,
      N_("Current Folder"),
      NULL,
      NULL,  /* XXX Add a tooltip! */
      MAIL_SCOPE_CURRENT_FOLDER },

    { "mail-scope-current-message",
      NULL,
      N_("Current Message"),
      NULL,
      NULL,  /* XXX Add a tooltip! */
      MAIL_SCOPE_CURRENT_MESSAGE }
};

void
e_mail_shell_view_actions_init (EMailShellView *mail_shell_view)
{
    EShellView *shell_view;
    EShellWindow *shell_window;
    GtkActionGroup *action_group;
    GtkUIManager *ui_manager;
    GConfBridge *bridge;
    GtkAction *action;
    GObject *object;
    const gchar *domain;
    const gchar *key;

    shell_view = E_SHELL_VIEW (mail_shell_view);
    shell_window = e_shell_view_get_shell_window (shell_view);
    ui_manager = e_shell_window_get_ui_manager (shell_window);
    domain = GETTEXT_PACKAGE;

    action_group = mail_shell_view->priv->mail_actions;
    gtk_action_group_set_translation_domain (action_group, domain);
    gtk_action_group_add_actions (
        action_group, mail_entries,
        G_N_ELEMENTS (mail_entries), mail_shell_view);
    gtk_action_group_add_toggle_actions (
        action_group, mail_toggle_entries,
        G_N_ELEMENTS (mail_toggle_entries), mail_shell_view);
    gtk_action_group_add_radio_actions (
        action_group, mail_view_entries,
        G_N_ELEMENTS (mail_view_entries), -1,
        G_CALLBACK (action_mail_view_cb), mail_shell_view);
    gtk_action_group_add_radio_actions (
        action_group, mail_search_entries,
        G_N_ELEMENTS (mail_search_entries),
        MAIL_SEARCH_SUBJECT_OR_SENDER_CONTAINS,
        NULL, NULL);
    gtk_action_group_add_radio_actions (
        action_group, mail_scope_entries,
        G_N_ELEMENTS (mail_scope_entries),
        MAIL_SCOPE_CURRENT_FOLDER,
        NULL, NULL);
    gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);

    /* Bind GObject properties for GConf keys. */

    bridge = gconf_bridge_get ();

    object = G_OBJECT (ACTION (MAIL_PREVIEW));
    key = "/apps/evolution/mail/display/show_preview";
    gconf_bridge_bind_property (bridge, key, object, "active");

    object = G_OBJECT (ACTION (MAIL_VIEW_VERTICAL));
    key = "/apps/evolution/mail/display/show_wide";
    gconf_bridge_bind_property (bridge, key, object, "active");

    object = G_OBJECT (ACTION (MAIL_THREADS_GROUP_BY));
    key = "/apps/evolution/mail/display/thread_list";
    gconf_bridge_bind_property (bridge, key, object, "active");
}