gnome-build r635 - in branches/gnome-2-24: . src/backends/libgbf_am src/gbf



Author: sgranjoux
Date: Sun Oct  5 15:23:53 2008
New Revision: 635
URL: http://svn.gnome.org/viewvc/gnome-build?rev=635&view=rev

Log:
	* src/backends/libgbf_am/gbf-am-config.h,
	src/backends/libgbf_am/gbf-am-config.c,
	src/backends/libgbf_am/gbf-am-project.c,
	src/backends/libgbf_am/gbf-am-parse.in:
	Fix #541694 - new modules and packaged are not displayed in dialog
	until the project is reloaded

	* src/backends/libgbf_am/test.c,
	src/gbf/test.c:
	Avoid GCC warning: not enough variable arguments to fit a sentinel


Modified:
   branches/gnome-2-24/ChangeLog
   branches/gnome-2-24/src/backends/libgbf_am/gbf-am-config.c
   branches/gnome-2-24/src/backends/libgbf_am/gbf-am-config.h
   branches/gnome-2-24/src/backends/libgbf_am/gbf-am-parse.in
   branches/gnome-2-24/src/backends/libgbf_am/gbf-am-project.c
   branches/gnome-2-24/src/backends/libgbf_am/test.c
   branches/gnome-2-24/src/gbf/test.c

Modified: branches/gnome-2-24/src/backends/libgbf_am/gbf-am-config.c
==============================================================================
--- branches/gnome-2-24/src/backends/libgbf_am/gbf-am-config.c	(original)
+++ branches/gnome-2-24/src/backends/libgbf_am/gbf-am-config.c	Sun Oct  5 15:23:53 2008
@@ -301,6 +301,44 @@
 }
 
 gboolean 
