This code shows how I created the column view:
GListStore *store = g_list_store_new (GTK_TYPE_STRING_OBJECT);
GtkSelectionModel *selection = GTK_SELECTION_MODEL(gtk_single_selection_new (G_LIST_MODEL(store)));
GtkWidget *view = gtk_column_view_new (selection);
// begin col1:
GtkListItemFactory *factory = gtk_signal_list_item_factory_new ();
g_signal_connect (factory, "setup", G_CALLBACK (cb_setup_col1), NULL);
g_signal_connect (factory, "bind", G_CALLBACK (cb_bind_col1), NULL);
GtkColumnViewColumn *column1 = gtk_column_view_column_new ("Archivo", factory);
gtk_column_view_append_column (GTK_COLUMN_VIEW (view), column1);
// end col1
// begin col2:
GtkColumnViewColumn *column2 = gtk_column_view_column_new ("Formato", factory);
gtk_column_view_append_column (GTK_COLUMN_VIEW (view), column2);
// end col2
g_autoptr(GtkStringObject) strobj1 = gtk_string_object_new ("str_for_col1");
g_autoptr(GtkStringObject) strobj2 = gtk_string_object_new ("str_for_col2");
g_list_store_append (store, strobj1);
g_list_store_append (store, strobj2);
//...
void cb_setup_col1 (GtkSignalListItemFactory *self, GtkListItem *list_item, gpointer user_data)
{
GtkWidget *label = gtk_label_new ("");
gtk_list_item_set_child (list_item, label);
}
void cb_bind_col1 (GtkSignalListItemFactory *self, GtkListItem *list_item, gpointer user_data)
{
GtkStringObject *strobj = gtk_list_item_get_item (list_item);
GtkWidget *label = gtk_list_item_get_child (list_item);
gtk_label_set_text (GTK_LABEL(label), gtk_string_object_get_string (strobj));
}
The thing is that I realize that I have one model with the type string for both columns, not like gtk_list_store_set
which I can tell the position to insert the string. Any ideas about how to insert strobj2 as item for the second column?