Re: [gtk-list] Combo Box
- From: Paolo Molaro <lupus lettere unipd it>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Combo Box
- Date: Fri, 16 Oct 1998 15:08:24 +0200
On Fri, Oct 16, 1998 at 07:37:48AM -0500, Wesley Lemke wrote:
> #define WEEKS 17
> GtkWidget *table1;
> GtkWidget *combo;
> GList *list
> GString *string;
> int i;
>
> combo = gtk_combo_new ();
- list = g_list_alloc();
+ list = NULL;
>
> for(i = 0; i < WEEKS; i++)
> {
> string = g_string_new("Week ");
> string = g_string_append_c(string, i+49);
> list = g_list_append(list, string);
> }
This doesn't do what you want:-)
You need char* in the list, not GStrings. Use something like:
char buf[64];
for(i = 0; i < WEEKS; i++)
{
sprintf(buf, "Week %d", i);
list = g_list_append(list, g_strdup(buf));
}
g_list_foreach(list, g_free, NULL);
...
lupus
--
"The number of UNIX installations has grown to 10, with more expected."
- _The UNIX Programmer's Manual_, Second Edition, June, 1972.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]