am-project: Avoid a crash when adding a target to an invalid group
[anjuta.git] / plugins / am-project / amp-target.h
blob9d674f8641aee8f9a3e9d5c43e2d9f27d6550179
1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4; coding: utf-8 -*- */
2 /* amp-target.h
4 * Copyright (C) 2010 Sébastien Granjoux
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of the
9 * License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public
17 * License along with this program; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
22 #ifndef _AMP_TARGET_H_
23 #define _AMP_TARGET_H_
25 #include "am-project-private.h"
26 #include "am-scanner.h"
28 #include <glib-object.h>
30 #include <libanjuta/anjuta-project.h>
31 #include <libanjuta/anjuta-token.h>
32 #include <libanjuta/anjuta-token-file.h>
34 G_BEGIN_DECLS
36 /* Type macros
37 *---------------------------------------------------------------------------*/
39 #define AMP_TYPE_TARGET_NODE (amp_target_node_get_type ())
40 #define AMP_TARGET_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AMP_TYPE_TARGET_NODE, AmpTargetNode))
42 GType amp_target_node_get_type (void) G_GNUC_CONST;
44 typedef enum {
45 AM_TARGET_TOKEN_TARGET,
46 AM_TARGET_TOKEN_SOURCES,
47 AM_TARGET_TOKEN_LAST
48 } AmpTargetNodeTokenCategory;
50 typedef enum _AmpTargetNodeFlag
52 AM_TARGET_CHECK = 1 << 0,
53 AM_TARGET_NOINST = 1 << 1,
54 AM_TARGET_DIST = 1 << 2,
55 AM_TARGET_NODIST = 1 << 3,
56 AM_TARGET_NOBASE = 1 << 4,
57 AM_TARGET_NOTRANS = 1 << 5,
58 AM_TARGET_MAN = 1 << 6,
59 AM_TARGET_MAN_SECTION = 31 << 7
60 } AmpTargetNodeFlag;
62 void amp_target_node_register (GTypeModule *module);
64 void amp_target_node_add_token (AmpTargetNode *target, AmTokenType type, AnjutaToken *token);
65 void amp_target_node_remove_token (AmpTargetNode *target, AnjutaToken *token);
66 GList * amp_target_node_get_token (AmpTargetNode *target, AmTokenType type);
67 GList * amp_target_node_get_all_token (AmpTargetNode *target);
68 void amp_target_node_set_type (AmpTargetNode *target, AmTokenType type);
69 AnjutaTokenType amp_target_node_get_first_token_type (AmpTargetNode *target);
70 AnjutaTokenType amp_target_node_get_next_token_type (AmpTargetNode *target, AnjutaTokenType type);
71 AmpTargetNode* amp_target_node_new (const gchar *name, AnjutaProjectNodeType type, const gchar *install, gint flags);
72 AmpTargetNode* amp_target_node_new_valid (const gchar *name, AnjutaProjectNodeType type, const gchar *install, gint flags, AnjutaProjectNode *parent, GError **error);
73 void amp_target_node_free (AmpTargetNode *node);
74 void amp_target_node_update_node (AmpTargetNode *node, AmpTargetNode *new_node);
75 void amp_target_changed (AmpTargetNode *node);
77 G_END_DECLS
79 #endif /* _AM_TARGET_H_ */