Index: gedit/gedit-tab.c =================================================================== RCS file: /cvs/gnome/gedit/gedit/gedit-tab.c,v retrieving revision 1.15 diff -u -p -r1.15 gedit-tab.c --- gedit/gedit-tab.c 17 Aug 2006 19:55:29 -0000 1.15 +++ gedit/gedit-tab.c 24 Aug 2006 13:05:50 -0000 @@ -1973,9 +1973,17 @@ print_preview_destroyed (GtkWidget *prev tab->priv->print_preview = NULL; if (tab->priv->state == GEDIT_TAB_STATE_SHOWING_PRINT_PREVIEW) + { gedit_tab_set_state (tab, GEDIT_TAB_STATE_NORMAL); + } else - gtk_widget_show (tab->priv->view_scrolled_window); + { + /* When does this happen ??? - Paolo (Aug 24, 2006) */ + /* One of the case it should happen is when printing while showing + * print preview. In this case let us continue whithout changing + * the state and show the document. See bug #352658 */ + gtk_widget_show (tab->priv->view_scrolled_window); + } } static void @@ -1986,8 +1994,7 @@ set_print_preview (GeditTab *tab, GtkWi if (tab->priv->print_preview != NULL) gtk_widget_destroy (tab->priv->print_preview); - - + tab->priv->print_preview = print_preview; gtk_box_pack_end (GTK_BOX (tab), @@ -2072,10 +2079,18 @@ print_finished_cb (GtkSourcePrintJob *pj g_object_unref (gjob); gedit_print_job_save_config (GEDIT_PRINT_JOB (pjob)); - + g_object_unref (pjob); + + if (tab->priv->print_preview != NULL) + { + /* If we were printing while showing the print preview, + see bug #352658 */ + gtk_widget_destroy (tab->priv->print_preview); + g_return_if_fail (tab->priv->state == GEDIT_TAB_STATE_PRINTING); + } - gedit_tab_set_state (tab, GEDIT_TAB_STATE_NORMAL); + gedit_tab_set_state (tab, GEDIT_TAB_STATE_NORMAL); } static void @@ -2089,8 +2104,16 @@ print_cancelled (GeditMessageArea *area, g_object_unref (tab->priv->print_job); set_message_area (tab, NULL); /* destroy the message area */ + + if (tab->priv->print_preview != NULL) + { + /* If we were printing while showing the print preview, + see bug #352658 */ + gtk_widget_destroy (tab->priv->print_preview); + g_return_if_fail (tab->priv->state == GEDIT_TAB_STATE_PRINTING); + } - gedit_tab_set_state (tab, GEDIT_TAB_STATE_NORMAL); + gedit_tab_set_state (tab, GEDIT_TAB_STATE_NORMAL); } static void