1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4; coding: utf-8 -*- */ 2 /* amp-group.h 3 * 4 * Copyright (C) 2010 Sébastien Granjoux 5 * 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. 10 * 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. 15 * 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., 51 Franklin Street, Fifth Floor, 19 * Boston, MA 02110-1301, USA. 20 */ 21 22 #ifndef _AMP_GROUP_H_ 23 #define _AMP_GROUP_H_ 24 25 #include "amp-node.h" 26 27 G_BEGIN_DECLS 28 29 /* Type macros 30 *---------------------------------------------------------------------------*/ 31 32 #define AMP_TYPE_GROUP_NODE (amp_group_node_get_type ()) 33 #define AMP_GROUP_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AMP_TYPE_GROUP_NODE, AmpGroupNode)) 34 35 typedef struct _AmpGroupNode AmpGroupNode; 36 typedef struct _AmpGroupNodeClass AmpGroupNodeClass; 37 38 typedef enum { 39 AM_GROUP_TOKEN_CONFIGURE, 40 AM_GROUP_TOKEN_SUBDIRS, 41 AM_GROUP_TOKEN_DIST_SUBDIRS, 42 AM_GROUP_TARGET, 43 AM_GROUP_TOKEN_LAST 44 } AmpGroupNodeTokenCategory; 45 46 struct _AmpGroupNode { 47 AnjutaProjectNode base; 48 gboolean dist_only; /* TRUE if the group is distributed but not built */ 49 GFile *makefile; /* GFile corresponding to group makefile */ 50 AnjutaTokenFile *tfile; /* Corresponding Makefile */ 51 GList *tokens[AM_GROUP_TOKEN_LAST]; /* List of token used by this group */ 52 AnjutaToken *make_token; 53 AnjutaToken *preset_token; 54 GHashTable *variables; 55 GFileMonitor *monitor; /* File monitor */ 56 }; 57 58 struct _AmpGroupNodeClass { 59 AmpNodeClass parent_class; 60 }; 61 62 63 GType amp_group_node_get_type (void) G_GNUC_CONST; 64 65 typedef struct _AmpVariable AmpVariable; 66 67 struct _AmpVariable { 68 gchar *name; 69 AnjutaTokenType assign; 70 AnjutaToken *value; 71 }; 72 73 void amp_group_node_register (GTypeModule *module); 74 75 AmpVariable* amp_variable_new (gchar *name, AnjutaTokenType assign, AnjutaToken *value); 76 77 78 void amp_group_node_add_token (AmpGroupNode *group, AnjutaToken *token, AmpGroupNodeTokenCategory category); 79 void amp_group_node_remove_token (AmpGroupNode *group, AnjutaToken *token); 80 GList * amp_group_node_get_token (AmpGroupNode *group, AmpGroupNodeTokenCategory category); 81 GList * amp_group_node_get_all_token (AmpGroupNode *group); 82 AnjutaToken* amp_group_node_get_first_token (AmpGroupNode *group, AmpGroupNodeTokenCategory category); 83 void amp_group_node_set_dist_only (AmpGroupNode *group, gboolean dist_only); 84 AnjutaTokenFile* amp_group_node_set_makefile (AmpGroupNode *group, GFile *makefile, AmpProject *project); 85 AnjutaToken* amp_group_node_get_makefile_token (AmpGroupNode *group); 86 AnjutaTokenFile *amp_group_node_get_make_token_file (AmpGroupNode *group); 87 gchar *amp_group_node_get_makefile_name (AmpGroupNode *group); 88 gboolean amp_group_node_update_makefile (AmpGroupNode *group, AnjutaToken *token); 89 void amp_group_node_update_variable (AmpGroupNode *group, AnjutaToken *variable); 90 AnjutaToken* amp_group_node_get_variable_token (AmpGroupNode *group, const gchar *name); 91 AmpGroupNode* amp_group_node_new_valid (GFile *file, const gchar *name, gboolean dist_only, GError **error); 92 AmpGroupNode* amp_group_node_new (GFile *file, const gchar *name, gboolean dist_only); 93 void amp_group_node_free (AmpGroupNode *node); 94 void amp_group_node_update_node (AmpGroupNode *node, AmpGroupNode *new_node); 95 gboolean amp_group_node_set_file (AmpGroupNode *group, GFile *new_file); 96 97 98 G_END_DECLS 99 100 #endif /* _AMP_GROUP_H_ */ 101