1 /* ide-application-shortcuts.c
2  *
3  * Copyright 2017 Sebastien Lafargue <slafargue@gnome.org>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  *
18  * SPDX-License-Identifier: GPL-3.0-or-later
19  */
20 
21 #define G_LOG_DOMAIN "ide-application-shortcuts"
22 
23 #include "config.h"
24 
25 #include <glib/gi18n.h>
26 #include <dazzle.h>
27 
28 #include "ide-application-private.h"
29 
30 #define I_(s) (g_intern_static_string(s))
31 
32 void
_ide_application_init_shortcuts(IdeApplication * self)33 _ide_application_init_shortcuts (IdeApplication *self)
34 {
35   DzlShortcutManager *manager;
36   DzlShortcutTheme *theme;
37 
38   g_assert (IDE_IS_APPLICATION (self));
39 
40   manager = dzl_application_get_shortcut_manager (DZL_APPLICATION (self));
41   theme = dzl_shortcut_manager_get_theme_by_name (manager, "internal");
42 
43   dzl_shortcut_manager_add_action (manager,
44                                    I_("app.help"),
45                                    N_("Workbench shortcuts"),
46                                    N_("Help"),
47                                    N_("Show the help window"),
48                                    NULL);
49   dzl_shortcut_theme_set_accel_for_action (theme,
50                                            "app.help",
51                                            "F1",
52                                            DZL_SHORTCUT_PHASE_GLOBAL);
53 
54   dzl_shortcut_manager_add_action (manager,
55                                    I_("app.preferences"),
56                                    N_("Workbench shortcuts"),
57                                    N_("Preferences"),
58                                    N_("Show the preferences window"),
59                                    NULL);
60   dzl_shortcut_theme_set_accel_for_action (theme,
61                                            "app.preferences",
62                                            "<Primary>comma",
63                                            DZL_SHORTCUT_PHASE_GLOBAL);
64 
65   dzl_shortcut_manager_add_action (manager,
66                                    I_("app.shortcuts"),
67                                    N_("Workbench shortcuts"),
68                                    N_("Help"),
69                                    N_("Show the shortcuts window"),
70                                    NULL);
71   dzl_shortcut_theme_set_accel_for_action (theme,
72                                            "app.shortcuts",
73                                            "<Primary>question",
74                                            DZL_SHORTCUT_PHASE_GLOBAL);
75   dzl_shortcut_theme_set_accel_for_action (theme,
76                                            "app.quit",
77                                            "<Primary>q",
78                                            DZL_SHORTCUT_PHASE_GLOBAL);
79 }
80