threads/treeview



I seem to have run amuck of...something. I've pasted a small test program
below. Take out the call gdk_threads_init() and it works ok. Take out the
call to gtk_tree_view_insert_column_with_attributes() and it works ok.
Leave both in and it pops up the window, but wont respond to anything.
Have I done something foolish? Or have I stumbled across some insidious
little beastie of a bug? Oh, yes, I have 2.0.0 installed.

--------------------------------
#include <gtk/gtk.h>

int
main (int argc, char *argv[])
{
  GtkWidget *win, *vbox;
  GtkTreeStore *model;
  GtkWidget *view;
  GtkTreeViewColumn *column;
  GtkCellRenderer *cell_renderer;
  int col_off;

  gtk_init (&argc, &argv);
  g_thread_init (NULL);
  gdk_threads_init ();
  win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  g_signal_connect(G_OBJECT(win), "delete_event", G_CALLBACK(gtk_main_quit), NULL);

  vbox = gtk_vbox_new (FALSE, 1);
  gtk_container_add (GTK_CONTAINER (win), vbox);
  model =
    gtk_tree_store_new (4, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_BOOLEAN,
                        G_TYPE_BOOLEAN);
  view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
  gtk_container_add (GTK_CONTAINER (vbox), view);
  g_object_unref (G_OBJECT (model));
  cell_renderer = gtk_cell_renderer_text_new ();
  /* **** this seems to be the line causing it */
  col_off = gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW(view),
                                                        -1, "Datasets",
                                                        cell_renderer,
                                                        "markup", 0, NULL);

  gtk_widget_show_all (win);
  gdk_threads_enter ();
  gtk_main ();
  gdk_threads_leave ();
  return (0);
}

-- 
Slyder earendel org                  |  "Into the flood again... 
Earendel / <insert here>             |   ...if I would, could you?"
Sing your dreams, Scream your song   |     --"Would", Alice in Chains



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