[anjuta] libanjuta: Reuse G_FILE_ERROR instead of defining a new error domain for autogen



commit 1dbf030234c5743a511157511fdde61050740e07
Author: SÃbastien Granjoux <seb sfo free fr>
Date:   Sun Apr 29 18:38:19 2012 +0200

    libanjuta: Reuse G_FILE_ERROR instead of defining a new error domain for autogen

 libanjuta/anjuta-autogen.c |   28 +++++++++++-----------------
 libanjuta/anjuta-autogen.h |   24 ------------------------
 2 files changed, 11 insertions(+), 41 deletions(-)
---
diff --git a/libanjuta/anjuta-autogen.c b/libanjuta/anjuta-autogen.c
index 0740bd0..9f2107a 100644
--- a/libanjuta/anjuta-autogen.c
+++ b/libanjuta/anjuta-autogen.c
@@ -179,16 +179,6 @@ anjuta_check_autogen (void)
 	return FALSE;
 }
 
-GQuark
-anjuta_autogen_error_quark (void)
-{
-	static GQuark quark;
-
-	if (!quark) quark = g_quark_from_static_string ("anjuta_autogen_error");
-
-	return quark;
-}
-
 
 
 /* Write definitions
@@ -242,8 +232,8 @@ anjuta_autogen_write_definition_file (AnjutaAutogen* this, GHashTable* values, G
 	/* Autogen should not be running */
 	if (this->busy)
 	{
-		g_set_error_literal (error, ANJUTA_AUTOGEN_ERROR,
-		                     ANJUTA_AUTOGEN_ERROR_BUSY,
+		g_set_error_literal (error, G_FILE_ERROR,
+		                     G_FILE_ERROR_AGAIN,
 		                     _("Autogen is busy"));
 
 		return FALSE;
@@ -252,10 +242,14 @@ anjuta_autogen_write_definition_file (AnjutaAutogen* this, GHashTable* values, G
 	def = fopen (this->deffilename, "wt");
 	if (def == NULL)
 	{
-		g_set_error (error, ANJUTA_AUTOGEN_ERROR,
-		             ANJUTA_AUTOGEN_ERROR_WRITE_FAIL,
-		             _("Failed to write autogen definition file %s"),
-		             this->deffilename);
+		g_set_error(
+		            error,
+		            G_FILE_ERROR,
+		            g_file_error_from_errno(errno),
+		            _("Could not write definition file \"%s\": %s"),
+		            this->deffilename,
+					g_strerror(errno)
+		            );
 
 		return FALSE;
 	}
@@ -586,7 +580,7 @@ anjuta_autogen_execute (AnjutaAutogen* this, AnjutaAutogenFunc func, gpointer da
 				error,
 				G_FILE_ERROR,
 				g_file_error_from_errno(errno),
-				"Could not open file \"%s\": %s",
+				_("Could not open file \"%s\": %s"),
 				this->outfilename,
 				g_strerror(errno)
 			);
diff --git a/libanjuta/anjuta-autogen.h b/libanjuta/anjuta-autogen.h
index bb6ff0c..f924494 100644
--- a/libanjuta/anjuta-autogen.h
+++ b/libanjuta/anjuta-autogen.h
@@ -59,30 +59,6 @@ typedef void (*AnjutaAutogenFunc) (AnjutaAutogen* autogen, gpointer data);
  */
 typedef void (*AnjutaAutogenOutputFunc) (const gchar* output, gpointer data);
 
-/**
- * AnjutaAutogenError:
- * @ANJUTA_AUTOGEN_ERROR_BUSY: autogen is already running
- * @ANJUTA_AUTOGEN_ERROR_WRITE_FAIL: unable to write definition file
- *
- * Possibly errors that can occur during autogen processing.
- **/
-typedef enum
-{
-	ANJUTA_AUTOGEN_ERROR_BUSY,
-	ANJUTA_AUTOGEN_ERROR_WRITE_FAIL
-} AnjutaAutogenError;
-
-/**
- * ANJUTA_AUTOGEN_ERROR:
- *
- * Error domain for errors generated by a #AnjutaAutogen object.
- * Errors in this domain will be from the #AnjutaAutogenError enumeration.
- * See #GError for more information on error domains.
- **/
-
-#define ANJUTA_AUTOGEN_ERROR anjuta_autogen_error_quark()
-GQuark anjuta_autogen_error_quark (void);
-
 
 AnjutaAutogen* anjuta_autogen_new (void);
 



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