debug-manager: removed size_request
[anjuta.git] / libanjuta / gbf-project.h
blobf44e1c736ef04a159b9b7267a4334806676207b9
1 /* gbf-project.h
3 * Copyright (C) 2002 Jeroen Zwartepoorte
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Library General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #ifndef _GBF_PROJECT_H_
21 #define _GBF_PROJECT_H_
23 #include <glib-object.h>
24 #include <gtk/gtk.h>
26 G_BEGIN_DECLS
28 #define GBF_TYPE_PROJECT (gbf_project_get_type ())
29 #define GBF_PROJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GBF_TYPE_PROJECT, GbfProject))
30 #define GBF_PROJECT_CLASS(obj) (G_TYPE_CHECK_CLASS_CAST ((klass), GBF_TYPE_PROJECT, GbfProjectClass))
31 #define GBF_IS_PROJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GBF_TYPE_PROJECT))
32 #define GBF_IS_PROJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), GBF_TYPE_PROJECT))
33 #define GBF_PROJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GBF_TYPE_PROJECT, GbfProjectClass))
35 #define GBF_PROJECT_ERROR (gbf_project_error_quark ())
37 #define GBF_TYPE_PROJECT_GROUP (gbf_project_group_get_type ())
38 #define GBF_TYPE_PROJECT_TARGET (gbf_project_target_get_type ())
39 #define GBF_TYPE_PROJECT_TARGET_SOURCE (gbf_project_target_source_get_type ())
41 #define GBF_BUILD_ID_DEFAULT "DEFAULT"
43 typedef struct _GbfProject GbfProject;
44 typedef struct _GbfProjectClass GbfProjectClass;
45 typedef struct _GbfProjectGroup GbfProjectGroup;
46 typedef struct _GbfProjectTarget GbfProjectTarget;
47 typedef struct _GbfProjectTargetSource GbfProjectTargetSource;
49 struct _GbfProjectGroup {
50 gchar *id;
51 gchar *parent_id;
53 gchar *name;
55 GList *groups;
56 GList *targets;
59 struct _GbfProjectTarget {
60 gchar *id;
61 gchar *group_id;
63 gchar *name;
64 gchar *type;
66 GList *sources;
69 struct _GbfProjectTargetSource {
70 gchar *id;
71 gchar *target_id;
73 gchar *source_uri;
76 /* FIXME: extend this list */
77 typedef enum {
78 GBF_PROJECT_ERROR_SUCCESS = 0,
79 GBF_PROJECT_ERROR_DOESNT_EXIST,
80 GBF_PROJECT_ERROR_ALREADY_EXISTS,
81 GBF_PROJECT_ERROR_VALIDATION_FAILED,
82 GBF_PROJECT_ERROR_PROJECT_MALFORMED,
83 GBF_PROJECT_ERROR_GENERAL_FAILURE,
84 } GbfProjectError;
86 typedef enum {
87 GBF_PROJECT_CAN_ADD_NONE = 0,
88 GBF_PROJECT_CAN_ADD_GROUP = 1 << 0,
89 GBF_PROJECT_CAN_ADD_TARGET = 1 << 1,
90 GBF_PROJECT_CAN_ADD_SOURCE = 1 << 2,
91 GBF_PROJECT_CAN_PACKAGES = 1 << 3
92 } GbfProjectCapabilities;
94 struct _GbfProject {
95 GObject parent;
98 struct _GbfProjectClass {
99 GObjectClass parent_class;
101 void (* project_updated) (GbfProject *project);
103 /* Virtual Table */
104 /* Project. */
105 void (* load) (GbfProject *project,
106 const gchar *path,
107 GError **error);
108 gboolean (* probe) (GbfProject *project,
109 const gchar *path,
110 GError **error);
111 void (* refresh) (GbfProject *project,
112 GError **error);
113 GbfProjectCapabilities (* get_capabilities) (GbfProject *project,
114 GError **error);
116 /* Groups. */
117 gchar * (* add_group) (GbfProject *project,
118 const gchar *parent_id,
119 const gchar *name,
120 GError **error);
121 void (* remove_group) (GbfProject *project,
122 const gchar *id,
123 GError **error);
124 GbfProjectGroup * (* get_group) (GbfProject *project,
125 const gchar *id,
126 GError **error);
127 GList * (* get_all_groups) (GbfProject *project,
128 GError **error);
129 GtkWidget * (* configure_group) (GbfProject *project,
130 const gchar *id,
131 GError **error);
132 GtkWidget * (* configure_new_group) (GbfProject *project,
133 GError **error);
135 /* Targets. */
136 gchar * (* add_target) (GbfProject *project,
137 const gchar *group_id,
138 const gchar *name,
139 const gchar *type,
140 GError **error);
141 void (* remove_target) (GbfProject *project,
142 const gchar *id,
143 GError **error);
144 GbfProjectTarget * (* get_target) (GbfProject *project,
145 const gchar *id,
146 GError **error);
147 GList * (* get_all_targets) (GbfProject *project,
148 GError **error);
149 GtkWidget * (* configure_target) (GbfProject *project,
150 const gchar *id,
151 GError **error);
152 GtkWidget * (* configure_new_target) (GbfProject *project,
153 GError **error);
155 /* Sources. */
156 gchar * (* add_source) (GbfProject *project,
157 const gchar *target_id,
158 const gchar *uri,
159 GError **error);
160 void (* remove_source) (GbfProject *project,
161 const gchar *id,
162 GError **error);
163 GbfProjectTargetSource * (* get_source) (GbfProject *project,
164 const gchar *id,
165 GError **error);
166 GList * (* get_all_sources) (GbfProject *project,
167 GError **error);
168 GtkWidget * (* configure_source) (GbfProject *project,
169 const gchar *id,
170 GError **error);
171 GtkWidget * (* configure_new_source) (GbfProject *project,
172 GError **error);
173 GtkWidget * (* configure) (GbfProject *project,
174 GError **error);
176 GList * (* get_config_modules) (GbfProject *project,
177 GError **error);
178 GList * (* get_config_packages) (GbfProject *project,
179 const gchar* module,
180 GError **error);
183 /* Types. */
184 const gchar * (* name_for_type) (GbfProject *project,
185 const gchar *type);
186 const gchar * (* mimetype_for_type) (GbfProject *project,
187 const gchar *type);
188 gchar ** (* get_types) (GbfProject *project);
191 GQuark gbf_project_error_quark (void);
192 GType gbf_project_get_type (void);
193 GType gbf_project_group_get_type (void);
194 GType gbf_project_target_get_type (void);
195 GType gbf_project_target_source_get_type (void);
196 void gbf_project_load (GbfProject *project,
197 const gchar *path,
198 GError **error);
199 gboolean gbf_project_probe (GbfProject *project,
200 const gchar *path,
201 GError **error);
202 void gbf_project_refresh (GbfProject *project,
203 GError **error);
204 GbfProjectCapabilities gbf_project_get_capabilities (GbfProject *project,
205 GError **error);
207 /* Groups. */
208 gchar *gbf_project_add_group (GbfProject *project,
209 const gchar *parent_id,
210 const gchar *name,
211 GError **error);
212 void gbf_project_remove_group (GbfProject *project,
213 const gchar *id,
214 GError **error);
215 GbfProjectGroup *gbf_project_get_group (GbfProject *project,
216 const gchar *id,
217 GError **error);
218 GList *gbf_project_get_all_groups (GbfProject *project,
219 GError **error);
220 GtkWidget *gbf_project_configure_group (GbfProject *project,
221 const gchar *id,
222 GError **error);
223 GtkWidget *gbf_project_configure_new_group (GbfProject *project,
224 GError **error);
227 /* Targets. */
228 gchar *gbf_project_add_target (GbfProject *project,
229 const gchar *group_id,
230 const gchar *name,
231 const gchar *type,
232 GError **error);
233 void gbf_project_remove_target (GbfProject *project,
234 const gchar *id,
235 GError **error);
236 GbfProjectTarget *gbf_project_get_target (GbfProject *project,
237 const gchar *id,
238 GError **error);
239 GList *gbf_project_get_all_targets (GbfProject *project,
240 GError **error);
241 GtkWidget *gbf_project_configure_target (GbfProject *project,
242 const gchar *id,
243 GError **error);
244 GtkWidget *gbf_project_configure_new_target (GbfProject *project,
245 GError **error);
248 /* Sources. */
249 gchar *gbf_project_add_source (GbfProject *project,
250 const gchar *target_id,
251 const gchar *uri,
252 GError **error);
253 void gbf_project_remove_source (GbfProject *project,
254 const gchar *id,
255 GError **error);
256 GbfProjectTargetSource *gbf_project_get_source (GbfProject *project,
257 const gchar *id,
258 GError **error);
259 GList *gbf_project_get_all_sources (GbfProject *project,
260 GError **error);
261 GtkWidget *gbf_project_configure_source (GbfProject *project,
262 const gchar *id,
263 GError **error);
264 GtkWidget *gbf_project_configure_new_source (GbfProject *project,
265 GError **error);
266 /* Project */
268 GtkWidget *gbf_project_configure (GbfProject *project,
269 GError **error);
271 /* Packages */
272 GList *gbf_project_get_config_modules (GbfProject *project,
273 GError** error);
275 GList *gbf_project_get_config_packages (GbfProject *project,
276 const gchar* module,
277 GError** error);
280 /* Types. */
281 const gchar *gbf_project_name_for_type (GbfProject *project,
282 const gchar *type);
283 const gchar *gbf_project_mimetype_for_type (GbfProject *project,
284 const gchar *type);
286 gchar **gbf_project_get_types (GbfProject *project);
288 /* functions for copying/freeing data structures */
290 GbfProjectGroup *gbf_project_group_copy (GbfProjectGroup *group);
291 void gbf_project_group_free (GbfProjectGroup *group);
293 GbfProjectTarget *gbf_project_target_copy (GbfProjectTarget *target);
294 void gbf_project_target_free (GbfProjectTarget *target);
296 GbfProjectTargetSource *gbf_project_target_source_copy (GbfProjectTargetSource *source);
297 void gbf_project_target_source_free (GbfProjectTargetSource *source);
302 #define GBF_BACKEND_BOILERPLATE(class_name, prefix) \
303 GType \
304 prefix##_get_type (GTypeModule *module) \
306 static GType type = 0; \
307 if (!type) { \
308 static const GTypeInfo type_info = { \
309 sizeof (class_name##Class), \
310 NULL, \
311 NULL, \
312 (GClassInitFunc)prefix##_class_init, \
313 NULL, \
314 NULL, \
315 sizeof (class_name), \
316 0, \
317 (GInstanceInitFunc)prefix##_instance_init \
318 }; \
319 if (module == NULL) { \
320 type = g_type_register_static (GBF_TYPE_PROJECT, \
321 #class_name, \
322 &type_info, 0); \
323 } else { \
324 type = g_type_module_register_type (module, \
325 GBF_TYPE_PROJECT, \
326 #class_name, \
327 &type_info, 0); \
330 return type; \
333 G_END_DECLS
335 #endif /* _GBF_PROJECT_H_ */