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>
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
{
59 struct _GbfProjectTarget
{
69 struct _GbfProjectTargetSource
{
76 /* FIXME: extend this list */
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
,
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
;
98 struct _GbfProjectClass
{
99 GObjectClass parent_class
;
101 void (* project_updated
) (GbfProject
*project
);
105 void (* load
) (GbfProject
*project
,
108 gboolean (* probe
) (GbfProject
*project
,
111 void (* refresh
) (GbfProject
*project
,
113 GbfProjectCapabilities (* get_capabilities
) (GbfProject
*project
,
117 gchar
* (* add_group
) (GbfProject
*project
,
118 const gchar
*parent_id
,
121 void (* remove_group
) (GbfProject
*project
,
124 GbfProjectGroup
* (* get_group
) (GbfProject
*project
,
127 GList
* (* get_all_groups
) (GbfProject
*project
,
129 GtkWidget
* (* configure_group
) (GbfProject
*project
,
132 GtkWidget
* (* configure_new_group
) (GbfProject
*project
,
136 gchar
* (* add_target
) (GbfProject
*project
,
137 const gchar
*group_id
,
141 void (* remove_target
) (GbfProject
*project
,
144 GbfProjectTarget
* (* get_target
) (GbfProject
*project
,
147 GList
* (* get_all_targets
) (GbfProject
*project
,
149 GtkWidget
* (* configure_target
) (GbfProject
*project
,
152 GtkWidget
* (* configure_new_target
) (GbfProject
*project
,
156 gchar
* (* add_source
) (GbfProject
*project
,
157 const gchar
*target_id
,
160 void (* remove_source
) (GbfProject
*project
,
163 GbfProjectTargetSource
* (* get_source
) (GbfProject
*project
,
166 GList
* (* get_all_sources
) (GbfProject
*project
,
168 GtkWidget
* (* configure_source
) (GbfProject
*project
,
171 GtkWidget
* (* configure_new_source
) (GbfProject
*project
,
173 GtkWidget
* (* configure
) (GbfProject
*project
,
176 GList
* (* get_config_modules
) (GbfProject
*project
,
178 GList
* (* get_config_packages
) (GbfProject
*project
,
184 const gchar
* (* name_for_type
) (GbfProject
*project
,
186 const gchar
* (* mimetype_for_type
) (GbfProject
*project
,
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
,
199 gboolean
gbf_project_probe (GbfProject
*project
,
202 void gbf_project_refresh (GbfProject
*project
,
204 GbfProjectCapabilities
gbf_project_get_capabilities (GbfProject
*project
,
208 gchar
*gbf_project_add_group (GbfProject
*project
,
209 const gchar
*parent_id
,
212 void gbf_project_remove_group (GbfProject
*project
,
215 GbfProjectGroup
*gbf_project_get_group (GbfProject
*project
,
218 GList
*gbf_project_get_all_groups (GbfProject
*project
,
220 GtkWidget
*gbf_project_configure_group (GbfProject
*project
,
223 GtkWidget
*gbf_project_configure_new_group (GbfProject
*project
,
228 gchar
*gbf_project_add_target (GbfProject
*project
,
229 const gchar
*group_id
,
233 void gbf_project_remove_target (GbfProject
*project
,
236 GbfProjectTarget
*gbf_project_get_target (GbfProject
*project
,
239 GList
*gbf_project_get_all_targets (GbfProject
*project
,
241 GtkWidget
*gbf_project_configure_target (GbfProject
*project
,
244 GtkWidget
*gbf_project_configure_new_target (GbfProject
*project
,
249 gchar
*gbf_project_add_source (GbfProject
*project
,
250 const gchar
*target_id
,
253 void gbf_project_remove_source (GbfProject
*project
,
256 GbfProjectTargetSource
*gbf_project_get_source (GbfProject
*project
,
259 GList
*gbf_project_get_all_sources (GbfProject
*project
,
261 GtkWidget
*gbf_project_configure_source (GbfProject
*project
,
264 GtkWidget
*gbf_project_configure_new_source (GbfProject
*project
,
268 GtkWidget
*gbf_project_configure (GbfProject
*project
,
272 GList
*gbf_project_get_config_modules (GbfProject
*project
,
275 GList
*gbf_project_get_config_packages (GbfProject
*project
,
281 const gchar
*gbf_project_name_for_type (GbfProject
*project
,
283 const gchar
*gbf_project_mimetype_for_type (GbfProject
*project
,
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) \
304 prefix##_get_type (GTypeModule *module) \
306 static GType type = 0; \
308 static const GTypeInfo type_info = { \
309 sizeof (class_name##Class), \
312 (GClassInitFunc)prefix##_class_init, \
315 sizeof (class_name), \
317 (GInstanceInitFunc)prefix##_instance_init \
319 if (module == NULL) { \
320 type = g_type_register_static (GBF_TYPE_PROJECT, \
324 type = g_type_module_register_type (module, \
335 #endif /* _GBF_PROJECT_H_ */