GnomeAnimator + GtkEventBox



I needed to write a widget that has a clickable GnomeAnimator, so I just packed an animator into a GtkEventBox, but this causes a segfault (right after the main window shows itself on the display).
Has anyone had that problem, or maybe that's the way it should be and there's some theory lurking behind this behavior ?. I've figured out that when I use a vbox instead of event box (or omit any container and pack directly to the main window), things work just fine. I guess that may be connected with the fact that event box has its own window, and vbox hasn't.
Or maybe it's just my configuration (glib & gtk+ 1.2.10, gnome 1.4).

Please enlighten me,
Piotr Zgorecki

This is a sample code that crashes (to the end of the letter). If you remove the event box and pack the animator directly to the main window, it will start to work properly:

#include <gnome.h>

const char *IMAGE_FILE = "green.xpm"; /* change to something existant */

int main(int argc, char *argv[])
{
	GtkWidget *window;
	GtkWidget *event_box;
	GtkWidget *animator;
	
	gnome_init("dupa", "dupa", argc, argv);

	window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	gtk_signal_connect (GTK_OBJECT (window), "destroy",
			    GTK_SIGNAL_FUNC (gtk_exit), NULL);

	event_box = gtk_event_box_new ();
	gtk_container_add (GTK_CONTAINER(window), event_box);
	gtk_widget_show (event_box);

	animator = gnome_animator_new_with_size(48, 48);
	gnome_animator_append_frames_from_file_at_size
		(GNOME_ANIMATOR(animator),
		 IMAGE_FILE,
		 0,
		 0,
		 100,
		 48,
		 32,
		 32);
	gtk_widget_show(animator);
	gtk_container_add (GTK_CONTAINER (event_box), animator);

	gtk_widget_show (window);

	gtk_main ();
	return(0);
}




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]