[anjuta] libanjuta: Move autogen functions from project-wizard to libanjuta



commit 32a03735830aed14af6a8520e0f6f9f03e0ead8e
Author: SÃbastien Granjoux <seb sfo free fr>
Date:   Sat Apr 28 16:40:42 2012 +0200

    libanjuta: Move autogen functions from project-wizard to libanjuta

 libanjuta/Makefile.am                              |    4 +-
 .../autogen.c => libanjuta/anjuta-autogen.c        |  105 +++++------
 libanjuta/anjuta-autogen.h                         |   65 +++++++
 plugins/class-gen/Makefile.am                      |    6 +-
 plugins/class-gen/generator.c                      |   50 ++---
 plugins/class-gen/plugin.c                         |    4 +-
 plugins/project-wizard/Makefile.am                 |    4 -
 plugins/project-wizard/autogen.h                   |   51 -----
 plugins/project-wizard/druid.c                     |   32 ++--
 plugins/project-wizard/install.c                   |   36 ++--
 plugins/project-wizard/install.h                   |    2 +-
 plugins/project-wizard/values.c                    |  203 --------------------
 plugins/project-wizard/values.h                    |   47 -----
 po/POTFILES.in                                     |    1 +
 14 files changed, 175 insertions(+), 435 deletions(-)
---
diff --git a/libanjuta/Makefile.am b/libanjuta/Makefile.am
index 7369cb0..fb74a87 100644
--- a/libanjuta/Makefile.am
+++ b/libanjuta/Makefile.am
@@ -129,7 +129,9 @@ libanjuta_3_la_SOURCES= \
 	anjuta-environment-editor.h \
 	anjuta-environment-editor.c \
 	anjuta-tree-combo.h \
-	anjuta-tree-combo.c
+	anjuta-tree-combo.c \
+	anjuta-autogen.h \
+	anjuta-autogen.c
 
 # Glade module
 if HAVE_PLUGIN_GLADE
diff --git a/plugins/project-wizard/autogen.c b/libanjuta/anjuta-autogen.c
similarity index 83%
rename from plugins/project-wizard/autogen.c
rename to libanjuta/anjuta-autogen.c
index 75aac8f..71e434e 100644
--- a/plugins/project-wizard/autogen.c
+++ b/libanjuta/anjuta-autogen.c
@@ -1,6 +1,6 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
 /*
-    autogen.c
+   anjuta-autogen.c
     Copyright (C) 2004 Sebastien Granjoux
 
     This program is free software; you can redistribute it and/or modify
@@ -31,10 +31,10 @@
 
 #include <config.h>
 
-#include "autogen.h"
-
 #include <libanjuta/anjuta-launcher.h>
+#include <libanjuta/anjuta-autogen.h>
 
+#include <glib/gi18n.h>
 #include <glib/gstdio.h>
 #include <glib.h>
 #include <errno.h>
@@ -52,7 +52,7 @@
 
 /*---------------------------------------------------------------------------*/
 
-struct _NPWAutogen
+struct _AnjutaAutogen
 {
 	gchar* deffilename;		/* name of generated definition file */
 	const gchar* tplfilename;	/* name of template (input) file */
@@ -69,11 +69,11 @@ struct _NPWAutogen
 	gboolean empty;
 					/* Call back function and data used
 					 * when autogen output something */
-	NPWAutogenOutputFunc outfunc;
+	AnjutaAutogenOutputFunc outfunc;
 	gpointer outdata;
 					/* Call back function and data used
 					 * when autogen terminate */
-	NPWAutogenFunc endfunc;
+	AnjutaAutogenFunc endfunc;
 	gpointer enddata;
 
 	AnjutaLauncher* launcher;
@@ -88,7 +88,7 @@ struct _NPWAutogen
 /* Check if autogen version 5 is present */
 
 gboolean
-npw_check_autogen (void)
+anjuta_check_autogen (void)
 {
 	gchar* args[] = {"autogen", "-v", NULL};
 	gchar* output;
@@ -127,48 +127,20 @@ npw_check_autogen (void)
 	return FALSE;
 }
 
-/* Write definitions
- *---------------------------------------------------------------------------*/
-
-static void
-cb_autogen_write_definition (const gchar* name, NPWValue * node, gpointer user_data)
+GQuark
+anjuta_autogen_error_quark (void)
 {
-	FILE* def = (FILE *)user_data;
+	static GQuark quark;
 
-	if ((npw_value_get_tag(node) & NPW_VALID_VALUE) && (npw_value_get_value(node) != NULL))
-	{
-		if(npw_value_get_value (node)[0] == '{') /* Seems to be a list, so do not quote */
-		{
-			fprintf(def, "%s = %s;\n", name, npw_value_get_value (node));
-		}
-		else
-		{
-			gchar *esc_value = g_strescape (npw_value_get_value (node), NULL);
-			fprintf (def, "%s = \"%s\";\n", name, esc_value);
-			g_free (esc_value);
-		}
-	}
-}
+	if (!quark) quark = g_quark_from_static_string ("anjuta_autogen_error");
 
-gboolean
-npw_autogen_write_definition_file (NPWAutogen* this, GHashTable* values)
-{
-	FILE* def;
-
-	/* Autogen should not be running */
-	g_return_val_if_fail (this->busy == FALSE, FALSE);
-
-	def = fopen (this->deffilename, "wt");
-	if (def == NULL) return FALSE;
+	return quark;
+}
 
-	/* Generate definition data for autogen */
-	fputs ("AutoGen Definitions .;\n",def);
-	npw_value_heap_foreach_value (values, (GHFunc)cb_autogen_write_definition, def);
 
-	fclose (def);
 
-	return TRUE;
-}
+/* Write definitions
+ *---------------------------------------------------------------------------*/
 
 static void
 cb_autogen_write_key (const gchar* name, const gchar *value, gpointer user_data)
