1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 /*
3 * ianjuta-project.c -- Autogenerated from libanjuta.idl
4 *
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.
9 *
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.
14 *
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.
18 */
19
20 /**
21 * SECTION:ianjuta-project
22 * @title: IAnjutaProject
23 * @short_description: Interface implemented by project backend
24 * @see_also:
25 * @stability: Unstable
26 * @include: libanjuta/interfaces/ianjuta-project-backend.h
27 *
28 * This is the new interface that is replacing Gnome Build.
29 */
30
31 #include "ianjuta-project.h"
32 #include "libanjuta-iface-marshallers.h"
33
34 GQuark
ianjuta_project_error_quark(void)35 ianjuta_project_error_quark (void)
36 {
37 static GQuark quark = 0;
38
39 if (quark == 0) {
40 quark = g_quark_from_static_string ("ianjuta-project-quark");
41 }
42
43 return quark;
44 }
45
46 /**
47 * ianjuta_project_add_node_after:
48 * @obj: Self
49 * @parent: (transfer none): Parent
50 * @sibling: (allow-none) (transfer none): Sibling
51 * @type: Node type
52 * @file: (allow-none) (transfer none): Optional file object for the node
53 * @name: (allow-none) (transfer none): Optional name for the node
54 * @err: Error propagation and reporting
55 *
56 * Create a new node and insert it after sibling
57 *
58 * Return value: (transfer none): The new node, NULL if error
59 */
60 AnjutaProjectNode *
ianjuta_project_add_node_after(IAnjutaProject * obj,AnjutaProjectNode * parent,AnjutaProjectNode * sibling,AnjutaProjectNodeType type,GFile * file,const gchar * name,GError ** err)61 ianjuta_project_add_node_after (IAnjutaProject *obj, AnjutaProjectNode *parent, AnjutaProjectNode *sibling, AnjutaProjectNodeType type, GFile *file, const gchar *name, GError **err)
62 {
63 g_return_val_if_fail (IANJUTA_IS_PROJECT(obj), NULL);
64 g_return_val_if_fail ((parent == NULL) ||ANJUTA_IS_PROJECT_NODE(parent), NULL);
65 g_return_val_if_fail ((sibling == NULL) ||ANJUTA_IS_PROJECT_NODE(sibling), NULL);
66 return IANJUTA_PROJECT_GET_IFACE (obj)->add_node_after (obj, parent, sibling, type, file, name, err);
67 }
68
69 /* Default implementation */
70 static AnjutaProjectNode *
ianjuta_project_add_node_after_default(IAnjutaProject * obj,AnjutaProjectNode * parent,AnjutaProjectNode * sibling,AnjutaProjectNodeType type,GFile * file,const gchar * name,GError ** err)71 ianjuta_project_add_node_after_default (IAnjutaProject *obj, AnjutaProjectNode *parent, AnjutaProjectNode *sibling, AnjutaProjectNodeType type, GFile *file, const gchar *name, GError **err)
72 {
73 g_return_val_if_reached (NULL);
74 }
75
76 /**
77 * ianjuta_project_add_node_before:
78 * @obj: Self
79 * @parent: (transfer none): Parent
80 * @sibling: (allow-none) (transfer none): Sibling
81 * @type: Node type
82 * @file: (allow-none) (transfer none): Optional file object for the node
83 * @name: (allow-none) (transfer none): Optional name for the node
84 * @err: Error propagation and reporting
85 *
86 * Create a new node and insert it before sibling
87 *
88 * Return value: (transfer none): The new node, NULL if error
89 */
90 AnjutaProjectNode *
ianjuta_project_add_node_before(IAnjutaProject * obj,AnjutaProjectNode * parent,AnjutaProjectNode * sibling,AnjutaProjectNodeType type,GFile * file,const gchar * name,GError ** err)91 ianjuta_project_add_node_before (IAnjutaProject *obj, AnjutaProjectNode *parent, AnjutaProjectNode *sibling, AnjutaProjectNodeType type, GFile *file, const gchar *name, GError **err)
92 {
93 g_return_val_if_fail (IANJUTA_IS_PROJECT(obj), NULL);
94 g_return_val_if_fail ((parent == NULL) ||ANJUTA_IS_PROJECT_NODE(parent), NULL);
95 g_return_val_if_fail ((sibling == NULL) ||ANJUTA_IS_PROJECT_NODE(sibling), NULL);
96 return IANJUTA_PROJECT_GET_IFACE (obj)->add_node_before (obj, parent, sibling, type, file, name, err);
97 }
98
99 /* Default implementation */
100 static AnjutaProjectNode *
ianjuta_project_add_node_before_default(IAnjutaProject * obj,AnjutaProjectNode * parent,AnjutaProjectNode * sibling,AnjutaProjectNodeType type,GFile * file,const gchar * name,GError ** err)101 ianjuta_project_add_node_before_default (IAnjutaProject *obj, AnjutaProjectNode *parent, AnjutaProjectNode *sibling, AnjutaProjectNodeType type, GFile *file, const gchar *name, GError **err)
102 {
103 g_return_val_if_reached (NULL);
104 }
105
106 /**
107 * ianjuta_project_get_node_info:
108 * @obj: Self
109 * @err: Error propagation and reporting
110 *
111 * Return a list of possible node;
112 *
113 * Return value: (element-type Anjuta.ProjectNodeInfo) (transfer none): A list
114 * containing information on all node supported by the project.
115 */
116 const GList*
ianjuta_project_get_node_info(IAnjutaProject * obj,GError ** err)117 ianjuta_project_get_node_info (IAnjutaProject *obj, GError **err)
118 {
119 g_return_val_if_fail (IANJUTA_IS_PROJECT(obj), 0);
120 return IANJUTA_PROJECT_GET_IFACE (obj)->get_node_info (obj, err);
121 }
122
123 /* Default implementation */
124 static const GList*
ianjuta_project_get_node_info_default(IAnjutaProject * obj,GError ** err)125 ianjuta_project_get_node_info_default (IAnjutaProject *obj, GError **err)
126 {
127 g_return_val_if_reached (NULL);
128 }
129
130 /**
131 * ianjuta_project_get_root:
132 * @obj: Self
133 * @err: Error propagation and reporting
134 *
135 * Get root_node
136 *
137 * Return value: (transfer none): The root node
138 */
139 AnjutaProjectNode *
ianjuta_project_get_root(IAnjutaProject * obj,GError ** err)140 ianjuta_project_get_root (IAnjutaProject *obj, GError **err)
141 {
142 g_return_val_if_fail (IANJUTA_IS_PROJECT(obj), NULL);
143 return IANJUTA_PROJECT_GET_IFACE (obj)->get_root (obj, err);
144 }
145
146 /* Default implementation */
147 static AnjutaProjectNode *
ianjuta_project_get_root_default(IAnjutaProject * obj,GError ** err)148 ianjuta_project_get_root_default (IAnjutaProject *obj, GError **err)
149 {
150 g_return_val_if_reached (NULL);
151 }
152
153 /**
154 * ianjuta_project_is_loaded:
155 * @obj: Self
156 * @err: Error propagation and reporting
157 *
158 * Return TRUE if the project is loaded;
159 *
160 * Return value: TRUE if the project is completely loaded.
161 */
162 gboolean
ianjuta_project_is_loaded(IAnjutaProject * obj,GError ** err)163 ianjuta_project_is_loaded (IAnjutaProject *obj, GError **err)
164 {
165 g_return_val_if_fail (IANJUTA_IS_PROJECT(obj), FALSE);
166 return IANJUTA_PROJECT_GET_IFACE (obj)->is_loaded (obj, err);
167 }
168
169 /* Default implementation */
170 static gboolean
ianjuta_project_is_loaded_default(IAnjutaProject * obj,GError ** err)171 ianjuta_project_is_loaded_default (IAnjutaProject *obj, GError **err)
172 {
173 g_return_val_if_reached (FALSE);
174 }
175
176 /**
177 * ianjuta_project_load_node:
178 * @obj: Self
179 * @node: (transfer none): Project node to reload
180 * @err: Error propagation and reporting
181 *
182 * Reload a project node
183 *
184 * Return value: TRUE if the node has been loaded without error
185 */
186 gboolean
ianjuta_project_load_node(IAnjutaProject * obj,AnjutaProjectNode * node,GError ** err)187 ianjuta_project_load_node (IAnjutaProject *obj, AnjutaProjectNode *node, GError **err)
188 {
189 g_return_val_if_fail (IANJUTA_IS_PROJECT(obj), FALSE);
190 g_return_val_if_fail ((node == NULL) ||ANJUTA_IS_PROJECT_NODE(node), FALSE);
191 return IANJUTA_PROJECT_GET_IFACE (obj)->load_node (obj, node, err);
192 }
193
194 /* Default implementation */
195 static gboolean
ianjuta_project_load_node_default(IAnjutaProject * obj,AnjutaProjectNode * node,GError ** err)196 ianjuta_project_load_node_default (IAnjutaProject *obj, AnjutaProjectNode *node, GError **err)
197 {
198 g_return_val_if_reached (FALSE);
199 }
200
201 /**
202 * ianjuta_project_remove_node:
203 * @obj: Self
204 * @node: (transfer none): Node
205 * @err: Error propagation and reporting
206 *
207 * Remove a node
208 *
209 * Return value: TRUE if the node can be removed
210 */
211 gboolean
ianjuta_project_remove_node(IAnjutaProject * obj,AnjutaProjectNode * node,GError ** err)212 ianjuta_project_remove_node (IAnjutaProject *obj, AnjutaProjectNode *node, GError **err)
213 {
214 g_return_val_if_fail (IANJUTA_IS_PROJECT(obj), FALSE);
215 g_return_val_if_fail ((node == NULL) ||ANJUTA_IS_PROJECT_NODE(node), FALSE);
216 return IANJUTA_PROJECT_GET_IFACE (obj)->remove_node (obj, node, err);
217 }
218
219 /* Default implementation */
220 static gboolean
ianjuta_project_remove_node_default(IAnjutaProject * obj,AnjutaProjectNode * node,GError ** err)221 ianjuta_project_remove_node_default (IAnjutaProject *obj, AnjutaProjectNode *node, GError **err)
222 {
223 g_return_val_if_reached (FALSE);
224 }
225
226 /**
227 * ianjuta_project_remove_property:
228 * @obj: Self
229 * @node: (transfer none): Node
230 * @id: (transfer none): Property
231 * @name: (allow-none) (transfer none): Name for map property
232 * @err: Error propagation and reporting
233 *
234 * Remove a property of the node
235 *
236 * Return value: TRUE if the node is removed
237 */
238 gboolean
ianjuta_project_remove_property(IAnjutaProject * obj,AnjutaProjectNode * node,const gchar * id,const gchar * name,GError ** err)239 ianjuta_project_remove_property (IAnjutaProject *obj, AnjutaProjectNode *node, const gchar *id, const gchar *name, GError **err)
240 {
241 g_return_val_if_fail (IANJUTA_IS_PROJECT(obj), FALSE);
242 g_return_val_if_fail ((node == NULL) ||ANJUTA_IS_PROJECT_NODE(node), FALSE);
243 return IANJUTA_PROJECT_GET_IFACE (obj)->remove_property (obj, node, id, name, err);
244 }
245
246 /* Default implementation */
247 static gboolean
ianjuta_project_remove_property_default(IAnjutaProject * obj,AnjutaProjectNode * node,const gchar * id,const gchar * name,GError ** err)248 ianjuta_project_remove_property_default (IAnjutaProject *obj, AnjutaProjectNode *node, const gchar *id, const gchar *name, GError **err)
249 {
250 g_return_val_if_reached (FALSE);
251 }
252
253 /**
254 * ianjuta_project_save_node:
255 * @obj: Self
256 * @node: (transfer none): Project node to save
257 * @err: Error propagation and reporting
258 *
259 * Save a project node
260 *
261 * Return value: TRUE if the node has been saved without error
262 */
263 gboolean
ianjuta_project_save_node(IAnjutaProject * obj,AnjutaProjectNode * node,GError ** err)264 ianjuta_project_save_node (IAnjutaProject *obj, AnjutaProjectNode *node, GError **err)
265 {
266 g_return_val_if_fail (IANJUTA_IS_PROJECT(obj), FALSE);
267 g_return_val_if_fail ((node == NULL) ||ANJUTA_IS_PROJECT_NODE(node), FALSE);
268 return IANJUTA_PROJECT_GET_IFACE (obj)->save_node (obj, node, err);
269 }
270
271 /* Default implementation */
272 static gboolean
ianjuta_project_save_node_default(IAnjutaProject * obj,AnjutaProjectNode * node,GError ** err)273 ianjuta_project_save_node_default (IAnjutaProject *obj, AnjutaProjectNode *node, GError **err)
274 {
275 g_return_val_if_reached (FALSE);
276 }
277
278 /**
279 * ianjuta_project_set_property:
280 * @obj: Self
281 * @node: (transfer none): Node
282 * @id: (transfer none): Property
283 * @name: (allow-none) (transfer none): Name for map property
284 * @value: (transfer none): Value
285 * @err: Error propagation and reporting
286 *
287 * Change a properties on node.
288 *
289 * Return value: (allow-none) (transfer none): The new property of NULL if the property cannot be set
290 */
291 AnjutaProjectProperty *
ianjuta_project_set_property(IAnjutaProject * obj,AnjutaProjectNode * node,const gchar * id,const gchar * name,const gchar * value,GError ** err)292 ianjuta_project_set_property (IAnjutaProject *obj, AnjutaProjectNode *node, const gchar *id, const gchar *name, const gchar *value, GError **err)
293 {
294 g_return_val_if_fail (IANJUTA_IS_PROJECT(obj), NULL);
295 g_return_val_if_fail ((node == NULL) ||ANJUTA_IS_PROJECT_NODE(node), NULL);
296 return IANJUTA_PROJECT_GET_IFACE (obj)->set_property (obj, node, id, name, value, err);
297 }
298
299 /* Default implementation */
300 static AnjutaProjectProperty *
ianjuta_project_set_property_default(IAnjutaProject * obj,AnjutaProjectNode * node,const gchar * id,const gchar * name,const gchar * value,GError ** err)301 ianjuta_project_set_property_default (IAnjutaProject *obj, AnjutaProjectNode *node, const gchar *id, const gchar *name, const gchar *value, GError **err)
302 {
303 g_return_val_if_reached (NULL);
304 }
305
306 static void
ianjuta_project_base_init(IAnjutaProjectIface * klass)307 ianjuta_project_base_init (IAnjutaProjectIface* klass)
308 {
309 static gboolean initialized = FALSE;
310
311 klass->add_node_after = ianjuta_project_add_node_after_default;
312 klass->add_node_before = ianjuta_project_add_node_before_default;
313 klass->get_node_info = ianjuta_project_get_node_info_default;
314 klass->get_root = ianjuta_project_get_root_default;
315 klass->is_loaded = ianjuta_project_is_loaded_default;
316 klass->load_node = ianjuta_project_load_node_default;
317 klass->remove_node = ianjuta_project_remove_node_default;
318 klass->remove_property = ianjuta_project_remove_property_default;
319 klass->save_node = ianjuta_project_save_node_default;
320 klass->set_property = ianjuta_project_set_property_default;
321
322 if (!initialized) {
323
324 /* Signals */
325 /**
326 * IAnjutaProject::file-changed:
327 * @obj: Self
328 * @node: Node to be reloaded.
329 *
330 * This signal is emitted when the project is changed on the disk. The
331 * corresponding node has to be reloaded.
332 */
333 g_signal_new ("file-changed",
334 IANJUTA_TYPE_PROJECT,
335 G_SIGNAL_RUN_LAST,
336 G_STRUCT_OFFSET (IAnjutaProjectIface, file_changed),
337 NULL, NULL,
338 libanjuta_iface_cclosure_marshal_VOID__POINTER,
339 G_TYPE_NONE,
340 1,
341 G_TYPE_POINTER);
342
343
344 /**
345 * IAnjutaProject::node-changed:
346 * @obj: Self
347 * @node: Changed node.
348 * @error: Error while changing node
349 *
350 * This signal is emitted when a node is changed by a function of this
351 * interface. The error argument is not NULL if the change was not
352 * possible. The corresponding node need to be saved.
353 */
354 g_signal_new ("node-changed",
355 IANJUTA_TYPE_PROJECT,
356 G_SIGNAL_RUN_LAST,
357 G_STRUCT_OFFSET (IAnjutaProjectIface, node_changed),
358 NULL, NULL,
359 libanjuta_iface_cclosure_marshal_VOID__POINTER_BOXED,
360 G_TYPE_NONE,
361 2,
362 G_TYPE_POINTER,
363 G_TYPE_ERROR);
364
365
366 /**
367 * IAnjutaProject::node-loaded:
368 * @obj: Self
369 * @node: Loaded node.
370 * @error: Error while loading node
371 *
372 * This signal is emitted when a node is loaded. It returns an error if the
373 * load operation fail.
374 */
375 g_signal_new ("node-loaded",
376 IANJUTA_TYPE_PROJECT,
377 G_SIGNAL_RUN_LAST,
378 G_STRUCT_OFFSET (IAnjutaProjectIface, node_loaded),
379 NULL, NULL,
380 libanjuta_iface_cclosure_marshal_VOID__POINTER_BOXED,
381 G_TYPE_NONE,
382 2,
383 G_TYPE_POINTER,
384 G_TYPE_ERROR);
385
386
387 /**
388 * IAnjutaProject::node-saved:
389 * @obj: Self
390 * @node: Saved node.
391 * @error: Error while saving node
392 *
393 * This signal is emitted when a node is saved. It returns an error if the
394 * save operation fail.
395 */
396 g_signal_new ("node-saved",
397 IANJUTA_TYPE_PROJECT,
398 G_SIGNAL_RUN_LAST,
399 G_STRUCT_OFFSET (IAnjutaProjectIface, node_saved),
400 NULL, NULL,
401 libanjuta_iface_cclosure_marshal_VOID__POINTER_BOXED,
402 G_TYPE_NONE,
403 2,
404 G_TYPE_POINTER,
405 G_TYPE_ERROR);
406
407
408 initialized = TRUE;
409 }
410 }
411
412 GType
ianjuta_project_get_type(void)413 ianjuta_project_get_type (void)
414 {
415 static GType type = 0;
416 if (!type) {
417 static const GTypeInfo info = {
418 sizeof (IAnjutaProjectIface),
419 (GBaseInitFunc) ianjuta_project_base_init,
420 NULL,
421 NULL,
422 NULL,
423 NULL,
424 0,
425 0,
426 NULL
427 };
428 type = g_type_register_static (G_TYPE_INTERFACE, "IAnjutaProject", &info, 0);
429 g_type_interface_add_prerequisite (type, G_TYPE_OBJECT);
430 }
431 return type;
432 }
433
434 GType
ianjuta_project_error_get_type(void)435 ianjuta_project_error_get_type (void)
436 {
437 static const GEnumValue values[] =
438 {
439 { IANJUTA_PROJECT_ERROR_SUCCESS, "IANJUTA_PROJECT_ERROR_SUCCESS", "error-success" },
440 { IANJUTA_PROJECT_ERROR_DOESNT_EXIST, "IANJUTA_PROJECT_ERROR_DOESNT_EXIST", "error-doesnt-exist" },
441 { IANJUTA_PROJECT_ERROR_ALREADY_EXISTS, "IANJUTA_PROJECT_ERROR_ALREADY_EXISTS", "error-already-exists" },
442 { IANJUTA_PROJECT_ERROR_VALIDATION_FAILED, "IANJUTA_PROJECT_ERROR_VALIDATION_FAILED", "error-validation-failed" },
443 { IANJUTA_PROJECT_ERROR_PROJECT_MALFORMED, "IANJUTA_PROJECT_ERROR_PROJECT_MALFORMED", "error-project-malformed" },
444 { IANJUTA_PROJECT_ERROR_WRONG_PARENT, "IANJUTA_PROJECT_ERROR_WRONG_PARENT", "error-wrong-parent" },
445 { IANJUTA_PROJECT_ERROR_NOT_SUPPORTED, "IANJUTA_PROJECT_ERROR_NOT_SUPPORTED", "error-not-supported" },
446 { IANJUTA_PROJECT_ERROR_GENERAL_FAILURE, "IANJUTA_PROJECT_ERROR_GENERAL_FAILURE", "error-general-failure" },
447 { 0, NULL, NULL }
448 };
449
450 static GType type = 0;
451
452 if (! type)
453 {
454 type = g_enum_register_static ("IAnjutaProjectError", values);
455 }
456
457 return type;
458 }
459
460 GType
ianjuta_project_probe_get_type(void)461 ianjuta_project_probe_get_type (void)
462 {
463 static const GEnumValue values[] =
464 {
465 { IANJUTA_PROJECT_PROBE_FILES, "IANJUTA_PROJECT_PROBE_FILES", "probe-files" },
466 { IANJUTA_PROJECT_PROBE_MAKE_FILES, "IANJUTA_PROJECT_PROBE_MAKE_FILES", "probe-make-files" },
467 { IANJUTA_PROJECT_PROBE_PROJECT_FILES, "IANJUTA_PROJECT_PROBE_PROJECT_FILES", "probe-project-files" },
468 { 0, NULL, NULL }
469 };
470
471 static GType type = 0;
472
473 if (! type)
474 {
475 type = g_enum_register_static ("IAnjutaProjectProbe", values);
476 }
477
478 return type;
479 }
480