+
+
+/* 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");
+}
+
+
+