Re: Recurisive directory unset



Hey Havoc,

On 7 Jan 2002, Havoc Pennington wrote:

> Maybe we should edit xml-dir.c to delete the directory in
> dir_unset_value if the dir becomes empty, and undo the deletion in
> dir_set_value if required.

	yep, that makes sense - if set_value implicitly creates the
directory, unset_value is where it should be deleted.

> > 	1) Add a --recursive-delete-dir option to gconftool and fix an
> > 	assertion in the xml backend. (Could you comment on the two
> > 	FIXMEs I added? )
>
> I don't think we need --recursive-delete-dir, --recursive-unset should
> just be deleting directories. We could do this by adding
> gconf_engine_remove_dir() to --recursive-unset, or by changing the XML
> backend as described above. Hmm.

	sure - I thinking changing the backend makes the most sense

>
> > 	2) Remove calls to POA::activate_object, which are useless on
> > 	the RootPOA, since the RootPOA supports implicit activation
> > 	... and you were leaking ObjectIds anyway :-)
>
> OK, I'll take the word of the ORBit experts on this, I was just
> cut-and-pasting some early-GNOME-1 boilerplate from someplace. ;-)

	heh :-)

> > 	May I commit ?
>
> Please commit the POA fixes and XML backend fixes, but I would rather
> just change --recursive-unset in gconftool, instead of adding a new
> option.  Or if we make removing all keys in a dir implicitly drop the
> dir, --recursive-unset will work as written (this was what I was
> intending when I wrote it).

	Okay, I've committed - the changed XML backend patch is appended.

> > -  /* We should have a doc if dirty is TRUE */
> > -  g_assert(d->doc != NULL);
> > -
>
> This points out a bug, which is that dir_set_value() doesn't work on
> directories marked deleted.

	I'm not sure what you mean here, but I've removed it anyway
because the assertion clearly doesn't match up with dir_mark_deleted.

> Thanks for looking into this.

	No problem :-)

Good Luck,
Mark.

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gconf/ChangeLog,v
retrieving revision 1.343
diff -u -p -r1.343 ChangeLog
--- ChangeLog	2002/01/08 12:14:23	1.343
+++ ChangeLog	2002/01/08 12:19:13
@@ -1,3 +1,9 @@
+2002-01-08  Mark McLoughlin  <mark skynet ie>
+
+	* backends/xml-dir.c:
+	(struct _Dir): kill unused subdir_cache.
+	(dir_sync): move incorrect assertion.
+
 2002-01-07  Mark McLoughlin  <mark skynet ie>

 	* gconf/gconf-database.c: (gconf_database_new):
Index: backends/xml-dir.c
===================================================================
RCS file: /cvs/gnome/gconf/backends/xml-dir.c,v
retrieving revision 1.23
diff -u -p -r1.23 xml-dir.c
--- backends/xml-dir.c	2001/12/11 20:26:28	1.23
+++ backends/xml-dir.c	2002/01/08 12:19:13
@@ -69,7 +69,6 @@ struct _Dir {
   GTime last_access; /* so we know when to un-cache */
   xmlDocPtr doc;
   GHashTable* entry_cache; /* store key-value entries */
-  GHashTable* subdir_cache; /* store subdirectories */
   guint dir_mode;
   guint file_mode;
   guint dirty : 1;
@@ -286,9 +285,6 @@ dir_sync        (Dir* d, GError** err)
   if (!d->dirty)
     return TRUE;

-  /* We should have a doc if dirty is TRUE */
-  g_assert(d->doc != NULL);
-
   d->last_access = time(NULL);

   if (d->deleted)
@@ -313,6 +309,9 @@ dir_sync        (Dir* d, GError** err)
       gchar* tmp_filename;
       gchar* old_filename;
       FILE* outfile;
+
+      /* We should have a doc if deleted is FALSE */
+      g_assert(d->doc != NULL);

       /* First make sure entry values are synced to their
          XML nodes */




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