1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
4 * Copyright (C) Sébastien Granjoux 2009 <seb.sfo@free.fr>
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 * See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef _ANJUTA_PROJECT_H_
21 #define _ANJUTA_PROJECT_H_
28 #define ANJUTA_TYPE_PROJECT_PROPERTY (anjuta_project_property_get_type ())
29 #define ANJUTA_IS_PROJECT_PROPERTY
31 typedef struct _AnjutaProjectProperty AnjutaProjectProperty
;
35 ANJUTA_PROJECT_PROPERTY_STRING
= 1,
36 ANJUTA_PROJECT_PROPERTY_LIST
,
37 ANJUTA_PROJECT_PROPERTY_BOOLEAN
,
38 ANJUTA_PROJECT_PROPERTY_MAP
39 } AnjutaProjectValueType
;
43 ANJUTA_PROJECT_PROPERTY_READ_ONLY
= 1 << 0,
44 ANJUTA_PROJECT_PROPERTY_READ_WRITE
= 1 << 1,
45 } AnjutaProjectPropertyFlags
;
47 struct _AnjutaProjectProperty
50 AnjutaProjectValueType type
;
51 AnjutaProjectPropertyFlags flags
;
54 AnjutaProjectProperty
*native
;
57 GType
anjuta_project_property_get_type (void);
59 AnjutaProjectProperty
*anjuta_project_property_new (const gchar
*name
, AnjutaProjectValueType type
, const gchar
*value
, AnjutaProjectProperty
*native
);
60 AnjutaProjectProperty
* anjuta_project_property_copy (AnjutaProjectProperty
*prop
);
61 void anjuta_project_property_free (AnjutaProjectProperty
*prop
);
65 #define ANJUTA_TYPE_PROJECT_NODE (anjuta_project_node_get_type ())
66 #define ANJUTA_PROJECT_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ANJUTA_TYPE_PROJECT_NODE, AnjutaProjectNode))
67 #define ANJUTA_PROJECT_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ANJUTA_TYPE_PROJECT_NODE, AnjutaProjectNodeClass))
68 #define ANJUTA_IS_PROJECT_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ANJUTA_TYPE_PROJECT_NODE))
69 #define ANJUTA_IS_PROJECT_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ANJUTA_TYPE_PROJECT_NODE))
70 #define ANJUTA_PROJECT_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ANJUTA_TYPE_PROJECT_NODE, AnjutaProjectNodeClass))
72 typedef struct _AnjutaProjectNode AnjutaProjectNode
;
73 typedef struct _AnjutaProjectNodeClass AnjutaProjectNodeClass
;
77 ANJUTA_PROJECT_UNKNOWN
= 0,
78 ANJUTA_PROJECT_SHAREDLIB
,
79 ANJUTA_PROJECT_STATICLIB
,
80 ANJUTA_PROJECT_PROGRAM
,
81 ANJUTA_PROJECT_PYTHON
,
84 ANJUTA_PROJECT_HEADER
,
87 ANJUTA_PROJECT_GENERIC
,
90 ANJUTA_PROJECT_INTLTOOL
,
91 ANJUTA_PROJECT_CONFIGURE
,
93 ANJUTA_PROJECT_MKENUMS
,
94 ANJUTA_PROJECT_GENMARSHAL
,
95 ANJUTA_PROJECT_SCRIPT
,
96 ANJUTA_PROJECT_PROXY
= 1 << 16,
97 ANJUTA_PROJECT_PROJECT
= 1 << 17,
98 ANJUTA_PROJECT_PRIMARY
= 1 << 18,
99 ANJUTA_PROJECT_EXECUTABLE
= 1 << 19,
100 ANJUTA_PROJECT_READ_ONLY
= 1 << 20, /* Node cannot be created by the backend */
101 ANJUTA_PROJECT_ID_MASK
= 0xFFFF << 0,
102 ANJUTA_PROJECT_FLAG_MASK
= 0xFF << 16,
103 ANJUTA_PROJECT_TYPE_MASK
= 0xFF << 24,
104 ANJUTA_PROJECT_ROOT
= 1 << 24,
105 ANJUTA_PROJECT_GROUP
= 2 << 24,
106 ANJUTA_PROJECT_TARGET
= 3 << 24,
107 ANJUTA_PROJECT_SOURCE
= 4 << 24,
108 ANJUTA_PROJECT_MODULE
= 5 << 24,
109 ANJUTA_PROJECT_PACKAGE
= 6 << 24,
110 ANJUTA_PROJECT_VARIABLE
= 7 << 24
111 } AnjutaProjectNodeType
;
115 ANJUTA_PROJECT_OK
= 0,
116 ANJUTA_PROJECT_MODIFIED
= 1 << 0, /* Node has been modified */
117 ANJUTA_PROJECT_INCOMPLETE
= 1 << 1, /* Node is not fully loaded */
118 ANJUTA_PROJECT_LOADING
= 1 << 2, /* Node is send to the worker thread */
119 ANJUTA_PROJECT_REMOVED
= 1 << 3, /* Node has been removed */
120 ANJUTA_PROJECT_CAN_ADD_GROUP
= 1 << 8,
121 ANJUTA_PROJECT_CAN_ADD_TARGET
= 1 << 9,
122 ANJUTA_PROJECT_CAN_ADD_SOURCE
= 1 << 10,
123 ANJUTA_PROJECT_CAN_ADD_MODULE
= 1 << 11,
124 ANJUTA_PROJECT_CAN_ADD_PACKAGE
= 1 << 12,
125 ANJUTA_PROJECT_CAN_REMOVE
= 1 << 16,
126 ANJUTA_PROJECT_CAN_SAVE
= 1 << 17,
127 ANJUTA_PROJECT_REMOVE_FILE
= 1 << 18
128 } AnjutaProjectNodeState
;
133 * The #AnjutaProjectNode struct contains private data only, and should
134 * accessed using the functions below.
136 struct _AnjutaProjectNode
138 GInitiallyUnowned parent_instance
;
140 AnjutaProjectNode
*next
;
141 AnjutaProjectNode
*prev
;
142 AnjutaProjectNode
*parent
;
143 AnjutaProjectNode
*children
;
145 AnjutaProjectNodeType type
;
146 AnjutaProjectNodeState state
;
148 GList
*native_properties
;
149 GList
*custom_properties
;
154 struct _AnjutaProjectNodeClass
156 GInitiallyUnownedClass parent_class
;
158 void (*updated
) (GError
*error
);
159 void (*loaded
) (GError
*error
);
164 typedef gboolean (*AnjutaProjectNodeTraverseFunc
) (AnjutaProjectNode
*node
, gpointer data
);
165 typedef void (*AnjutaProjectNodeForeachFunc
) (AnjutaProjectNode
*node
, gpointer data
);
168 GType
anjuta_project_node_get_type (void) G_GNUC_CONST
;
170 AnjutaProjectNode
*anjuta_project_node_root (AnjutaProjectNode
*node
);
171 AnjutaProjectNode
*anjuta_project_node_parent (AnjutaProjectNode
*node
);
172 AnjutaProjectNode
*anjuta_project_node_first_child (AnjutaProjectNode
*node
);
173 AnjutaProjectNode
*anjuta_project_node_last_child (AnjutaProjectNode
*node
);
174 AnjutaProjectNode
*anjuta_project_node_next_sibling (AnjutaProjectNode
*node
);
175 AnjutaProjectNode
*anjuta_project_node_prev_sibling (AnjutaProjectNode
*node
);
176 AnjutaProjectNode
*anjuta_project_node_nth_child (AnjutaProjectNode
*node
, guint n
);
178 void anjuta_project_node_foreach (AnjutaProjectNode
*node
, GTraverseType order
, AnjutaProjectNodeForeachFunc func
, gpointer data
);
179 void anjuta_project_node_children_foreach (AnjutaProjectNode
*node
, AnjutaProjectNodeForeachFunc func
, gpointer data
);
180 AnjutaProjectNode
*anjuta_project_node_traverse (AnjutaProjectNode
*node
, GTraverseType order
, AnjutaProjectNodeTraverseFunc func
, gpointer data
);
181 AnjutaProjectNode
*anjuta_project_node_children_traverse (AnjutaProjectNode
*node
, AnjutaProjectNodeTraverseFunc func
, gpointer data
);
183 void anjuta_project_node_check (AnjutaProjectNode
*parent
);
184 void anjuta_project_node_dump (AnjutaProjectNode
*parent
);
186 AnjutaProjectNode
*anjuta_project_node_insert_before (AnjutaProjectNode
*parent
, AnjutaProjectNode
*sibling
, AnjutaProjectNode
*node
);
187 AnjutaProjectNode
*anjuta_project_node_insert_after (AnjutaProjectNode
*parent
, AnjutaProjectNode
*sibling
, AnjutaProjectNode
*node
);
188 AnjutaProjectNode
*anjuta_project_node_remove (AnjutaProjectNode
*node
);
189 AnjutaProjectNode
*anjuta_project_node_append (AnjutaProjectNode
*parent
, AnjutaProjectNode
*node
);
190 AnjutaProjectNode
*anjuta_project_node_prepend (AnjutaProjectNode
*parent
, AnjutaProjectNode
*node
);
192 AnjutaProjectNodeType
anjuta_project_node_get_node_type (const AnjutaProjectNode
*node
);
193 AnjutaProjectNodeType
anjuta_project_node_get_full_type (const AnjutaProjectNode
*node
);
194 AnjutaProjectNodeState
anjuta_project_node_get_state (const AnjutaProjectNode
*node
);
195 const gchar
*anjuta_project_node_get_name (const AnjutaProjectNode
*node
);
196 GFile
*anjuta_project_node_get_file (const AnjutaProjectNode
*node
);
198 GList
*anjuta_project_node_get_native_properties (AnjutaProjectNode
*node
);
199 GList
*anjuta_project_node_get_custom_properties (AnjutaProjectNode
*node
);
200 AnjutaProjectProperty
*anjuta_project_node_get_property (AnjutaProjectNode
*node
, AnjutaProjectProperty
*property
);
202 gboolean
anjuta_project_node_set_state (AnjutaProjectNode
*node
, AnjutaProjectNodeState state
);
203 gboolean
anjuta_project_node_clear_state (AnjutaProjectNode
*node
, AnjutaProjectNodeState state
);
205 AnjutaProjectProperty
*anjuta_project_node_insert_property (AnjutaProjectNode
*node
, AnjutaProjectProperty
*native
, AnjutaProjectProperty
*property
);
206 AnjutaProjectProperty
*anjuta_project_node_remove_property (AnjutaProjectNode
*node
, AnjutaProjectProperty
*property
);
208 AnjutaProjectNode
*anjuta_project_group_get_node_from_file (const AnjutaProjectNode
*root
, GFile
*directory
);
209 AnjutaProjectNode
*anjuta_project_target_get_node_from_name (const AnjutaProjectNode
*parent
, const gchar
*name
);
210 AnjutaProjectNode
*anjuta_project_source_get_node_from_file (const AnjutaProjectNode
*parent
, GFile
*file
);
214 #define ANJUTA_TYPE_PROJECT_NODE_INFO (anjuta_project_node_info_get_type ())
216 typedef struct _AnjutaProjectNodeInfo AnjutaProjectNodeInfo
;
218 struct _AnjutaProjectNodeInfo
220 AnjutaProjectNodeType type
;
225 GType
anjuta_project_node_info_get_type (void);
227 AnjutaProjectNodeInfo
*anjuta_project_node_info_new (AnjutaProjectNodeType type
, const gchar
*name
, const gchar
*mime_type
);
228 AnjutaProjectNodeInfo
*anjuta_project_node_info_copy (AnjutaProjectNodeInfo
*info
);
229 void anjuta_project_node_info_free (AnjutaProjectNodeInfo
*info
);
231 const gchar
*anjuta_project_node_info_name (const AnjutaProjectNodeInfo
*info
);
232 const gchar
*anjuta_project_node_info_mime (const AnjutaProjectNodeInfo
*info
);
233 AnjutaProjectNodeType
anjuta_project_node_info_type (const AnjutaProjectNodeInfo
*info
);