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 394153 - Accelerator keys for files in Documents menu (0-9)
Accelerator keys for files in Documents menu (0-9)
Status: RESOLVED OBSOLETE
Product: gedit
Classification: Applications
Component: general
git master
Other All
: Normal enhancement
: ---
Assigned To: Gedit maintainers
Gedit maintainers
Depends on:
Blocks:
 
 
Reported: 2007-01-08 06:56 UTC by Paul Wayper
Modified: 2015-01-02 10:07 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement



Description Paul Wayper 2007-01-08 06:56:20 UTC
The Documents menu gives you a list of files that you have open in the current window.  The first ten have the tooltip alt-1 through alt-9 and alt-0; it also makes sense for these numerals to be used to select the documents in the menu.

I checked out the CVS head and added the following code:

diff -r1.47 gedit-window.c
1605a1606,1612
>         /* Put a 0..9 as a shortcut key before the first ten items */
>         if (i < 10) {
>             g_string_prepend(
>                 name,
>                 g_strdup_printf("_%d: ", ((i + 1) % 10))
>             );
>         }

Unfortunately, my system (FC6) doesn't have the latest intltool, so I haven't bene able to finish running autogen.sh and compiling my copy of Gedit.  Therefore I don't know if the above code works or not.  Please be nice to me, this is my first ever patch to any GNOME program ever!

Hope this helps,

Paul
Comment 1 Paul Wayper 2007-01-09 23:40:37 UTC
That patch in -u format:

diff -u -r1.47 gedit-window.c
--- gedit-window.c      10 Dec 2006 17:31:47 -0000      1.47
+++ gedit-window.c      9 Jan 2007 05:19:09 -0000
@@ -1603,6 +1603,13 @@
                action_name = g_strdup_printf ("Tab_%d", i);
                tab_name = _gedit_tab_get_name (GEDIT_TAB (tab));
                name = gedit_utils_escape_underscores (tab_name, -1);
+        /* Put a 0..9 as a shortcut key before the first ten items */
+        if (i < 10) {
+            g_string_prepend(
+                name,
+                g_strdup_printf("_%d: ", ((i + 1) % 10))
+            );
+        }
                tip =  get_menu_tip_for_tab (GEDIT_TAB (tab));

                /* alt + 1, 2, 3... 0 to switch to the first ten tabs */

HTH,

Paul
Comment 2 Paolo Maggi 2007-01-10 09:38:49 UTC
Thanks for the patch.

I'm not sure adding a number before the first 10 documents in the Documents menu is a good idea since you will get something like:

1. Name
2. Name
...
0. Name
Name
Nanme

And so the menu items will not be aligned.
May be we could see if it possible to enable the 0-9 accellerator without showing it in the menu.
Comment 3 Paul Wayper 2007-01-28 02:10:47 UTC
My thought for long menus was to then start from 'a' and work down.  Anyone with more than 36 documents open in the one window has problems that this patch can't address :-)  However, that idea broke the similarity between pressing <ALT>-D 1 and <ALT>-1 to get document number 1.  This was what I was really after.

IMO there's no point in enabling the accelerator without showing the user that that's what they can press.
Comment 4 Robert Roth 2015-01-01 16:48:56 UTC
What's your opinion on this in the light of the latest gEdit changes? gEdit doesn't have a documents menu anymore, but rather a search for the recent files, which I find a lot more powerful than having simple shortcuts for the first 10 documents. Maybe it's time to mark this as obsolete.