If you create a Liststore and TreeView using Python, then everything works well:
... model = Gtk.ListStore(str, bool) for name in data: model.append([name, True]) treeview = Gtk.TreeView(self.model) col_name = Gtk.TreeViewColumn("Name") cell_name = Gtk.CellRendererText() col_name.pack_start(cell_name, expand=False) col_name.set_attributes(cell_name, text=1) col_bool = Gtk.TreeViewColumn("Bool") cell_bool = Gtk.CellRendererPixbuf() col_bool.pack_start(cell_bool, expand=False) col_bool.set_cell_data_func(cell_bool, render_icon) treeview.append_column(col_bool) treeview.append_column(col_name) ... But, if using Glade:
... builder = Gtk.Builder() builder.add_from_file("ui.glade") treeview = builder.get_object("treeview") model = treeview.get_model() col_bool = builder.get_object("col-bool") cell_bool = builder.get_object("cell-bool") col_bool.set_cell_data_func(cell_bool, render_icon) for name in data: model.append([name, True]) Ui.glade file
... <object class="GtkListStore" id="liststore"> <columns> <!-- column-name service --> <column type="gchararray"/> <!-- column-name state --> <column type="gboolean"/> </columns> </object> ... <child> <object class="GtkTreeViewColumn" id="col-name"> <property name="title" translatable="yes">Service</property> <property name="expand">True</property> <child> <object class="GtkCellRendererText" id="cell-name"/> <attributes> <attribute name="text">0</attribute> </attributes> </child> </object> </child> <child> <object class="GtkTreeViewColumn" id="col-bool"> <property name="max_width">25</property> <property name="title" translatable="yes">State</property> <property name="alignment">1</property> <child> <object class="GtkCellRendererPixbuf" id="cell-bool"/> </child> </object> </child> ... then when I run model.append, I get a lot of minings:
(myapp: 9434): Gtk-WARNING **: gtk_widget_size_allocate (): try to allocate widget with width -4 and height -9
and then
Segmentation Error
I can not understand what's the matter, everything seems to be right.
Also, if the data is entered into the GdekListStore in the glade file, they are displayed quite normally.
<data>section and do not execute the append, then the display is normal. - SasayGdkPixbuf.Pixbuftocell-bool, different icons depending on the value received from the model. - Sasay