After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 632150 - link-button: Add ::link-activated signal
link-button: Add ::link-activated signal
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2010-10-14 14:26 UTC by Emmanuele Bassi (:ebassi)
Modified: 2010-10-15 09:59 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
link-button: Add ::link-activated signal (6.16 KB, patch)
2010-10-14 14:26 UTC, Emmanuele Bassi (:ebassi)
reviewed Details | Review
link-button: Add ::link-activated signal (6.15 KB, patch)
2010-10-14 18:54 UTC, Emmanuele Bassi (:ebassi)
none Details | Review
link-button: Add ::activate-link signal (6.15 KB, patch)
2010-10-14 18:55 UTC, Emmanuele Bassi (:ebassi)
none Details | Review
link-button: Add ::activate-link signal (6.15 KB, patch)
2010-10-14 20:44 UTC, Emmanuele Bassi (:ebassi)
committed Details | Review

Description Emmanuele Bassi (:ebassi) 2010-10-14 14:26:54 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.
Comment 1 Emmanuele Bassi (:ebassi) 2010-10-14 14:26:56 UTC
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.
Comment 2 Matthias Clasen 2010-10-14 18:11:35 UTC
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
Comment 3 Emmanuele Bassi (:ebassi) 2010-10-14 18:54:14 UTC
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.
Comment 4 Emmanuele Bassi (:ebassi) 2010-10-14 18:55:18 UTC
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.
Comment 5 Matthias Clasen 2010-10-14 19:21:36 UTC
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.
Comment 6 Emmanuele Bassi (:ebassi) 2010-10-14 20:44:23 UTC
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.
Comment 7 Matthias Clasen 2010-10-15 03:24:33 UTC
Review of attachment 172391 [details] [review]:

Looks good
Comment 8 Emmanuele Bassi (:ebassi) 2010-10-15 09:59:44 UTC
Attachment 172391 [details] pushed to master