GNOME Bugzilla – Bug 632150
link-button: Add ::link-activated signal
Last modified: 2010-10-15 09:59:50 UTC
We cannot use GtkButton::clicked to override the default behavior of GtkLinkButton, since ::clicked is a G_SIGNAL_RUN_FIRST. One strategy decided on IRC was to add a new signal to GtkLinkButton; the new signal would be emitted by the ::clicked default handler and be the responsible of calling gtk_show_uri(). Blocking the default behavior is done using the standard boolean marshaller also used by the event-related signals.
Created attachment 172356 [details] [review] link-button: Add ::link-activated signal We cannot use the GtkButton::clicked signal to override the default behavior of GtkLinkButton (i.e. call gtk_show_uri()), because GtkButton::clicked is registered as a RUN_FIRST signal, which obviously prevents any other signal handler connected to it to stop the propagation before the class handler has a chance to run. For this reason we can add a GtkLinkButton::link-activated signal, which will be emitted by the default GtkButton::clicked signal handler; the ::link-activated signal has a boolean return value, which allows simpler code for stopping the propagation to the next signal handler.
Review of attachment 172356 [details] [review]: We have GtkLabel::activate-link and GtkAboutDialog::activate-link. It would be better to name this the same, I think
Created attachment 172383 [details] [review] link-button: Add ::link-activated signal We cannot use the GtkButton::clicked signal to override the default behavior of GtkLinkButton (i.e. call gtk_show_uri()), because GtkButton::clicked is registered as a RUN_FIRST signal, which obviously prevents any other signal handler connected to it to stop the propagation before the class handler has a chance to run. For this reason we can add a GtkLinkButton::link-activated signal, which will be emitted by the default GtkButton::clicked signal handler; the ::link-activated signal has a boolean return value, which allows simpler code for stopping the propagation to the next signal handler.
Created attachment 172384 [details] [review] link-button: Add ::activate-link signal We cannot use the GtkButton::clicked signal to override the default behavior of GtkLinkButton (i.e. call gtk_show_uri()), because GtkButton::clicked is registered as a RUN_FIRST signal, which obviously prevents any other signal handler connected to it to stop the propagation before the class handler has a chance to run. For this reason we can add a GtkLinkButton::activate-link signal, which will be emitted by the default GtkButton::clicked signal handler; the ::activate-link signal has a boolean return value, which allows simpler code for stopping the propagation to the next signal handler.
The docs talk about ::link-button in one place: + * The ::link-button signal is emitted each time the #GtkLinkButton + * has been clicked. Other than that, looks fine to me.
Created attachment 172391 [details] [review] link-button: Add ::activate-link signal We cannot use the GtkButton::clicked signal to override the default behavior of GtkLinkButton (i.e. call gtk_show_uri()), because GtkButton::clicked is registered as a RUN_FIRST signal, which obviously prevents any other signal handler connected to it to stop the propagation before the class handler has a chance to run. For this reason we can add a GtkLinkButton::activate-link signal, which will be emitted by the default GtkButton::clicked signal handler; the ::activate-link signal has a boolean return value, which allows simpler code for stopping the propagation to the next signal handler.
Review of attachment 172391 [details] [review]: Looks good
Attachment 172391 [details] pushed to master