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

Re: Help With Adding A New Tab to 'notebook1'




Jason Dempsey schrieb:

> Ok i've tryed many things. But i keep getting parse errors when i try
> something like:
>
> void
> on_button1_clicked                     (GtkButton       *button,
>                                         gpointer         user_data)
> {
> void
> gtk_notebook_insert_page (GtkNotebook *notebook,
>                                           GtkNotebook *child,
>                                           GtkNotebook *tab_label,
>                                                   ginit 1);
> }
>
> and i just can't seem 2 get it to work. Can anyone help me with this?
>
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

This can't work.

This looks like a function definition, not like function call

1.)Send your parent notebook object with the signal:

g_signal_connect (button, "clicked", on_button1_clicked, parent_object);

Then use something like this in your callback:

void
on_button1_clicked                     (GtkButton       *button,
                                        gpointer         user_data)
{
    do_something_funny (DO_SOMETHING(user_data), TRUE);
}

2.) An other alternativ:

In the main part do somethin like this:
g_object_set_data (G_OBJECT(button), "parent_object", parent_object);

and in your callback

DoSomething *parent_object = g_object_get_data (G_OBJECT(button),
"parent_object");

I prefer solution 1 but if you need more data for your callback and you
don't want to create an struct method 2 can be very useful

Bye David




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