A bug in GtkTree? (forgot attachment)



Sorry about this, I forgot the attachment in the previous message :(

Regards,
Constantine Vetoshev
#include <gtk/gtk.h>


int main(int argc, char **argv)
{
   GtkWidget *window, *tree,
      *item_1, *subtree_1, *subitem_1,
      *item_2, *subtree_2, *subitem_2;

   gtk_init (&argc, &argv);

   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
   gtk_signal_connect (GTK_OBJECT(window), "delete_event",
		       GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
   gtk_container_set_border_width (GTK_CONTAINER(window), 0);

   tree = gtk_tree_new();
   gtk_tree_set_selection_mode(GTK_TREE(tree),
			       GTK_SELECTION_MULTIPLE);
   gtk_container_add(GTK_CONTAINER(window), tree);
   gtk_widget_show(tree);

   /* Add stuff. */
   item_1 = gtk_tree_item_new_with_label("One");
   gtk_tree_append(GTK_TREE(tree), item_1);
   gtk_widget_show(item_1);
   subtree_1 = gtk_tree_new();
   gtk_tree_item_set_subtree(GTK_TREE_ITEM(item_1), subtree_1);
   subitem_1 = gtk_tree_item_new_with_label("Sub One");
   gtk_tree_append(GTK_TREE(subtree_1), subitem_1);
   gtk_widget_show(subitem_1);

   item_2 = gtk_tree_item_new_with_label("Two");
   gtk_tree_append(GTK_TREE(tree), item_2);
   gtk_widget_show(item_2);
   subtree_2 = gtk_tree_new();
   gtk_tree_item_set_subtree(GTK_TREE_ITEM(item_2), subtree_2);
   subitem_2 = gtk_tree_item_new_with_label("Sub Two");
   gtk_tree_append(GTK_TREE(subtree_2), subitem_2);
   gtk_widget_show(subitem_2);

   /* Remove stuff. */
   gtk_container_remove(GTK_CONTAINER(subtree_2), subitem_2);

   /* Run. */
   gtk_widget_show(window);
   gtk_main();
   return 0;
}

PGP signature



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