Two changes:

- Kill the stack in the treestore.  It was the wrong approach
	  at fixing the problem.  Now emit all of the change notifications
	  after the tree has been finished the check.

	- GtkCTree is not a tree internally but a list and the gaps
	  are, well, gaps.  Deal with it.

Miguel.
This commit is contained in:
Miguel de Icaza 1999-02-07 06:16:30 +00:00
parent 0108bdba8f
commit ffbd234ae6
4 changed files with 36 additions and 20 deletions

View File

@ -1,3 +1,9 @@
1999-02-07 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gtkdtree.c (gtk_dtree_lookup_dir): Scan the whole tree.
Appanrently now the nodes expose are not ordered, but can contain
holes and gaps
1999-02-06 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtkdtree.c (gtk_dtree_insert_node): This function was never

View File

@ -213,16 +213,17 @@ gtk_dtree_lookup_dir (GtkDTree *dtree, GtkCTreeNode *parent, char *dirname)
node = GTK_CTREE_ROW (parent)->children;
while (node && GTK_CTREE_ROW (node)->parent == parent){
while (node){
char *text;
gtk_ctree_node_get_pixtext (
GTK_CTREE (dtree), node, 0, &text,
NULL, NULL, NULL);
if (strcmp (dirname, text) == 0)
return node;
if (GTK_CTREE_ROW (node)->parent == parent){
gtk_ctree_node_get_pixtext (
GTK_CTREE (dtree), node, 0, &text,
NULL, NULL, NULL);
if (strcmp (dirname, text) == 0)
return node;
}
node = GTK_CTREE_NODE_NEXT (node);
}
@ -404,16 +405,17 @@ entry_removed_callback (tree_entry *tree, void *data)
* into the treestore. We update the gtkdtree with this new information.
*/
static void
entry_added_callback (tree_entry *tree, void *data)
entry_added_callback (char *dirname, void *data)
{
GtkCTreeNode *current_node, *new_node;
GtkDTree *dtree = data;
char *dirname, *copy, *current, *npath, *full_path;
char *copy, *current, *npath, *full_path;
if (dtree->loading_dir)
return;
copy = dirname = g_strdup (tree->name);
dirname = g_strdup (dirname);
copy = dirname;
copy++;
current_node = dtree->root_node;
npath = g_strdup ("/");

View File

@ -1,7 +1,13 @@
1999-02-06 Federico Mena Quintero <federico@nuclecu.unam.mx>
1999-02-07 Miguel de Icaza <miguel@nuclecu.unam.mx>
* treestore.h: Replaced TreeStore.check_name_list by a GSList, for
minimal memory savings.
* treestore.c: Revert all of the stack changes. Now the treestore
is again non-re-entrant. Being re-entrat was only covering up for
bugs in other places.
Now we postpone notifications for additions at
tree_store_end_check, not before.
1999-02-06 Federico Mena Quintero <federico@nuclecu.unam.mx>
* treestore.c (tree_store_remove_entry): Removed unused code for
base_sublevel computation.

View File

@ -24,7 +24,8 @@ typedef struct {
tree_entry *tree_first; /* First entry in the list */
tree_entry *tree_last; /* Last entry in the list */
tree_entry *check_start; /* Start of checked subdirectories */
GSList *check_name_stack;
char *check_name;
GList *add_queue; /* List of strings of added directories */
unsigned int loaded : 1;
unsigned int dirty : 1;
} TreeStore;
@ -54,11 +55,11 @@ void tree_store_add_entry_remove_hook (tree_store_remove_fn callback,
void tree_store_remove_entry_remove_hook (tree_store_remove_fn callback);
/*
* Register/unregister notification functions for "entry_remove"
* Register/unregister notification functions for "entry_add"
*/
typedef void (*tree_store_add_fn)(tree_entry *tree, void *data);
void tree_store_add_entry_add_hook (tree_store_remove_fn callback, void *data);
void tree_store_remove_entry_add_hook (tree_store_remove_fn callback);
typedef void (*tree_store_add_fn)(char *name, void *data);
void tree_store_add_entry_add_hook (tree_store_add_fn callback, void *data);
void tree_store_remove_entry_add_hook (tree_store_add_fn callback);
/*
* Changes in the tree_entry are notified with these
@ -71,3 +72,4 @@ tree_entry *tree_store_readdir (tree_scan *scanner);
void tree_store_closedir (tree_scan *scanner);
#endif