import project & .anjuta project file
- From: Jeroen Zwartepoorte <jeroen xs4all nl>
- To: gnome-devtools gnome org
- Cc: jpr ximian com
- Subject: import project & .anjuta project file
- Date: 28 Jan 2003 14:52:36 +0100
Hi all,
I just committed the attached patches to gnome-build and anjuta2.
The patch to gnome-build adds a "probe" method to the GbfProject
abstract class. This method returns TRUE when the backend is capable of
loading the project in the specified directory. In case of the automake
backend, it checks whether the directory contains a Makefile.am and
configure.in or configure.ac.
The anjuta2 patch adds an Import Project menuitem for importing existing
projects into anjuta2. What it does is ask the available backends if
they can load the project (probe) and then allow the user to choose one.
It will then create a new .anjuta file (XML) which atm only contains the
backend with which to load the project. My next step will be to add mime
type support for .anjuta files, so you can load a project by clicking on
an .anjuta file in nautilus.
Jeroen
? anjuta2.anjuta
? anjuta2.patch
? plugins/project-manager/anjuta-project-manager.gladep
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/anjuta2/ChangeLog,v
retrieving revision 1.250
diff -u -r1.250 ChangeLog
--- ChangeLog 27 Jan 2003 14:13:08 -0000 1.250
+++ ChangeLog 28 Jan 2003 13:47:07 -0000
@@ -1,3 +1,15 @@
+2003-01-28 Jeroen Zwartepoorte <jeroen xs4all nl>
+
+ * plugins/document-manager/anjuta-document-manager.xml: A little more
+ HIG compliance.
+ * plugins/project-manager/anjuta-project-manager.glade: Added Import
+ Project dialog.
+ * plugins/project-manager/anjuta-project-manager.xml: Added Import
+ Project menuitem.
+ * plugins/project-manager/project-tool.c: (set_build), (finish_cb),
+ (backend_set_text), (project_import), (project_open),
+ (project_close): Implemented import project, .anjuta loading & saving.
+
2003-01-27 Daniel Yacob <locales geez org>
* configure.in: Added Amharic (am) to ALL_LINGUAS.
Index: plugins/document-manager/anjuta-document-manager.xml
===================================================================
RCS file: /cvs/gnome/anjuta2/plugins/document-manager/anjuta-document-manager.xml,v
retrieving revision 1.14
diff -u -r1.14 anjuta-document-manager.xml
--- plugins/document-manager/anjuta-document-manager.xml 21 May 2002 23:00:24 -0000 1.14
+++ plugins/document-manager/anjuta-document-manager.xml 28 Jan 2003 13:47:07 -0000
@@ -23,14 +23,14 @@
<placeholder name="Templates" delimit="top"/>
<placeholder name="Plugins" delimit="top"/>
</submenu>
- <menuitem name="FileOpen" verb=""/>
+ <menuitem name="FileOpen" _label="_Open..." verb=""/>
<submenu name="FileRecent" _label="Recent _Files">
<placeholder name="RecentProjects"/>
<placeholder name="RecentFiles" delimit="top"/>
</submenu>
<separator/>
<menuitem name="FileSave" verb=""/>
- <menuitem name="FileSaveAs" verb=""/>
+ <menuitem name="FileSaveAs" _label="Save _As..." verb=""/>
<menuitem name="FileSaveAll" verb=""/>
<menuitem name="FileRevert" verb=""/>
<separator/>
Index: plugins/project-manager/anjuta-project-manager.glade
===================================================================
RCS file: /cvs/gnome/anjuta2/plugins/project-manager/anjuta-project-manager.glade,v
retrieving revision 1.1
diff -u -r1.1 anjuta-project-manager.glade
--- plugins/project-manager/anjuta-project-manager.glade 29 Dec 2002 19:17:05 -0000 1.1
+++ plugins/project-manager/anjuta-project-manager.glade 28 Jan 2003 13:47:09 -0000
@@ -807,4 +807,188 @@
</child>
</widget>
+<widget class="GtkDialog" id="project_import_dialog">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">Import Project</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="has_separator">False</property>
+
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox1">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area1">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+ <child>
+ <widget class="GtkButton" id="helpbutton1">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-help</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="response_id">-11</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="button1">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-cancel</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="response_id">-6</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="button2">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="response_id">-5</property>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment1">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox3">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">2</property>
+
+ <child>
+ <widget class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="stock">gtk-convert</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label17">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Import</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox1">
+ <property name="border_width">5</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label18">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><b>Select a backend:</b></property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkScrolledWindow" id="scrolledwindow4">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
+ <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+ <child>
+ <widget class="GtkTreeView" id="backend_tree">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">False</property>
+ <property name="rules_hint">False</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">True</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
</glade-interface>
Index: plugins/project-manager/anjuta-project-manager.xml
===================================================================
RCS file: /cvs/gnome/anjuta2/plugins/project-manager/anjuta-project-manager.xml,v
retrieving revision 1.11
diff -u -r1.11 anjuta-project-manager.xml
--- plugins/project-manager/anjuta-project-manager.xml 18 Sep 2002 16:40:59 -0000 1.11
+++ plugins/project-manager/anjuta-project-manager.xml 28 Jan 2003 13:47:09 -0000
@@ -4,6 +4,9 @@
accel="*control**alt*N" _tip="Create a new project"
pixtype="filename" pixname="anjuta-new-project.png"/>
+ <cmd name="ProjectImport" _label="Import Project"
+ _tip="Import an existing project" stockid="gtk-convert"/>
+
<cmd name="ProjectOpen" _label="Open Project"
accel="*control**alt*O" _tip="Open a project"
pixtype="filename" pixname="anjuta-open-project.png"/>
@@ -43,8 +46,9 @@
<menu>
<submenu name="File" _label="_File">
<placeholder name="ProjectOps">
- <menuitem name="ProjectNew" _label="Ne_w Project" verb=""/>
- <menuitem name="ProjectOpen" _label="Op_en Project" verb=""/>
+ <menuitem name="ProjectNew" _label="Ne_w Project..." verb=""/>
+ <menuitem name="ProjectImport" _label="_Import Project..." verb=""/>
+ <menuitem name="ProjectOpen" _label="Op_en Project..." verb=""/>
<menuitem name="ProjectClose" _label="C_lose Project" verb=""/>
</placeholder>
</submenu>
Index: plugins/project-manager/project-tool.c
===================================================================
RCS file: /cvs/gnome/anjuta2/plugins/project-manager/project-tool.c,v
retrieving revision 1.38
diff -u -r1.38 project-tool.c
--- plugins/project-manager/project-tool.c 12 Jan 2003 20:52:00 -0000 1.38
+++ plugins/project-manager/project-tool.c 28 Jan 2003 13:47:10 -0000
@@ -20,6 +20,7 @@
#include <unistd.h>
#include <sys/stat.h>
#include <string.h>
+#include <libxml/tree.h>
#include <bonobo/bonobo-ui-util.h>
#include <bonobo/bonobo-file-selector-util.h>
#include <gconf/gconf-client.h>
@@ -29,6 +30,7 @@
#include <gbf/gbf-project-view.h>
#include <gbf/gbf-tree-data.h>
#include <gbf/gbf-build-info.h>
+#include <glade/glade-xml.h>
#include <libanjuta/libanjuta.h>
#include <libgnome/gnome-i18n.h>
#include <libgnomevfs/gnome-vfs.h>
@@ -50,7 +52,8 @@
GbfProject *project;
GbfProjectTarget *current_target;
gchar *project_root;
-
+ xmlDocPtr project_file;
+
GdlRecent *recent;
} ProjectTool;
@@ -145,7 +148,7 @@
g_return_if_fail (ANJUTA_IS_TOOL (tool));
set_current_target (proj_tool, NULL);
-
+
/* Close any open project first. */
if (proj_tool->project) {
anjuta_shell_remove_value (tool->shell,
@@ -156,23 +159,62 @@
g_free (proj_tool->project_root);
proj_tool->project_root = NULL;
+
+ xmlFreeDoc (proj_tool->project_file);
+ proj_tool->project_file = NULL;
}
if (path != NULL) {
+ char *basename;
+ char *backend_id;
+ xmlNodePtr backend_node;
GbfBackend *backend = NULL;
+ char *dirname;
+
+ /* Check if the path contains a file and it exists. */
+ if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
+ g_message ("not a regular & existing file");
+ anjuta_dialog_error (_("Not an anjuta2 project file"));
+ return;
+ }
+
+ /* Check if the file has a ".anjuta" extension. */
+ basename = g_path_get_basename (path);
+ if (!g_str_has_suffix (basename, ".anjuta")) {
+ g_message ("%s has no suffix \".anjuta\"", basename);
+ anjuta_dialog_error (_("Not an anjuta2 project file"));
+ g_free (basename);
+ return;
+ }
+ g_free (basename);
+
+ /* Load the .anjuta file. */
+ proj_tool->project_file = xmlParseFile (path);
+ if (!proj_tool->project_file) {
+ g_message ("Error parsing project file: %s", path);
+ return;
+ }
+
+ /* Get the backend id from the document. */
+ backend_node = proj_tool->project_file->children->children;
+ backend_id = xmlNodeGetContent (backend_node);
+ if (!backend_id) {
+ g_message ("No backend node in %s", path);
+ return;
+ }
gbf_backend_init ();
- /* FIXME: Allow different project backends (use druid). */
for (l = gbf_backend_get_backends (); l; l = l->next) {
backend = l->data;
- if (!strcmp (backend->id, "gbf-am:GbfAmProject"))
+ if (!strcmp (backend->id, backend_id))
break;
backend = NULL;
}
+ g_free (backend_id);
if (!backend) {
- anjuta_dialog_error (_("No project backends found"));
+ anjuta_dialog_error (_("No matching project backends found"));
return;
}
@@ -183,7 +225,9 @@
}
/* Try to load the project */
- gbf_project_load (project, path, &err);
+ dirname = g_path_get_dirname (path);
+ gbf_project_load (project, dirname, &err);
+ g_free (dirname);
if (err != NULL) {
if (g_error_matches (err, gbf_project_error_quark (),
GBF_PROJECT_ERROR_DOESNT_EXIST)) {
@@ -256,7 +300,7 @@
info = anjuta_project_druid_get_info (druid);
gtk_widget_destroy (widget->parent);
-
+
anjuta_project_type_create_project (info->type, info, &err);
if (err != NULL) {
anjuta_dialog_error (_("Error creating project"));
@@ -302,36 +346,177 @@
gtk_widget_show (window);
}
-static void
-project_open (GtkWidget *widget, gpointer data)
+static void
+backend_set_text (GtkTreeViewColumn *tree_column,
+ GtkCellRenderer *cell,
+ GtkTreeModel *model,
+ GtkTreeIter *iter,
+ gpointer data)
{
- ProjectTool *proj_tool = (ProjectTool*)data;
+ GbfBackend *backend;
+
+ gtk_tree_model_get (model, iter, 0, &backend, -1);
+ g_object_set (GTK_CELL_RENDERER (cell), "text", backend->description, NULL);
+}
+
+static void
+project_import (GtkWidget *widget, gpointer data)
+{
+ AnjutaTool *tool = (AnjutaTool *) data;
+ ProjectTool *proj_tool = (ProjectTool *) data;
char *uri;
+ GSList *l;
+ GbfBackend *backend = NULL;
+ GError *err = NULL;
+ GSList *backends = NULL;
+ GbfProject *project;
+ char *path, *dirname;
uri = bonobo_file_selector_open (NULL, TRUE,
_("Open Project..."),
NULL, NULL);
-
+
if (uri) {
- GnomeVFSURI *vfs_uri = gnome_vfs_uri_new (uri);
- char *dirname = gnome_vfs_uri_extract_dirname (vfs_uri);
+ path = gnome_vfs_get_local_path_from_uri (uri);
+ if (!path) {
+ anjuta_dialog_error (_("Only local uris are supported for now"));
+ return;
+ }
+ dirname = g_path_get_dirname (path);
- set_build (proj_tool, dirname);
+ gbf_backend_init ();
- gdl_recent_add (proj_tool->recent, dirname);
+ for (l = gbf_backend_get_backends (); l; l = l->next) {
+ backend = l->data;
+
+ project = gbf_backend_new_project (backend->id);
+ if (!project) {
+ g_message ("Could not create project: %s", backend->id);
+ continue;
+ }
+
+ /* Probe to see if the backend can load the project. */
+ if (gbf_project_probe (project, dirname, &err)) {
+ backends = g_slist_append (backends, backend);
+ }
+
+ g_object_unref (project);
+ }
+
+ if (g_slist_length (backends) == 0) {
+ anjuta_dialog_error (_("No backends available which can import this project"));
+ } else {
+ GtkWidget *dialog;
+ GtkWidget *tree;
+ GtkTreeModel *model;
+ GtkCellRenderer *renderer;
+ GtkTreeViewColumn *column;
+ GtkTreeIter iter;
+
+ char *file = g_strconcat (DATADIR, "/anjuta2/glade/",
+ "anjuta-project-manager.glade", NULL);
+ GladeXML *gui = glade_xml_new (file, "project_import_dialog", NULL);
+ g_free (file);
+ if (!gui) {
+ g_error ("Could not find project-druid.glade, reinstall anjuta");
+ return;
+ }
+
+ dialog = glade_xml_get_widget (gui, "project_import_dialog");
+ tree = glade_xml_get_widget (gui, "backend_tree");
+
+ model = GTK_TREE_MODEL (gtk_list_store_new (1, G_TYPE_POINTER));
+ gtk_tree_view_set_model (GTK_TREE_VIEW (tree), model);
+ column = gtk_tree_view_column_new ();
+ gtk_tree_view_column_set_title (column, "Backends");
+ renderer = gtk_cell_renderer_text_new ();
+ gtk_tree_view_column_pack_start (column, renderer, TRUE);
+ gtk_tree_view_column_set_cell_data_func (column, renderer,
+ backend_set_text,
+ NULL, NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column);
+
+ for (l = backends; l != NULL; l = l->next) {
+ backend = l->data;
+ gtk_list_store_append (GTK_LIST_STORE (model),
+ &iter);
+ gtk_list_store_set (GTK_LIST_STORE (model),
+ &iter, 0, backend, -1);
+ }
- gnome_vfs_uri_unref (vfs_uri);
+ gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (tool->shell));
+ gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
+ gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER_ON_PARENT);
+ if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) {
+ xmlDocPtr doc;
+ char *filename, *save_uri;
+ GtkTreeSelection *treesel = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree));
+ gtk_tree_selection_get_selected (treesel, NULL, &iter);
+ gtk_tree_model_get (model, &iter, 0, &backend, -1);
+
+ doc = xmlNewDoc ("1.0");
+ doc->children = xmlNewDocNode (doc, NULL, "project", NULL);
+ xmlNewChild (doc->children, NULL, "backend", backend->id);
+
+ filename = g_strconcat ("project", ".anjuta", NULL);
+ save_uri = bonobo_file_selector_save (GTK_WINDOW (tool->shell),
+ TRUE, _("Save Project"),
+ NULL, dirname, filename);
+ g_free (filename);
+
+ if (save_uri) {
+ xmlSaveFormatFile (save_uri, doc, TRUE);
+ xmlFreeDoc (doc);
+ filename = gnome_vfs_get_local_path_from_uri (save_uri);
+ set_build (proj_tool, filename);
+ g_free (filename);
+ g_free (save_uri);
+ }
+ }
+ gtk_widget_destroy (dialog);
+ }
+
+ g_free (path);
g_free (dirname);
g_free (uri);
}
}
static void
+project_open (GtkWidget *widget, gpointer data)
+{
+ AnjutaTool *tool = (AnjutaTool *)data;
+ ProjectTool *proj_tool = (ProjectTool*)data;
+ char *uri;
+
+ uri = bonobo_file_selector_open (GTK_WINDOW (tool->shell), TRUE,
+ _("Open Project"), NULL, NULL);
+
+ if (uri) {
+ /* FIXME: Use gnome-vfs throughout this file instead of
+ * converting every file:// uri to a local path (because
+ * g_file_test doesn't accept uris; libxml2 probably doesn't
+ * either). */
+ char *path = gnome_vfs_get_local_path_from_uri (uri);
+ if (!path) {
+ anjuta_dialog_error (_("Only local uris are supported for now"));
+ return;
+ }
+
+ set_build (proj_tool, path);
+ gdl_recent_add (proj_tool->recent, path);
+
+ g_free (path);
+ g_free (uri);
+ }
+}
+
+static void
project_close (GtkWidget *widget, gpointer data)
{
- AnjutaTool *tool = ANJUTA_TOOL (data);
-
- set_build ((ProjectTool*)tool, NULL);
+ ProjectTool *proj_tool = (ProjectTool *) data;
+
+ set_build (proj_tool, NULL);
}
static GbfTreeData *
@@ -532,6 +717,7 @@
static BonoboUIVerb verbs [] = {
BONOBO_UI_UNSAFE_VERB ("ProjectNew", project_new),
+ BONOBO_UI_UNSAFE_VERB ("ProjectImport", project_import),
BONOBO_UI_UNSAFE_VERB ("ProjectOpen", project_open),
BONOBO_UI_UNSAFE_VERB ("ProjectClose", project_close),
? gbf.patch
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-build/ChangeLog,v
retrieving revision 1.124
diff -u -r1.124 ChangeLog
--- ChangeLog 25 Jan 2003 10:41:15 -0000 1.124
+++ ChangeLog 28 Jan 2003 13:00:30 -0000
@@ -1,3 +1,13 @@
+2003-01-28 Jeroen Zwartepoorte <jeroen xs4all nl>
+
+ * src/backends/libgbf_am/gbf-am-project.c: (impl_probe),
+ (gbf_am_project_class_init): Add probe implementation that checks for
+ Makefile.am and configure.in or configure.ac in the specified dir.
+ * src/lib/gbf-project.c: (gbf_project_probe): New probe method. Returns
+ TRUE if the backend is capable of loading the project in the specified
+ directory.
+ * src/lib/gbf-project.h: Idem.
+
2003-01-25 Michael Karcher <karcher physik fu-berlin de>
* src/controls/gbf-build-info.c: (build_callback),
Index: src/backends/libgbf_am/gbf-am-project.c
===================================================================
RCS file: /cvs/gnome/gnome-build/src/backends/libgbf_am/gbf-am-project.c,v
retrieving revision 1.37
diff -u -r1.37 gbf-am-project.c
--- src/backends/libgbf_am/gbf-am-project.c 19 Jan 2003 06:14:17 -0000 1.37
+++ src/backends/libgbf_am/gbf-am-project.c 28 Jan 2003 13:00:32 -0000
@@ -1785,6 +1785,37 @@
queue_op (prj, op);
}
+static gboolean
+impl_probe (GbfProject *project,
+ const char *path,
+ GError **error)
+{
+ char *filename;
+
+ filename = g_build_filename (path, "Makefile.am", NULL);
+ if (!g_file_test (filename, G_FILE_TEST_EXISTS)) {
+ g_free (filename);
+ return FALSE;
+ }
+ g_free (filename);
+
+ filename = g_build_filename (path, "configure.in", NULL);
+ if (g_file_test (filename, G_FILE_TEST_EXISTS)) {
+ g_free (filename);
+ return TRUE;
+ }
+ g_free (filename);
+
+ filename = g_build_filename (path, "configure.ac", NULL);
+ if (g_file_test (filename, G_FILE_TEST_EXISTS)) {
+ g_free (filename);
+ return TRUE;
+ }
+ g_free (filename);
+
+ return FALSE;
+}
+
static void
impl_add_build_callback (GbfProject *project,
GbfBuildCallback callback,
@@ -2328,6 +2359,7 @@
project_class->load = impl_load;
project_class->build = impl_build;
+ project_class->probe = impl_probe;
project_class->add_build_callback = impl_add_build_callback;
project_class->remove_build_callback = impl_remove_build_callback;
project_class->add_group = impl_add_group;
Index: src/lib/gbf-project.c
===================================================================
RCS file: /cvs/gnome/gnome-build/src/lib/gbf-project.c,v
retrieving revision 1.8
diff -u -r1.8 gbf-project.c
--- src/lib/gbf-project.c 12 Jan 2003 03:53:22 -0000 1.8
+++ src/lib/gbf-project.c 28 Jan 2003 13:00:33 -0000
@@ -48,6 +48,19 @@
GBF_PROJECT_GET_CLASS (project)->build (project, type, error);
}
+gboolean
+gbf_project_probe (GbfProject *project,
+ const char *path,
+ GError **error)
+{
+ g_return_val_if_fail (project != NULL, FALSE);
+ g_return_val_if_fail (GBF_IS_PROJECT (project), FALSE);
+ g_return_val_if_fail (path != NULL, FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ return GBF_PROJECT_GET_CLASS (project)->probe (project, path, error);
+}
+
/* Build. */
void
gbf_project_add_build_callback (GbfProject *project,
Index: src/lib/gbf-project.h
===================================================================
RCS file: /cvs/gnome/gnome-build/src/lib/gbf-project.h,v
retrieving revision 1.7
diff -u -r1.7 gbf-project.h
--- src/lib/gbf-project.h 12 Jan 2003 03:53:22 -0000 1.7
+++ src/lib/gbf-project.h 28 Jan 2003 13:00:33 -0000
@@ -137,6 +137,9 @@
void (*build) (GbfProject *project,
GbfBuildType type,
GError **error);
+ gboolean (*probe) (GbfProject *project,
+ const char *path,
+ GError **error);
/* Build. */
void (*add_build_callback) (GbfProject *project,
@@ -220,6 +223,9 @@
GError **error);
void gbf_project_build (GbfProject *project,
GbfBuildType type,
+ GError **error);
+gboolean gbf_project_probe (GbfProject *project,
+ const char *path,
GError **error);
/* Build. */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]