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



commit a8ab25c16fe9cfdc96e6da411dba43e524255a8b
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

 src/terminal-window.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
---
diff --git a/src/terminal-window.c b/src/terminal-window.c
index 1d877a98..19198f49 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -1880,6 +1880,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]