Tue, 02 Jan 2024 00:33:16 -0600
Make the application wide shortcuts work again
This only fixes the menu shortcuts but is a start point for moving many things
to the action based shortcuts.
Testing Done:
Ran the program and verified the shortcuts worked.
Reviewed at https://reviews.imfreedom.org/r/2906/
--- a/pidgin/pidginapplication.c Sun Dec 31 23:24:05 2023 -0600 +++ b/pidgin/pidginapplication.c Tue Jan 02 00:33:16 2024 -0600 @@ -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();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pidgin/resources/gtk/help-overlay.ui Tue Jan 02 00:33:16 2024 -0600 @@ -0,0 +1,88 @@ +<?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="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> + </object> + </child> + </object> + </child> + </object> + </child> + </object> +</interface>
--- a/pidgin/resources/gtk/menus.ui Sun Dec 31 23:24:05 2023 -0600 +++ b/pidgin/resources/gtk/menus.ui Tue Jan 02 00:33:16 2024 -0600 @@ -31,7 +31,6 @@ <item> <attribute name="label" translatable="yes">New Instant _Message</attribute> <attribute name="action">app.new-message</attribute> - <attribute name="accel"><Primary>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"><Primary>I</attribute> </item> </section> <section> <item> <attribute name="label" translatable="yes">_Quit</attribute> <attribute name="action">app.quit</attribute> - <attribute name="accel"><Primary>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"><Primary>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"><Primary>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"><Primary>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"><Primary>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>
--- a/pidgin/resources/pidgin.gresource.xml Sun Dec 31 23:24:05 2023 -0600 +++ b/pidgin/resources/pidgin.gresource.xml Tue Jan 02 00:33:16 2024 -0600 @@ -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>