Re: gtk-demo
- From: Owen Taylor <otaylor redhat com>
- To: Sven Neumann <sven gimp org>
- Cc: "Padraig O'Briain" <Padraig Obriain Sun COM>, gtk-devel-list gnome org
- Subject: Re: gtk-demo
- Date: 20 Aug 2001 10:23:39 -0400
Sven Neumann <sven gimp org> writes:
> Hi,
>
> "Padraig O'Briain" <Padraig Obriain Sun COM> writes:
>
> > + changed_id = g_signal_connect (G_OBJECT (buffer),
> > + "changed",
> > + G_CALLBACK (update_statusbar),
> > + statusbar);
> > +
> > + mark_set_id = g_signal_connect (G_OBJECT (buffer),
> > + "mark_set", /* cursor moved */
> > + G_CALLBACK (mark_set_callback),
> > + statusbar);
>
> I'd suggest using g_signal_connect_object() here so the signal handlers
> are automatically removed when the statusbar is disposed. It's much
> shorter and conceptually cleaner than removing the signal handlers in
> a destroy signal handler. Especially since noone assures you that
> "destroy" is only emitted once.
But when ::destroy is emitted, all signal handlers are removed,
so you are assured that you won't get to emissions of ::destroy
from a single connection.
Nothing wrong with using connect_object(), however.
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]