# HG changeset patch
# Node ID 49e635596b96
# Parent  dcdf8a9a686b
diff --git a/pidgin/pidginapplication.c b/pidgin/pidginapplication.c
--- a/pidgin/pidginapplication.c
+++ b/pidgin/pidginapplication.c
@@ -580,6 +580,37 @@
 };
 
 /******************************************************************************
+ * Shortcuts
+ *****************************************************************************/
+static inline void
+pidgin_application_add_shortcut(PidginApplication *application,
+                                const char *action,
+                                const char *accelerator)
+{
+	const char *accels[] = {accelerator, NULL};
+
+	gtk_application_set_accels_for_action(GTK_APPLICATION(application),
+	                                      action, accels);
+}
+
+static void
+pidgin_application_add_shortcuts(PidginApplication *application) {
+	pidgin_application_add_shortcut(application, "app.file-transfers",
+	                                "<Primary>T");
+	pidgin_application_add_shortcut(application, "app.get-user-info",
+	                                "<Primary>I");
+	pidgin_application_add_shortcut(application, "app.manage-accounts",
+	                                "<Primary>S");
+	pidgin_application_add_shortcut(application, "app.manage-plugins",
+	                                "<Primary>U");
+	pidgin_application_add_shortcut(application, "app.new-message",
+	                                "<Primary>M");
+	pidgin_application_add_shortcut(application, "app.preferences",
+	                                "<Primary>comma");
+	pidgin_application_add_shortcut(application, "app.quit", "<Primary>Q");
+}
+
+/******************************************************************************
  * Purple Signal Callbacks
  *****************************************************************************/
 static void
@@ -943,6 +974,8 @@
 	g_action_map_add_action_entries(G_ACTION_MAP(application), app_entries,
 	                                G_N_ELEMENTS(app_entries), application);
 
+	pidgin_application_add_shortcuts(application);
+
 	/* Set the default state for our actions to match our online state. */
 	online = purple_connections_is_online();
 
diff --git a/pidgin/resources/gtk/help-overlay.ui b/pidgin/resources/gtk/help-overlay.ui
new file mode 100644
--- /dev/null
+++ b/pidgin/resources/gtk/help-overlay.ui
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+Pidgin - Internet Messenger
+Copyright (C) Pidgin Developers <devel@pidgin.im>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, see <https://www.gnu.org/licenses/>.
+-->
+<interface>
+  <requires lib="gtk" version="4.0"/>
+  <!-- interface-license-type gplv2 -->
+  <!-- interface-name Pidgin -->
+  <!-- interface-description Internet Messenger -->
+  <!-- interface-copyright Pidgin Developers <devel@pidgin.im> -->
+  <object class="GtkShortcutsWindow" id="help_overlay">
+    <property name="modal">no</property>
+    <child>
+      <object class="GtkShortcutsSection">
+        <property name="section-name">shortcuts</property>
+        <property name="max-height">12</property>
+        <child>
+          <object class="GtkShortcutsGroup">
+            <property name="visible">1</property>
+            <property name="title" translatable="yes" context="shortcut window">Application Wide</property>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="action-name">app.new-message</property>
+                <property name="title" translatable="yes" context="shortcut window">Open the new message dialog</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="action-name">app.manage-accounts</property>
+                <property name="title" translatable="yes" context="shortcut window">Open the account manager</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="action-name">app.get-user-info</property>
+                <property name="title" translatable="yes" context="shortcut window">Open the get user info dialog</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="action-name">app.manage-plugins</property>
+                <property name="title" translatable="yes" context="shortcut window">Open the plugin manager</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="action-name">app.file-transfers</property>
+                <property name="title" translatable="yes" context="shortcut window">Open the file transfer manager</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="action-name">app.preferences</property>
+                <property name="title" translatable="yes" context="shortcut window">Show preferences</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="action-name">win.show-help-overlay</property>
+                <property name="title" translatable="yes" context="shortcut window">Show keyboard shortcuts</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="action-name">app.quit</property>
+                <property name="title" translatable="yes" context="shortcut window">Quit the application</property>
+                <property name="shortcut-type">accelerator</property>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/pidgin/resources/gtk/menus.ui b/pidgin/resources/gtk/menus.ui
--- a/pidgin/resources/gtk/menus.ui
+++ b/pidgin/resources/gtk/menus.ui
@@ -31,7 +31,6 @@
         <item>
           <attribute name="label" translatable="yes">New Instant _Message</attribute>
           <attribute name="action">app.new-message</attribute>
-          <attribute name="accel">&lt;Primary&gt;M</attribute>
         </item>
         <item>
           <attribute name="label" translatable="yes">Join Channel</attribute>
@@ -42,14 +41,12 @@
         <item>
           <attribute name="label" translatable="yes">Get User _Info...</attribute>
           <attribute name="action">app.get-user-info</attribute>
-          <attribute name="accel">&lt;Primary&gt;I</attribute>
         </item>
       </section>
       <section>
         <item>
           <attribute name="label" translatable="yes">_Quit</attribute>
           <attribute name="action">app.quit</attribute>
-          <attribute name="accel">&lt;Primary&gt;Q</attribute>
         </item>
       </section>
     </submenu>
@@ -61,7 +58,6 @@
         <item>
           <attribute name="label" translatable="yes">Account _Manager</attribute>
           <attribute name="action">app.manage-accounts</attribute>
-          <attribute name="accel">&lt;Primary&gt;A</attribute>
         </item>
         <submenu>
           <attribute name="label" translatable="yes">_Enable Account</attribute>
@@ -78,7 +74,6 @@
         <item>
           <attribute name="label" translatable="yes">Pr_eferences</attribute>
           <attribute name="action">app.preferences</attribute>
-          <attribute name="accel">&lt;Primary&gt;P</attribute>
         </item>
       </section>
 
@@ -86,7 +81,6 @@
         <item>
           <attribute name="label" translatable="yes">_File Transfers</attribute>
           <attribute name="action">app.file-transfers</attribute>
-          <attribute name="accel">&lt;Primary&gt;T</attribute>
         </item>
         <item>
           <attribute name="label" translatable="yes">R_oom List</attribute>
@@ -108,7 +102,6 @@
         <item>
           <attribute name="label" translatable="yes">Manage Plu_gins</attribute>
           <attribute name="action">app.manage-plugins</attribute>
-          <attribute name="accel">&lt;Primary&gt;U</attribute>
         </item>
       </section>
       <section id="plugins-menu"/>
@@ -122,6 +115,10 @@
           <attribute name="action">app.online-help</attribute>
         </item>
         <item>
+          <attribute name="label" translatable="yes">Keyboard _Shortcuts</attribute>
+          <attribute name="action">win.show-help-overlay</attribute>
+        </item>
+        <item>
           <attribute name="label" translatable="yes">_Donate</attribute>
           <attribute name="action">app.donate</attribute>
         </item>
diff --git a/pidgin/resources/pidgin.gresource.xml b/pidgin/resources/pidgin.gresource.xml
--- a/pidgin/resources/pidgin.gresource.xml
+++ b/pidgin/resources/pidgin.gresource.xml
@@ -37,6 +37,7 @@
     <file compressed="true" preprocess="xml-stripblanks">Roomlist/roomlist.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">Whiteboard/whiteboard.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">Xfer/xfer.ui</file>
+    <file compressed="true" preprocess="xml-stripblanks">gtk/help-overlay.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">gtk/menus.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">account-row.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">channeljoindialog.ui</file>
