Re: GtkList number of items? gtk_object_set_data (GList)?
- From: "Jean-Christophe Berthon" <jean-christophe berthon cgey com>
- To: "Andrés Giraldo" <andres_giraldo yahoo com>, "Gtk List" <gtk-list gnome org>
- Subject: Re: GtkList number of items? gtk_object_set_data (GList)?
- Date: Tue, 10 Jul 2001 17:05:25 +0200
1) you should try : g_list_length
2) you should define a structure... I'm explaining it better.
Maybe you have now something like that (based on the idea that you have a
combo box behind...)
GList *list = NULL;
gchar *comboitem;
comboitem = g_malloc(sizeof(gchar)*20);
strcpy(comboitem, "toto");
liste = g_list_insert(liste, comboitem, (GCompareFunc) compare);
strcpy(comboitem, "tata");
liste = g_list_insert(liste, comboitem, (GCompareFunc) compare);
/* ... */
OK now you change it for this:
typedef struct _MyComboItem
{
gchar *pcItem;
gpointer *pvData;
} MyComboItem;
GList *list = NULL;
MyComboItem *comboitem;
comboitem = g_malloc(sizeof(MyComboItem));
comboitem.pcItem = "toto";
comboitem.pvData = &ComplementaryInfo;
liste = g_list_insert(liste, comboitem, (GCompareFunc) compare);
comboitem.pcItem = "tata";
comboitem.pvData = &ComplementaryInfo;
liste = g_list_insert(liste, comboitem, (GCompareFunc) compare);
/* ... */
Best regards,
---
Jean-Christophe Berthon
Cap Gemini -- Ernst & Young
Toulouse FR
Skill Aerospace -- Image Quality
Email: Jean-Christophe Berthon cgey com
Tel : (+33) 561 31 6639
----- Original Message -----
From: "Andrés Giraldo" <andres_giraldo yahoo com>
To: "Gtk List" <gtk-list gnome org>
Sent: Tuesday, July 10, 2001 4:35 PM
Subject: GtkList number of items? gtk_object_set_data (GList)?
> Hi! 2 questions:
>
> 1. How can I know the number of items in a GtkList?
>
> 2. How can I add some info (like gtk_object_set_data)
> to a GList item? That's because I'm working with a
> combo box and I would to obtain that info on the
> selected item.
>
> Thanks by your help!
>
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail
> http://personal.mail.yahoo.com/
>
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]