Re: Gtk2::Notebook and switch-page signal

On Jan 27, 2011, at 3:26 AM, Kiss Gabor (Bitman) wrote:

What exactly are you trying to do? If you want to switch to a page you
should use $notebook->set_current_page ($page_num).

The page is already selected that is not a problem.
However I want to trigger the signal handler function.
I thought I don't call it directly.

I checked: set_current_page() does not emit switch-page signal
if page is already selected. I should have switch to another
page then back. I'm afraid this should be avoided.

Anyway the original question is: could somebody explain what
gpointer mean in "switch-page(Gtk2::Notebook, gpointer, Glib::UInt)"? :-)

Long ago when gtk+ was new, many signal arguments were made a void* type because in C you can just cast the 
pointer to what it's supposed to be.  This was problematic for bindings, but only when people actually tried 
to use that functionailty, so many of them were overlooked.

For this signal, in git master, the gpointer argument is now a proper GTK_TYPE_WIDGET representing the new 
selected child, suggesting someone attempted to fix this.

You may be able to get a usable thing by doing

    $child = Glib::Object->new_from_pointer ($the_gpointer_value);

if you really want to try using it.  However, if it breaks, you get the keep the pieces.

One problem with the signal documentation is that we get the signal signatures by asking the library at 
runtime for the types of the parameters.  This information doesn't include parameter names, and doesn't 
explain which signals are private and which are public.  Many of the very old things in gtk+ have signals 
when they actually just wanted virtual functions, so they're not always intended for application usage.

Yvonne: Let's do that one again so i can win.
Zella: No.

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