About GtkTree expand and collapse



hi,still newbie,more questions :-(

every time when I expand a directory on the tree,
it will read all the subdirectory into the treeitem,
so expand-collapse-expand-collapse.....
the same item will be read into the diretory,just like

+root
 -dir1
 -dir2
 -dir3
 -dir1
 -dir2
 -dir3
 -dir1
 -dir2
 -dir3
......
......
+etc

if fact there are only dir1,dir2,dir3 in the root DIR.
I want to remove all the items before build the tree,
I used gtk_tree_remove_item,gtk_tree_item_remove_subtree
,but it still doesnt work,help ,thanks a lot


static void expand_cb(GtkWidget *item, gchar *signame)
{

  gchar *name;
  gchar *path;
  GtkLabel *label;
  GtkTreeItem *subtree = NULL;
	
  label = GTK_LABEL (GTK_BIN (item)->child);
  path = get_folder_path(item);
  char tmp[256];
  strcpy(tmp,"/");
  strcat(tmp,path);
  gtk_label_get (label, &name);
  subtree = GTK_TREE_ITEM_SUBTREE(item);
  //build sub-tree
  scan_dir(subtree,tmp);
  g_print ("path is %s\n",tmp);

}



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