@@ -191,15 +163,30 @@ cb_autogen_write_key (const gchar* name, const gchar *value, gpointer user_data)
 }
 
 gboolean
-npw_autogen_write_definition_file_from_hash (NPWAutogen* this, GHashTable* values)
+anjuta_autogen_write_definition_file (AnjutaAutogen* this, GHashTable* values, GError **error)
 {
 	FILE* def;
 
 	/* Autogen should not be running */
-	g_return_val_if_fail (this->busy == FALSE, FALSE);
+	if (this->busy)
+	{
+		g_set_error_literal (error, ANJUTA_AUTOGEN_ERROR,
+		                     ANJUTA_AUTOGEN_ERROR_BUSY,
+		                     _("Autogen is busy"));
+
+		return FALSE;
+	}
 
 	def = fopen (this->deffilename, "wt");
-	if (def == NULL) return FALSE;
+	if (def == NULL)
+	{
+		g_set_error (error, ANJUTA_AUTOGEN_ERROR,
+		             ANJUTA_AUTOGEN_ERROR_WRITE_FAIL,
+		             _("Failed to write autogen definition file %s"),
+		             this->deffilename);
+
+		return FALSE;
+	}
 
 	/* Generate definition data for autogen */
 	fputs ("AutoGen Definitions .;\n",def);
@@ -214,7 +201,7 @@ npw_autogen_write_definition_file_from_hash (NPWAutogen* this, GHashTable* value
  *---------------------------------------------------------------------------*/
 
 void
-npw_autogen_set_library_path (NPWAutogen* this, const gchar *directory)
+anjuta_autogen_set_library_path (AnjutaAutogen* this, const gchar *directory)
 {
 	g_return_if_fail (directory != NULL);
 
@@ -222,7 +209,7 @@ npw_autogen_set_library_path (NPWAutogen* this, const gchar *directory)
 }
 
 void
-npw_autogen_clear_library_path (NPWAutogen* this)
+anjuta_autogen_clear_library_path (AnjutaAutogen* this)
 {
 	g_list_foreach (this->library_paths, (GFunc)g_free, NULL);
 	g_list_free (this->library_paths);
@@ -230,7 +217,7 @@ npw_autogen_clear_library_path (NPWAutogen* this)
 }
 
 GList *
-npw_autogen_get_library_paths (NPWAutogen* this)
+anjuta_autogen_get_library_paths (AnjutaAutogen* this)
 {
 	return this->library_paths;
 }
@@ -239,7 +226,7 @@ npw_autogen_get_library_paths (NPWAutogen* this)
  *---------------------------------------------------------------------------*/
 
 gboolean
-npw_autogen_set_input_file (NPWAutogen* this, const gchar* filename, const gchar* start_marker, const gchar* end_marker)
+anjuta_autogen_set_input_file (AnjutaAutogen* this, const gchar* filename, const gchar* start_marker, const gchar* end_marker)
 {
 	FILE* tpl;
 	FILE* src;
@@ -316,7 +303,7 @@ npw_autogen_set_input_file (NPWAutogen* this, const gchar* filename, const gchar
 }
 
 gboolean
-npw_autogen_set_output_file (NPWAutogen* this, const gchar* filename)
+anjuta_autogen_set_output_file (AnjutaAutogen* this, const gchar* filename)
 {
 	/* Autogen should not be running */
 	g_return_val_if_fail (this->busy == FALSE, FALSE);
@@ -328,7 +315,7 @@ npw_autogen_set_output_file (NPWAutogen* this, const gchar* filename)
 }
 
 gboolean
-npw_autogen_set_output_callback (NPWAutogen* this, NPWAutogenOutputFunc func, gpointer user_data)
+anjuta_autogen_set_output_callback (AnjutaAutogen* this, AnjutaAutogenOutputFunc func, gpointer user_data)
 {
 	/* Autogen should not be running */
 	g_return_val_if_fail (this->busy == FALSE, FALSE);
@@ -346,7 +333,7 @@ npw_autogen_set_output_callback (NPWAutogen* this, NPWAutogenOutputFunc func, gp
 static void
 on_autogen_output (AnjutaLauncher* launcher, AnjutaLauncherOutputType type, const gchar* output, gpointer user_data)
 {
-	NPWAutogen* this = (NPWAutogen*)user_data;
+	AnjutaAutogen* this = (AnjutaAutogen*)user_data;
 
 	if (this->outfilename != NULL)
 	{
@@ -365,7 +352,7 @@ on_autogen_output (AnjutaLauncher* launcher, AnjutaLauncherOutputType type, cons
 }
 
 static void
-on_autogen_terminated (AnjutaLauncher* launcher, gint pid, gint status, gulong time, NPWAutogen* this)
+on_autogen_terminated (AnjutaLauncher* launcher, gint pid, gint status, gulong time, AnjutaAutogen* this)
 {
 	this->busy = FALSE;
 	if (this->output != NULL)
@@ -386,7 +373,7 @@ on_autogen_terminated (AnjutaLauncher* launcher, gint pid, gint status, gulong t
 }
 
 gboolean
-npw_autogen_execute (NPWAutogen* this, NPWAutogenFunc func, gpointer data, GError** error)
+anjuta_autogen_execute (AnjutaAutogen* this, AnjutaAutogenFunc func, gpointer data, GError** error)
 {
 	gchar** args;
 	guint arg;
@@ -460,11 +447,11 @@ npw_autogen_execute (NPWAutogen* this, NPWAutogenFunc func, gpointer data, GErro
 /* Creation and Destruction
  *---------------------------------------------------------------------------*/
 
-NPWAutogen* npw_autogen_new (void)
+AnjutaAutogen* anjuta_autogen_new (void)
 {
-	NPWAutogen* this;
+	AnjutaAutogen* this;
 
-	this = g_new0(NPWAutogen, 1);
+	this = g_new0(AnjutaAutogen, 1);
 
 	this->launcher = anjuta_launcher_new ();
 	g_signal_connect (G_OBJECT (this->launcher), "child-exited", G_CALLBACK (on_autogen_terminated), this);
@@ -476,7 +463,7 @@ NPWAutogen* npw_autogen_new (void)
 	return this;
 }
 
-void npw_autogen_free (NPWAutogen* this)
+void anjuta_autogen_free (AnjutaAutogen* this)
 {
 	g_return_if_fail(this != NULL);
 
diff --git a/libanjuta/anjuta-autogen.h b/libanjuta/anjuta-autogen.h
new file mode 100644
index 0000000..7d8b503
--- /dev/null
+++ b/libanjuta/anjuta-autogen.h
@@ -0,0 +1,65 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+    anjuta-autogen.h
+    Copyright (C) 2004 Sebastien Granjoux
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+#ifndef __ANJUTA_AUTOGEN_H__
+#define __ANJUTA_AUTOGEN_H__
+
+#include <glib.h>
+
+
+typedef struct _AnjutaAutogen AnjutaAutogen;
+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 file
+ *
+ * Possibly errors that can occur during charset conversion
+ */
+typedef enum
+{
+	ANJUTA_AUTOGEN_ERROR_BUSY,
+	ANJUTA_AUTOGEN_ERROR_WRITE_FAIL
+} AnjutaAutogenError;
+
+#define ANJUTA_AUTOGEN_ERROR anjuta_autogen_error_quark()
+
+GQuark anjuta_autogen_error_quark (void);
+
+
+AnjutaAutogen* anjuta_autogen_new (void);
+void anjuta_autogen_free (AnjutaAutogen* this);
+
+gboolean anjuta_autogen_write_definition_file (AnjutaAutogen* this, GHashTable* values, GError **error);
+
+void anjuta_autogen_set_library_path (AnjutaAutogen* this, const gchar *directory);
+void anjuta_autogen_clear_library_path (AnjutaAutogen* this);
+GList *anjuta_autogen_get_library_paths (AnjutaAutogen* this);
+gboolean anjuta_autogen_set_input_file (AnjutaAutogen* this, const gchar* filename, const gchar* start_marker, const gchar* end_marker);
+gboolean anjuta_autogen_set_output_file (AnjutaAutogen* this, const gchar* filename);
+gboolean anjuta_autogen_set_output_callback (AnjutaAutogen* this, AnjutaAutogenOutputFunc func, gpointer user_data);
+
+gboolean anjuta_autogen_execute (AnjutaAutogen* this, AnjutaAutogenFunc func, gpointer data, GError** error);
+
+gboolean anjuta_check_autogen(void);
+
+#endif
diff --git a/plugins/class-gen/Makefile.am b/plugins/class-gen/Makefile.am
index fbee05c..9ce807b 100644
--- a/plugins/class-gen/Makefile.am
+++ b/plugins/class-gen/Makefile.am
@@ -50,11 +50,7 @@ libanjuta_class_gen_la_SOURCES= \
 	validator.c \
 	validator.h \
 	window.c \
-	window.h \
-	../project-wizard/autogen.c \
-	../project-wizard/autogen.h \
-	../project-wizard/values.c \
-	../project-wizard/values.h
+	window.h
 	
 EXTRA_DIST = \
 	$(plugin_in_files) \
diff --git a/plugins/class-gen/generator.c b/plugins/class-gen/generator.c
index ecc728d..ad7e90b 100644
--- a/plugins/class-gen/generator.c
+++ b/plugins/class-gen/generator.c
@@ -19,9 +19,8 @@
 
 #include "generator.h"
 
-#include <plugins/project-wizard/autogen.h>
-
 #include <libanjuta/anjuta-marshal.h>
+#include <libanjuta/anjuta-autogen.h>
 #include <libanjuta/anjuta-utils.h>
 
 #include <glib/gstdio.h>
@@ -30,7 +29,7 @@
 typedef struct _CgGeneratorPrivate CgGeneratorPrivate;
 struct _CgGeneratorPrivate
 {
-	NPWAutogen *autogen;
+	AnjutaAutogen *autogen;
 
 	gchar *header_template;
 	gchar *source_template;
@@ -88,7 +87,7 @@ cg_generator_make_absolute (const gchar *path)
 }
 
 static void
-cg_generator_autogen_source_func (NPWAutogen *autogen,
+cg_generator_autogen_source_func (AnjutaAutogen *autogen,
                                   gpointer user_data)
 {
 	CgGenerator *generator;
@@ -140,7 +139,7 @@ cg_generator_autogen_source_func (NPWAutogen *autogen,
 }
 
 static void
-cg_generator_autogen_header_func (NPWAutogen *autogen,
+cg_generator_autogen_header_func (AnjutaAutogen *autogen,
                                   gpointer user_data)
 {
 	CgGenerator *generator;
@@ -153,10 +152,10 @@ cg_generator_autogen_header_func (NPWAutogen *autogen,
 
 	error = NULL;
 
-	npw_autogen_set_input_file (priv->autogen, priv->source_template, NULL, NULL); /*"[+", "+]");*/
-	npw_autogen_set_output_file (priv->autogen, priv->source_destination);
+	anjuta_autogen_set_input_file (priv->autogen, priv->source_template, NULL, NULL); /*"[+", "+]");*/
+	anjuta_autogen_set_output_file (priv->autogen, priv->source_destination);
 
-	result = npw_autogen_execute (priv->autogen,
+	result = anjuta_autogen_execute (priv->autogen,
 	                              cg_generator_autogen_source_func,
 	                              generator, &error);
 
@@ -174,7 +173,7 @@ cg_generator_init (CgGenerator *generator)
 	CgGeneratorPrivate *priv;
 	priv = CG_GENERATOR_PRIVATE (generator);
 
-	priv->autogen = npw_autogen_new ();
+	priv->autogen = anjuta_autogen_new ();
 
 	priv->header_template = NULL;
 	priv->source_template = NULL;
@@ -191,7 +190,7 @@ cg_generator_finalize (GObject *object)
 	generator = CG_GENERATOR (object);
 	priv = CG_GENERATOR_PRIVATE (generator);
 
-	npw_autogen_free (priv->autogen);
+	anjuta_autogen_free (priv->autogen);
 
 	g_free (priv->header_template);
 	g_free (priv->source_template);
@@ -398,35 +397,30 @@ cg_generator_run (CgGenerator *generator,
 	CgGeneratorPrivate *priv;
 	priv = CG_GENERATOR_PRIVATE (generator);
 
-	/* TODO: npw_autogen_write_definiton_file should take a GError... */
-	if (npw_autogen_write_definition_file_from_hash (priv->autogen, values) == FALSE)
+	if (anjuta_autogen_write_definition_file (priv->autogen, values, error) == FALSE)
 	{
-		g_set_error (error, g_quark_from_static_string("CG_GENERATOR_ERROR"),
-		             CG_GENERATOR_ERROR_DEFFILE,
-		             _("Failed to write autogen definition file"));
-
 		return FALSE;
 	}
 	else if ((priv->header_destination != NULL) && (priv->header_template != NULL))
 	{
-		npw_autogen_set_input_file (priv->autogen, priv->header_template,
-		                            NULL, NULL); /*"[+", "+]");*/
-		npw_autogen_set_output_file (priv->autogen, priv->header_destination);
+		anjuta_autogen_set_input_file (priv->autogen, priv->header_template,
+		                               NULL, NULL); /*"[+", "+]");*/
+		anjuta_autogen_set_output_file (priv->autogen, priv->header_destination);
 
-		return npw_autogen_execute (priv->autogen,
-		                            cg_generator_autogen_header_func,
-		                            generator, error);
+		return anjuta_autogen_execute (priv->autogen,
+		                               cg_generator_autogen_header_func,
+		                               generator, error);
 	}
 	else
 	{
 		/* No header file, generate source file */
-		npw_autogen_set_input_file (priv->autogen, priv->source_template,
-		                            NULL, NULL); /*"[+", "+]");*/
-		npw_autogen_set_output_file (priv->autogen, priv->source_destination);
+		anjuta_autogen_set_input_file (priv->autogen, priv->source_template,
+		                               NULL, NULL); /*"[+", "+]");*/
+		anjuta_autogen_set_output_file (priv->autogen, priv->source_destination);
 
-		return npw_autogen_execute (priv->autogen,
-	                              cg_generator_autogen_source_func,
-	                              generator, error);
+		return anjuta_autogen_execute (priv->autogen,
+		                               cg_generator_autogen_source_func,
+		                               generator, error);
 	}
 }
 
diff --git a/plugins/class-gen/plugin.c b/plugins/class-gen/plugin.c
index ba424ea..36c1898 100644
--- a/plugins/class-gen/plugin.c
+++ b/plugins/class-gen/plugin.c
@@ -22,13 +22,13 @@
 #include <glib/gi18n.h>
 #include <libanjuta/anjuta-preferences.h>
 #include <libanjuta/anjuta-debug.h>
+#include <libanjuta/anjuta-autogen.h>
 #include <libanjuta/interfaces/ianjuta-wizard.h>
 #include <libanjuta/interfaces/ianjuta-project-manager.h>
 #include <libanjuta/interfaces/ianjuta-file-loader.h>
 #include <libanjuta/interfaces/ianjuta-vcs.h>
 #include <libanjuta/interfaces/ianjuta-document-manager.h>
 
-#include <plugins/project-wizard/autogen.h>
 
 #include "plugin.h"
 /* #include "class_gen.h" */
@@ -91,7 +91,7 @@ activate_plugin (AnjutaPlugin *plugin)
 	cg_plugin->top_dir = NULL;
 
 	/* Check if autogen is present */
-	if(!npw_check_autogen())
+	if(!anjuta_check_autogen())
 	{
 		anjuta_util_dialog_error(
 			NULL,
diff --git a/plugins/project-wizard/Makefile.am b/plugins/project-wizard/Makefile.am
index 015fd73..7e45cf6 100644
--- a/plugins/project-wizard/Makefile.am
+++ b/plugins/project-wizard/Makefile.am
@@ -49,8 +49,6 @@ libanjuta_project_wizard_la_SOURCES= \
 	header.h \
 	property.c \
 	property.h \
-	values.c \
-	values.h \
 	file.c \
 	file.h \
 	action.c \
@@ -59,8 +57,6 @@ libanjuta_project_wizard_la_SOURCES= \
 	parser.h \
 	install.c \
 	install.h \
-	autogen.c \
-	autogen.h \
 	tar.c \
 	tar.h
 
diff --git a/plugins/project-wizard/druid.c b/plugins/project-wizard/druid.c
index 8fc2dc1..d50298a 100644
--- a/plugins/project-wizard/druid.c
+++ b/plugins/project-wizard/druid.c
@@ -32,10 +32,10 @@
 #include "property.h"
 #include "parser.h"
 #include "install.h"
-#include "autogen.h"
 
 #include <libanjuta/anjuta-debug.h>
 #include <libanjuta/anjuta-utils.h>
+#include <libanjuta/anjuta-autogen.h>
 #include <libanjuta/interfaces/ianjuta-wizard.h>
 #include <libanjuta/interfaces/ianjuta-editor.h>
 #include <stdlib.h>
@@ -119,7 +119,7 @@ struct _NPWDruid
 	NPWPageParser* parser;
 	GList* header_list;
 	NPWHeader* header;
-	NPWAutogen* gen;
+	AnjutaAutogen* gen;
 	gboolean busy;
 };
 
@@ -390,7 +390,7 @@ npw_druid_fill_selection_page (NPWDruid* druid, const gchar *directory)
 	/* Remove all previous data */
 	gtk_notebook_remove_page(druid->project_book, 0);
 	npw_header_list_free (druid->header_list);
-	npw_autogen_clear_library_path (druid->gen);
+	anjuta_autogen_clear_library_path (druid->gen);
 
 	/* Create list of projects */
 	druid->header_list = npw_header_list_new ();
@@ -401,7 +401,7 @@ npw_druid_fill_selection_page (NPWDruid* druid, const gchar *directory)
 		 * other directories can still be used to get included
 		 * files */
 		npw_header_list_readdir (&druid->header_list, directory);
-		npw_autogen_set_library_path (druid->gen, directory);
+		anjuta_autogen_set_library_path (druid->gen, directory);
 	}
 
 	dir = g_build_filename (g_get_user_data_dir (), "anjuta", "project", NULL);
@@ -412,7 +412,7 @@ npw_druid_fill_selection_page (NPWDruid* druid, const gchar *directory)
 	 	* the first template read override the others */
 		npw_header_list_readdir (&druid->header_list, dir);
 	}
-	npw_autogen_set_library_path (druid->gen, dir);
+	anjuta_autogen_set_library_path (druid->gen, dir);
 	g_free (dir);
 
 	for (sys_dir = g_get_system_data_dirs (); *sys_dir != NULL; sys_dir++)
@@ -423,7 +423,7 @@ npw_druid_fill_selection_page (NPWDruid* druid, const gchar *directory)
 			/* Read project template in system directory */
 			npw_header_list_readdir (&druid->header_list, dir);
 		}
-		npw_autogen_set_library_path (druid->gen, dir);
+		anjuta_autogen_set_library_path (druid->gen, dir);
 		g_free (dir);
 	}
 
@@ -432,7 +432,7 @@ npw_druid_fill_selection_page (NPWDruid* druid, const gchar *directory)
 		/* Read anjuta installation directory */
 		npw_header_list_readdir (&druid->header_list, PROJECT_WIZARD_DIRECTORY);
 	}
-	npw_autogen_set_library_path (druid->gen, PROJECT_WIZARD_DIRECTORY);
+	anjuta_autogen_set_library_path (druid->gen, PROJECT_WIZARD_DIRECTORY);
 
 	if (g_list_length (druid->header_list) == 0)
 	{
@@ -836,7 +836,7 @@ on_project_wizard_key_press_event(GtkWidget *widget, GdkEventKey *event,
 }
 
 static void
-on_druid_get_new_page (NPWAutogen* gen, gpointer data)
+on_druid_get_new_page (AnjutaAutogen* gen, gpointer data)
 {
 	NPWDruid* druid = (NPWDruid *)data;
 	gint current;
@@ -1042,7 +1042,7 @@ on_druid_real_prepare (GtkAssistant* assistant, GtkWidget *page, NPWDruid* druid
 
 				/* Change project */
 				druid->project_file = new_project;
-				npw_autogen_set_input_file (druid->gen, druid->project_file, "[+","+]");
+				anjuta_autogen_set_input_file (druid->gen, druid->project_file, "[+","+]");
 
 			}
 		}
@@ -1065,9 +1065,9 @@ on_druid_real_prepare (GtkAssistant* assistant, GtkWidget *page, NPWDruid* druid
 				npw_page_parser_free (druid->parser);
 			druid->parser = npw_page_parser_new (npw_druid_add_new_page (druid), druid->project_file, previous);
 
-			npw_autogen_set_output_callback (druid->gen, on_druid_parse_page, druid->parser);
-			npw_autogen_write_definition_file_from_hash (druid->gen, druid->values);
-			npw_autogen_execute (druid->gen, on_druid_get_new_page, druid, NULL);
+			anjuta_autogen_set_output_callback (druid->gen, on_druid_parse_page, druid->parser);
+			anjuta_autogen_write_definition_file (druid->gen, druid->values, NULL);
+			anjuta_autogen_execute (druid->gen, on_druid_get_new_page, druid, NULL);
 		}
 		else
 		{
@@ -1128,7 +1128,7 @@ on_druid_finish (GtkAssistant* assistant, NPWDruid* druid)
 	inst = npw_install_new (druid->plugin);
 	npw_install_set_property (inst, druid->values);
 	npw_install_set_wizard_file (inst, npw_header_get_filename (druid->header));
-	for (path = g_list_last (npw_autogen_get_library_paths (druid->gen)); path != NULL; path = g_list_previous (path))
+	for (path = g_list_last (anjuta_autogen_get_library_paths (druid->gen)); path != NULL; path = g_list_previous (path))
 	{
 		npw_install_set_library_path (inst, (const gchar *)path->data);
 	}
@@ -1253,7 +1253,7 @@ npw_druid_new (NPWPlugin* plugin, const gchar *directory)
 	NPWDruid* druid;
 
 	/* Check if autogen is present */
-	if (!npw_check_autogen())
+	if (!anjuta_check_autogen())
 	{
 		anjuta_util_dialog_error (NULL, _("Could not find autogen version 5; please install the autogen package. You can get it from http://autogen.sourceforge.net.";));
 		return NULL;
@@ -1265,7 +1265,7 @@ npw_druid_new (NPWPlugin* plugin, const gchar *directory)
 	druid->busy = FALSE;
 	druid->page_list = g_queue_new ();
 	druid->values = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify)g_free);
-	druid->gen = npw_autogen_new ();
+	druid->gen = anjuta_autogen_new ();
 	druid->plugin = plugin;
 	druid->error_extra_widget = NULL;
 
@@ -1296,7 +1296,7 @@ npw_druid_free (NPWDruid* druid)
 	}
 	g_queue_free (druid->page_list);
 	g_hash_table_destroy (druid->values);
-	npw_autogen_free (druid->gen);
+	anjuta_autogen_free (druid->gen);
 	if (druid->parser != NULL) npw_page_parser_free (druid->parser);
 	npw_header_list_free (druid->header_list);
 	gtk_widget_destroy (GTK_WIDGET (druid->window));
diff --git a/plugins/project-wizard/install.c b/plugins/project-wizard/install.c
index 98e00dc..26ffdc7 100644
--- a/plugins/project-wizard/install.c
+++ b/plugins/project-wizard/install.c
@@ -30,10 +30,10 @@
 #include "plugin.h"
 #include "file.h"
 #include "parser.h"
-#include "autogen.h"
 #include "action.h"
 
 #include <libanjuta/interfaces/ianjuta-file-loader.h>
+#include <libanjuta/anjuta-autogen.h>
 #include <libanjuta/anjuta-launcher.h>
 #include <libanjuta/anjuta-debug.h>
 
@@ -55,7 +55,7 @@
 
 struct _NPWInstall
 {
-	NPWAutogen* gen;
+	AnjutaAutogen* gen;
 	NPWFileListParser* file_parser;
 	GList* file_list;
 	GList* current_file;
@@ -70,7 +70,7 @@ struct _NPWInstall
 
 /*---------------------------------------------------------------------------*/
 
-static void on_install_end_install_file (NPWAutogen* gen, gpointer data);
+static void on_install_end_install_file (AnjutaAutogen* gen, gpointer data);
 static void on_run_terminated (AnjutaLauncher* launcher, gint pid, gint status, gulong time, NPWInstall* this);
 static gboolean npw_install_install_file (NPWInstall* this);
 static gboolean npw_run_action (NPWInstall* this);
@@ -193,7 +193,7 @@ NPWInstall* npw_install_new (NPWPlugin* plugin)
 	if (plugin->install != NULL) return plugin->install;
 
 	this = g_new0(NPWInstall, 1);
-	this->gen = npw_autogen_new ();
+	this->gen = anjuta_autogen_new ();
 	this->plugin = plugin;
 	this->success = TRUE;
 	npw_plugin_create_view (plugin);
@@ -228,7 +228,7 @@ void npw_install_free (NPWInstall* this)
 		g_signal_handlers_disconnect_by_func (G_OBJECT (this->launcher), G_CALLBACK (on_run_terminated), this);
 		g_object_unref (this->launcher);
 	}
-	npw_autogen_free (this->gen);
+	anjuta_autogen_free (this->gen);
 	this->plugin->install = NULL;
 	g_free (this);
 }
@@ -236,7 +236,7 @@ void npw_install_free (NPWInstall* this)
 gboolean
 npw_install_set_property (NPWInstall* this, GHashTable* values)
 {
-	npw_autogen_write_definition_file_from_hash (this->gen, values);
+	anjuta_autogen_write_definition_file (this->gen, values, NULL);
 
 	return TRUE;
 }
@@ -256,7 +256,7 @@ npw_install_set_wizard_file (NPWInstall* this, const gchar* filename)
 	}
 	this->file_parser = npw_file_list_parser_new (filename);
 
-	npw_autogen_set_input_file (this->gen, filename, "[+","+]");
+	anjuta_autogen_set_input_file (this->gen, filename, "[+","+]");
 
 	return TRUE;
 }
@@ -264,7 +264,7 @@ npw_install_set_wizard_file (NPWInstall* this, const gchar* filename)
 gboolean
 npw_install_set_library_path (NPWInstall* this, const gchar *directory)
 {
-	npw_autogen_set_library_path (this->gen, directory);
+	anjuta_autogen_set_library_path (this->gen, directory);
 
 	return TRUE;
 }
@@ -326,7 +326,7 @@ on_install_end_action (gpointer data)
 }
 
 static void
-on_install_read_all_action_list (NPWAutogen* gen, gpointer data)
+on_install_read_all_action_list (AnjutaAutogen* gen, gpointer data)
 {
 	NPWInstall* this = (NPWInstall*)data;
 
@@ -344,7 +344,7 @@ on_install_read_file_list (const gchar* output, gpointer data)
 }
 
 static void
-on_install_read_all_file_list (NPWAutogen* gen, gpointer data)
+on_install_read_all_file_list (AnjutaAutogen* gen, gpointer data)
 {
 	NPWInstall* this = (NPWInstall*)data;
 
@@ -364,12 +364,12 @@ on_install_read_all_file_list (NPWAutogen* gen, gpointer data)
 		npw_action_list_parser_free (this->action_parser);
 	}
 	this->action_parser = npw_action_list_parser_new ();
-	npw_autogen_set_output_callback (this->gen, on_install_read_action_list, this);
-	npw_autogen_execute (this->gen, on_install_read_all_action_list, this, NULL);
+	anjuta_autogen_set_output_callback (this->gen, on_install_read_action_list, this);
+	anjuta_autogen_execute (this->gen, on_install_read_all_action_list, this, NULL);
 }
 
 static void
-on_install_end_install_file (NPWAutogen* gen, gpointer data)
+on_install_end_install_file (AnjutaAutogen* gen, gpointer data)
 {
 	NPWInstall* this = (NPWInstall*)data;
 
@@ -440,8 +440,8 @@ on_install_end_install_file (NPWAutogen* gen, gpointer data)
 gboolean
 npw_install_launch (NPWInstall* this)
 {
-	npw_autogen_set_output_callback (this->gen, on_install_read_file_list, this);
-	npw_autogen_execute (this->gen, on_install_read_all_file_list, this, NULL);
+	anjuta_autogen_set_output_callback (this->gen, on_install_read_file_list, this);
+	anjuta_autogen_execute (this->gen, on_install_read_all_file_list, this, NULL);
 
 	return TRUE;
 }
@@ -520,9 +520,9 @@ npw_install_install_file (NPWInstall* this)
 	{
 		if (use_autogen)
 		{
-			npw_autogen_set_input_file (this->gen, source, NULL, NULL);
-			npw_autogen_set_output_file (this->gen, destination);
-			ok = npw_autogen_execute (this->gen, on_install_end_install_file, this, NULL);
+			anjuta_autogen_set_input_file (this->gen, source, NULL, NULL);
+			anjuta_autogen_set_output_file (this->gen, destination);
+			ok = anjuta_autogen_execute (this->gen, on_install_end_install_file, this, NULL);
 			msg = g_strdup_printf (_("Creating %s (using AutoGen)â %s"), destination, ok ? "Ok" : "Fail to Execute");
 		}
 		else
diff --git a/plugins/project-wizard/install.h b/plugins/project-wizard/install.h
index 303963f..1a46e21 100644
--- a/plugins/project-wizard/install.h
+++ b/plugins/project-wizard/install.h
@@ -36,7 +36,7 @@ void npw_install_free (NPWInstall* this);
 
 gboolean npw_install_set_property (NPWInstall* this, GHashTable* values);
 gboolean npw_install_set_wizard_file (NPWInstall* this, const gchar* filename);
-gboolean npw_install_set_libray_path (NPWInstall *this, const gchar *directory);
+gboolean npw_install_set_library_path (NPWInstall *this, const gchar *directory);
 gboolean npw_install_launch (NPWInstall* this);
 
 #endif
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 648a0dd..1e7cda3 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -2,6 +2,7 @@
 # List of source files containing translatable strings.
 # Please keep this list in alphabetical order.
 anjuta.desktop.in.in
+libanjuta/anjuta-autogen.c
 libanjuta/anjuta-cell-renderer-captioned-image.c
 libanjuta/anjuta-c-module.c
 libanjuta/anjuta-column-text-view.c



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