[9347] in The GTK GIMP ToolKit mailing list archive
[gtk-list] Re: Combo Box
daemon@ATHENA.MIT.EDU (Paolo Molaro)
Fri Oct 16 09:05:55 1998
Date: Fri, 16 Oct 1998 15:08:24 +0200
From: Paolo Molaro <lupus@lettere.unipd.it>
To: gtk-list@redhat.com
Mail-Followup-To: gtk-list@redhat.com
In-Reply-To: <199810161237.HAA05715@home.dwave.net>; from Wesley Lemke on Fri, Oct 16, 1998 at 07:37:48AM -0500
Resent-From: gtk-list@redhat.com
Reply-To: gtk-list@redhat.com
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.
--
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null