After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 154191 - Pixbuf & text renderer in combo box center aligned when 2nd renderer expanded
Pixbuf & text renderer in combo box center aligned when 2nd renderer expanded
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkComboBox
2.4.x
Other Linux
: High normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2004-09-30 18:34 UTC by Martyn Russell
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: 2.5/2.6


Attachments
Test case to show this bug (1.89 KB, application/x-gzip)
2004-09-30 18:35 UTC, Martyn Russell
Details

Description Martyn Russell 2004-09-30 18:34:41 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?
Comment 1 Martyn Russell 2004-09-30 18:35:36 UTC
Created attachment 32123 [details]
Test case to show this bug
Comment 2 Matthias Clasen 2004-10-01 19:01:27 UTC
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)