[patch] Some fixes to gnome-build



Hi JP,

I've had this patch siting on my tree for some time now.  It fixes two
bugs somebody on the list reported some time ago (don't remember who,
sorry).

May I commit?

Thanks,
Gustavo

? .tm_project.cache
? autom4te.cache
? stamp-h1
? src/controls/gbf-project-model.c
? src/controls/gbf-project-model.h
? src/controls/gbf-project-tree.c.sort
? src/controls/gbf-project-view.c
? src/controls/gbf-project-view.h
? src/controls/test-project-view
? src/controls/test-project-view.c
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-build/ChangeLog,v
retrieving revision 1.117
diff -u -r1.117 ChangeLog
--- ChangeLog	29 Dec 2002 19:45:07 -0000	1.117
+++ ChangeLog	2 Jan 2003 04:32:54 -0000
@@ -1,3 +1,13 @@
+2003-01-02  Gustavo Giraldez  <gustavo giraldez gmx net>
+
+	* src/controls/gbf-target-tree.c: 
+	* src/controls/gbf-project-tree.c: Create root URI reference at
+	load_data time, not when the user sets the project.
+	* src/backends/libgbf_am/GBF/AmFiles.pm (expand_one_var): Handle
+	multiple substitution macros correctly.
+	* src/backends/libgbf_am/gbf-am-project.c (get_project): Return -1
+	on error, not the forked child exit status.
+
 2002-12-29  Jeroen Zwartepoorte  <jeroen xs4all nl>
 
 	* src/controls/Makefile.am: Forgot to remove utils.[ch].
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.33
diff -u -r1.33 gbf-am-project.c
--- src/backends/libgbf_am/gbf-am-project.c	10 Oct 2002 23:14:42 -0000	1.33
+++ src/backends/libgbf_am/gbf-am-project.c	2 Jan 2003 04:32:58 -0000
@@ -28,9 +28,6 @@
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <gnome.h>
-#include <bonobo/bonobo-exception.h>
-#include <bonobo/bonobo-property-bag.h>
-#include <bonobo/bonobo-event-source.h>
 #include <fcntl.h>
 #include <libgnome/gnome-macros.h>
 #include <libxml/parser.h>
@@ -1344,7 +1341,7 @@
 	if (!data) 
 		return -1;
 
-	retval = data->child_status;
+	retval = -1;
 	if (data->child_status == 0) {
 		/* FIXME: process the errors!! */
 		if (data->error.length > 0) {
Index: src/backends/libgbf_am/GBF/AmFiles.pm
===================================================================
RCS file: /cvs/gnome/gnome-build/src/backends/libgbf_am/GBF/AmFiles.pm,v
retrieving revision 1.2
diff -u -r1.2 AmFiles.pm
--- src/backends/libgbf_am/GBF/AmFiles.pm	21 Sep 2002 21:03:44 -0000	1.2
+++ src/backends/libgbf_am/GBF/AmFiles.pm	2 Jan 2003 04:33:00 -0000
@@ -934,7 +934,7 @@
     }
 
     # Expand substitution macros $(macro:search=replace)
-    while ($source =~ /\$\((\w*):(.+)=(.*)\)/) {
+    while ($source =~ /\$\((\w*):([^=]+)=([^\)]*)\)/) {
 	$var_name = $1;
 	my ($search, $replace) = ($2, $3);
 
@@ -942,7 +942,7 @@
 	$repl =~ s/$search/$replace/g;
 
 	# Set sources list
-	$source =~ s/\$\($var_name:(.+)=(.*)\)/$repl/;
+	$source =~ s/\$\($var_name:([^=]+)=([^\)]*)\)/$repl/;
     }
     return $source;
 }
