[gtranslator] Shortcuts window
- From: Daniel Garcia Moreno <danigm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtranslator] Shortcuts window
- Date: Thu, 20 Sep 2018 09:08:32 +0000 (UTC)
commit 690a708e8f9f5a577dd5d7eec2de8521c7ee6fab
Author: Daniel GarcĂa Moreno <danigm wadobo com>
Date: Thu Sep 20 11:08:12 2018 +0200
Shortcuts window
src/gtr-application.c | 35 +++++++++++
src/gtr-notebook.ui | 4 +-
src/gtr-projects.ui | 4 +-
src/gtranslator.gresource.xml | 1 +
src/help-overlay.ui | 141 ++++++++++++++++++++++++++++++++++++++++++
5 files changed, 181 insertions(+), 4 deletions(-)
---
diff --git a/src/gtr-application.c b/src/gtr-application.c
index 29017ef6..02e2ecd5 100644
--- a/src/gtr-application.c
+++ b/src/gtr-application.c
@@ -237,6 +237,40 @@ preferences_activated (GSimpleAction *action,
gtr_show_preferences_dialog (priv->active_window);
}
+static void
+shortcuts_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ GtrApplication *app = GTR_APPLICATION (user_data);
+ GtrApplicationPrivate *priv = gtr_application_get_instance_private (app);
+ static GtkWidget *shortcuts_window;
+ GtkWindow *window = GTK_WINDOW (priv->active_window);
+
+ if (shortcuts_window == NULL)
+ {
+ GtkBuilder *builder;
+
+ builder = gtk_builder_new_from_resource ("/org/gnome/translator/help-overlay.ui");
+ shortcuts_window = GTK_WIDGET (gtk_builder_get_object (builder, "help_overlay"));
+
+ g_signal_connect (shortcuts_window,
+ "destroy",
+ G_CALLBACK (gtk_widget_destroyed),
+ &shortcuts_window);
+
+ g_object_unref (builder);
+ }
+
+ if (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));
+}
+
static void
help_activated (GSimpleAction *action,
GVariant *parameter,
@@ -429,6 +463,7 @@ static GActionEntry app_entries[] = {
{ "new_window", new_window_activated, NULL, NULL, NULL },
{ "preferences", preferences_activated, NULL, NULL, NULL },
+ { "shortcuts", shortcuts_activated, NULL, NULL, NULL },
{ "help", help_activated, NULL, NULL, NULL },
{ "about", about_activated, NULL, NULL, NULL },
{ "quit", quit_activated, NULL, NULL, NULL }
diff --git a/src/gtr-notebook.ui b/src/gtr-notebook.ui
index 115cca16..36359735 100644
--- a/src/gtr-notebook.ui
+++ b/src/gtr-notebook.ui
@@ -90,8 +90,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="action_name">app.keybinding</property>
- <property name="text" translatable="yes">Keybindings</property>
+ <property name="action_name">app.shortcuts</property>
+ <property name="text" translatable="yes">Keyboard Shortcuts</property>
</object>
<packing>
<property name="expand">False</property>
diff --git a/src/gtr-projects.ui b/src/gtr-projects.ui
index f1d8c407..98d984cb 100644
--- a/src/gtr-projects.ui
+++ b/src/gtr-projects.ui
@@ -146,8 +146,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="action_name">app.keybinding</property>
- <property name="text" translatable="yes">Keybindings</property>
+ <property name="action_name">app.shortcuts</property>
+ <property name="text" translatable="yes">Keyboard Shortcuts</property>
</object>
<packing>
<property name="expand">False</property>
diff --git a/src/gtranslator.gresource.xml b/src/gtranslator.gresource.xml
index c9189e11..bf790226 100644
--- a/src/gtranslator.gresource.xml
+++ b/src/gtranslator.gresource.xml
@@ -17,5 +17,6 @@
<file preprocess="xml-stripblanks">gtr-tab.ui</file>
<file preprocess="xml-stripblanks">gtr-window.ui</file>
<file preprocess="xml-stripblanks">gtr-projects.ui</file>
+ <file preprocess="xml-stripblanks">help-overlay.ui</file>
</gresource>
</gresources>
diff --git a/src/help-overlay.ui b/src/help-overlay.ui
new file mode 100644
index 00000000..39e8e38e
--- /dev/null
+++ b/src/help-overlay.ui
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <object class="GtkShortcutsWindow" id="help_overlay">
+ <property name="modal">true</property>
+ <child>
+ <object class="GtkShortcutsSection">
+ <property name="visible">true</property>
+ <property name="section-name">shortcuts</property>
+ <property name="max-height">10</property>
+ <child>
+ <object class="GtkShortcutsGroup">
+ <property name="visible">true</property>
+ <property name="title" translatable="yes" context="shortcut window group">General</property>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">true</property>
+ <property name="accelerator"><Primary>o</property>
+ <property name="title" translatable="yes" context="shortcut window">Open file</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">true</property>
+ <property name="accelerator"><Primary>s</property>
+ <property name="title" translatable="yes" context="shortcut window">Save the current
file</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">true</property>
+ <property name="accelerator"><Primary><Shift>s</property>
+ <property name="title" translatable="yes" context="shortcut window">Save the current file
as</property>
+ </object>
+ </child>
+
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">true</property>
+ <property name="accelerator"><Primary>p</property>
+ <property name="title" translatable="yes" context="shortcut window">Preferences</property>
+ </object>
+ </child>
+
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">true</property>
+ <property name="title" translatable="yes" context="shortcut window">Keyboard
Shortcuts</property>
+ <property name="accelerator"><ctrl><Shift>question</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">true</property>
+ <property name="title" translatable="yes" context="shortcut window">Quit</property>
+ <property name="accelerator"><Primary>q</property>
+ </object>
+ </child>
+ </object>
+ </child>
+
+ <child>
+ <object class="GtkShortcutsGroup">
+ <property name="visible">true</property>
+ <property name="title" translatable="yes" context="shortcut window group">Edit</property>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">true</property>
+ <property name="title" translatable="yes" context="shortcut window">Undo</property>
+ <property name="accelerator"><Primary>z</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">true</property>
+ <property name="title" translatable="yes" context="shortcut window">Redo</property>
+ <property name="accelerator"><Primary><Shift>z</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">true</property>
+ <property name="title" translatable="yes" context="shortcut window">Mark/Unmark as
fuzzy</property>
+ <property name="accelerator"><Primary>u</property>
+ </object>
+ </child>
+ </object>
+ </child>
+
+ <child>
+ <object class="GtkShortcutsGroup">
+ <property name="visible">true</property>
+ <property name="title" translatable="yes" context="shortcut window group">Navigation</property>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">true</property>
+ <property name="title" translatable="yes" context="shortcut window">Go previous
message</property>
+ <property name="accelerator"><Alt>Left</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">true</property>
+ <property name="title" translatable="yes" context="shortcut window">Go next
message</property>
+ <property name="accelerator"><Alt>Right</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">true</property>
+ <property name="title" translatable="yes" context="shortcut window">Go previous untranslated
message</property>
+ <property name="accelerator"><Alt>Page_Up</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">true</property>
+ <property name="title" translatable="yes" context="shortcut window">Go next untranslated
message</property>
+ <property name="accelerator"><Alt>Page_Down</property>
+ </object>
+ </child>
+ </object>
+ </child>
+
+ <child>
+ <object class="GtkShortcutsGroup">
+ <property name="visible">true</property>
+ <property name="title" translatable="yes" context="shortcut window group">Translation
Memory</property>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">true</property>
+ <property name="title" translatable="yes" context="shortcut window">Build translation
memory</property>
+ <property name="accelerator"><Primary>plus</property>
+ </object>
+ </child>
+ </object>
+ </child>
+
+ </object>
+ </child>
+ </object>
+</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]