Commit 66d98bec authored by Paolo Borelli's avatar Paolo Borelli

Add shortcuts window

parent cd4bd997
......@@ -559,6 +559,20 @@ preferences_activated (GSimpleAction *action,
gedit_show_preferences_dialog (window);
}
static void
keyboard_shortcuts_activated (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
GtkApplication *app;
GeditWindow *window;
app = GTK_APPLICATION (user_data);
window = GEDIT_WINDOW (gtk_application_get_active_window (app));
_gedit_cmd_help_keyboard_shortcuts (window);
}
static void
help_activated (GSimpleAction *action,
GVariant *parameter,
......@@ -599,6 +613,7 @@ static GActionEntry app_entries[] = {
{ "new-window", new_window_activated, NULL, NULL, NULL },
{ "new-document", new_document_activated, NULL, NULL, NULL },
{ "preferences", preferences_activated, NULL, NULL, NULL },
{ "shortcuts", keyboard_shortcuts_activated, NULL, NULL, NULL },
{ "help", help_activated, NULL, NULL, NULL },
{ "about", about_activated, NULL, NULL, NULL },
{ "quit", quit_activated, NULL, NULL, NULL }
......
......@@ -34,6 +34,37 @@
#include "gedit-app.h"
#include "gedit-dirs.h"
void
_gedit_cmd_help_keyboard_shortcuts (GeditWindow *window)
{
static GtkWidget *shortcuts_window;
gedit_debug (DEBUG_COMMANDS);
if (shortcuts_window == NULL)
{
GtkBuilder *builder;
builder = gtk_builder_new_from_resource ("/org/gnome/gedit/ui/gedit-shortcuts.ui");
shortcuts_window = GTK_WIDGET (gtk_builder_get_object (builder, "shortcuts-gedit"));
g_signal_connect (shortcuts_window,
"destroy",
G_CALLBACK (gtk_widget_destroyed),
&shortcuts_window);
g_object_unref (builder);
}
if (GTK_WINDOW (window) != gtk_window_get_transient_for (GTK_WINDOW (shortcuts_window)))
{
gtk_window_set_transient_for (GTK_WINDOW (shortcuts_window), GTK_WINDOW (window));
}
gtk_widget_show_all (shortcuts_window);
gtk_window_present (GTK_WINDOW (shortcuts_window));
}
void
_gedit_cmd_help_contents (GeditWindow *window)
{
......
......@@ -156,6 +156,7 @@ void _gedit_cmd_documents_next_tab_group (GSimpleAction *action,
GVariant *parameter,
gpointer user_data);
void _gedit_cmd_help_keyboard_shortcuts (GeditWindow *window);
void _gedit_cmd_help_contents (GeditWindow *window);
void _gedit_cmd_help_about (GeditWindow *window);
......
......@@ -17,6 +17,7 @@
<file preprocess="xml-stripblanks">ui/gedit-highlight-mode-selector.ui</file>
<file preprocess="xml-stripblanks">ui/gedit-window.ui</file>
<file preprocess="xml-stripblanks">ui/gedit-open-document-selector.ui</file>
<file preprocess="xml-stripblanks">ui/gedit-shortcuts.ui</file>
<file preprocess="xml-stripblanks">ui/gedit-statusbar.ui</file>
<file>css/gedit-style.css</file>
<file>css/gedit.adwaita.css</file>
......
......@@ -18,6 +18,10 @@
</section>
<section>
<attribute name="id">help-section</attribute>
<item>
<attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
<attribute name="action">app.shortcuts</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Help</attribute>
<attribute name="action">app.help</attribute>
......
......@@ -257,6 +257,10 @@
<attribute name="label" translatable="yes">Help</attribute>
<section>
<attribute name="id">help-section</attribute>
<item>
<attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
<attribute name="action">app.shortcuts</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Help</attribute>
<attribute name="action">app.help</attribute>
......
......@@ -108,6 +108,10 @@
</section>
<section>
<attribute name="id">help-section</attribute>
<item>
<attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
<attribute name="action">app.shortcuts</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Help</attribute>
<attribute name="action">app.help</attribute>
......
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.17 -->
<object class="GtkShortcutsWindow" id="shortcuts-gedit">
<property name="modal">1</property>
<child>
<object class="GtkShortcutsSection">
<property name="visible">1</property>
<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">Touchpad gestures</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="shortcut-type">gesture-two-finger-swipe-right</property>
<property name="title" translatable="yes">Switch to the next document</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="shortcut-type">gesture-two-finger-swipe-left</property>
<property name="title" translatable="yes">Switch to the previous document</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="title" translatable="yes">Documents</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;N</property>
<property name="title" translatable="yes">Create new document</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;O</property>
<property name="title" translatable="yes">Open a document</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;S</property>
<property name="title" translatable="yes">Save the document</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;W</property>
<property name="title" translatable="yes">Close the document</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;&lt;Alt&gt;Page_Down</property>
<property name="title" translatable="yes">Switch to the next document</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;&lt;Alt&gt;Page_Up</property>
<property name="title" translatable="yes">Switch to the previous document</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="title" translatable="yes">Find and Replace</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;F</property>
<property name="title" translatable="yes">Find</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;G</property>
<property name="title" translatable="yes">Find the next match</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;&lt;Shift&gt;G</property>
<property name="title" translatable="yes">Find the previous match</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;H</property>
<property name="title" translatable="yes">Find and Replace</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;&lt;Shift&gt;K</property>
<property name="title" translatable="yes">Clear highlight</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;I</property>
<property name="title" translatable="yes">Go to line</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="title" translatable="yes">Tools</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;shift&gt;F7</property>
<property name="title" translatable="yes">Check spelling</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="title" translatable="yes">Miscellaneous</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">F11</property>
<property name="title" translatable="yes">Fullscreen on / off</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;P</property>
<property name="title" translatable="yes">Print the document</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">Insert</property>
<property name="title" translatable="yes">Toggle insert / overwrite</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</interface>
......@@ -50,6 +50,7 @@ gedit/gedit-window.c
[type: gettext/glade]gedit/resources/ui/gedit-print-preferences.ui
[type: gettext/glade]gedit/resources/ui/gedit-print-preview.ui
[type: gettext/glade]gedit/resources/ui/gedit-replace-dialog.ui
[type: gettext/glade]gedit/resources/ui/gedit-shortcuts.ui
[type: gettext/glade]gedit/resources/ui/gedit-tab-label.ui
[type: gettext/glade]gedit/resources/ui/gedit-window.ui
plugins/checkupdate/checkupdate.plugin.desktop.in
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment