$NetBSD: patch-ae,v 1.5 2004/05/03 21:01:56 jmmv Exp $

http://bugzilla.gnome.org/show_bug.cgi?id=130129

--- gconf/gconftool.c.orig	2004-04-05 21:07:34.000000000 +0200
+++ gconf/gconftool.c
@@ -59,6 +59,7 @@ static char* long_desc = NULL;
 static char* owner = NULL;
 static char* schema_file = NULL;
 static char* entry_file = NULL;
+static char* unload_entry_file = NULL;
 static const char* config_source = NULL;
 static int use_local_source = FALSE;
 static int makefile_install_mode = FALSE;
@@ -167,6 +168,15 @@ struct poptOption options[] = {
     NULL
   },
   {
+    "unload",
+    '\0',
+    POPT_ARG_STRING,
+    &unload_entry_file,
+    0,
+    N_("Unload a set of values described in an XML file."),
+    NULL
+  },
+  {
     "recursive-list",
     'R',
     POPT_ARG_NONE,
@@ -838,6 +848,18 @@ main (int argc, char** argv)
       return retval;
     }
   
+  if (unload_entry_file != NULL)
+    {
+      const gchar** args = poptGetArgs(ctx);
+      gint retval;
+
+      retval = do_load_file(conf, LOAD_ENTRY_FILE, unload_entry_file, args);
+
+      gconf_engine_unref(conf);
+
+      return retval;
+    }
+
   if (spawn_gconfd)
     {
       do_spawn_daemon(conf);
@@ -2769,30 +2791,29 @@ set_values(GConfEngine* conf, const gcha
   else
     full_key = g_strdup(key);
 
-  if (schema_key)
+  if (unload_entry_file != NULL || schema_key)
     {
-      gchar* full_schema_key;
+      gchar* full_schema_key = NULL;
+      GError* error = NULL;
 
-      if (base_dir && *schema_key != '/')
-        full_schema_key = gconf_concat_dir_and_key(base_dir, schema_key);
-      else
-        full_schema_key = g_strdup(schema_key);
+      if (unload_entry_file == NULL)
+        {
+          if (base_dir && *schema_key != '/')
+            full_schema_key = gconf_concat_dir_and_key(base_dir, schema_key);
+          else
+            full_schema_key = g_strdup(schema_key);
+        }
 
-      if (full_schema_key)
+      if (!gconf_engine_associate_schema(conf, full_key, full_schema_key,  &error))
         {
-	  GError* error = NULL;
-	  
-          if (!gconf_engine_associate_schema(conf, full_key, full_schema_key,  &error))
-            {
-              g_assert(error != NULL);
+          g_assert(error != NULL);
           
-              g_printerr (_("WARNING: failed to associate schema `%s' with key `%s': %s\n"),
-			  full_schema_key, full_key, error->message);
-              g_error_free(error);
-            }
+          g_printerr (_("WARNING: failed to associate schema `%s' with key `%s': %s\n"),
+                      full_schema_key, full_key, error->message);
+          g_error_free(error);
+        }
 
-	  g_free(full_schema_key);
-	}
+      g_free(full_schema_key);
     }
 
   tmp = values;
@@ -2802,7 +2823,10 @@ set_values(GConfEngine* conf, const gcha
       GError* error;
 
       error = NULL;
-      gconf_engine_set(conf, full_key, value, &error);
+      if (unload_entry_file != NULL)
+        gconf_engine_unset(conf, full_key, &error);
+      else
+        gconf_engine_set(conf, full_key, value, &error);
       if (error != NULL)
         {
           g_printerr (_("Error setting value: %s\n"), error->message);
@@ -3318,7 +3342,7 @@ process_key_list(GConfEngine* conf, cons
   GSList* tmp;
   GError* error = NULL;
 
-  if (makefile_uninstall_mode)
+  if (makefile_uninstall_mode || unload_entry_file != NULL)
     {
       schema_name = NULL;
     }
@@ -3515,7 +3539,7 @@ process_schema(GConfEngine* conf, xmlNod
 
       hash_foreach_info.conf = conf;
       hash_foreach_info.key = schema_key;
-      if (makefile_uninstall_mode)
+      if (makefile_uninstall_mode || unload_entry_file != NULL)
         g_hash_table_foreach(schemas_hash, hash_uninstall_foreach, &hash_foreach_info);
       else 
         g_hash_table_foreach(schemas_hash, hash_install_foreach, &hash_foreach_info);
