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 373279 - Toggling a GtkToggleButton emits "clicked", not "toggled"
Toggling a GtkToggleButton emits "clicked", not "toggled"
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Documentation
2.10.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2006-11-10 07:01 UTC by Lars Clausen
Modified: 2012-08-14 11:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
document clicked signal and fix example (1.93 KB, patch)
2012-02-20 11:42 UTC, David King
rejected Details | Review
clarify action signals (981 bytes, patch)
2012-05-04 02:28 UTC, David King
committed Details | Review

Description Lars Clausen 2006-11-10 07:01:19 UTC
The docs claim that calling gtk_toggle_button_set_active() causes a "toggled" event, while the "clicked" event defined on GtkButton is only caused by the button being pressed and released.  In reality, gtk_toggle_button_set_active() does emit a "clicked" event:

  • #5 g_signal_emit
    from /opt/gnome/lib/libgobject-2.0.so.0
  • #6 gtk_button_clicked
    from /opt/gnome/lib/libgtk-x11-2.0.so.0
  • #7 gtk_toggle_button_set_active
    from /opt/gnome/lib/libgtk-x11-2.0.so.0

The explanation is at best rather misleading.  Also, this means (AFAICT) that there is no nice way to programmatically toggle a button without getting an event for it -- I was hoping "clicked" would allow me that.
Comment 1 David King 2012-02-20 11:42:15 UTC
Created attachment 208034 [details] [review]
document clicked signal and fix example

I chatted to Ryan about this, and he said that it was not possible to change the behaviour without breaking API, so both the clicked and the toggled signals are emitted by gtk_toggle_button_set_active(). I added some extra markup so that the toggled signal is linked in the description, and added that the clicked signal is emitted, making this a bit more obvious. Additionally, I fixed the example code.
Comment 2 Allison Karlitskaya (desrt) 2012-05-03 22:57:38 UTC
Review of attachment 208034 [details] [review]:

There appears to be some unrelated things tucked into this patch.  The docs part looks good, though.
Comment 3 David King 2012-05-04 02:28:14 UTC
Created attachment 213431 [details] [review]
clarify action signals
Comment 4 David King 2012-08-14 11:44:58 UTC
Comment on attachment 213431 [details] [review]
clarify action signals

Pushed to master as commit 9d11da702b6ead8027456a107b879499ba84fcd9.