nested_msg = MODEST_IS_MSG_VIEW_WINDOW (window) &&
MODEST_IS_MSG_VIEW_WINDOW (parent);
+ /* Close views if they're being shown */
+ if (!nested_msg &&
+ (MODEST_IS_MSG_EDIT_WINDOW (current_top) ||
+ MODEST_IS_MSG_VIEW_WINDOW (current_top))) {
+ gboolean retval;
+
+ /* If the current view has modal dialogs then
+ we fail to register the new view */
+ if ((current_top != NULL) &&
+ window_has_modals (MODEST_WINDOW (current_top))) {
+ /* Window on top but it has opened dialogs */
+ goto fail;
+ }
- /* Close views if they're being shown. Nevertheless we must
- allow nested messages */
- if (!nested_msg &&
- (MODEST_IS_MSG_EDIT_WINDOW (current_top) ||
- MODEST_IS_MSG_VIEW_WINDOW (current_top))) {
- gboolean retval;
-
- /* If the current view has modal dialogs then
- we fail to register the new view */
- if ((current_top != NULL) &&
- window_has_modals (MODEST_WINDOW (current_top))) {
- /* Window on top but it has opened dialogs */
- goto fail;
- }
-
- /* Close the current view */
- g_signal_emit_by_name (G_OBJECT (current_top), "delete-event", NULL, &retval);
- if (retval == TRUE) {
- /* Cancelled closing top window, then we fail to register */
- goto fail;
- }
- }
+ /* Close the current view */
+ g_signal_emit_by_name (G_OBJECT (current_top), "delete-event", NULL, &retval);
+ if (retval == TRUE) {
+ /* Cancelled closing top window, then we fail to register */
+ goto fail;
+ }
+ }
/* Listen to object destruction */
handler_id = g_malloc0 (sizeof (gint));
allowed_size = MODEST_MAX_ATTACHMENT_SIZE;
msg_win = modest_msg_edit_window_new (msg, account_name, FALSE);
- if (!modest_window_mgr_register_window (modest_runtime_get_window_mgr(), msg_win, NULL)) {
+ if (!modest_window_mgr_register_window (modest_runtime_get_window_mgr(), msg_win, win)) {
gtk_widget_destroy (GTK_WIDGET (msg_win));
goto cleanup;
}