Index: src/controls/gbf-project-tree.c
===================================================================
RCS file: /cvs/gnome/gnome-build/src/controls/gbf-project-tree.c,v
retrieving revision 1.35
diff -u -r1.35 gbf-project-tree.c
--- src/controls/gbf-project-tree.c	29 Dec 2002 19:36:06 -0000	1.35
+++ src/controls/gbf-project-tree.c	2 Jan 2003 04:33:01 -0000
@@ -198,15 +198,9 @@
 	      const GValue *value, GParamSpec *pspec)
 {
 	GbfProjectTree *tree = GBF_PROJECT_TREE (object);
-	char *dir;
 
 	switch (prop_id) {
 	case PROP_PROJECT:
-		if (tree->priv->root) {
-			gnome_vfs_uri_unref (tree->priv->root);
-			tree->priv->root = NULL;
-		}
-
 		if (tree->priv->prj) {
 			/* disconnect project handlers */
 			g_signal_handlers_disconnect_matched (
@@ -221,8 +215,6 @@
 			/* keep a ref to the project so we can later
 			 * disconnect the signal handler correctly */
 			g_object_ref (tree->priv->prj);
-			g_object_get (G_OBJECT (tree->priv->prj), "project-dir", &dir, NULL);
-			tree->priv->root = gnome_vfs_uri_new (dir);
 			g_signal_connect_swapped (G_OBJECT (tree->priv->prj),
 						  "project-updated",
 						  (GCallback) load_data,
@@ -258,6 +250,10 @@
 	priv = tree->priv;
 	
 	if (priv) {
+		if (priv->root) {
+			gnome_vfs_uri_unref (priv->root);
+		}
+		
 		if (priv->prj != NULL) {
 			g_signal_handlers_disconnect_matched (
 				G_OBJECT (priv->prj),
@@ -412,19 +408,31 @@
 	GtkTreeIter iter;
 	GtkTreePath *path;
 	GbfTreeData *node;
-	char *uri;
+	char *uri, *dir;
 
 	priv = tree->priv;
 
 	gtk_tree_store_clear (GTK_TREE_STORE (priv->tree_model));
 	g_hash_table_foreach_remove (priv->dirs, destroy_tree_node, NULL);
 
+	if (priv->root) {
+		gnome_vfs_uri_unref (priv->root);
+		priv->root = NULL;
+	}
+	
 	if (priv->prj == NULL) {
 		insert_no_project_node (tree);
 		return;
 	}
 
 	/* Add the highest directory in the tree */
+	g_object_get (G_OBJECT (priv->prj), "project-dir", &dir, NULL);
+	if (!dir) {
+		insert_no_project_node (tree);
+		return;
+	}
+
+	priv->root = gnome_vfs_uri_new (dir);
 	uri = gnome_vfs_uri_to_string (priv->root, GNOME_VFS_URI_HIDE_NONE);
 
 	node = gbf_tree_data_new (GBF_TREE_NODE_FOLDER, g_strdup (uri));
Index: src/controls/gbf-target-tree.c
===================================================================
RCS file: /cvs/gnome/gnome-build/src/controls/gbf-target-tree.c,v
retrieving revision 1.34
diff -u -r1.34 gbf-target-tree.c
--- src/controls/gbf-target-tree.c	29 Dec 2002 19:36:06 -0000	1.34
+++ src/controls/gbf-target-tree.c	2 Jan 2003 04:33:01 -0000
@@ -213,11 +213,6 @@
 
 	switch (prop_id) {
 	case PROP_PROJECT:
-		if (tree->priv->root) {
-			gnome_vfs_uri_unref (tree->priv->root);
-			tree->priv->root = NULL;
-		}
-
 		if (tree->priv->prj) {
 			/* disconnect project handlers */
 			g_signal_handlers_disconnect_matched (
@@ -232,8 +227,6 @@
 			/* keep a ref to the project so we can later
 			 * disconnect the signal handler correctly */
 			g_object_ref (tree->priv->prj);
-			g_object_get (G_OBJECT (tree->priv->prj), "project-dir", &dir, NULL);
-			tree->priv->root = gnome_vfs_uri_new (dir);
 			g_signal_connect_swapped (G_OBJECT (tree->priv->prj),
 						  "project-updated",
 						  (GCallback) load_data,
@@ -258,6 +251,10 @@
 	priv = tree->priv;
 	
 	if (priv) {
+		if (priv->root) {
+			gnome_vfs_uri_unref (priv->root);
+		}
+		
 		if (priv->prj != NULL) {
 			g_signal_handlers_disconnect_matched (
 				G_OBJECT (priv->prj),
@@ -368,18 +365,30 @@
 	GtkTreeIter iter, child_iter, root_iter;
 	GtkTreePath *path;
 	GbfTreeData *node;
-	char *uri;
+	char *uri, *dir;
 
 	priv = tree->priv;
 
 	gtk_tree_store_clear (GTK_TREE_STORE (priv->tree_model));
 
+	if (priv->root) {
+		gnome_vfs_uri_unref (priv->root);
+		priv->root = NULL;
+	}
+	
 	if (priv->prj == NULL) {
 		insert_no_project_node (tree);
 		return;
 	}
 
 	/* Add the highest directory in the tree */
+	g_object_get (G_OBJECT (priv->prj), "project-dir", &dir, NULL);
+	if (!dir) {
+		insert_no_project_node (tree);
+		return;
+	}
+
+	priv->root = gnome_vfs_uri_new (dir);
 	uri = gnome_vfs_uri_to_string (priv->root, GNOME_VFS_URI_HIDE_NONE);
 	node = gbf_tree_data_new (GBF_TREE_NODE_FOLDER, uri);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]