2011/4/20 Tristan Van Berkom <t...@gnome.org>

> On Wed, Apr 20, 2011 at 8:34 AM, Bernhard Schuster
> <schuster.bernh...@googlemail.com> wrote:
> > Hi I am trying to achieve the effect of new tab openening if one tab gets
> > selected. Unfortunaltly the doc is very sparse on that:
> > http://developer.gnome.org/gtk/stable/GtkNotebook.html as of using the
> > "select-page" signal. Can anyone give me a hint how to use it properly
> with
> > a g_signal_connect function?
> >
> > Note: I am still in a learning phase so please be patient with me :)
> >
> > What I tried so far:
> >
> > gboolean
> > derived_notebook_insert_page (DerivedNotebook *obj, gboolean b, gpointer
> > data)
> > {
> > // do page insert
> > }
> >
> > and within foo_derived_notebook_init: g_signal_connect (obj,
> "select-page",
> > G_CALLBACK (derived_notebook_insert_page), NULL);
> >
> > If anybody could shed some light of what the return value is for, and how
> to
> > achiev what I want, thanks very much
>
> Hi,
>  First of all if you are deriving the notebook, you should not connect a
> signal handler but instead override the class vfunc (in this case would
> be GtkNotebookClass->select_page).
>
> Also, "select-page" is generally a keybinding signal used to move
> focus (it's used when one of the tabs have keyboard focus and
> spacebar is pressed to make that tab's page the current page,
> the return value I believe is whether the notebook keeps focus or
> not).
>
> Probably you want to use the "switch-page" vfunc which will be
> called to do the work of actually changing the current page (whether
> it's done by code or by user interaction, so you might have to
> be careful to avoid recursion here).
>
> Also, I have a hard time imagining how it would be desirable
> to open a new tab as a result of selecting a different tab (maybe
> some more context here would let us give you better advice).
>

Texteditor, where the last tab head is just a plus and the tab content is
never expected to be visible. The tab head is GtkImage showing
GTK_STOCK_ADD. On click its expected to spawn a new tab let of the "special"
one and gets focused instantly.

Thanks for your tipp!

B.
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to