[gedit] Added domain checks for CONVERSION_FALLBACK errors



commit d11a8e84244b773cdf262bf0b57e76a4f0e8f4f2
Author: Jesse van den Kieboom <jesse vandenkieboom epfl ch>
Date:   Mon Mar 1 08:59:23 2010 +0100

    Added domain checks for CONVERSION_FALLBACK errors

 gedit/gedit-document.c |    4 +++-
 gedit/gedit-tab.c      |    9 ++++++---
 2 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/gedit/gedit-document.c b/gedit/gedit-document.c
index 854cfbb..e4fb2a0 100644
--- a/gedit/gedit-document.c
+++ b/gedit/gedit-document.c
@@ -1216,7 +1216,9 @@ document_loader_loaded (GeditDocumentLoader *loader,
 			GeditDocument       *doc)
 {
 	/* load was successful */
-	if (error == NULL || error->code == GEDIT_DOCUMENT_ERROR_CONVERSION_FALLBACK)
+	if (error == NULL ||
+	    (error->domain == GEDIT_DOCUMENT_ERROR &&
+	     error->code == GEDIT_DOCUMENT_ERROR_CONVERSION_FALLBACK))
 	{
 		GtkTextIter iter;
 		GFileInfo *info;
diff --git a/gedit/gedit-tab.c b/gedit/gedit-tab.c
index 9f6c4c4..1dcdcbe 100644
--- a/gedit/gedit-tab.c
+++ b/gedit/gedit-tab.c
@@ -896,7 +896,8 @@ document_loaded (GeditDocument *document,
 	uri = gedit_document_get_uri (document);
 
 	/* if the error is CONVERSION FALLBACK don't treat it as a normal error */
-	if (error != NULL && error->code != GEDIT_DOCUMENT_ERROR_CONVERSION_FALLBACK)
+	if (error != NULL &&
+	    (error->domain != GEDIT_DOCUMENT_ERROR || error->code != GEDIT_DOCUMENT_ERROR_CONVERSION_FALLBACK))
 	{
 		if (tab->priv->state == GEDIT_TAB_STATE_LOADING)
 			gedit_tab_set_state (tab, GEDIT_TAB_STATE_LOADING_ERROR);
@@ -905,7 +906,7 @@ document_loaded (GeditDocument *document,
 
 		encoding = gedit_document_get_encoding (document);
 
-		if (error->domain == G_IO_ERROR && 
+		if (error->domain == G_IO_ERROR &&
 		    error->code == G_IO_ERROR_CANCELLED)
 		{
 			/* remove the tab, but in an idle handler, since
@@ -975,7 +976,9 @@ document_loaded (GeditDocument *document,
 				   mime);
 		g_free (mime);
 
-		if (error && error->code == GEDIT_DOCUMENT_ERROR_CONVERSION_FALLBACK)
+		if (error &&
+		    error->domain == GEDIT_DOCUMENT_ERROR &&
+		    error->code == GEDIT_DOCUMENT_ERROR_CONVERSION_FALLBACK)
 		{
 			GtkWidget *emsg;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]