Re: Adding row to the ListStore



On Mon, 2004-12-13 at 09:52 +0100, Petr Hracek wrote:
Hi all,

Hi,

I would like to aske you how I can insert row to the ListStore.

My code:
struct _DialogData
{
    GtkWindow * TreeView;
}

static GtkTreeModel * create_model()
{
    GtkListStore * store;
    GtkTreeIter iter;

    store = gtk_list_store_new (4, G_TYPE_STRING, G_TYPE_STRING, 
G_TYPE_STRING, G_TYPE_STRING);

    return GTK_TREE_MODEL(store);
}


int main(int argc, char *argv[])
{
    DialogData * data;
    data = g_new0(DialogData,1);
    GtkTreeModel * model;

    ......
    model = create_model();
    data->TreeView = gtk_tree_view_new_with_model(model);
    g_object_unref(model);
    // Now I want add data as a rows to the ListStore.
    // How I can do this
}

You can do this using gtk_list_store_append (store, &iter) or
gtk_list_store_prepend (store, &iter).

If you have only the GtkTreeModel, you can use GTK_LIST_STORE (model) to
get the GtkListStore*.

-- 
Regards,
Martyn



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