diff options
author | Egmont Koblinger <egmont@gmail.com> | 2019-03-26 11:46:40 +0100 |
---|---|---|
committer | Egmont Koblinger <egmont@gmail.com> | 2019-04-08 14:03:10 +0200 |
commit | f4e1576d0d819e55277a6e2d3b27466ac24f29d3 (patch) | |
tree | c412af308d9e51586495ecce0a2774e5d6192015 | |
parent | f4ad540da1b3c28698e14d3d1b4ae669c7fae73b (diff) | |
download | gnome-terminal-f4e1576d0d819e55277a6e2d3b27466ac24f29d3.tar.gz |
window: Show last tab's accel in the tab menu
https://gitlab.gnome.org/GNOME/gnome-terminal/issues/94
(cherry picked from commit a8ab25c16fe9cfdc96e6da411dba43e524255a8b)
-rw-r--r-- | src/terminal-window.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/terminal-window.c b/src/terminal-window.c index 0ff7844b..d2ae3ea6 100644 --- a/src/terminal-window.c +++ b/src/terminal-window.c @@ -1869,6 +1869,16 @@ notebook_update_tabs_menu_cb (GtkMenuButton *button, gs_unref_object GMenuItem *item; const char *title; + if (t->next == NULL) { + /* Last entry. If it has no dedicated shortcut "Switch to Tab N", + * display the accel of "Switch to Last Tab". */ + GtkApplication *app = GTK_APPLICATION (g_application_get_default ()); + gs_free gchar *detailed_action = g_strdup_printf("win.active-tab(%d)", i); + gs_strfreev gchar **accels = gtk_application_get_accels_for_action (app, detailed_action); + if (accels[0] == NULL) + i = -1; + } + title = terminal_screen_get_title (screen); item = g_menu_item_new (title && title[0] ? title : _("Terminal"), NULL); |