* Allow opening multiple viewers in nested messages
authorSergio Villar Senin <svillar@igalia.com>
Mon, 15 Dec 2008 16:03:36 +0000 (16:03 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Mon, 15 Dec 2008 16:03:36 +0000 (16:03 +0000)
* Fixes a crash added with the latest changes in the window manager

pmo-trunk-r6852

src/hildon2/modest-hildon2-window-mgr.c
src/modest-ui-actions.c

index 04d68dd..e17a2e6 100644 (file)
@@ -334,6 +334,7 @@ modest_hildon2_window_mgr_register_window (ModestWindowMgr *self,
        HildonProgram *program;
        GtkWidget *current_top;
        HildonWindowStack *stack;
        HildonProgram *program;
        GtkWidget *current_top;
        HildonWindowStack *stack;
+       gboolean nested_msg = FALSE;
 
        g_return_val_if_fail (MODEST_IS_HILDON2_WINDOW_MGR (self), FALSE);
        g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE);
 
        g_return_val_if_fail (MODEST_IS_HILDON2_WINDOW_MGR (self), FALSE);
        g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE);
@@ -360,16 +361,16 @@ modest_hildon2_window_mgr_register_window (ModestWindowMgr *self,
        priv->window_list = g_list_prepend (priv->window_list, window);
 
        current_top = hildon_window_stack_peek (stack);
        priv->window_list = g_list_prepend (priv->window_list, window);
 
        current_top = hildon_window_stack_peek (stack);
-
-       /* Close views if they're being shown */
-       if (MODEST_IS_MSG_EDIT_WINDOW (current_top) ||
-           MODEST_IS_MSG_VIEW_WINDOW (current_top)) {
+       nested_msg = MODEST_IS_MSG_VIEW_WINDOW (window) && 
+               MODEST_IS_MSG_VIEW_WINDOW (parent);
+
+       /* 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;
 
                gboolean retval;
 
-               /* TODO: allow nested messages, maybe we should add
-                  something to the msg view when it's showing an
-                  email sent as attachment */
-
                /* If the current view has modal dialogs then
                   we fail to register the new view */
                if ((current_top != NULL) &&
                /* If the current view has modal dialogs then
                   we fail to register the new view */
                if ((current_top != NULL) &&
index a31dc47..d8039a2 100644 (file)
@@ -1608,7 +1608,7 @@ reply_forward_cb (ModestMailOperation *mail_op,
        mgr = modest_runtime_get_window_mgr ();
        modest_window_mgr_register_window (mgr, msg_win, (ModestWindow *) rf_helper->parent_window);
 
        mgr = modest_runtime_get_window_mgr ();
        modest_window_mgr_register_window (mgr, msg_win, (ModestWindow *) rf_helper->parent_window);
 
-       if (rf_helper->parent_window != NULL) {
+       if (MODEST_IS_WINDOW (rf_helper->parent_window)) {
                gdouble parent_zoom;
 
                parent_zoom = modest_window_get_zoom (MODEST_WINDOW (rf_helper->parent_window));
                gdouble parent_zoom;
 
                parent_zoom = modest_window_get_zoom (MODEST_WINDOW (rf_helper->parent_window));