+gbf_am_config_mapping_update (GbfAmConfigMapping *mapping,
+			      const gchar        *key,
+			      GbfAmConfigValue   *value)
+{
+	GbfAmConfigEntry *entry = NULL;
+	GList            *lp;
+	gboolean         update = TRUE;
+	gboolean 	 insert = TRUE;
+	
+	g_return_val_if_fail (mapping != NULL && key != NULL, FALSE);
+
+	for (lp = mapping->pairs; lp; lp = lp->next) {
+		entry = (GbfAmConfigEntry *) lp->data;
+		if (!strcmp (entry->key, key)) {
+			if (entry->value != value)
+			{
+				gbf_am_config_value_free (entry->value);
+				entry->value = value;
+				update = TRUE;	
+			}
+			insert = FALSE;
+			break;
+		}
+	}
+	
+	if (insert) {
+		GbfAmConfigEntry *new_entry;
+
+		new_entry = g_new0 (GbfAmConfigEntry, 1);
+		new_entry->key = g_strdup (key);
+		new_entry->value = value;
+		mapping->pairs = g_list_prepend (mapping->pairs, new_entry);
+	}
+	
+	return update;
+}
+
+gboolean 
 gbf_am_config_mapping_remove (GbfAmConfigMapping *mapping,
 			      const gchar        *key)
 {

Modified: branches/gnome-2-24/src/backends/libgbf_am/gbf-am-config.h
==============================================================================
--- branches/gnome-2-24/src/backends/libgbf_am/gbf-am-config.h	(original)
+++ branches/gnome-2-24/src/backends/libgbf_am/gbf-am-config.h	Sun Oct  5 15:23:53 2008
@@ -74,6 +74,9 @@
 gboolean            gbf_am_config_mapping_insert        (GbfAmConfigMapping *mapping,
 							 const gchar        *key,
 							 GbfAmConfigValue   *value);
+gboolean            gbf_am_config_mapping_update        (GbfAmConfigMapping *mapping,
+							 const gchar        *key,
+							 GbfAmConfigValue   *value);
 gboolean            gbf_am_config_mapping_remove        (GbfAmConfigMapping *mapping,
 							 const gchar        *key);
 void                gbf_am_config_mapping_foreach       (GbfAmConfigMapping *mapping,

Modified: branches/gnome-2-24/src/backends/libgbf_am/gbf-am-parse.in
==============================================================================
--- branches/gnome-2-24/src/backends/libgbf_am/gbf-am-parse.in	(original)
+++ branches/gnome-2-24/src/backends/libgbf_am/gbf-am-parse.in	Sun Oct  5 15:23:53 2008
@@ -17,8 +17,8 @@
 use GBF::AmFiles;
 
 # I18n
-use Locale::gettext;
 use POSIX;
+use Locale::gettext qw(textdomain);
 
 setlocale(LC_MESSAGES, "");
 textdomain("@PACKAGE@");
@@ -1413,10 +1413,12 @@
     my ($project, $op, $operand) = @_;
     my $configure_in = $project->{"configure_in"};
 
-    print "Operation = $op\n";
-    print "operand start\n";
-    print Dumper $operand;
-    print "operand end\n";
+    if ($verbose) {
+        print "Operation = $op\n";
+        print "operand start\n";
+        print Dumper $operand;
+        print "operand end\n";
+    }
     
     # op is: "set_config"
     # operand is full group name for add_group, and ignored for remove_group
@@ -1439,7 +1441,6 @@
 		    }
 		}
 	    } elsif ($key =~ /^pkg_check_modules_(.*)$/) {
-		print "Updating pkg config modules\n";
 		my $module = $1;
 	    	foreach my $subkey (keys %$value) {
 		    if ($subkey eq "packages") {
@@ -2196,7 +2197,7 @@
     
     shift @$tree;
     
-    while ($$tree[0] eq "param") {
+    while (@$tree && $$tree[0] eq "param") {
     	shift @$tree;
 	my $child = $$tree[0];
 	if (defined($$child[0]->{value})) {
@@ -2206,7 +2207,7 @@
 		my %items;
 		$params{$$child[0]->{name}} = \%items;
 		shift @$child;
-		while ($$child[0] eq "item") {
+		while (@$child && $$child[0] eq "item") {
 			shift @$child;
 			my $str = $$child[0][0]->{value};
 			$items{$$child[0][0]->{name}} = xml_unescape ($str);

Modified: branches/gnome-2-24/src/backends/libgbf_am/gbf-am-project.c
==============================================================================
--- branches/gnome-2-24/src/backends/libgbf_am/gbf-am-project.c	(original)
+++ branches/gnome-2-24/src/backends/libgbf_am/gbf-am-project.c	Sun Oct  5 15:23:53 2008
@@ -47,7 +47,10 @@
 #include "gbf-am-config.h"
 #include "gbf-am-properties.h"
 
-#define ENABLE_DEBUG
+/* With debugging enable, the perl script gbf-am-parse outputs
+ * debugging messages not in xml format and the parser
+ * return an error */
+/*#define ENABLE_DEBUG*/
 
 #ifdef ENABLE_DEBUG
 #define DEBUG(x) x
@@ -1375,7 +1378,7 @@
 			gbf_am_config_value_set_string (param, (char *) param_value);
 
 			/* try to save the parameter in the config mapping */
-			if (!gbf_am_config_mapping_insert (data->config,
+			if (!gbf_am_config_mapping_update (data->config,
 							   (char *) param_name, param)) {
 				gbf_am_config_value_free (param);
 			}
@@ -1442,7 +1445,7 @@
 			    
 		    case GBF_AM_TYPE_MAPPING:
 			    if (item_name == NULL ||
-				!gbf_am_config_mapping_insert (param->mapping,
+				!gbf_am_config_mapping_update (param->mapping,
 							       (char *) item_name,
 							       item)) {
 				    gbf_am_config_value_free (item);

Modified: branches/gnome-2-24/src/backends/libgbf_am/test.c
==============================================================================
--- branches/gnome-2-24/src/backends/libgbf_am/test.c	(original)
+++ branches/gnome-2-24/src/backends/libgbf_am/test.c	Sun Oct  5 15:23:53 2008
@@ -105,7 +105,8 @@
 	
 	/* Bootstrap */
 	gnome_program_init ("libgbf-am-test", VERSION, LIBGNOME_MODULE, 
-			    argc, argv, NULL);
+			    argc, argv, NULL,
+			    NULL);  /* Avoid GCC sentinel warning */
 
 	if (argc < 2) {
 		g_print ("! You need to specify a project path\n");

Modified: branches/gnome-2-24/src/gbf/test.c
==============================================================================
--- branches/gnome-2-24/src/gbf/test.c	(original)
+++ branches/gnome-2-24/src/gbf/test.c	Sun Oct  5 15:23:53 2008
@@ -10,7 +10,8 @@
 	GSList *l;
 
 	gnome_program_init ("libgbf-test", VERSION, LIBGNOME_MODULE, 
-			    argc, argv, NULL);
+			    argc, argv, NULL,
+			    NULL);  /* Avoid GCC sentinel warning */
 
 	g_print ("initializing gbf backend...\n");
 



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