chiark / gitweb /
disobedience more robust against server restart
[disorder] / disobedience / choose.c
index 369c601da819ad753d766e033edfb075d911d5e4..71256c8e19f1cff7363f3b9b93e0a1be013631b9 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * This file is part of DisOrder
- * Copyright (C) 2006 Richard Kettlewell
+ * Copyright (C) 2006, 2007 Richard Kettlewell
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -93,6 +93,7 @@ static int nsearchresults;              /* number of results */
 
 /* Forward Declarations */
 
+static void clear_children(struct choosenode *cn);
 static struct choosenode *newnode(struct choosenode *parent,
                                   const char *path,
                                   const char *display,
@@ -174,6 +175,7 @@ static void fill_root_node(struct choosenode *cn) {
   struct callbackdata *cbd;
 
   D(("fill_root_node"));
+  clear_children(cn);
   if(choosealpha) {
     if(!cn->children.nvec) {              /* Only need to do this once */
       for(ch = 'A'; ch <= 'Z'; ++ch) {
@@ -296,7 +298,7 @@ static void fill_directory_node(struct choosenode *cn) {
   /* TODO: de-dupe against fill_letter_node */
   assert(report_label != 0);
   gtk_label_set_text(GTK_LABEL(report_label), "getting files");
-  cn->children.nvec = 0;
+  clear_children(cn);
   cbd = xmalloc(sizeof *cbd);
   cbd->u.choosenode = cn;
   disorder_eclient_dirs(client, got_dirs, cn->path, 0, cbd);
@@ -996,4 +998,3 @@ fill-column:79
 indent-tabs-mode:nil
 End:
 */
-/* arch-tag:A5KX3X9SR8Pl57VRLSnCng */