Hello and welcome to the GTK+ forums!
You're having troubles because you don't fully understand how tree view works. Tree view can be seen as a empty piece of paper that is divided vertically into columns (column is represented by GtkTreeViewColumn) and horizontally into rows (you then actually get a grid). The actual content of tree view is then directly drawn on this paper by cell renderer. Cell renderer functions like rubber stamp where you set the attributes
and then paint one cell of the grid. So it's operation can be described in pseudo-code like this:
- set proper attributes on cell renderer
- stamp contents into proper place
- move to next cell
- repeat from 1
It should be clear now that you cannot use widgets (or widget trees) when it comes to tree view.
Now, to solve your problem. There are three solutions available to this problem. The easiest one is to simply store the complete text in one column in your data store and embed a newline character directly inside it. This is really simply to implement, but complexity comes if you need to update just the second line, since now you'll need to hammer the string into something reasonable.
Second option is to store upper and lower strings in separate columns inside data store and then use cell data function to combine them at render time. This is a bit more complex to set up and will tax the performance of your application a bit, but now it's easy to modify only upper or lower text.
Third (and the best option) would be to create custom cell renderer, but this requires some work and knowledge of GObject and GType. I don't think this is feasible to achieve with your level of knowledge right now, but with a little hard work this can be changed.
Now, just to give you a quick boost, I created a sample app for the second approach (implementations of the first and third one are left as a practice/learning opportunity ) that demo's how to use cell data functions.
C_PIXBUF = 0,
glue_text (GtkTreeViewColumn *col,
char *title, *text;
gtk_tree_model_get (model, iter, C_UP_TEXT, &title,
C_DOWN_TEXT, &text, -1);
markup = g_strdup_printf ("<b><big>%s</big></b>\n%s", title, text);
g_object_set (cell, "markup", markup, NULL);
main (int argc,
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (window, "destroy", gtk_main_quit, NULL);
store = gtk_list_store_new (NO_COLS, GDK_TYPE_PIXBUF,
for (i = 1; i < 10; i++)
char line1 = "Title in row ";
char line2 = "Text in row ";
line1 = line2 = '0' + i;
pbuf = gtk_widget_render_icon_pixbuf (window,
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, C_PIXBUF, pbuf,
C_UP_TEXT, line1, C_DOWN_TEXT, line2, -1);
treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
gtk_container_add (GTK_CONTAINER (window), treeview);
cell = gtk_cell_renderer_pixbuf_new ();
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
-1, "Image", cell,
cell = gtk_cell_renderer_text_new ();
gtk_tree_view_insert_column_with_data_func (GTK_TREE_VIEW (treeview),
-1, "Text", cell,