GNOME Bugzilla – Bug 154191
Pixbuf & text renderer in combo box center aligned when 2nd renderer expanded
Last modified: 2004-12-22 21:47:04 UTC
If I use the example shown at the bottom of this page: http://developer.gnome.org/doc/API/2.2/gtk/gtk-migrating-GtkComboBox.html which adds two renderers (pixbuf and text) and packs them into a layout, they are aligned centered to the GtkComboBox. This seems to occur after the GtkComboBox has been set up. By that I mean, if you use glade OR use the following code: combo_box = gtk_combo_box_new_text (); gtk_widget_show (combo_box); gtk_box_pack_start (GTK_BOX (hbox), combo_box, TRUE, TRUE, 0); gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), "Jabber"); then go to change the layout, this bug is demonstrated. To fix this I have noticed that using the gtk_cell_layout_reorder() function works if you do it for index 0 and 1. But also using gtk_cell_layout_clear() fixes this bug but with a notable error: (test_gtkcombobox:5393): Gtk-CRITICAL **: file gtkcellview.c: line 707 (gtk_cell_view_cell_layout_clear_attributes): assertion `info != NULL' failed After tracking this down further by compiling against GTK 2.4.10, it turns out the renderer is NULL when calling gtk_cell_view_get_cell_info() on line 706, and the function wouldn't match any of the renderers in the list for that cellview anyway (because it is NULL) so perhaps a check is needed?
Created attachment 32123 [details] Test case to show this bug
2004-10-01 Matthias Clasen <mclasen@redhat.com> * gtk/gtkcombobox.c (gtk_combo_box_set_model): Add a comment regarding cell renderers to the docs. * gtk/gtkcellview.c (gtk_cell_view_cell_layout_clear_attributes): * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_cell_layout_clear_attributes): Silently ignore info being NULL. This is unavoidable with the current design where we have every implementation of layout_clear call layout_clear_attributes, and also delegate calls to dependent cell layouts. (#154191, Martyn Russell)