{ "EmailReply", NULL, N_("mcen_me_inbox_reply"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_reply) },
{ "EmailReplyAll", NULL, N_("mcen_me_inbox_replytoall"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_reply_all) },
{ "EmailForward", NULL, N_("mcen_me_inbox_forward"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_forward) },
- { "EmailDelete", NULL, N_("mcen_me_inbox_delete"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_delete) },
+ { "EmailDelete", NULL, N_("mcen_me_inbox_delete"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_delete_message_or_folder) },
{ "EmailContents", NULL, N_("mcen_me_inbox_retrieve_contents"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_retrieve_msg_contents) },
{ "EmailDetails", NULL, N_("mcen_me_inbox_messagedetails"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_details) },
{ "EmailPurgeAttachments", NULL, N_("mcen_me_inbox_remove_attachments"), NULL, NULL, G_CALLBACK (modest_ui_actions_remove_attachments) },
{ "ToolbarMessageForward", MODEST_STOCK_FORWARD, N_("mcen_me_inbox_forward"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_forward) },
{ "ToolbarSendReceive", MODEST_STOCK_REFRESH, N_("qgn_toolb_gene_refresh"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_send_receive) },
/* { "ToolbarToggleView", MODEST_STOCK_SPLIT_VIEW, N_("gqn_toolb_rss_fldonoff"), "<CTRL>t", NULL, G_CALLBACK (modest_ui_actions_toggle_folders_view) }, */
- { "ToolbarDeleteMessage", MODEST_STOCK_DELETE, N_("qgn_toolb_gene_deletebutton"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_delete) },
+ { "ToolbarDeleteMessage", MODEST_STOCK_DELETE, N_("qgn_toolb_gene_deletebutton"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_delete_message_or_folder) },
{ "ToolbarSort", MODEST_STOCK_SORT, N_("qgn_list_sort"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_sort) },
{ "ToolbarFindInMessage", GTK_STOCK_FIND, N_("qgn_toolb_gene_find"), NULL, NULL, NULL },
{ "ToolbarMessageBack", GTK_STOCK_GO_BACK, N_("qgn_toolb_gene_back"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_prev) },
{ "HeaderViewCSMCut", NULL, N_("mcen_me_inbox_cut"), "<CTRL>X", NULL, G_CALLBACK (modest_ui_actions_on_cut) },
{ "HeaderViewCSMCopy", NULL, N_("mcen_me_inbox_copy"), "<CTRL>C", NULL, G_CALLBACK (modest_ui_actions_on_copy) },
{ "HeaderViewCSMPaste", NULL, N_("mcen_me_inbox_paste"), "<CTRL>V", NULL, G_CALLBACK (modest_ui_actions_on_paste) },
- { "HeaderViewCSMDelete", NULL, N_("mcen_me_inbox_delete"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_delete) },
+ { "HeaderViewCSMDelete", NULL, N_("mcen_me_inbox_delete"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_delete_message) },
{ "HeaderViewCSMCancelSending", NULL, N_("mcen_me_outbox_cancelsend"), NULL, NULL, G_CALLBACK (modest_ui_actions_cancel_send) },
{ "HeaderViewCSMHelp", NULL, N_("mcen_me_inbox_help"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_help) },
};
}
void
-modest_ui_actions_on_delete (GtkAction *action, ModestWindow *win)
+modest_ui_actions_on_delete_message (GtkAction *action, ModestWindow *win)
{
TnyList *header_list = NULL;
TnyIterator *iter = NULL;
}
+
+
+/* delete either message or folder, based on what has focus */
+void
+modest_ui_actions_on_delete_message_or_folder (GtkAction *action, ModestWindow *win)
+{
+ g_return_if_fail (MODEST_IS_WINDOW(win));
+
+ /* Check first if the header view has the focus */
+ if (MODEST_IS_MAIN_WINDOW (win)) {
+ GtkWidget *w;
+
+ w = modest_main_window_get_child_widget (MODEST_MAIN_WINDOW (win),
+ MODEST_WIDGET_TYPE_HEADER_VIEW);
+ if (gtk_widget_is_focus (w)) {
+ modest_ui_actions_on_delete_message (action, win);
+ return;
+ }
+
+ w = modest_main_window_get_child_widget (MODEST_MAIN_WINDOW (win),
+ MODEST_WIDGET_TYPE_FOLDER_VIEW);
+ if (gtk_widget_is_focus (w)) {
+ modest_ui_actions_on_delete_folder (action, MODEST_MAIN_WINDOW(win));
+ return;
+ }
+ }
+ g_warning ("BUG: delete toolbar button pressed with neither headerview nor folderview "
+ "having focus");
+}
+
+
+
void
modest_ui_actions_on_quit (GtkAction *action, ModestWindow *win)
{
/* Menu & toolbar actions */
void modest_ui_actions_on_about (GtkAction *action, ModestWindow *win);
-void modest_ui_actions_on_delete (GtkAction *action, ModestWindow *win);
+void modest_ui_actions_on_delete_message (GtkAction *action, ModestWindow *win);
+
+void modest_ui_actions_on_delete_message_or_folder (GtkAction *action, ModestWindow *win);
void modest_ui_actions_on_quit (GtkAction *action, ModestWindow *win);
/* ACTIONS */
{ "ActionsNewMessage", NULL, N_("mcen_me_viewer_newemail"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_new_msg) },
{ "ActionsSaveToDrafts", NULL, N_("mcen_me_editor_save_as_draft"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_save_to_drafts) },
- { "ActionsDelete", NULL, N_("mcen_me_inbox_delete"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_delete) },
+ { "ActionsDelete", NULL, N_("mcen_me_inbox_delete"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_delete_message) },
{ "ActionsSend", NULL, N_("mcen_me_editor_send"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_send) },
/* { "ActionsFontColor", GTK_STOCK_SELECT_COLOR, N_("Color"), NULL, N_("Change text color"), G_CALLBACK (modest_ui_actions_on_select_editor_color)}, */
/* { "BackgroundColor", GTK_STOCK_SELECT_COLOR, N_("Background color"), NULL, N_("Change background color"), G_CALLBACK (modest_ui_actions_on_select_editor_background_color)}, */