gtk_list_store from XML UI not storing strings



I have designed my interface with glade, and have set up what I believe to
be a good, valid GtkListStore. Here is the corresponding XML:

  <object class="GtkListStore" id="list_results">
    <columns>
      <!-- column-name thread_id -->
      <column type="gint"/>
      <!-- column-name hostname -->
      <column type="gchar"/>
      <!-- column-name bytes_sent -->
      <column type="gint"/>
      <!-- column-name bytes_recv -->
      <column type="gint"/>
      <!-- column-name data_sent -->
      <column type="gpointer"/>
      <!-- column-name data_recv -->
      <column type="gpointer"/>
    </columns>
  </object>

I am trying to add a row to this list store, but for some reason my string
is turning into an int.

This is my test code:

    GtkListStore * liststore;
    GtkTreeIter iter;

    liststore = gtk_builder_get_object(builder, "list_results");

    gtk_list_store_append(liststore, &iter);

    char * test = NULL;
    printf("%x - ", test);

    gtk_list_store_set(liststore, &iter,
                       0, 1,
                       1, "asdf",
                       2, 2,
                       3, 3,
                       4, NULL,
                       5, NULL,
                       -1);

    gtk_tree_model_get (GTK_TREE_MODEL(liststore), &iter, 1, &test, -1);
    printf("%x\n", test);

The first 4 columns are displayed, and all of the gint columns display
correctly, exactly as expected. The 1st column (the gchar) displays as -124.
The output to stdout is: 0 - 84.

I am at a loss for what is happening and what I am doing wrong.

- Alex



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