Commit bed225e6 authored by Sebastien Granjoux's avatar Sebastien Granjoux

am: Fix removing and adding modules

parent 5cbd9860
......@@ -1527,6 +1527,7 @@ AnjutaToken*
anjuta_token_free_children (AnjutaToken *token)
{
AnjutaToken *child;
AnjutaToken *last;
if (token == NULL) return NULL;
......@@ -1538,10 +1539,11 @@ anjuta_token_free_children (AnjutaToken *token)
if (token->last != NULL)
{
last = token->last;
for (child = anjuta_token_next (token); child != NULL; child = anjuta_token_next (token))
{
anjuta_token_free (child);
if (child == token->last) break;
if (child == last) break;
}
}
token->last = NULL;
......
......@@ -264,6 +264,7 @@ amp_module_create_token (AmpProject *project, AnjutaAmModuleNode *module, GErro
gboolean after;
AnjutaToken *token;
AnjutaToken *prev;
AnjutaToken *next;
AnjutaProjectNode *sibling;
/* Get root node */
......@@ -280,7 +281,11 @@ amp_module_create_token (AmpProject *project, AnjutaAmModuleNode *module, GErro
if (anjuta_project_node_get_node_type (sibling) == ANJUTA_PROJECT_MODULE)
{
prev = amp_module_get_token (ANJUTA_AM_MODULE_NODE (sibling));
if (prev != NULL) break;
if (prev != NULL)
{
prev = anjuta_token_list (prev);
break;
}
}
}
if (prev == NULL)
......@@ -291,12 +296,21 @@ amp_module_create_token (AmpProject *project, AnjutaAmModuleNode *module, GErro
if (anjuta_project_node_get_node_type (sibling) == ANJUTA_PROJECT_MODULE)
{
prev = amp_module_get_token (ANJUTA_AM_MODULE_NODE (sibling));
if (prev != NULL) break;
if (prev != NULL)
{
prev = anjuta_token_list (prev);
break;
}
}
}
}
token = amp_project_write_module_list (root, anjuta_project_node_get_name (ANJUTA_PROJECT_NODE (module)), after, prev);
next = anjuta_token_next (token);
next = anjuta_token_next (next);
next = anjuta_token_next (next);
amp_module_add_token (module, next);
amp_root_update_configure (root, token);
return TRUE;
......
......@@ -382,9 +382,15 @@ anjuta_am_root_node_class_init (AnjutaAmRootNodeClass *klass)
void
amp_module_add_token (AnjutaAmModuleNode *module, AnjutaToken *token)
{
gchar *name;
module->module = token;
g_free (module->base.name);
module->base.name = anjuta_token_evaluate (anjuta_token_first_item (token));
name = anjuta_token_evaluate (anjuta_token_first_item (token));
if (name != NULL)
{
g_free (module->base.name);
module->base.name = name;
}
}
AnjutaToken *
......
......@@ -757,7 +757,6 @@ amp_project_load_module (AmpProject *project, AnjutaToken *module_token)
AnjutaAmPackageNode *package;
gchar *compare;
/* Module name */
arg = anjuta_token_first_item (module_token);
value = anjuta_token_evaluate (arg);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment