GList and Combo



I want to make a combo with :

    GtkWidget *combo;
    GList *strings = NULL;  

    combo = gtk_combo_new ();
    strings = select_sizes();
    gtk_combo_set_popdown_strings (GTK_COMBO (combo), strings);
    gtk_widget_show (combo1);

And my select_sizes function that creates the GList:

GList* select_sizes (void)
{
    guint i;
    gchar *size;
    GList *sizelist = NULL;

    size = (char *) calloc (2, sizeof(char));
    for (i=1; i<=5; i++)
    {
        sprintf (size, "%d", i);
        sizelist = g_list_append (sizelist, size);
    } /* end_for */
    sizelist = g_list_append (sizelist, "end");
    return sizelist;
} 

And here's what the combo pops down when clicked:  
  5
  5
  5
  5
  5
  end

My question is : Why ?

Regards,
		Marc



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