[Glade-users] Dynamically add data to GtkComboEntry ListStore



Hello,

I am trying to add data to a liststore for a GtkComboEntry.  I am using 
GTKBuilder and have created a GtkComboEntry and a liststore with two 
columns both of type gchararray.  I have left the data fields empty.  
How do I access the liststore I created and add data to it when the user 
clicks on the popdown button?  Do I have to call
gtk_list_store_new (); if I created the liststore already in glade?

I have tried the following:

typedef struct  _Data Data;
struct _Data
{
     GtkWidget            *window;
     GtkComboBox      *country;
     GtkListStore         *country_store;
};

enum
{
     COL_COUNTRY_NAME = 0,
     COL_CONTRY_ABREVIATION,
     NUM_COLS
};

add_liststore_data (GtkButton *sender, Data *data);
{
     data->country_store = gtk_list_store_new (NUM_COLS, G_TYPE_STRING, 
G_TYPE_STRING);
     gtk_list_store_append( GTK_LIST_STORE (data->country_store), &iter );
     gtk_list_store_set( GTK_LIST_STORE (data->country_store), &iter, 
COL_COUNTRY_NAME, "America", COL_CONTRY_ABREVIATION, "USA", -1 );
}

Any help would be greatly appreciated.

Thanks,

Patrick





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