Bug#211113: libgtk2.0-0: GtkCellRenderPixbuf problem

[ATR]Dj-Death "[ATR]Dj-Death" <djdeath@gmx.fr>, 211113-quiet@bugs.debian.org
Wed, 9 Jun 2004 00:43:21 +0200


--DocE+STaALJfprDB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Sat, Jun 05, 2004 at 11:07:46PM +0200, Sebastien Bacher wrote :
> > By using the "stock_id" property to displqy stock icons, I
> > found that if you set this one cell with the linked porperty
> > to NULL, it will draws an icon anyway. Using the last used icon.
> 
> Hi,
> 
> Sorry for the long delay. Could you test if the problem is still here
> with gtk+2.4 ? If yes could you provide the test case again, the link
> you provided seems to doesn't work anymore.

Tested with GTK+ 2.4.1. Doesnt bug anymore ;)
I join the test file.

Thx.

--DocE+STaALJfprDB
Content-Type: text/x-csrc; charset=us-ascii
Content-Disposition: attachment; filename="pixbuf_render.c"

/* compile with gcc pixbuf_render.c -o pixbuf_render `pkg-config gtk+-2.0 --cflags --libs` */

#include <stdio.h>
#include <stdlib.h>

#include <gtk/gtk.h>

GtkWidget *
create_the_treeview (void)
{
	GtkTreeIter iter, parent;
	GtkTreeStore *store;
	GtkCellRenderer *renderer;
	GtkTreeViewColumn *column;
	
	GtkWidget *window, *vbox;
	GtkWidget *treeview;
	
	/* Create */
	
	window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	gtk_widget_realize (window);
	g_signal_connect (window, "destroy",
			  G_CALLBACK (gtk_main_quit),
			  NULL);
	gtk_window_set_title (GTK_WINDOW (window), "oOOOoo");
	
	vbox = gtk_vbox_new (FALSE, 0);
	gtk_container_add (GTK_CONTAINER (window), vbox);
       	
	store = gtk_tree_store_new (1, G_TYPE_STRING);
	treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
	g_object_unref (store);
	gtk_box_pack_start_defaults (GTK_BOX (vbox), treeview);
	
	renderer = gtk_cell_renderer_pixbuf_new ();
	g_object_set (renderer, "stock_size", GTK_ICON_SIZE_MENU, NULL);
	
	column = gtk_tree_view_column_new_with_attributes ("Something wrong here",
							   renderer,
							   "stock_id", 0, NULL);
	gtk_tree_view_column_set_resizable (column, TRUE);
	gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
	
	/* Add */
	
	gtk_tree_store_append (store, &parent, NULL);
	gtk_tree_store_set (store, &parent, 0, NULL, -1);
	
	gtk_tree_store_append (store, &iter, &parent);
	gtk_tree_store_set (store, &iter, 0, GTK_STOCK_HOME, -1);
	
	gtk_widget_show_all (window);
	
	return treeview;
}

gint
main (gint argc, gchar *argv[])
{
	gtk_init (&argc, &argv);
	
	create_the_treeview ();
	
	gtk_main ();
	
	return EXIT_SUCCESS;
}

--DocE+STaALJfprDB--