gnome-build r556 - in trunk: . src/backends/libgbf_am src/gbf
- From: jhs svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-build r556 - in trunk: . src/backends/libgbf_am src/gbf
- Date: Fri, 2 May 2008 12:42:02 +0100 (BST)
Author: jhs
Date: Fri May 2 11:42:02 2008
New Revision: 556
URL: http://svn.gnome.org/viewvc/gnome-build?rev=556&view=rev
Log:
2008-05-02 Johannes Schmid <jhs gnome org>
* src/backends/libgbf_am/gbf-am-project.c
(impl_get_config_modules), (impl_get_config_packages),
(gbf_am_project_class_init):
* src/gbf/gbf-project.c (gbf_project_get_config_modules),
(gbf_project_get_config_packages):
* src/gbf/gbf-project.h:
Added methods to access the list of pkg-config packages required for
building the project (to be used for symbol autocompletion for example).
* src/gbf/test-project-view.c (show_packages), (open_project):
Added a test case
Modified:
trunk/ChangeLog
trunk/src/backends/libgbf_am/gbf-am-project.c
trunk/src/gbf/gbf-project.c
trunk/src/gbf/gbf-project.h
trunk/src/gbf/test-project-view.c
Modified: trunk/src/backends/libgbf_am/gbf-am-project.c
==============================================================================
--- trunk/src/backends/libgbf_am/gbf-am-project.c (original)
+++ trunk/src/backends/libgbf_am/gbf-am-project.c Fri May 2 11:42:02 2008
@@ -3838,6 +3838,88 @@
return wid;
}
+static GList *
+impl_get_config_modules (GbfProject *project, GError **error)
+{
+ GbfAmConfigMapping *config;
+ GbfAmConfigValue *value;
+ GError* err = NULL;
+ const gchar* pkg_modules;
+ GList* result = NULL;
+
+ config = gbf_am_project_get_config (GBF_AM_PROJECT(project), &err);
+ if (err)
+ {
+ g_propagate_error (error, err);
+ return NULL;
+ }
+ if ((value = gbf_am_config_mapping_lookup (config, "pkg_check_modules")) &&
+ (pkg_modules = gbf_am_config_value_get_string (value)))
+ {
+ gchar **module;
+ gchar **modules = g_strsplit (pkg_modules, ", ", -1);
+ for (module = modules; *module != NULL; ++module)
+ {
+ result = g_list_prepend (result, *module);
+ }
+ }
+ return result;
+}
+
+static GList *
+impl_get_config_packages (GbfProject *project,
+ const gchar* module,
+ GError **error)
+{
+ GbfAmConfigMapping *config;
+ GbfAmConfigValue *module_info;
+ GbfAmConfigMapping *module_info_map;
+ GError* err = NULL;
+ GList* result = NULL;
+
+ config = gbf_am_project_get_config (GBF_AM_PROJECT(project), &err);
+ if (err)
+ {
+ g_propagate_error (error, err);
+ return NULL;
+ }
+
+ gchar *module_key = g_strconcat ("pkg_check_modules_",
+ module,
+ NULL);
+
+ if ((module_info = gbf_am_config_mapping_lookup (config, module_key)) &&
+ (module_info_map = gbf_am_config_value_get_mapping (module_info)))
+ {
+ GbfAmConfigValue *pkgs_val;
+ const gchar *packages;
+
+ if ((pkgs_val = gbf_am_config_mapping_lookup (module_info_map, "packages")) &&
+ (packages = gbf_am_config_value_get_string (pkgs_val)))
+ {
+ gchar **pkgs, **pkg;
+ pkgs = g_strsplit (packages, ", ", -1);
+ for (pkg = pkgs; *pkg != NULL; ++pkg)
+ {
+ gchar *version;
+ if ((version = strchr (*pkg, ' ')))
+ {
+ *version = '\0';
+ version++;
+ result = g_list_append (result, *pkg);
+
+ }
+ else
+ {
+ result = g_list_append (result, *pkg);
+ }
+ }
+ }
+ }
+ g_free (module_key);
+ return result;
+}
+
static void
gbf_am_project_class_init (GbfAmProjectClass *klass)
{
@@ -3884,6 +3966,9 @@
project_class->configure_new_source = impl_configure_new_source;
project_class->configure = impl_configure;
+ project_class->get_config_modules = impl_get_config_modules;
+ project_class->get_config_packages = impl_get_config_packages;
+
project_class->name_for_type = impl_name_for_type;
project_class->mimetype_for_type = impl_mimetype_for_type;
project_class->get_types = impl_get_types;
Modified: trunk/src/gbf/gbf-project.c
==============================================================================
--- trunk/src/gbf/gbf-project.c (original)
+++ trunk/src/gbf/gbf-project.c Fri May 2 11:42:02 2008
@@ -421,6 +421,28 @@
return GBF_PROJECT_GET_CLASS (project)->configure (project, error);
}
+GList *
+gbf_project_get_config_modules (GbfProject *project, GError **error)
+{
+ g_return_val_if_fail (project != NULL, NULL);
+ g_return_val_if_fail (GBF_IS_PROJECT (project), NULL);
+
+ return GBF_PROJECT_GET_CLASS (project)->get_config_modules (project, error);
+}
+
+GList *
+gbf_project_get_config_packages (GbfProject *project,
+ const gchar* module,
+ GError **error)
+{
+ g_return_val_if_fail (project != NULL, NULL);
+ g_return_val_if_fail (module != NULL, NULL);
+ g_return_val_if_fail (GBF_IS_PROJECT (project), NULL);
+
+ return GBF_PROJECT_GET_CLASS (project)->get_config_packages (project, module,
+ error);
+}
+
/* Types. */
const gchar *
gbf_project_name_for_type (GbfProject *project,
Modified: trunk/src/gbf/gbf-project.h
==============================================================================
--- trunk/src/gbf/gbf-project.h (original)
+++ trunk/src/gbf/gbf-project.h Fri May 2 11:42:02 2008
@@ -108,7 +108,8 @@
GBF_PROJECT_CAN_ADD_NONE = 0,
GBF_PROJECT_CAN_ADD_GROUP = 1 << 0,
GBF_PROJECT_CAN_ADD_TARGET = 1 << 1,
- GBF_PROJECT_CAN_ADD_SOURCE = 1 << 2
+ GBF_PROJECT_CAN_ADD_SOURCE = 1 << 2,
+ GBF_PROJECT_CAN_PACKAGES = 1 << 3
};
struct _GbfBuildWarning {
@@ -232,6 +233,13 @@
GtkWidget * (* configure) (GbfProject *project,
GError **error);
+ GList * (* get_config_modules) (GbfProject *project,
+ GError **error);
+ GList * (* get_config_packages) (GbfProject *project,
+ const gchar* module,
+ GError **error);
+
+
/* Types. */
const gchar * (* name_for_type) (GbfProject *project,
const gchar *type);
@@ -338,6 +346,15 @@
GtkWidget *gbf_project_configure (GbfProject *project,
GError **error);
+/* Packages */
+GList *gbf_project_get_config_modules (GbfProject *project,
+ GError** error);
+
+GList *gbf_project_get_config_packages (GbfProject *project,
+ const gchar* module,
+ GError** error);
+
+
/* Types. */
const gchar *gbf_project_name_for_type (GbfProject *project,
const gchar *type);
Modified: trunk/src/gbf/test-project-view.c
==============================================================================
--- trunk/src/gbf/test-project-view.c (original)
+++ trunk/src/gbf/test-project-view.c Fri May 2 11:42:02 2008
@@ -114,6 +114,25 @@
}
static void
+show_packages (GbfProject* proj)
+{
+ GList* modules = gbf_project_get_config_modules(proj, NULL);
+ GList* module;
+ for (module = modules; module != NULL; module = g_list_next (module))
+ {
+ GList* packages = gbf_project_get_config_packages (proj, module->data, NULL);
+ GList* package;
+ printf ("%s\n", (gchar*)module->data);
+ for (package = packages; package != NULL; package = g_list_next (package))
+ {
+ printf ("\t%s\n", (gchar*)package->data);
+ }
+ g_list_foreach (packages, (GFunc)g_free, NULL);
+ }
+ g_list_foreach (modules, (GFunc)g_free, NULL);
+}
+
+static void
open_project (GtkWidget *widget,
gpointer user_data)
{
@@ -171,6 +190,8 @@
gbf_project_load (proj, dirname, NULL);
g_free (dirname);
+ show_packages (proj);
+
g_object_set (G_OBJECT (model), "project", proj, NULL);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]