[anjuta] am-project: Do not check characters on root group node
- From: Sebastien Granjoux <sgranjoux src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] am-project: Do not check characters on root group node
- Date: Thu, 5 May 2011 20:19:00 +0000 (UTC)
commit f16419c3ef410f1c021888a942b4fc2ead35b00e
Author: Sébastien Granjoux <seb sfo free fr>
Date: Wed May 4 22:37:13 2011 +0200
am-project: Do not check characters on root group node
plugins/am-project/am-project.c | 26 +++++++++++++-------------
plugins/am-project/amp-group.c | 23 +++++++++++++++--------
plugins/am-project/amp-group.h | 3 ++-
plugins/am-project/amp-module.c | 8 +++++++-
plugins/am-project/amp-module.h | 3 ++-
plugins/am-project/amp-node.c | 12 ++++++------
plugins/am-project/amp-node.h | 8 +++++++-
plugins/am-project/amp-package.c | 12 +++++++++---
plugins/am-project/amp-package.h | 3 ++-
plugins/am-project/amp-root.c | 8 +++++++-
plugins/am-project/amp-root.h | 3 ++-
plugins/am-project/amp-source.c | 8 +++++++-
plugins/am-project/amp-source.h | 3 ++-
plugins/am-project/amp-target.c | 27 +++++++++++++++++----------
plugins/am-project/amp-target.h | 3 ++-
15 files changed, 100 insertions(+), 50 deletions(-)
---
diff --git a/plugins/am-project/am-project.c b/plugins/am-project/am-project.c
index 75f0684..bd77ed0 100644
--- a/plugins/am-project/am-project.c
+++ b/plugins/am-project/am-project.c
@@ -720,7 +720,7 @@ amp_project_load_module (AmpProject *project, AnjutaToken *module_token)
/* Module name */
arg = anjuta_token_first_item (module_token);
value = anjuta_token_evaluate (arg);
- module = amp_module_node_new (value, NULL);
+ module = amp_module_node_new (value);
amp_module_node_add_token (module, module_token);
anjuta_project_node_append (ANJUTA_PROJECT_NODE (project), ANJUTA_PROJECT_NODE (module));
@@ -762,7 +762,7 @@ amp_project_load_module (AmpProject *project, AnjutaToken *module_token)
}
else
{
- package = amp_package_node_new (value, NULL);
+ package = amp_package_node_new (value);
amp_package_node_add_token (package, item);
anjuta_project_node_append (ANJUTA_PROJECT_NODE (module), ANJUTA_PROJECT_NODE (package));
anjuta_project_node_set_state (ANJUTA_PROJECT_NODE (package), ANJUTA_PROJECT_INCOMPLETE);
@@ -859,7 +859,7 @@ project_load_target (AmpProject *project, AnjutaProjectNode *parent, AnjutaToken
}
/* Create target */
- target = amp_target_node_new (value, info->base.type, install, flags, NULL);
+ target = amp_target_node_new_valid (value, info->base.type, install, flags, NULL);
if (target != NULL)
{
amp_target_node_add_token (target, ANJUTA_TOKEN_ARGUMENT, arg);
@@ -988,7 +988,7 @@ project_load_sources (AmpProject *project, AnjutaProjectNode *parent, AnjutaToke
}
else
{
- target = ANJUTA_PROJECT_NODE (amp_target_node_new ("dummy", 0, NULL, 0, NULL));
+ target = ANJUTA_PROJECT_NODE (amp_target_node_new ("dummy", 0, NULL, 0));
}
g_hash_table_insert (orphan_properties, target_id, target);
}
@@ -1009,7 +1009,7 @@ project_load_sources (AmpProject *project, AnjutaProjectNode *parent, AnjutaToke
/* Create source */
src_file = g_file_get_child (parent_file, value);
- source = amp_node_new (parent, ANJUTA_PROJECT_SOURCE | ANJUTA_PROJECT_PROJECT, src_file, NULL, NULL);
+ source = amp_node_new_valid (parent, ANJUTA_PROJECT_SOURCE | ANJUTA_PROJECT_PROJECT, src_file, NULL, NULL);
g_object_unref (src_file);
if (source != NULL)
{
@@ -1061,7 +1061,7 @@ project_load_data (AmpProject *project, AnjutaProjectNode *parent, AnjutaToken *
if ((gchar *)find == target_id)
{
/* Create target */
- target = amp_target_node_new (target_id, info->base.type, install, flags, NULL);
+ target = amp_target_node_new_valid (target_id, info->base.type, install, flags, NULL);
if (target != NULL)
{
anjuta_project_node_append (parent, ANJUTA_PROJECT_NODE (target));
@@ -1091,7 +1091,7 @@ project_load_data (AmpProject *project, AnjutaProjectNode *parent, AnjutaToken *
/* Create source */
src_file = g_file_get_child (parent_file, value);
- source = amp_node_new (parent, ANJUTA_PROJECT_SOURCE | ANJUTA_PROJECT_PROJECT | data_flags, src_file, NULL, NULL);
+ source = amp_node_new_valid (parent, ANJUTA_PROJECT_SOURCE | ANJUTA_PROJECT_PROJECT | data_flags, src_file, NULL, NULL);
g_object_unref (src_file);
if (source != NULL)
{
@@ -1179,7 +1179,7 @@ project_load_target_properties (AmpProject *project, AnjutaProjectNode *parent,
else
{
/* Create dummy target */
- parent = ANJUTA_PROJECT_NODE (amp_target_node_new ("dummy", 0, NULL, 0, NULL));
+ parent = ANJUTA_PROJECT_NODE (amp_target_node_new ("dummy", 0, NULL, 0));
}
g_hash_table_insert (orphan_properties, target_id, parent);
}
@@ -1265,7 +1265,7 @@ project_load_subdirs (AmpProject *project, AnjutaToken *list, AnjutaProjectNode
else
{
/* Create new group */
- group = amp_group_node_new (subdir, dist_only, NULL);
+ group = amp_group_node_new_valid (subdir, dist_only, NULL);
/* Group can be NULL if the name is not valid */
if (group != NULL)
@@ -1603,7 +1603,7 @@ amp_project_load_root (AmpProject *project, GError **error)
}
/* Load all makefiles recursively */
- group = amp_group_node_new (root_file, FALSE, NULL);
+ group = amp_group_node_new (root_file, FALSE);
g_hash_table_insert (project->groups, g_file_get_uri (root_file), group);
anjuta_project_node_append (ANJUTA_PROJECT_NODE (project), ANJUTA_PROJECT_NODE (group));
@@ -1611,7 +1611,7 @@ amp_project_load_root (AmpProject *project, GError **error)
{
g_set_error (error, IANJUTA_PROJECT_ERROR,
IANJUTA_PROJECT_ERROR_DOESNT_EXIST,
- _("Project doesn't exist or invalid path"));
+ _("Project doesn't exist or has an invalid path"));
return FALSE;
}
@@ -2228,7 +2228,7 @@ iproject_add_node_before (IAnjutaProject *obj, AnjutaProjectNode *parent, Anjuta
if (AMP_PROJECT (obj)->queue == NULL) AMP_PROJECT (obj)->queue = pm_command_queue_new ();
- node = amp_node_new (parent, type, file, name, err);
+ node = amp_node_new_valid (parent, type, file, name, err);
if (node != NULL)
{
add_job = pm_job_new (&_add_before_job, node, parent, sibling, ANJUTA_PROJECT_UNKNOWN, NULL, NULL, obj);
@@ -2246,7 +2246,7 @@ iproject_add_node_after (IAnjutaProject *obj, AnjutaProjectNode *parent, AnjutaP
if (AMP_PROJECT (obj)->queue == NULL) AMP_PROJECT (obj)->queue = pm_command_queue_new ();
- node = amp_node_new (parent, type, file, name, err);
+ node = amp_node_new_valid (parent, type, file, name, err);
if (node != NULL)
{
add_job = pm_job_new (&_add_after_job, node, parent, sibling, ANJUTA_PROJECT_UNKNOWN, NULL, NULL, obj);
diff --git a/plugins/am-project/amp-group.c b/plugins/am-project/amp-group.c
index ec2fbef..e8f9fa7 100644
--- a/plugins/am-project/amp-group.c
+++ b/plugins/am-project/amp-group.c
@@ -170,7 +170,7 @@ project_load_group_module (AmpProject *project, AmpGroupNode *group)
/* Add new module */
AnjutaProjectNode *new_module;
- new_module = amp_node_new (target, ANJUTA_PROJECT_MODULE, NULL, name, NULL);
+ new_module = amp_node_new_valid (target, ANJUTA_PROJECT_MODULE, NULL, name, NULL);
anjuta_project_node_append (target, new_module);
}
g_free (cpp_flags);
@@ -538,9 +538,21 @@ amp_group_node_set_file (AmpGroupNode *group, GFile *new_file)
}
AmpGroupNode*
-amp_group_node_new (GFile *file, gboolean dist_only, GError **error)
+amp_group_node_new (GFile *file, gboolean dist_only)
{
AmpGroupNode *node = NULL;
+
+ node = g_object_new (AMP_TYPE_GROUP_NODE, NULL);
+ node->base.file = g_object_ref (file);
+ node->dist_only = dist_only;
+ memset (node->tokens, 0, sizeof (node->tokens));
+
+ return node;
+}
+
+AmpGroupNode*
+amp_group_node_new_valid (GFile *file, gboolean dist_only, GError **error)
+{
gchar *name;
/* Validate group name */
@@ -568,13 +580,8 @@ amp_group_node_new (GFile *file, gboolean dist_only, GError **error)
}
}
g_free (name);
-
- node = g_object_new (AMP_TYPE_GROUP_NODE, NULL);
- node->base.file = g_object_ref (file);
- node->dist_only = dist_only;
- memset (node->tokens, 0, sizeof (node->tokens));
- return node;
+ return amp_group_node_new (file, dist_only);
}
void
diff --git a/plugins/am-project/amp-group.h b/plugins/am-project/amp-group.h
index 6b6679c..80650a4 100644
--- a/plugins/am-project/amp-group.h
+++ b/plugins/am-project/amp-group.h
@@ -75,7 +75,8 @@ gchar *amp_group_node_get_makefile_name (AmpGroupNode *group);
gboolean amp_group_node_update_makefile (AmpGroupNode *group, AnjutaToken *token);
void amp_group_node_update_variable (AmpGroupNode *group, AnjutaToken *variable);
AnjutaToken* amp_group_node_get_variable_token (AmpGroupNode *group, AnjutaToken *variable);
-AmpGroupNode* amp_group_node_new (GFile *file, gboolean dist_only, GError **error);
+AmpGroupNode* amp_group_node_new_valid (GFile *file, gboolean dist_only, GError **error);
+AmpGroupNode* amp_group_node_new (GFile *file, gboolean dist_only);
void amp_group_node_free (AmpGroupNode *node);
void amp_group_node_update_node (AmpGroupNode *node, AmpGroupNode *new_node);
gboolean amp_group_node_set_file (AmpGroupNode *group, GFile *new_file);
diff --git a/plugins/am-project/amp-module.c b/plugins/am-project/amp-module.c
index 2a131cf..877e197 100644
--- a/plugins/am-project/amp-module.c
+++ b/plugins/am-project/amp-module.c
@@ -82,7 +82,7 @@ amp_module_node_update_node (AmpModuleNode *node, AmpModuleNode *new_node)
}
AmpModuleNode*
-amp_module_node_new (const gchar *name, GError **error)
+amp_module_node_new (const gchar *name)
{
AmpModuleNode *module = NULL;
@@ -92,6 +92,12 @@ amp_module_node_new (const gchar *name, GError **error)
return module;
}
+AmpModuleNode*
+amp_module_node_new_valid (const gchar *name, GError **error)
+{
+ return amp_module_node_new (name);
+}
+
void
amp_module_node_free (AmpModuleNode *node)
{
diff --git a/plugins/am-project/amp-module.h b/plugins/am-project/amp-module.h
index bac3c8f..c072aa1 100644
--- a/plugins/am-project/amp-module.h
+++ b/plugins/am-project/amp-module.h
@@ -43,7 +43,8 @@ GType amp_module_node_get_type (void) G_GNUC_CONST;
void amp_module_node_register (GTypeModule *module);
-AmpModuleNode* amp_module_node_new (const gchar *name, GError **error);
+AmpModuleNode* amp_module_node_new (const gchar *name);
+AmpModuleNode* amp_module_node_new_valid (const gchar *name, GError **error);
void amp_module_node_free (AmpModuleNode *node);
AnjutaToken *amp_module_node_get_token (AmpModuleNode *node);
void amp_module_node_add_token (AmpModuleNode *group, AnjutaToken *token);
diff --git a/plugins/am-project/amp-node.c b/plugins/am-project/amp-node.c
index dfa308e..2008d07 100644
--- a/plugins/am-project/amp-node.c
+++ b/plugins/am-project/amp-node.c
@@ -46,7 +46,7 @@
*---------------------------------------------------------------------------*/
AnjutaProjectNode *
-amp_node_new (AnjutaProjectNode *parent, AnjutaProjectNodeType type, GFile *file, const gchar *name, GError **error)
+amp_node_new_valid(AnjutaProjectNode *parent, AnjutaProjectNodeType type, GFile *file, const gchar *name, GError **error)
{
AnjutaProjectNode *node = NULL;
GFile *new_file = NULL;
@@ -65,10 +65,10 @@ amp_node_new (AnjutaProjectNode *parent, AnjutaProjectNodeType type, GFile *file
}
file = new_file;
}
- node = ANJUTA_PROJECT_NODE (amp_group_node_new (file, FALSE, error));
+ node = ANJUTA_PROJECT_NODE (amp_group_node_new_valid (file, FALSE, error));
break;
case ANJUTA_PROJECT_TARGET:
- node = ANJUTA_PROJECT_NODE (amp_target_node_new (name, type, NULL, 0, error));
+ node = ANJUTA_PROJECT_NODE (amp_target_node_new_valid (name, type, NULL, 0, error));
break;
case ANJUTA_PROJECT_SOURCE:
/* Look for parent */
@@ -124,13 +124,13 @@ amp_node_new (AnjutaProjectNode *parent, AnjutaProjectNodeType type, GFile *file
}
}
- node = ANJUTA_PROJECT_NODE (amp_source_node_new (file, error));
+ node = ANJUTA_PROJECT_NODE (amp_source_node_new_valid (file, error));
break;
case ANJUTA_PROJECT_MODULE:
- node = ANJUTA_PROJECT_NODE (amp_module_node_new (name, error));
+ node = ANJUTA_PROJECT_NODE (amp_module_node_new_valid (name, error));
break;
case ANJUTA_PROJECT_PACKAGE:
- node = ANJUTA_PROJECT_NODE (amp_package_node_new (name, error));
+ node = ANJUTA_PROJECT_NODE (amp_package_node_new_valid (name, error));
break;
default:
g_assert_not_reached ();
diff --git a/plugins/am-project/amp-node.h b/plugins/am-project/amp-node.h
index 224b04e..3cafe29 100644
--- a/plugins/am-project/amp-node.h
+++ b/plugins/am-project/amp-node.h
@@ -87,7 +87,13 @@ struct _AmpNodeClass
GType amp_node_get_type (void) G_GNUC_CONST;
-AnjutaProjectNode * amp_node_new (AnjutaProjectNode *parent,
+AnjutaProjectNode * amp_node_new_valid (AnjutaProjectNode *parent,
+ AnjutaProjectNodeType type,
+ GFile *file,
+ const gchar *name,
+ GError **error);
+
+AnjutaProjectNode * amp_node_new_valid (AnjutaProjectNode *parent,
AnjutaProjectNodeType type,
GFile *file,
const gchar *name,
diff --git a/plugins/am-project/amp-package.c b/plugins/am-project/amp-package.c
index 83afdc7..059f550 100644
--- a/plugins/am-project/amp-package.c
+++ b/plugins/am-project/amp-package.c
@@ -58,7 +58,7 @@ struct _AmpPackageNode {
*---------------------------------------------------------------------------*/
AmpPackageNode*
-amp_package_node_new (const gchar *name, GError **error)
+amp_package_node_new (const gchar *name)
{
AmpPackageNode *node = NULL;
@@ -68,6 +68,12 @@ amp_package_node_new (const gchar *name, GError **error)
return node;
}
+AmpPackageNode*
+amp_package_node_new_valid (const gchar *name, GError **error)
+{
+ return amp_package_node_new (name);
+}
+
void
amp_package_node_free (AmpPackageNode *node)
{
@@ -124,7 +130,7 @@ amp_package_node_load (AmpNode *node, AmpNode *parent, AmpProject *project, GErr
/* Create a package node for the depedencies */
AnjutaProjectNode *pkg;
- pkg = amp_node_new (ANJUTA_PROJECT_NODE (parent), ANJUTA_PROJECT_PACKAGE, NULL, dep->data, NULL);
+ pkg = ANJUTA_PROJECT_NODE (amp_package_node_new (dep->data));
anjuta_project_node_append (ANJUTA_PROJECT_NODE (node), pkg);
}
anjuta_util_glist_strings_free (deps);
@@ -153,7 +159,7 @@ amp_package_node_load (AmpNode *node, AmpNode *parent, AmpProject *project, GErr
/* Create a source for files */
AnjutaProjectNode *source;
- source = amp_node_new (ANJUTA_PROJECT_NODE (parent), ANJUTA_PROJECT_SOURCE, (GFile *)file->data, NULL, NULL);
+ source = amp_node_new_valid (ANJUTA_PROJECT_NODE (parent), ANJUTA_PROJECT_SOURCE, (GFile *)file->data, NULL, NULL);
anjuta_project_node_append (ANJUTA_PROJECT_NODE (node), source);
g_object_unref ((GObject *)file->data);
}
diff --git a/plugins/am-project/amp-package.h b/plugins/am-project/amp-package.h
index 3e1f9b1..b753097 100644
--- a/plugins/am-project/amp-package.h
+++ b/plugins/am-project/amp-package.h
@@ -43,7 +43,8 @@ GType amp_package_node_get_type (void) G_GNUC_CONST;
void amp_package_node_register (GTypeModule *module);
-AmpPackageNode* amp_package_node_new (const gchar *name, GError **error);
+AmpPackageNode* amp_package_node_new (const gchar *name);
+AmpPackageNode* amp_package_node_new_valid (const gchar *name, GError **error);
void amp_package_node_free (AmpPackageNode *node);
void amp_package_node_set_version (AmpPackageNode *node, const gchar *compare, const gchar *version);
AnjutaToken *amp_package_node_get_token (AmpPackageNode *node);
diff --git a/plugins/am-project/amp-root.c b/plugins/am-project/amp-root.c
index 2ef3458..79a6e75 100644
--- a/plugins/am-project/amp-root.c
+++ b/plugins/am-project/amp-root.c
@@ -61,7 +61,7 @@ amp_root_node_set_file (AmpRootNode *root, GFile *new_file)
}
AnjutaProjectNode*
-amp_root_node_new (GFile *file, GError **error)
+amp_root_node_new (GFile *file)
{
AmpRootNode *node = NULL;
@@ -71,6 +71,12 @@ amp_root_node_new (GFile *file, GError **error)
return ANJUTA_PROJECT_NODE (node);
}
+AnjutaProjectNode*
+amp_root_node_new_valid (GFile *file, GError **error)
+{
+ return amp_root_node_new (file);
+}
+
void
amp_root_node_free (AmpRootNode *node)
{
diff --git a/plugins/am-project/amp-root.h b/plugins/am-project/amp-root.h
index 76205d0..39bf9e2 100644
--- a/plugins/am-project/amp-root.h
+++ b/plugins/am-project/amp-root.h
@@ -53,7 +53,8 @@ struct _AmpRootNodeClass {
void amp_root_node_register (GTypeModule *module);
-AnjutaProjectNode* amp_root_node_new (GFile *file, GError **error);
+AnjutaProjectNode* amp_root_node_new (GFile *file);
+AnjutaProjectNode* amp_root_node_new_valid (GFile *file, GError **error);
void amp_root_node_free (AmpRootNode *node);
gboolean amp_root_node_set_file (AmpRootNode *source, GFile *new_file);
diff --git a/plugins/am-project/amp-source.c b/plugins/am-project/amp-source.c
index d8326be..e816a33 100644
--- a/plugins/am-project/amp-source.c
+++ b/plugins/am-project/amp-source.c
@@ -75,7 +75,7 @@ amp_source_node_update_node (AmpSourceNode *node, AmpSourceNode *new_node)
}
AnjutaProjectNode*
-amp_source_node_new (GFile *file, GError **error)
+amp_source_node_new (GFile *file)
{
AmpSourceNode *node = NULL;
@@ -85,6 +85,12 @@ amp_source_node_new (GFile *file, GError **error)
return ANJUTA_PROJECT_NODE (node);
}
+AnjutaProjectNode*
+amp_source_node_new_valid (GFile *file, GError **error)
+{
+ return amp_source_node_new (file);
+}
+
gboolean
amp_source_node_set_file (AmpSourceNode *source, GFile *new_file)
{
diff --git a/plugins/am-project/amp-source.h b/plugins/am-project/amp-source.h
index 12a5db6..755ecb9 100644
--- a/plugins/am-project/amp-source.h
+++ b/plugins/am-project/amp-source.h
@@ -45,7 +45,8 @@ GType amp_source_node_get_type (void) G_GNUC_CONST;
void amp_source_node_register (GTypeModule *module);
-AnjutaProjectNode* amp_source_node_new (GFile *file, GError **error);
+AnjutaProjectNode* amp_source_node_new (GFile *file);
+AnjutaProjectNode* amp_source_node_new_valid (GFile *file, GError **error);
void amp_source_node_free (AmpSourceNode *node);
AnjutaToken *amp_source_node_get_token (AmpSourceNode *node);
void amp_source_node_add_token (AmpSourceNode *node, AnjutaToken *token);
diff --git a/plugins/am-project/amp-target.c b/plugins/am-project/amp-target.c
index d6795ae..8f57199 100644
--- a/plugins/am-project/amp-target.c
+++ b/plugins/am-project/amp-target.c
@@ -268,9 +268,22 @@ amp_target_node_update_node (AmpTargetNode *node, AmpTargetNode *new_node)
}
AmpTargetNode*
-amp_target_node_new (const gchar *name, AnjutaProjectNodeType type, const gchar *install, gint flags, GError **error)
+amp_target_node_new (const gchar *name, AnjutaProjectNodeType type, const gchar *install, gint flags)
+{
+ AmpTargetNode *node;
+
+ node = g_object_new (AMP_TYPE_TARGET_NODE, NULL);
+ amp_target_node_set_type (node, type);
+ node->base.name = g_strdup (name);
+ node->install = g_strdup (install);
+ node->flags = flags;
+
+ return node;
+}
+
+AmpTargetNode*
+amp_target_node_new_valid (const gchar *name, AnjutaProjectNodeType type, const gchar *install, gint flags, GError **error)
{
- AmpTargetNode *node = NULL;
const gchar *basename;
/* Validate target name */
@@ -319,14 +332,8 @@ amp_target_node_new (const gchar *name, AnjutaProjectNodeType type, const gchar
return NULL;
}
}
-
- node = g_object_new (AMP_TYPE_TARGET_NODE, NULL);
- amp_target_node_set_type (node, type);
- node->base.name = g_strdup (name);
- node->install = g_strdup (install);
- node->flags = flags;
-
- return node;
+
+ return amp_target_node_new (name, type, install, flags);
}
void
diff --git a/plugins/am-project/amp-target.h b/plugins/am-project/amp-target.h
index 644f8ec..38dd092 100644
--- a/plugins/am-project/amp-target.h
+++ b/plugins/am-project/amp-target.h
@@ -68,7 +68,8 @@ GList * amp_target_node_get_all_token (AmpTargetNode *target);
void amp_target_node_set_type (AmpTargetNode *target, AmTokenType type);
AnjutaTokenType amp_target_node_get_first_token_type (AmpTargetNode *target);
AnjutaTokenType amp_target_node_get_next_token_type (AmpTargetNode *target, AnjutaTokenType type);
-AmpTargetNode* amp_target_node_new (const gchar *name, AnjutaProjectNodeType type, const gchar *install, gint flags, GError **error);
+AmpTargetNode* amp_target_node_new (const gchar *name, AnjutaProjectNodeType type, const gchar *install, gint flags);
+AmpTargetNode* amp_target_node_new_valid (const gchar *name, AnjutaProjectNodeType type, const gchar *install, gint flags, GError **error);
void amp_target_node_free (AmpTargetNode *node);
void amp_target_node_update_node (AmpTargetNode *node, AmpTargetNode *new_node);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]