I want a button with text on it for a GtkListStore
. I read another answer using an image as a button, but I really need the title to be text. How can I do this? I'd be fine with a solution that renders text onto a GdkPixbuf
as well.
I've tried this:
GType *types;
types = g_new0 (GType, num_fields);
for(int i=0; i<num_fields; i++) {
types[i] = GTK_TYPE_BUTTON;
}
tree_store = gtk_list_store_newv(num_fields, types);
tree_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(tree_store));
GtkTreeViewColumn *column;
GtkCellRenderer *renderer;
GdkPixbuf *icon;
renderer = gtk_cell_renderer_pixbuf_new();
column = gtk_tree_view_column_new_with_attributes (name.c_str(),renderer,"pixbuf",i,NULL);
button = gtk_button_new_with_label ("Quit");
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_widget_destroy), window);
gtk_widget_set_can_default (button, TRUE);
gtk_list_store_set(tree_store, &iter, j, button, -1);
There are no errors, but nothing shows up.
I want to view the selection in a new window.