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 131177 - Accelerators only work for actions which have menu entries
Accelerators only work for actions which have menu entries
Status: RESOLVED WONTFIX
Product: gtk+
Classification: Platform
Component: Class: UIManager / Actions
unspecified
Other Linux
: Normal normal
: Small API
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2004-01-11 20:37 UTC by Jon Kåre Hellan
Modified: 2014-08-30 05:00 UTC
See Also:
GNOME target: ---
GNOME version: 2.9/2.10


Attachments
Test program (3.21 KB, text/plain)
2004-01-11 20:38 UTC, Jon Kåre Hellan
  Details
Test for toggle tool items (3.18 KB, text/plain)
2007-08-31 19:33 UTC, Stefan Sauer (gstreamer, gtkdoc dev)
  Details
updated test for toggle tool items (7.36 KB, text/plain)
2007-09-02 17:03 UTC, Stefan Sauer (gstreamer, gtkdoc dev)
  Details
toggle the toggle button when pressing the accelerator (4.96 KB, patch)
2007-09-02 17:07 UTC, Stefan Sauer (gstreamer, gtkdoc dev)
rejected Details | Review

Description Jon Kåre Hellan 2004-01-11 20:37:10 UTC
Accelerators only work for actions which have menu entries.

See the attached test program. There are toolbar entries for bold and italic.
Bold and italic both have accelerators. There's a menu command for bold,
but not for italic. bold can be toggled through its accelerator, italic cannot.
Comment 1 Jon Kåre Hellan 2004-01-11 20:38:25 UTC
Created attachment 23240 [details]
Test program
Comment 2 Jon Kåre Hellan 2004-01-11 21:00:12 UTC
This is with CVS HEAD
Comment 3 Jon Kåre Hellan 2004-01-11 21:24:47 UTC
Error Between Chair And Keyboard.

This works if I add <accelerator name="italic" action="italic">.
Comment 4 Jon Kåre Hellan 2004-01-12 14:48:26 UTC
Hmm. On further reflection, I think this is a bug. Does it ever make
sense to display a toolbar button with an accelerator, but not enable
the accelerator?
Comment 5 Matthias Clasen 2004-01-12 15:42:33 UTC
The toolbar button doesn't "have" an accelerator, at least it doesn't 
give any visual hints about it. I believe that is the rationale for 
not enabling accelerators on actions whose only proxies are toolitems.


But then, toolitem-only actions are kind of broken anyway. The idea of 
a toolbar is to give quick access to a small number of important menu 
items, isn't it ? Office applications have certainly perverted that 
idea...
Comment 6 Jon Kåre Hellan 2004-01-12 18:34:24 UTC
Take the "Bold" example. Gnumeric has no menu command for bold, you can
use the toolbar button, the accelerator or the format dialog, which
*is* available from the menus. I hardly think that's perverting the idea.

Comment 7 Stefan Sauer (gstreamer, gtkdoc dev) 2007-08-31 19:33:02 UTC
Created attachment 94727 [details]
Test for toggle tool items

I don't know if its the same issue. The attached test programm creatas a toolbar with two toolitems - a play toggle button and a stop button. I've tried various ways to add accelerators.

First I hit a gtkbug when trying to use an accel-path (it asserts). This is bad as I would like to make the accelerators changable and that requires this method.

Second issue is that the accelerator seems to only invoke the closure but not the action on the widget. For a normal button its fine, but for the toggle button it fails, as the button does not get toggled.

In the test programm, using the buttons with the mouse works. Using play with the mouse and stop with accelerator works, but triggering play with accelrator fails.
Comment 8 Stefan Sauer (gstreamer, gtkdoc dev) 2007-09-02 15:08:37 UTC
more details:

pressing accelerator:
Gtk-Message: GtkToggleToolButton::clicked : 0,0

klicking the button:
Gtk-Message: GtkToggleButton::clicked : 0
Gtk-Message: GtkToggleToolButton::toggled : 0,1
Gtk-Message: GtkToggleToolButton::clicked : 1,1

the value is the ->active field. for toogl_tool_button is the one of itself and the child. That means the accelerator is triggering the click on the button itself and this is not synced wit the child. A real click would trigger the click on the child and sync the tool_button.
Comment 9 Stefan Sauer (gstreamer, gtkdoc dev) 2007-09-02 17:03:41 UTC
Created attachment 94814 [details]
updated test for toggle tool items
Comment 10 Stefan Sauer (gstreamer, gtkdoc dev) 2007-09-02 17:07:24 UTC
Created attachment 94815 [details] [review]
toggle the toggle button when pressing the accelerator

This is a preliminary patch, that also add some g_message() to be see whats going on. If what the patch does sounds acceptable, I will apply the following changes before ommiting:
* remove g_message()
* cache signal_id for gtktoggletoolbutton::button_clicked() and use that for block/unblock()
Comment 11 Owen Taylor 2007-09-10 17:48:38 UTC
Comment on attachment 94815 [details] [review]
toggle the toggle button when pressing the accelerator

Blocking signals like this is almost never a good thing to do. I think it would be better to add a separate ::activate signal.
Comment 12 Matthias Clasen 2014-08-30 05:00:04 UTC
GtkAction has been deprecated