Re: g_signal_connect
- From: Carlos Pereira <jose carlos pereira ist utl pt>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: g_signal_connect
- Date: Sun, 15 Jun 2008 20:55:55 +0100
Brian J. Tarricone wrote:
On Sun, 15 Jun 2008 19:40:22 +0100 Carlos Pereira wrote:
For the sake of elegance, which version people like more?
1) g_signal_connect (widget, "signal",
G_CALLBACK (callback), data);
I think this was the "intended" use -- the first param is of type
gpointer so you don't have to use a cast macro like in #2.
Most code (but not all) in gtk-demo uses this version...
2) g_signal_connect (G_OBJECT (widget), "signal",
G_CALLBACK (callback), data);
... but out of (probably stupid) habit, I tend to use this one most of
the time...
but most of the code in the examples directory, come with the G_OBJECT
cast...
3) g_signal_connect (GTK_OBJECT (widget), "signal",
G_CALLBACK (callback), data);
Definitely not this one... *waves arms* GtkObject doesn't exist! *waves
arms*
Excellent, one less to choose from... I am coming from GTK 1, that's
why... ;-)
It's interesting anyway, that compiling with
-DG_DISABLE_DEPRECATED \
-DGDK_DISABLE_DEPRECATED \
-DGDK_PIXBUF_DISABLE_DEPRECATED \
-DGTK_DISABLE_DEPRECATED
activated, no warning is reported, and the signal works just fine,
that's why I didn't notice that this was a no no....
Anyway, GtkObject still exists (I supose mostly because of GtkAdjustment
and other old structures?):
<http://library.gnome.org/devel/gtk/stable/GtkAdjustment.html>
http://library.gnome.org/devel/gtk/stable/GtkObject.html
pkg-config --modversion gtk+-2.0:
Gtk 2.12.8
Thanks a lot,
Carlos
-brian
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]