All pastes #33283 Raw Edit

Stuff

public text v1 · immutable
#33283 ·published 2005-12-11 13:53 UTC
rendered paste body
Index: gedit-tab.c
===================================================================
RCS file: /cvs/gnome/gedit/gedit/Attic/gedit-tab.c,v
retrieving revision 1.1.2.66
diff -u -p -r1.1.2.66 gedit-tab.c
--- gedit-tab.c	10 Dec 2005 19:20:35 -0000	1.1.2.66
+++ gedit-tab.c	11 Dec 2005 13:52:56 -0000
@@ -700,6 +700,18 @@ document_loading (GeditDocument    *docu
 	tab->priv->times_called++;
 }
 
+static gboolean
+remove_tab (GeditTab *tab)
+{
+	GeditNotebook *notebook;
+
+	notebook = GEDIT_NOTEBOOK (gtk_widget_get_parent (GTK_WIDGET (tab)));
+
+	gedit_notebook_remove_tab (notebook, tab);
+
+	return FALSE;
+}
+
 static void
 document_loaded (GeditDocument *document,
 		 const GError  *error,
@@ -711,7 +723,7 @@ document_loaded (GeditDocument *document
 
 	g_return_if_fail ((tab->priv->state == GEDIT_TAB_STATE_LOADING) ||
 			  (tab->priv->state == GEDIT_TAB_STATE_REVERTING));
-	
+
 	g_timer_destroy (tab->priv->timer);
 	tab->priv->timer = NULL;
 	tab->priv->times_called = 0;
@@ -726,17 +738,19 @@ document_loaded (GeditDocument *document
 			gedit_tab_set_state (tab, GEDIT_TAB_STATE_LOADING_ERROR);
 		else
 			gedit_tab_set_state (tab, GEDIT_TAB_STATE_REVERTING_ERROR);
-			
+
 		encoding = gedit_document_get_encoding (document);
 
 		if (error->domain == GEDIT_DOCUMENT_ERROR)
 		{
 			if (error->code == GNOME_VFS_ERROR_CANCELLED)
-			{	
-				unrecoverable_loading_error_message_area_response (NULL,
-										   0,
-										   tab);
-										   
+			{
+				/* remove the tab, but in an idle handler, since
+				 * we are in the handler of doc loaded and we 
+				 * don't want doc and tab to be finalized now.
+				 */
+				g_idle_add ((GSourceFunc) remove_tab, tab);
+
 				goto end;
 			}
 			else