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
;
53 AnjutaProjectProperty
*native
;
56 GType
anjuta_project_property_get_type (void);
58 AnjutaProjectProperty
*anjuta_project_property_new (const gchar
*name
, AnjutaProjectValueType type
, const gchar
*value
, AnjutaProjectProperty
*native
);
59 AnjutaProjectProperty
* anjuta_project_property_copy (AnjutaProjectProperty
*prop
);
60 void anjuta_project_property_free (AnjutaProjectProperty
*prop
);
64 #define ANJUTA_TYPE_PROJECT_NODE (anjuta_project_node_get_type ())
65 #define ANJUTA_PROJECT_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ANJUTA_TYPE_PROJECT_NODE, AnjutaProjectNode))
66 #define ANJUTA_PROJECT_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ANJUTA_TYPE_PROJECT_NODE, AnjutaProjectNodeClass))
67 #define ANJUTA_IS_PROJECT_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ANJUTA_TYPE_PROJECT_NODE))
68 #define ANJUTA_IS_PROJECT_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ANJUTA_TYPE_PROJECT_NODE))
69 #define ANJUTA_PROJECT_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ANJUTA_TYPE_PROJECT_NODE, AnjutaProjectNodeClass))
71 typedef struct _AnjutaProjectNode AnjutaProjectNode
;
72 typedef struct _AnjutaProjectNodeClass AnjutaProjectNodeClass
;
76 ANJUTA_PROJECT_UNKNOWN
= 0,
77 ANJUTA_PROJECT_SHAREDLIB
,
78 ANJUTA_PROJECT_STATICLIB
,
79 ANJUTA_PROJECT_BINARY
,
80 ANJUTA_PROJECT_PYTHON
,
83 ANJUTA_PROJECT_HEADER
,
86 ANJUTA_PROJECT_GENERIC
,
89 ANJUTA_PROJECT_INTLTOOL
,
90 ANJUTA_PROJECT_CONFIGURE
,
92 ANJUTA_PROJECT_MKENUMS
,
93 ANJUTA_PROJECT_GENMARSHAL
,
94 ANJUTA_PROJECT_SCRIPT
,
95 ANJUTA_PROJECT_PROXY
= 1 << 12,
96 ANJUTA_PROJECT_PROJECT
= 1 << 13,
97 ANJUTA_PROJECT_PRIMARY
= 1 << 14,
98 ANJUTA_PROJECT_EXECUTABLE
= 1 << 15,
99 ANJUTA_PROJECT_ID_MASK
= 0xFFF,
100 ANJUTA_PROJECT_FLAG_MASK
= 0x0F << 12,
101 ANJUTA_PROJECT_TYPE_MASK
= 0xFFFF << 16,
102 ANJUTA_PROJECT_ROOT
= 1 << 16,
103 ANJUTA_PROJECT_GROUP
= 2 << 16,
104 ANJUTA_PROJECT_TARGET
= 3 << 16,
105 ANJUTA_PROJECT_SOURCE
= 4 << 16 ,
106 ANJUTA_PROJECT_MODULE
= 5 << 16,
107 ANJUTA_PROJECT_PACKAGE
= 6 << 16,
108 ANJUTA_PROJECT_VARIABLE
= 7 << 16
109 } AnjutaProjectNodeType
;
113 ANJUTA_PROJECT_OK
= 0,
114 ANJUTA_PROJECT_MODIFIED
= 1 << 0, /* Node has been modified */
115 ANJUTA_PROJECT_INCOMPLETE
= 1 << 1, /* Node is not fully loaded */
116 ANJUTA_PROJECT_LOADING
= 1 << 2, /* Node is send to the worker thread */
117 ANJUTA_PROJECT_REMOVED
= 1 << 3, /* Node has been removed */
118 ANJUTA_PROJECT_CAN_ADD_GROUP
= 1 << 8,
119 ANJUTA_PROJECT_CAN_ADD_TARGET
= 1 << 9,
120 ANJUTA_PROJECT_CAN_ADD_SOURCE
= 1 << 10,
121 ANJUTA_PROJECT_CAN_ADD_MODULE
= 1 << 11,
122 ANJUTA_PROJECT_CAN_ADD_PACKAGE
= 1 << 12,
123 ANJUTA_PROJECT_CAN_REMOVE
= 1 << 16,
124 ANJUTA_PROJECT_CAN_SAVE
= 1 << 17,
125 ANJUTA_PROJECT_REMOVE_FILE
= 1 << 18
126 } AnjutaProjectNodeState
;
131 * The #AnjutaProjectNode struct contains private data only, and should
132 * accessed using the functions below.
134 struct _AnjutaProjectNode
136 GInitiallyUnowned parent_instance
;
138 AnjutaProjectNode
*next
;
139 AnjutaProjectNode
*prev
;
140 AnjutaProjectNode
*parent
;
141 AnjutaProjectNode
*children
;
143 AnjutaProjectNodeType type
;
144 AnjutaProjectNodeState state
;
146 GList
*native_properties
;
147 GList
*custom_properties
;
152 struct _AnjutaProjectNodeClass
154 GInitiallyUnownedClass parent_class
;
156 void (*updated
) (GError
*error
);
157 void (*loaded
) (GError
*error
);
162 typedef gboolean (*AnjutaProjectNodeTraverseFunc
) (AnjutaProjectNode
*node
, gpointer data
);
163 typedef void (*AnjutaProjectNodeForeachFunc
) (AnjutaProjectNode
*node
, gpointer data
);
166 GType
anjuta_project_node_get_type (void) G_GNUC_CONST
;
168 AnjutaProjectNode
*anjuta_project_node_root (AnjutaProjectNode
*node
);
169 AnjutaProjectNode
*anjuta_project_node_parent (AnjutaProjectNode
*node
);
170 AnjutaProjectNode
*anjuta_project_node_first_child (AnjutaProjectNode
*node
);
171 AnjutaProjectNode
*anjuta_project_node_last_child (AnjutaProjectNode
*node
);
172 AnjutaProjectNode
*anjuta_project_node_next_sibling (AnjutaProjectNode
*node
);
173 AnjutaProjectNode
*anjuta_project_node_prev_sibling (AnjutaProjectNode
*node
);
174 AnjutaProjectNode
*anjuta_project_node_nth_child (AnjutaProjectNode
*node
, guint n
);
176 void anjuta_project_node_foreach (AnjutaProjectNode
*node
, GTraverseType order
, AnjutaProjectNodeForeachFunc func
, gpointer data
);
177 void anjuta_project_node_children_foreach (AnjutaProjectNode
*node
, AnjutaProjectNodeForeachFunc func
, gpointer data
);
178 AnjutaProjectNode
*anjuta_project_node_traverse (AnjutaProjectNode
*node
, GTraverseType order
, AnjutaProjectNodeTraverseFunc func
, gpointer data
);
179 AnjutaProjectNode
*anjuta_project_node_children_traverse (AnjutaProjectNode
*node
, AnjutaProjectNodeTraverseFunc func
, gpointer data
);
181 AnjutaProjectNode
*anjuta_project_node_insert_before (AnjutaProjectNode
*parent
, AnjutaProjectNode
*sibling
, AnjutaProjectNode
*node
);
182 AnjutaProjectNode
*anjuta_project_node_insert_after (AnjutaProjectNode
*parent
, AnjutaProjectNode
*sibling
, AnjutaProjectNode
*node
);
183 AnjutaProjectNode
*anjuta_project_node_remove (AnjutaProjectNode
*node
);
184 AnjutaProjectNode
*anjuta_project_node_append (AnjutaProjectNode
*parent
, AnjutaProjectNode
*node
);
185 AnjutaProjectNode
*anjuta_project_node_prepend (AnjutaProjectNode
*parent
, AnjutaProjectNode
*node
);
188 AnjutaProjectNodeType
anjuta_project_node_get_node_type (const AnjutaProjectNode
*node
);
189 AnjutaProjectNodeType
anjuta_project_node_get_full_type (const AnjutaProjectNode
*node
);
190 AnjutaProjectNodeState
anjuta_project_node_get_state (const AnjutaProjectNode
*node
);
191 const gchar
*anjuta_project_node_get_name (const AnjutaProjectNode
*node
);
192 GFile
*anjuta_project_node_get_file (const AnjutaProjectNode
*node
);
194 GList
*anjuta_project_node_get_native_properties (AnjutaProjectNode
*node
);
195 GList
*anjuta_project_node_get_custom_properties (AnjutaProjectNode
*node
);
196 AnjutaProjectProperty
*anjuta_project_node_get_property (AnjutaProjectNode
*node
, AnjutaProjectProperty
*property
);
198 gboolean
anjuta_project_node_set_state (AnjutaProjectNode
*node
, AnjutaProjectNodeState state
);
199 gboolean
anjuta_project_node_clear_state (AnjutaProjectNode
*node
, AnjutaProjectNodeState state
);
201 AnjutaProjectProperty
*anjuta_project_node_insert_property (AnjutaProjectNode
*node
, AnjutaProjectProperty
*native
, AnjutaProjectProperty
*property
);
202 AnjutaProjectProperty
*anjuta_project_node_remove_property (AnjutaProjectNode
*node
, AnjutaProjectProperty
*property
);
205 AnjutaProjectNode
*anjuta_project_group_get_node_from_file (const AnjutaProjectNode
*root
, GFile
*directory
);
206 AnjutaProjectNode
*anjuta_project_target_get_node_from_name (const AnjutaProjectNode
*parent
, const gchar
*name
);
207 AnjutaProjectNode
*anjuta_project_source_get_node_from_file (const AnjutaProjectNode
*parent
, GFile
*file
);
211 #define ANJUTA_TYPE_PROJECT_NODE_INFO (anjuta_project_node_info_get_type ())
213 typedef struct _AnjutaProjectNodeInfo
215 AnjutaProjectNodeType type
;
218 } AnjutaProjectNodeInfo
;
220 GType
anjuta_project_node_info_get_type (void);
222 AnjutaProjectNodeInfo
*anjuta_project_node_info_new (AnjutaProjectNodeType type
, const gchar
*name
, const gchar
*mime_type
);
223 AnjutaProjectNodeInfo
*anjuta_project_node_info_copy (AnjutaProjectNodeInfo
*info
);
224 void anjuta_project_node_info_free (AnjutaProjectNodeInfo
*info
);
226 const gchar
*anjuta_project_node_info_name (const AnjutaProjectNodeInfo
*info
);
227 const gchar
*anjuta_project_node_info_mime (const AnjutaProjectNodeInfo
*info
);
228 AnjutaProjectNodeType
anjuta_project_node_info_type (const AnjutaProjectNodeInfo
*info
);