Re: help regarding the combobox



On 04/08/2005 01:40:02 AM, poonam chokshi wrote:
hello,

I am using the combobox in the heirarchy as shown
-Main window
        -secframe
                -secfixed
                        -seccmb
Now i am trying to add some data to the the combo box usingthe
g_list_append()
function in my own callback defined in the callback.c ..But it
gives
me the segmentationfault
My function goes like this....

int parse_ini_file(char * ini_name)
{
        int i=0;
        GtkWidget *seccmbentry;
        GList *items=NULL;
        GList *seccmb_items=NULL;
ini = iniparser_load(ini_name); //library function that
i am using
        if (ini==NULL)
        {
                fprintf(stderr, "cannot parse file [%s]",
ini_name);
                return -1 ;
        }
        section=iniparser_getnsec(ini); //library function that
will return the count
        printf("the number of sections:%d\n",section);
        seccmbentry = GTK_COMBO (seccmb)->entry;
        for(i=0;i<=section-1;i++)
        {
                seccmb_items=iniparser_getsecname(ini,i);
//library function
                printf("Items=%s\n",seccmb_items);
                items=g_list_append(items,seccmb_items);
//giving segmentation fault over here
        }
gtk_entry_set_text (GTK_ENTRY (seccmbentry),
seccmb_items);
        gtk_combo_set_popdown_strings (GTK_COMBO (seccmb),
items);

        iniparser_freedict(ini); //library function
        return 0;
}

Your declaration of seccmb_items looks strange. What type does iniparser_getsecname() return? Doesn't gtk_entry_set_text (GTK_ENTRY (seccmbentry), seccmb_items) raise a compiler warning? You're passing a GList* pointer as const gchar*.




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