[gnome-terminal/gnome-3-28] window: Show last tab's accel in the tab menu



commit f4e1576d0d819e55277a6e2d3b27466ac24f29d3
Author: Egmont Koblinger <egmont gmail com>
Date:   Tue Mar 26 11:46:40 2019 +0100

    window: Show last tab's accel in the tab menu
    
    https://gitlab.gnome.org/GNOME/gnome-terminal/issues/94
    (cherry picked from commit a8ab25c16fe9cfdc96e6da411dba43e524255a8b)

 src/terminal-window.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
---
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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]