[anjuta/newproject] Merge target and node type
- From: Sebastien Granjoux <sgranjoux src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta/newproject] Merge target and node type
- Date: Wed, 21 Apr 2010 13:41:36 +0000 (UTC)
commit 60faa38fc54cb6e2ca7ba65c3486c96627ff001a
Author: Sébastien Granjoux <seb sfo free fr>
Date: Tue Apr 20 22:25:14 2010 +0200
Merge target and node type
libanjuta/anjuta-project.c | 23 +--
libanjuta/anjuta-project.h | 33 +++-
libanjuta/interfaces/libanjuta.idl | 20 ++-
plugins/am-project/am-dialogs.c | 6 +-
plugins/am-project/am-project.c | 215 ++++++++++++++++-----------
plugins/am-project/am-project.h | 10 +-
plugins/am-project/am-properties.c | 6 +-
plugins/am-project/am-properties.h | 2 +-
plugins/am-project/projectparser.c | 31 ++--
plugins/am-project/tests/target.at | 4 +-
plugins/dir-project/dir-project.c | 41 +++++-
plugins/mk-project/mk-project-private.h | 2 +-
plugins/mk-project/mk-project.c | 73 ++++++----
plugins/mk-project/mk-project.h | 1 -
plugins/mk-project/mk-rule.c | 2 +-
plugins/project-manager/gbf-project-model.c | 12 +--
plugins/project-manager/gbf-project-util.c | 43 +++---
plugins/project-manager/plugin.c | 14 +-
plugins/project-manager/project.c | 6 +-
plugins/project-manager/project.h | 4 +-
20 files changed, 328 insertions(+), 220 deletions(-)
---
diff --git a/libanjuta/anjuta-project.c b/libanjuta/anjuta-project.c
index 2933fe9..3013478 100644
--- a/libanjuta/anjuta-project.c
+++ b/libanjuta/anjuta-project.c
@@ -661,12 +661,6 @@ anjuta_project_target_get_name (const AnjutaProjectNode *target)
return NODE_DATA (target)->name;
}
-AnjutaProjectTargetType
-anjuta_project_target_get_type (const AnjutaProjectNode *target)
-{
- return NODE_DATA (target)->target_type;
-}
-
/* Source access functions
*---------------------------------------------------------------------------*/
@@ -676,25 +670,25 @@ anjuta_project_source_get_file (const AnjutaProjectNode *source)
return NODE_DATA (source)->file;
}
-/* Target type functions
+/* Node information functions
*---------------------------------------------------------------------------*/
const gchar *
-anjuta_project_target_type_name (const AnjutaProjectTargetType type)
+anjuta_project_node_info_name (const AnjutaProjectNodeInfo *info)
{
- return type->name;
+ return info->name;
}
const gchar *
-anjuta_project_target_type_mime (const AnjutaProjectTargetType type)
+anjuta_project_node_info_mime (const AnjutaProjectNodeInfo *info)
{
- return type->mime_type;
+ return info->mime_type;
}
-AnjutaProjectTargetClass
-anjuta_project_target_type_class (const AnjutaProjectTargetType type)
+AnjutaProjectNodeType
+anjuta_project_node_info_type (const AnjutaProjectNodeInfo *info)
{
- return type->base;
+ return info->type;
}
/* Proxy node functions
@@ -739,7 +733,6 @@ anjuta_project_proxy_new (AnjutaProjectNode *node)
}
proxy->base.file = g_object_ref (data->file);
proxy->base.name = g_strdup (data->name);
- proxy->base.target_type = data->target_type;
node = g_node_new (proxy);
}
diff --git a/libanjuta/anjuta-project.h b/libanjuta/anjuta-project.h
index d5d6857..3f2294b 100644
--- a/libanjuta/anjuta-project.h
+++ b/libanjuta/anjuta-project.h
@@ -33,8 +33,27 @@ G_BEGIN_DECLS
typedef enum
{
ANJUTA_PROJECT_UNKNOWN = 0,
+ ANJUTA_PROJECT_SHAREDLIB,
+ ANJUTA_PROJECT_STATICLIB,
+ ANJUTA_PROJECT_BINARY,
+ ANJUTA_PROJECT_PYTHON,
+ ANJUTA_PROJECT_JAVA,
+ ANJUTA_PROJECT_LISP,
+ ANJUTA_PROJECT_HEADER,
+ ANJUTA_PROJECT_MAN,
+ ANJUTA_PROJECT_INFO,
+ ANJUTA_PROJECT_GENERIC,
+ ANJUTA_PROJECT_DATA,
+ ANJUTA_PROJECT_EXTRA,
+ ANJUTA_PROJECT_INTLTOOL,
+ ANJUTA_PROJECT_CONFIGURE,
+ ANJUTA_PROJECT_IDL,
+ ANJUTA_PROJECT_MKENUMS,
+ ANJUTA_PROJECT_GENMARSHAL,
+ ANJUTA_PROJECT_SCRIPT,
ANJUTA_PROJECT_PROXY = 1 << 14,
ANJUTA_PROJECT_EXECUTABLE = 1 << 15,
+ ANJUTA_PROJECT_ID_MASK = 0xFFF,
ANJUTA_PROJECT_TYPE_MASK = 0xFFFF << 16,
ANJUTA_PROJECT_ROOT = 1 << 16,
ANJUTA_PROJECT_GROUP = 2 << 16,
@@ -77,12 +96,10 @@ typedef enum
typedef struct
{
+ AnjutaProjectNodeType type;
gchar *name;
- AnjutaProjectTargetClass base;
gchar *mime_type;
-} AnjutaProjectTargetInfo;
-
-typedef AnjutaProjectTargetInfo* AnjutaProjectTargetType;
+} AnjutaProjectNodeInfo;
typedef enum
{
@@ -108,7 +125,6 @@ typedef struct
AnjutaProjectProperty *properties;
GFile *file;
gchar *name;
- AnjutaProjectTargetType target_type;
AnjutaProjectNodeState state;
} AnjutaProjectNodeData;
@@ -192,13 +208,12 @@ AnjutaProjectNode *anjuta_project_source_get_node_from_uri (const AnjutaProjectN
GFile *anjuta_project_group_get_directory (const AnjutaProjectNode *group);
const gchar *anjuta_project_target_get_name (const AnjutaProjectNode *target);
-AnjutaProjectTargetType anjuta_project_target_get_type (const AnjutaProjectNode *target);
GFile *anjuta_project_source_get_file (const AnjutaProjectNode *source);
-const gchar *anjuta_project_target_type_name (const AnjutaProjectTargetType type);
-const gchar *anjuta_project_target_type_mime (const AnjutaProjectTargetType type);
-AnjutaProjectTargetClass anjuta_project_target_type_class (const AnjutaProjectTargetType type);
+const gchar *anjuta_project_node_info_name (const AnjutaProjectNodeInfo *info);
+const gchar *anjuta_project_node_info_mime (const AnjutaProjectNodeInfo *info);
+AnjutaProjectNodeType anjuta_project_node_info_type (const AnjutaProjectNodeInfo *info);
AnjutaProjectNode *anjuta_project_proxy_new (AnjutaProjectNode *node);
AnjutaProjectNode *anjuta_project_proxy_unref (AnjutaProjectNode *node);
diff --git a/libanjuta/interfaces/libanjuta.idl b/libanjuta/interfaces/libanjuta.idl
index d8e56a3..f731dc0 100644
--- a/libanjuta/interfaces/libanjuta.idl
+++ b/libanjuta/interfaces/libanjuta.idl
@@ -3226,6 +3226,18 @@ interface IAnjutaProject
gboolean remove_property (AnjutaProjectNode *node, AnjutaProjectProperty *property);
/**
+ * ianjuta_project_get_node_info:
+ * @obj: Self
+ * @err: Error propagation and reporting
+ *
+ * Return a list of possible node;
+ *
+ * Return value: TRUE if the property has been successfully removed
+ * else FALSE
+ */
+ List<AnjutaProjectNodeInformation *> get_node_info();
+
+ /**
* ianjuta_project_load:
* @obj: Self
* @file: Project directory
@@ -3267,7 +3279,7 @@ interface IAnjutaProject
*
* Returns: the list of supported target types
*/
- List<AnjutaProjectTargetType> get_target_types();
+ List<AnjutaProjectNodeType> get_target_types();
/**
* ianjuta_project_configure:
@@ -3327,7 +3339,7 @@ interface IAnjutaProject
*
* Returns: The new target or NULL on error.
*/
- AnjutaProjectNode* add_target (AnjutaProjectNode *parent, const gchar *name, AnjutaProjectTargetType type);
+ AnjutaProjectNode* add_target (AnjutaProjectNode *parent, const gchar *name, AnjutaProjectNodeType type);
/**
* ianjuta_project_add_source:
@@ -3487,7 +3499,7 @@ interface IAnjutaProjectManager
*
* Returns: Return the type of the target.
*/
- AnjutaProjectTargetClass get_target_type (GFile *target);
+ AnjutaProjectNodeType get_target_type (GFile *target);
/**
* ianjuta_project_manager_get_targets:
@@ -3501,7 +3513,7 @@ interface IAnjutaProjectManager
* type or %NULL if none exists. Free the returned list with g_list_free()
* and the files with g_object_unref().
*/
- List<GFile *> get_targets (AnjutaProjectTargetClass target_type);
+ List<GFile *> get_targets (AnjutaProjectNodeType target_type);
/**
* ianjuta_project_manager_get_parent:
diff --git a/plugins/am-project/am-dialogs.c b/plugins/am-project/am-dialogs.c
index 2389ce1..c35e690 100644
--- a/plugins/am-project/am-dialogs.c
+++ b/plugins/am-project/am-dialogs.c
@@ -283,7 +283,7 @@ amp_configure_target_dialog (AmpProject *project, AnjutaProjectNode *target, GEr
GtkWidget *extra_table;
gint extra_pos;
AmpConfigureProjectDialog *dlg;
- AnjutaProjectTargetType type;
+ AnjutaProjectNodeInfo* info;
const gchar *name;
AnjutaProjectProperty *prop;
@@ -304,8 +304,8 @@ amp_configure_target_dialog (AmpProject *project, AnjutaProjectNode *target, GEr
extra_pos = 0;
name = amp_target_get_name (target);
add_label (_("Name:"), name, main_table, &main_pos);
- type = anjuta_project_target_get_type (target);
- add_label (_("Type:"), anjuta_project_target_type_name (type), main_table, &main_pos);
+ info = amp_project_get_type_info (project, anjuta_project_node_get_type (target));;
+ add_label (_("Type:"), anjuta_project_node_info_name (info), main_table, &main_pos);
for (prop = anjuta_project_node_first_valid_property (target); prop != NULL; prop = anjuta_project_property_next (prop))
{
diff --git a/plugins/am-project/am-project.c b/plugins/am-project/am-project.c
index d906f94..9bdb2ae 100644
--- a/plugins/am-project/am-project.c
+++ b/plugins/am-project/am-project.c
@@ -153,10 +153,10 @@ struct _AmpConfigFile {
AnjutaToken *token;
};
-typedef struct _AmpTargetInformation AmpTargetInformation;
+typedef struct _AmpNodeInfo AmpNodeInfo;
-struct _AmpTargetInformation {
- AnjutaProjectTargetInfo base;
+struct _AmpNodeInfo {
+ AnjutaProjectNodeInfo base;
AnjutaTokenType token;
const gchar *prefix;
const gchar *install;
@@ -167,83 +167,110 @@ struct _AmpTargetPropertyBuffer {
GList *properties;
};
-/* Target types
+/* Node types
*---------------------------------------------------------------------------*/
-static AmpTargetInformation AmpTargetTypes[] = {
- {{N_("Unknown"), ANJUTA_TARGET_UNKNOWN,
+static AmpNodeInfo AmpNodeInformations[] = {
+ {{ANJUTA_PROJECT_GROUP,
+ N_("Group"),
"text/plain"},
ANJUTA_TOKEN_NONE,
NULL,
NULL},
- {{N_("Program"), ANJUTA_TARGET_EXECUTABLE,
- "application/x-executable"},
- AM_TOKEN__PROGRAMS,
- "_PROGRAMS",
- "bin"},
-
- {{N_("Shared Library"), ANJUTA_TARGET_SHAREDLIB,
+ {{ANJUTA_PROJECT_SOURCE,
+ N_("Source"),
+ "text/plain"},
+ ANJUTA_TOKEN_NONE,
+ NULL,
+ NULL},
+
+ {{ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_UNKNOWN,
+ N_("Unknown"),
+ "text/plain"},
+ ANJUTA_TOKEN_NONE,
+ NULL,
+ NULL},
+
+ {{ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_SHAREDLIB,
+ N_("Shared Library"),
"application/x-sharedlib"},
AM_TOKEN__LTLIBRARIES,
"_LTLIBRARIES",
"lib"},
- {{N_("Static Library"), ANJUTA_TARGET_STATICLIB,
+ {{ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_STATICLIB,
+ N_("Static Library"),
"application/x-archive"},
AM_TOKEN__LIBRARIES,
"_LIBRARIES",
"lib"},
+
+ {{ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_EXECUTABLE | ANJUTA_PROJECT_BINARY,
+ N_("Program"),
+ "application/x-executable"},
+ AM_TOKEN__PROGRAMS,
+ "_PROGRAMS",
+ "bin"},
+
+ {{ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_PYTHON,
+ N_("Python Module"),
+ "application/x-python"},
+ AM_TOKEN__PYTHON,
+ "_PYTHON",
+ NULL},
- {{N_("Header Files"), ANJUTA_TARGET_UNKNOWN,
+ {{ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_JAVA,
+ N_("Java Module"),
+ "application/x-java"},
+ AM_TOKEN__JAVA,
+ "_JAVA",
+ NULL},
+
+ {{ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_UNKNOWN,
+ N_("Lisp Module"),
+ "text/plain"},
+ AM_TOKEN__LISP,
+ "_LISP",
+ "lisp"},
+
+ {{ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_UNKNOWN,
+ N_("Header Files"),
"text/x-chdr"},
AM_TOKEN__HEADERS,
"_HEADERS",
"include"},
- {{N_("Man Documentation"), ANJUTA_TARGET_UNKNOWN,
+ {{ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_UNKNOWN,
+ N_("Man Documentation"),
"text/x-troff-man"},
AM_TOKEN__MANS,
"_MANS",
"man"},
+
+ {{ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_UNKNOWN,
+ N_("Info Documentation"),
+ "application/x-tex-info"},
+ AM_TOKEN__TEXINFOS,
+ "_TEXINFOS",
+ "info"},
- {{N_("Miscellaneous Data"), ANJUTA_TARGET_UNKNOWN,
+ {{ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_UNKNOWN,
+ N_("Miscellaneous Data"),
"application/octet-stream"},
AM_TOKEN__DATA,
"_DATA",
"data"},
- {{N_("Script"), ANJUTA_TARGET_EXECUTABLE,
+ {{ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_EXECUTABLE | ANJUTA_PROJECT_SCRIPT,
+ N_("Script"),
"text/x-shellscript"},
AM_TOKEN__SCRIPTS,
"_SCRIPTS",
"bin"},
- {{N_("Info Documentation"), ANJUTA_TARGET_UNKNOWN,
- "application/x-tex-info"},
- AM_TOKEN__TEXINFOS,
- "_TEXINFOS",
- "info"},
-
- {{N_("Java Module"), ANJUTA_TARGET_JAVA,
- "application/x-java"},
- AM_TOKEN__JAVA,
- "_JAVA",
- NULL},
-
- {{N_("Python Module"), ANJUTA_TARGET_PYTHON,
- "application/x-python"},
- AM_TOKEN__PYTHON,
- "_PYTHON",
- NULL},
-
- {{N_("Lisp Module"), ANJUTA_TARGET_UNKNOWN,
- "text/plain"},
- AM_TOKEN__LISP,
- "_LISP",
- "lisp"},
-
- {{NULL, ANJUTA_TARGET_UNKNOWN,
+ {{ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_UNKNOWN,
+ NULL,
NULL},
ANJUTA_TOKEN_NONE,
NULL,
@@ -519,7 +546,7 @@ amp_target_property_buffer_add_source (AmpTargetPropertyBuffer *buffer, AmpSourc
}
void
-amp_target_property_buffer_add_property (AmpTargetPropertyBuffer *buffer, AnjutaProjectPropertyInfo *prop)
+amp_target_property_buffer_add_property (AmpTargetPropertyBuffer *buffer, AnjutaProjectProperty *prop)
{
buffer->properties = g_list_prepend (buffer->properties, prop);
}
@@ -834,15 +861,14 @@ amp_target_get_token (AmpTarget *node)
static AmpTarget*
-amp_target_new (const gchar *name, AnjutaProjectTargetType type, const gchar *install, gint flags)
+amp_target_new (const gchar *name, AnjutaProjectNodeType type, const gchar *install, gint flags)
{
AmpTargetData *target = NULL;
target = g_slice_new0(AmpTargetData);
- target->base.type = ANJUTA_PROJECT_TARGET;
+ target->base.type = ANJUTA_PROJECT_TARGET | type;
target->base.properties = amp_get_target_property_list(type);
target->base.name = g_strdup (name);
- target->base.target_type = type;
target->install = g_strdup (install);
target->flags = flags;
@@ -1285,21 +1311,18 @@ static AnjutaToken*
project_load_target (AmpProject *project, AnjutaToken *name, AnjutaTokenType token_type, AnjutaToken *list, AnjutaProjectNode *parent, GHashTable *orphan_properties)
{
AnjutaToken *arg;
- AnjutaProjectTargetType type = NULL;
gchar *install;
gchar *value;
gint flags;
- AmpTargetInformation *targets = AmpTargetTypes;
+ AmpNodeInfo *info = AmpNodeInformations;
- type = (AnjutaProjectTargetType)targets;
- while (targets->base.name != NULL)
+ while (info->base.type != 0)
{
- if (token_type == targets->token)
+ if (token_type == info->token)
{
- type = (AnjutaProjectTargetType)targets;
break;
}
- targets++;
+ info++;
}
value = anjuta_token_evaluate (name);
@@ -1331,7 +1354,7 @@ project_load_target (AmpProject *project, AnjutaToken *name, AnjutaTokenType tok
}
/* Create target */
- target = amp_target_new (value, type, install, flags);
+ target = amp_target_new (value, info->base.type, install, flags);
amp_target_add_token (target, arg);
anjuta_project_node_append (parent, target);
DEBUG_PRINT ("create target %p name %s", target, value);
@@ -1483,24 +1506,21 @@ project_load_sources (AmpProject *project, AnjutaToken *name, AnjutaToken *list,
static AnjutaToken*
project_load_data (AmpProject *project, AnjutaToken *name, AnjutaToken *list, AnjutaProjectNode *parent, GHashTable *orphan_properties)
{
- AnjutaProjectTargetType type = NULL;
gchar *install;
AnjutaProjectNode *target;
gchar *target_id;
gpointer find;
gint flags;
- AmpTargetInformation *targets = AmpTargetTypes;
+ AmpNodeInfo *info = AmpNodeInformations;
AnjutaToken *arg;
- type = (AnjutaProjectTargetType)targets;
- while (targets->base.name != NULL)
+ while (info->base.name != NULL)
{
- if (anjuta_token_get_type (name) == targets->token)
+ if (anjuta_token_get_type (name) == info->token)
{
- type = (AnjutaProjectTargetType)targets;
break;
}
- targets++;
+ info++;
}
target_id = anjuta_token_evaluate (name);
@@ -1522,7 +1542,7 @@ project_load_data (AmpProject *project, AnjutaToken *name, AnjutaToken *list, An
if ((gchar *)find == target_id)
{
/* Create target */
- target = amp_target_new (target_id, type, install, flags);
+ target = amp_target_new (target_id, info->base.type, install, flags);
amp_target_add_token (target, arg);
anjuta_project_node_append (parent, target);
DEBUG_PRINT ("create target %p name %s", target, target_id);
@@ -1839,6 +1859,19 @@ amp_project_set_am_variable (AmpProject* project, AmpGroup* group, AnjutaTokenTy
/* Public functions
*---------------------------------------------------------------------------*/
+AnjutaProjectNodeInfo *
+amp_project_get_type_info (AmpProject *project, AnjutaProjectNodeType type)
+{
+ AmpNodeInfo *info;
+
+ for (info = AmpNodeInformations; info->base.type != type; info++)
+ {
+ if ((info->base.type == type) || (info->base.type == 0)) break;
+ }
+
+ return (AnjutaProjectNodeInfo *)info;
+}
+
static AnjutaProjectNode *
amp_project_load_root (AmpProject *project, AnjutaProjectNode *node, GError **error)
{
@@ -2401,13 +2434,14 @@ amp_project_remove_group (AmpProject *project,
}
AmpTarget*
-amp_project_add_sibling_target (AmpProject *project, AmpGroup *parent, const gchar *name, AnjutaProjectTargetType type, gboolean after, AmpTarget *sibling, GError **error)
+amp_project_add_sibling_target (AmpProject *project, AmpGroup *parent, const gchar *name, AnjutaProjectNodeType type, gboolean after, AmpTarget *sibling, GError **error)
{
AmpTarget *child;
AnjutaToken* token;
AnjutaToken *args;
AnjutaToken *var;
AnjutaToken *prev;
+ AmpNodeInfo *info;
gchar *targetname;
gchar *find;
GList *last;
@@ -2415,6 +2449,9 @@ amp_project_add_sibling_target (AmpProject *project, AmpGroup *parent, const gc
g_return_val_if_fail (name != NULL, NULL);
g_return_val_if_fail (parent != NULL, NULL);
+ g_message ("add sibling target %x", type);
+ info = (AmpNodeInfo *)amp_project_get_type_info (project, type);
+
/* Validate target name */
if (!name || strlen (name) <= 0)
{
@@ -2437,7 +2474,7 @@ amp_project_add_sibling_target (AmpProject *project, AmpGroup *parent, const gc
return NULL;
}
}
- if (type->base == ANJUTA_TARGET_SHAREDLIB) {
+ if ((type & ANJUTA_PROJECT_ID_MASK) == ANJUTA_PROJECT_SHAREDLIB) {
if (strlen (name) < 7 ||
strncmp (name, "lib", strlen("lib")) != 0 ||
strcmp (&name[strlen(name) - 3], ".la") != 0) {
@@ -2446,7 +2483,7 @@ amp_project_add_sibling_target (AmpProject *project, AmpGroup *parent, const gc
return NULL;
}
}
- else if (type->base == ANJUTA_TARGET_STATICLIB) {
+ else if ((type & ANJUTA_PROJECT_ID_MASK) == ANJUTA_TARGET_STATICLIB) {
if (strlen (name) < 6 ||
strncmp (name, "lib", strlen("lib")) != 0 ||
strcmp (&name[strlen(name) - 2], ".a") != 0) {
@@ -2488,7 +2525,7 @@ amp_project_add_sibling_target (AmpProject *project, AmpGroup *parent, const gc
//anjuta_project_node_append (parent, child);
/* Add in Makefile.am */
- targetname = g_strconcat (((AmpTargetInformation *)type)->install, ((AmpTargetInformation *)type)->prefix, NULL);
+ targetname = g_strconcat (info->install, info->prefix, NULL);
// Get token corresponding to sibling and check if the target are compatible
args = NULL;
@@ -2546,7 +2583,7 @@ amp_project_add_sibling_target (AmpProject *project, AmpGroup *parent, const gc
if (args == NULL)
{
- args = amp_project_write_target (AMP_GROUP_DATA (parent)->make_token, ((AmpTargetInformation *)type)->token, targetname, after, var);
+ args = amp_project_write_target (AMP_GROUP_DATA (parent)->make_token, info->token, targetname, after, var);
}
g_free (targetname);
@@ -2575,7 +2612,7 @@ AmpTarget*
amp_project_add_target (AmpProject *project,
AmpGroup *parent,
const gchar *name,
- AnjutaProjectTargetType type,
+ AnjutaProjectNodeType type,
GError **error)
{
return amp_project_add_sibling_target (project, parent, name, type, TRUE, NULL, error);
@@ -2765,22 +2802,25 @@ amp_project_get_config_packages (AmpProject *project,
}
GList *
-amp_project_get_target_types (AmpProject *project, GError **error)
+amp_project_get_node_info (AmpProject *project, GError **error)
{
- AmpTargetInformation *targets = AmpTargetTypes;
- GList *types = NULL;
+ static GList *info_list = NULL;
- while (targets->base.name != NULL)
+ if (info_list == NULL)
{
- types = g_list_prepend (types, targets);
- targets++;
- }
- types = g_list_reverse (types);
+ AmpNodeInfo *node;
+
+ for (node = AmpNodeInformations; node->base.type != 0; node++)
+ {
+ info_list = g_list_prepend (info_list, node);
+ }
- return types;
+ info_list = g_list_reverse (info_list);
+ }
+
+ return info_list;
}
-
/* Public functions
*---------------------------------------------------------------------------*/
@@ -3110,7 +3150,7 @@ iproject_add_source (IAnjutaProject *obj, AnjutaProjectNode *parent, GFile *fil
}
static AnjutaProjectNode*
-iproject_add_target (IAnjutaProject *obj, AnjutaProjectNode *parent, const gchar *name, AnjutaProjectTargetType type, GError **err)
+iproject_add_target (IAnjutaProject *obj, AnjutaProjectNode *parent, const gchar *name, AnjutaProjectNodeType type, GError **err)
{
return amp_project_add_target (AMP_PROJECT (obj), AMP_GROUP (parent), name, type, err);
}
@@ -3166,7 +3206,7 @@ iproject_get_root (IAnjutaProject *obj, GError **err)
static GList*
iproject_get_target_types (IAnjutaProject *obj, GError **err)
{
- return amp_project_get_target_types (AMP_PROJECT (obj), err);
+ return amp_project_get_node_info (AMP_PROJECT (obj), err);
}
static gboolean
@@ -3278,6 +3318,12 @@ iproject_remove_property (IAnjutaProject *project, AnjutaProjectNode *node, Anju
return FALSE;
}
+static GList*
+iproject_get_node_info (IAnjutaProject *obj, GError **err)
+{
+ return amp_project_get_node_info (AMP_PROJECT (obj), err);
+}
+
static void
iproject_iface_init(IAnjutaProjectIface* iface)
{
@@ -3302,6 +3348,7 @@ iproject_iface_init(IAnjutaProjectIface* iface)
iface->set_string_property = iproject_set_string_property;
iface->set_list_property = iproject_set_list_property;
iface->remove_property = iproject_remove_property;
+ iface->get_node_info = iproject_get_node_info;
}
/* Group access functions
@@ -3334,12 +3381,6 @@ amp_target_get_name (AmpTarget *target)
return AMP_TARGET_DATA (target)->base.name;
}
-AnjutaProjectTargetType
-amp_target_get_type (AmpTarget *target)
-{
- return AMP_TARGET_DATA (target)->base.target_type;
-}
-
gchar *
amp_target_get_id (AmpTarget *target)
{
diff --git a/plugins/am-project/am-project.h b/plugins/am-project/am-project.h
index 7b5216d..087521b 100644
--- a/plugins/am-project/am-project.h
+++ b/plugins/am-project/am-project.h
@@ -76,7 +76,7 @@ AmpTargetPropertyBuffer* amp_target_property_buffer_new (void);
void amp_target_property_buffer_free (AmpTargetPropertyBuffer *buffer);
void amp_target_property_buffer_add_source (AmpTargetPropertyBuffer *buffer, AmpSource *source);
-void amp_target_property_buffer_add_property (AmpTargetPropertyBuffer *buffer, AnjutaProjectPropertyInfo *prop);
+void amp_target_property_buffer_add_property (AmpTargetPropertyBuffer *buffer, AnjutaProjectProperty *prop);
GList *amp_target_property_buffer_steal_sources (AmpTargetPropertyBuffer *buffer);
GList *amp_target_property_buffer_steal_properties (AmpTargetPropertyBuffer *buffer);
@@ -106,14 +106,17 @@ AmpGroup* amp_project_add_group (AmpProject *project, AmpGroup *parent, const g
AmpGroup* amp_project_add_sibling_group (AmpProject *project, AmpGroup *parent, const gchar *name, gboolean after, AmpGroup *sibling, GError **error);
void amp_project_remove_group (AmpProject *project, AmpGroup *group, GError **error);
-AmpTarget* amp_project_add_target (AmpProject *project, AmpGroup *parent, const gchar *name, AnjutaProjectTargetType type, GError **error);
-AmpTarget* amp_project_add_sibling_target (AmpProject *project, AmpGroup *parent, const gchar *name, AnjutaProjectTargetType type, gboolean after, AmpTarget *sibling, GError **error);
+AmpTarget* amp_project_add_target (AmpProject *project, AmpGroup *parent, const gchar *name, AnjutaProjectNodeType type, GError **error);
+AmpTarget* amp_project_add_sibling_target (AmpProject *project, AmpGroup *parent, const gchar *name, AnjutaProjectNodeType type, gboolean after, AmpTarget *sibling, GError **error);
void amp_project_remove_target (AmpProject *project, AmpTarget *target, GError **error);
AmpSource* amp_project_add_source (AmpProject *project, AmpTarget *parent, GFile *file, GError **error);
AmpSource* amp_project_add_sibling_source (AmpProject *project, AmpTarget *parent, GFile *file, gboolean after, AmpSource *sibling, GError **error);
void amp_project_remove_source (AmpProject *project, AmpSource *source, GError **error);
+AnjutaProjectNodeInfo *amp_project_get_type_info (AmpProject *project, AnjutaProjectNodeType type);
+GList *amp_project_get_node_info (AmpProject *project, GError **error);
+
GList *amp_project_get_config_modules (AmpProject *project, GError **error);
GList *amp_project_get_config_packages (AmpProject *project, const gchar* module, GError **error);
@@ -138,7 +141,6 @@ GFile *amp_group_get_makefile (AmpGroup *group);
gchar *amp_group_get_id (AmpGroup *group);
const gchar *amp_target_get_name (AmpTarget *target);
-AnjutaProjectTargetType amp_target_get_type (AmpTarget *target);
gchar *amp_target_get_id (AmpTarget *target);
void amp_source_free (AmpSource *node);
diff --git a/plugins/am-project/am-properties.c b/plugins/am-project/am-properties.c
index 70bb09c..191416e 100644
--- a/plugins/am-project/am-properties.c
+++ b/plugins/am-project/am-properties.c
@@ -277,11 +277,11 @@ amp_get_group_property_list (void)
}
GList*
-amp_get_target_property_list (AnjutaProjectTargetType type)
+amp_get_target_property_list (AnjutaProjectNodeType type)
{
- switch (type->base)
+ switch (type & ANJUTA_PROJECT_ID_MASK)
{
- case ANJUTA_TARGET_MAN:
+ case ANJUTA_PROJECT_MAN:
return amp_create_property_list (&AmpManTargetPropertyList, AmpManTargetProperties);
default:
return amp_create_property_list (&AmpTargetPropertyList, AmpTargetProperties);
diff --git a/plugins/am-project/am-properties.h b/plugins/am-project/am-properties.h
index 404c5f0..e2721a1 100644
--- a/plugins/am-project/am-properties.h
+++ b/plugins/am-project/am-properties.h
@@ -37,7 +37,7 @@ AnjutaProjectProperty * amp_node_property_set (AnjutaProjectNode *node, AnjutaPr
GList* amp_get_project_property_list (void);
GList* amp_get_group_property_list (void);
-GList* amp_get_target_property_list (AnjutaProjectTargetType type);
+GList* amp_get_target_property_list (AnjutaProjectNodeType type);
GList* amp_get_source_property_list (void);
GList* amp_get_module_property_list (void);
GList* amp_get_package_property_list (void);
diff --git a/plugins/am-project/projectparser.c b/plugins/am-project/projectparser.c
index 5b07ed1..f097cf6 100644
--- a/plugins/am-project/projectparser.c
+++ b/plugins/am-project/projectparser.c
@@ -139,7 +139,6 @@ list_module (IAnjutaProject *project, AnjutaProjectNode *module, gint indent, co
static void
list_property (IAnjutaProject *project, AnjutaProjectNode *parent, gint indent)
{
- AnjutaProjectProperty *list;
AnjutaProjectProperty *prop;
for (prop = anjuta_project_node_first_property (parent); prop != NULL; prop = anjuta_project_property_next (prop))
@@ -297,24 +296,29 @@ get_file (AnjutaProjectNode *target, const char *id)
return g_file_resolve_relative_path (anjuta_project_group_get_directory (group), id);
}
-static AnjutaProjectTargetType
-get_type (IAnjutaProject *project, const char *id)
+static AnjutaProjectNodeType
+get_target_type (IAnjutaProject *project, const char *id)
{
- AnjutaProjectTargetType type;
+ AnjutaProjectNodeType type;
GList *list;
GList *item;
guint num = atoi (id);
- list = ianjuta_project_get_target_types (project, NULL);
- type = (AnjutaProjectTargetType)list->data;
+ list = ianjuta_project_get_node_info (project, NULL);
+ type = 0;
for (item = list; item != NULL; item = g_list_next (item))
{
- if (num == 0)
+ AnjutaProjectNodeInfo *info = (AnjutaProjectNodeInfo *)item->data;
+
+ if ((info->type & ANJUTA_PROJECT_TYPE_MASK) == ANJUTA_PROJECT_TARGET)
{
- type = (AnjutaProjectTargetType)item->data;
- break;
+ if (num == 0)
+ {
+ type = info->type;
+ break;
+ }
+ num--;
}
- num--;
}
g_list_free (list);
@@ -477,18 +481,18 @@ main(int argc, char *argv[])
if ((command[5] != NULL) && (g_ascii_strcasecmp (command[5], "before") == 0))
{
sibling = get_node (project, command[6]);
- amp_project_add_sibling_target (project, node, command[3], get_type (project, command[4]), FALSE, sibling, NULL);
+ amp_project_add_sibling_target (project, node, command[3], get_target_type (project, command[4]), FALSE, sibling, NULL);
command += 2;
}
else if ((command[5] != NULL) && (g_ascii_strcasecmp (command[5], "after") == 0))
{
sibling = get_node (project, command[6]);
- amp_project_add_sibling_target (project, node, command[3], get_type (project, command[4]), TRUE, sibling, NULL);
+ amp_project_add_sibling_target (project, node, command[3], get_target_type (project, command[4]), TRUE, sibling, NULL);
command += 2;
}
else
{
- ianjuta_project_add_target (project, node, command[3], get_type (project, command[4]), NULL);
+ ianjuta_project_add_target (project, node, command[3], get_target_type (project, command[4]), NULL);
}
command++;
}
@@ -527,7 +531,6 @@ main(int argc, char *argv[])
if (AMP_IS_PROJECT (project))
{
AnjutaProjectProperty *item;
- AnjutaProjectPropertyInfo *info = NULL;
item = get_project_property (project, root, command[1]);
if (item != NULL)
diff --git a/plugins/am-project/tests/target.at b/plugins/am-project/tests/target.at
index e951c49..99b1c7c 100644
--- a/plugins/am-project/tests/target.at
+++ b/plugins/am-project/tests/target.at
@@ -12,7 +12,7 @@ AT_DATA([expect],
]])
AT_PARSER_CHECK([load empty \
move empty1 \
- add target 0 target1 1 \
+ add target 0 target1 3 \
list \
save])
AT_CHECK([diff output expect])
@@ -26,7 +26,7 @@ AT_DATA([expect],
]])
AT_PARSER_CHECK([load empty1 \
move empty2 \
- add target 0 target2 1 after 0:0\
+ add target 0 target2 3 after 0:0\
list \
save])
AT_CHECK([diff -b output expect])
diff --git a/plugins/dir-project/dir-project.c b/plugins/dir-project/dir-project.c
index 214d719..5b86260 100644
--- a/plugins/dir-project/dir-project.c
+++ b/plugins/dir-project/dir-project.c
@@ -860,7 +860,7 @@ static DirTarget*
dir_project_add_target (DirProject *project,
DirGroup *parent,
const gchar *name,
- AnjutaProjectTargetType type,
+ AnjutaProjectNodeType type,
GError **error)
{
return NULL;
@@ -876,11 +876,33 @@ dir_project_add_source (DirProject *project,
}
static GList *
-dir_project_get_target_types (DirProject *project, GError **error)
+dir_project_get_node_info (DirProject *project, GError **error)
{
- static AnjutaProjectTargetInfo unknown_type = {N_("Unknown"), ANJUTA_TARGET_UNKNOWN,"text/plain"};
+ static AnjutaProjectNodeInfo node_info[] = {
+ {ANJUTA_PROJECT_GROUP,
+ N_("Group"),
+ ""},
+ {ANJUTA_PROJECT_SOURCE,
+ N_("Source"),
+ ""},
+ {ANJUTA_PROJECT_UNKNOWN,
+ NULL,
+ NULL}};
+ static GList *info_list = NULL;
+
+ if (info_list == NULL)
+ {
+ AnjutaProjectNodeInfo *node;
+
+ for (node = node_info; node->type != 0; node++)
+ {
+ info_list = g_list_prepend (info_list, node);
+ }
- return g_list_prepend (NULL, &unknown_type);
+ info_list = g_list_reverse (info_list);
+ }
+
+ return info_list;
}
static DirGroup *
@@ -916,7 +938,7 @@ iproject_add_source (IAnjutaProject *obj, AnjutaProjectNode *parent, GFile *fil
}
static AnjutaProjectNode*
-iproject_add_target (IAnjutaProject *obj, AnjutaProjectNode *parent, const gchar *name, AnjutaProjectTargetType type, GError **err)
+iproject_add_target (IAnjutaProject *obj, AnjutaProjectNode *parent, const gchar *name, AnjutaProjectNodeType type, GError **err)
{
return dir_project_add_target (DIR_PROJECT (obj), parent, name, type, err);
}
@@ -948,7 +970,7 @@ iproject_get_root (IAnjutaProject *obj, GError **err)
static GList*
iproject_get_target_types (IAnjutaProject *obj, GError **err)
{
- return dir_project_get_target_types (DIR_PROJECT (obj), err);
+ return dir_project_get_node_info (DIR_PROJECT (obj), err);
}
static gboolean
@@ -1025,6 +1047,12 @@ iproject_remove_property (IAnjutaProject *project, AnjutaProjectNode *node, Anju
return FALSE;
}
+static GList*
+iproject_get_node_info (IAnjutaProject *obj, GError **err)
+{
+ return dir_project_get_node_info (DIR_PROJECT (obj), err);
+}
+
static void
iproject_iface_init(IAnjutaProjectIface* iface)
{
@@ -1048,6 +1076,7 @@ iproject_iface_init(IAnjutaProjectIface* iface)
iface->set_string_property = iproject_set_string_property;
iface->set_list_property = iproject_set_list_property;
iface->remove_property = iproject_remove_property;
+ iface->get_node_info = iproject_get_node_info;
}
/* GbfProject implementation
diff --git a/plugins/mk-project/mk-project-private.h b/plugins/mk-project/mk-project-private.h
index b9bda25..b6c26c7 100644
--- a/plugins/mk-project/mk-project-private.h
+++ b/plugins/mk-project/mk-project-private.h
@@ -79,7 +79,7 @@ struct _MkpRule {
gchar *mkp_project_token_evaluate (MkpProject *project, AnjutaToken *token);
-MkpTarget* mkp_target_new (const gchar *name, AnjutaProjectTargetType type);
+MkpTarget* mkp_target_new (const gchar *name, AnjutaProjectNodeType type);
void mkp_target_free (MkpTarget *node);
void mkp_target_add_token (MkpGroup *node, AnjutaToken *token);
MkpSource* mkp_source_new (GFile *file);
diff --git a/plugins/mk-project/mk-project.c b/plugins/mk-project/mk-project.c
index 6d9a160..4310976 100644
--- a/plugins/mk-project/mk-project.c
+++ b/plugins/mk-project/mk-project.c
@@ -121,10 +121,10 @@ struct _MkpSourceData {
AnjutaToken* token;
};
-typedef struct _MkpTargetInformation MkpTargetInformation;
+typedef struct _MkpNodeInfo MkpNodeInfo;
-struct _MkpTargetInformation {
- AnjutaProjectTargetInfo base;
+struct _MkpNodeInfo {
+ AnjutaProjectNodeInfo base;
AnjutaTokenType token;
const gchar *prefix;
const gchar *install;
@@ -133,14 +133,30 @@ struct _MkpTargetInformation {
/* Target types
*---------------------------------------------------------------------------*/
-static MkpTargetInformation MkpTargetTypes[] = {
- {{N_("Unknown"), ANJUTA_TARGET_UNKNOWN,
+static MkpNodeInfo MkpNodeInformation[] = {
+ {{ANJUTA_PROJECT_GROUP,
+ N_("Group"),
+ ""},
+ ANJUTA_TOKEN_NONE,
+ NULL,
+ NULL},
+
+ {{ANJUTA_PROJECT_SOURCE,
+ N_("Source"),
+ ""},
+ ANJUTA_TOKEN_NONE,
+ NULL,
+ NULL},
+
+ {{ANJUTA_PROJECT_TARGET,
+ N_("Unknown"),
"text/plain"},
ANJUTA_TOKEN_NONE,
NULL,
NULL},
- {{NULL, ANJUTA_TARGET_UNKNOWN,
+ {{ANJUTA_PROJECT_UNKNOWN,
+ NULL,
NULL},
ANJUTA_TOKEN_NONE,
NULL,
@@ -400,15 +416,13 @@ mkp_target_get_token (MkpGroup *node)
MkpTarget*
-mkp_target_new (const gchar *name, AnjutaProjectTargetType type)
+mkp_target_new (const gchar *name, AnjutaProjectNodeType type)
{
MkpTargetData *target = NULL;
target = g_slice_new0(MkpTargetData);
- target->base.type = ANJUTA_PROJECT_TARGET;
+ target->base.type = type | ANJUTA_PROJECT_TARGET;
target->base.name = g_strdup (name);
- if (type == NULL) type = (AnjutaProjectTargetType)&MkpTargetTypes[0];
- target->base.target_type = type;
return g_node_new (target);
}
@@ -844,19 +858,23 @@ mkp_project_get_file (MkpProject *project)
}
GList *
-mkp_project_get_target_types (MkpProject *project, GError **error)
+mkp_project_get_node_info (MkpProject *project, GError **error)
{
- MkpTargetInformation *targets = MkpTargetTypes;
- GList *types = NULL;
+ static GList *info_list = NULL;
- while (targets->base.name != NULL)
+ if (info_list == NULL)
{
- types = g_list_prepend (types, targets);
- targets++;
- }
- types = g_list_reverse (types);
+ MkpNodeInfo *node;
+
+ for (node = MkpNodeInformation; node->base.type != 0; node++)
+ {
+ info_list = g_list_prepend (info_list, node);
+ }
- return types;
+ info_list = g_list_reverse (info_list);
+ }
+
+ return info_list;
}
gboolean
@@ -908,12 +926,6 @@ mkp_target_get_name (MkpTarget *target)
return MKP_TARGET_DATA (target)->base.name;
}
-AnjutaProjectTargetType
-mkp_target_get_type (MkpTarget *target)
-{
- return MKP_TARGET_DATA (target)->base.target_type;
-}
-
gchar *
mkp_target_get_id (MkpTarget *target)
{
@@ -1366,7 +1378,7 @@ iproject_add_source (IAnjutaProject *obj, AnjutaProjectNode *parent, GFile *fil
}
static AnjutaProjectNode*
-iproject_add_target (IAnjutaProject *obj, AnjutaProjectNode *parent, const gchar *name, AnjutaProjectTargetType type, GError **err)
+iproject_add_target (IAnjutaProject *obj, AnjutaProjectNode *parent, const gchar *name, AnjutaProjectNodeType type, GError **err)
{
return NULL;
}
@@ -1398,7 +1410,7 @@ iproject_get_root (IAnjutaProject *obj, GError **err)
static GList*
iproject_get_target_types (IAnjutaProject *obj, GError **err)
{
- return mkp_project_get_target_types (MKP_PROJECT (obj), err);
+ return mkp_project_get_node_info (MKP_PROJECT (obj), err);
}
static gboolean
@@ -1475,6 +1487,12 @@ iproject_remove_property (IAnjutaProject *project, AnjutaProjectNode *node, Anju
return FALSE;
}
+static GList*
+iproject_get_node_info (IAnjutaProject *obj, GError **err)
+{
+ return mkp_project_get_node_info (MKP_PROJECT (obj), err);
+}
+
static void
iproject_iface_init(IAnjutaProjectIface* iface)
{
@@ -1498,6 +1516,7 @@ iproject_iface_init(IAnjutaProjectIface* iface)
iface->set_string_property = iproject_set_string_property;
iface->set_list_property = iproject_set_list_property;
iface->remove_property = iproject_remove_property;
+ iface->get_node_info = iproject_get_node_info;
}
/* GObject implementation
diff --git a/plugins/mk-project/mk-project.h b/plugins/mk-project/mk-project.h
index 4db41a0..437ab6b 100644
--- a/plugins/mk-project/mk-project.h
+++ b/plugins/mk-project/mk-project.h
@@ -111,7 +111,6 @@ GFile *mkp_group_get_makefile (MkpGroup *group);
gchar *mkp_group_get_id (MkpGroup *group);
const gchar *mkp_target_get_name (MkpTarget *target);
-AnjutaProjectTargetType amp_target_get_type (MkpTarget *target);
gchar *mkp_target_get_id (MkpTarget *target);
gchar *mkp_source_get_id (MkpSource *source);
diff --git a/plugins/mk-project/mk-rule.c b/plugins/mk-project/mk-rule.c
index 09d440c..de25db7 100644
--- a/plugins/mk-project/mk-rule.c
+++ b/plugins/mk-project/mk-rule.c
@@ -325,7 +325,7 @@ mkp_project_enumerate_targets (MkpProject *project, AnjutaProjectNode *parent)
if (rule->phony || rule->pattern) continue;
/* Create target */
- target = mkp_target_new (rule->name, NULL);
+ target = mkp_target_new (rule->name, ANJUTA_PROJECT_UNKNOWN);
mkp_target_add_token (target, rule->rule);
anjuta_project_node_append (parent, target);
diff --git a/plugins/project-manager/gbf-project-model.c b/plugins/project-manager/gbf-project-model.c
index ab72788..ded8fb1 100644
--- a/plugins/project-manager/gbf-project-model.c
+++ b/plugins/project-manager/gbf-project-model.c
@@ -568,17 +568,9 @@ add_target (GbfProjectModel *model,
* set of public functions to add/remove shortcuts to save
* this information in the project metadata (when that's
* implemented) */
- switch (anjuta_project_target_type_class (anjuta_project_target_get_type (target)))
+ if (anjuta_project_node_get_type (target) & ANJUTA_PROJECT_EXECUTABLE)
{
- case ANJUTA_TARGET_SHAREDLIB:
- case ANJUTA_TARGET_STATICLIB:
- case ANJUTA_TARGET_EXECUTABLE:
- case ANJUTA_TARGET_PYTHON:
- case ANJUTA_TARGET_JAVA:
- add_target_shortcut (model, NULL, data, NULL);
- break;
- default:
- break;
+ add_target_shortcut (model, NULL, data, NULL);
}
}
diff --git a/plugins/project-manager/gbf-project-util.c b/plugins/project-manager/gbf-project-util.c
index 753f119..8ff4e9d 100644
--- a/plugins/project-manager/gbf-project-util.c
+++ b/plugins/project-manager/gbf-project-util.c
@@ -265,7 +265,7 @@ build_types_store (AnjutaPmProject *project)
GList *types;
GList *node;
- types = anjuta_pm_project_get_target_types (project);
+ types = anjuta_pm_project_get_node_info (project);
store = gtk_list_store_new (TARGET_TYPE_N_COLUMNS,
G_TYPE_POINTER,
G_TYPE_STRING,
@@ -274,23 +274,28 @@ build_types_store (AnjutaPmProject *project)
for (node = g_list_first (types); node != NULL; node = g_list_next (node)) {
GdkPixbuf *pixbuf;
const gchar *name;
+ AnjutaProjectNodeType type;
- name = anjuta_project_target_type_name ((AnjutaProjectTargetType)node->data);
- pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default(),
- GTK_STOCK_CONVERT,
- ICON_SIZE,
- GTK_ICON_LOOKUP_GENERIC_FALLBACK,
- NULL);
-
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter,
- TARGET_TYPE_TYPE, node->data,
- TARGET_TYPE_NAME, name,
- TARGET_TYPE_PIXBUF, pixbuf,
- -1);
-
- if (pixbuf)
- g_object_unref (pixbuf);
+ type = anjuta_project_node_info_type ((AnjutaProjectNodeInfo *)node->data);
+ if (type & ANJUTA_PROJECT_TARGET)
+ {
+ name = anjuta_project_node_info_name ((AnjutaProjectNodeInfo *)node->data);
+ pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default(),
+ GTK_STOCK_CONVERT,
+ ICON_SIZE,
+ GTK_ICON_LOOKUP_GENERIC_FALLBACK,
+ NULL);
+
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (store, &iter,
+ TARGET_TYPE_TYPE, type,
+ TARGET_TYPE_NAME, name,
+ TARGET_TYPE_PIXBUF, pixbuf,
+ -1);
+
+ if (pixbuf)
+ g_object_unref (pixbuf);
+ }
}
g_list_free (types);
@@ -380,7 +385,7 @@ gbf_project_util_new_target (AnjutaPmProject *project,
AnjutaProjectNode *group;
GtkTreeIter iter;
gchar *name;
- AnjutaProjectTargetType type = NULL;
+ AnjutaProjectNodeType type;
name = gtk_editable_get_chars (
GTK_EDITABLE (target_name_entry), 0, -1);
diff --git a/plugins/project-manager/plugin.c b/plugins/project-manager/plugin.c
index 951cf89..2fdb835 100644
--- a/plugins/project-manager/plugin.c
+++ b/plugins/project-manager/plugin.c
@@ -1985,7 +1985,7 @@ iproject_manager_get_elements (IAnjutaProjectManager *project_manager,
return gbf_project_util_replace_by_file (gbf_project_util_node_all (anjuta_pm_project_get_root (plugin->project), element_type));
}
-static AnjutaProjectTargetClass
+static AnjutaProjectNodeType
iproject_manager_get_target_type (IAnjutaProjectManager *project_manager,
GFile *target_file,
GError **err)
@@ -2005,9 +2005,7 @@ iproject_manager_get_target_type (IAnjutaProjectManager *project_manager,
if (target != NULL)
{
- AnjutaProjectTargetType type = anjuta_project_target_get_type (target);
-
- return anjuta_project_target_type_class (type);
+ return anjuta_project_node_get_type (target);
}
else
{
@@ -2017,7 +2015,7 @@ iproject_manager_get_target_type (IAnjutaProjectManager *project_manager,
static GList*
iproject_manager_get_targets (IAnjutaProjectManager *project_manager,
- AnjutaProjectTargetClass target_type,
+ AnjutaProjectNodeType target_type,
GError **err)
{
GList *targets, *node;
@@ -2033,10 +2031,10 @@ iproject_manager_get_targets (IAnjutaProjectManager *project_manager,
/* Remove all targets not in specified class */
for (node = g_list_first (targets); node != NULL;)
{
- AnjutaProjectTargetType type;
+ AnjutaProjectNodeType type;
- type = anjuta_project_target_get_type (node->data);
- if (anjuta_project_target_type_class (type) != target_type)
+ type = anjuta_project_node_get_full_type (node->data);
+ if (type != target_type)
{
GList *next = g_list_next (node);
targets = g_list_delete_link (targets, node);
diff --git a/plugins/project-manager/project.c b/plugins/project-manager/project.c
index 99d17fc..5919b1d 100644
--- a/plugins/project-manager/project.c
+++ b/plugins/project-manager/project.c
@@ -529,11 +529,11 @@ anjuta_pm_project_get_capabilities (AnjutaPmProject *project)
}
GList *
-anjuta_pm_project_get_target_types (AnjutaPmProject *project)
+anjuta_pm_project_get_node_info (AnjutaPmProject *project)
{
g_return_val_if_fail (project->project != NULL, NULL);
- return ianjuta_project_get_target_types (project->project, NULL);
+ return ianjuta_project_get_node_info (project->project, NULL);
}
AnjutaProjectNode *
@@ -559,7 +559,7 @@ anjuta_pm_project_add_group (AnjutaPmProject *project, AnjutaProjectNode *group,
}
AnjutaProjectNode *
-anjuta_pm_project_add_target (AnjutaPmProject *project, AnjutaProjectNode *group, const gchar *name, AnjutaProjectTargetType type, GError **error)
+anjuta_pm_project_add_target (AnjutaPmProject *project, AnjutaProjectNode *group, const gchar *name, AnjutaProjectNodeType type, GError **error)
{
g_return_val_if_fail (project->project != NULL, NULL);
diff --git a/plugins/project-manager/project.h b/plugins/project-manager/project.h
index c83f67a..6034585 100644
--- a/plugins/project-manager/project.h
+++ b/plugins/project-manager/project.h
@@ -82,12 +82,12 @@ gboolean anjuta_pm_project_refresh (AnjutaPmProject *project, GError **error);
GtkWidget *anjuta_pm_project_configure (AnjutaPmProject *project, AnjutaProjectNode *node);
IAnjutaProjectCapabilities anjuta_pm_project_get_capabilities (AnjutaPmProject *project);
-GList *anjuta_pm_project_get_target_types (AnjutaPmProject *project);
+GList *anjuta_pm_project_get_node_info (AnjutaPmProject *project);
GList *anjuta_pm_project_get_packages (AnjutaPmProject *project);
AnjutaProjectNode *anjuta_pm_project_add_group (AnjutaPmProject *project, AnjutaProjectNode *group, const gchar *name, GError **error);
-AnjutaProjectNode *anjuta_pm_project_add_target (AnjutaPmProject *project, AnjutaProjectNode *group, const gchar *name, AnjutaProjectTargetType type, GError **error);
+AnjutaProjectNode *anjuta_pm_project_add_target (AnjutaPmProject *project, AnjutaProjectNode *group, const gchar *name, AnjutaProjectNodeType type, GError **error);
AnjutaProjectNode *anjuta_pm_project_add_source (AnjutaPmProject *project, AnjutaProjectNode *target, GFile *file, GError **error);
AnjutaProjectNode *anjuta_pm_project_get_root (AnjutaPmProject *project);
gboolean anjuta_pm_project_remove (AnjutaPmProject *project, AnjutaProjectNode *node, GError **error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]