Re: C/GTK - Packing GtkImage inside GtkEventBox loses reference



On Fri, Nov 18, 2005 at 03:56:52PM -0200, Marcus Reis wrote:

g_signal_connect (G_OBJECT (event_box), 
                      "button_press_event",
                      G_CALLBACK (movimento_do_jogador),
                      image);

...

static void movimento_do_jogador(GtkWidget *widget, GtkWidget *image)

This is a wrong prototype for a "button-press-event"
callback, see

  http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html#GtkWidget-button-press-event

The callback gets the event as its second argument (which
you try to use it as a widget).

I would also add it's probably not the best idea to load the
image from file every time it changes; simply loading the
images to three pixbufs and using gtk_image_set_from_pixbuf()
would be a considerable improvement.

Yeti


--
That's enough.



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