[file-roller: 1/3] help-overlay: Add Keyboard Shortcuts dialog



commit e3146dc8c75401396fcc6f6e7c10b0e038b543fa
Author: Sabri Ünal <libreajans gmail com>
Date:   Wed Apr 15 16:44:16 2020 +0300

    help-overlay: Add Keyboard Shortcuts dialog
    
    Keyboard Shortcuts dialog is very common for GTK applications.
    It helps users to find shortcuts easily.

 src/file-roller.gresource.xml |   1 +
 src/fr-application.c          |   2 +
 src/ui/app-menubar.ui         |   5 ++
 src/ui/gears-menu.ui          |   4 ++
 src/ui/help-overlay.ui        | 163 ++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 175 insertions(+)
---
diff --git a/src/file-roller.gresource.xml b/src/file-roller.gresource.xml
index 7ee944cd..2fb2e2ec 100644
--- a/src/file-roller.gresource.xml
+++ b/src/file-roller.gresource.xml
@@ -18,5 +18,6 @@
     <file compressed="true">ui/request-dialog.ui</file>
     <file compressed="true">ui/update.ui</file>
     <file compressed="true">../data/org.gnome.ArchiveManager1.xml</file>
+    <file alias="gtk/help-overlay.ui" compressed="true">ui/help-overlay.ui</file>
   </gresource>
 </gresources>
diff --git a/src/fr-application.c b/src/fr-application.c
index 00ebe552..8a80df99 100644
--- a/src/fr-application.c
+++ b/src/fr-application.c
@@ -26,6 +26,7 @@
 #include <signal.h>
 #include <stdlib.h>
 #include <glib/gi18n.h>
+#include <gtk/gtk.h>
 #include <glib/gprintf.h>
 #ifdef ENABLE_NOTIFICATION
 #  include <libnotify/notify.h>
@@ -449,6 +450,7 @@ fr_application_startup (GApplication *application)
        GtkSettings     *gtk_settings;
        gboolean         shell_shows_menubar;
 
+    g_application_set_resource_base_path (application, "/org/gnome/FileRoller");
        G_APPLICATION_CLASS (fr_application_parent_class)->startup (application);
 
        g_set_application_name (_("Archive Manager"));
diff --git a/src/ui/app-menubar.ui b/src/ui/app-menubar.ui
index 0979ddc4..37ad076f 100644
--- a/src/ui/app-menubar.ui
+++ b/src/ui/app-menubar.ui
@@ -133,6 +133,11 @@
         <attribute name="label" translatable="yes">Contents</attribute>
         <attribute name="accel">F1</attribute>
       </item>
+      <item>
+        <attribute name="action">app.help</attribute>
+        <attribute name="label" translatable="yes">Keyboard Shorcuts</attribute>
+        <attribute name="accel"><![CDATA[<Ctrl>question]]></attribute>
+      </item>
       <item>
         <attribute name="action">app.about</attribute>
         <attribute name="label" translatable="yes">_About</attribute>
diff --git a/src/ui/gears-menu.ui b/src/ui/gears-menu.ui
index e40cd620..d649ae1c 100644
--- a/src/ui/gears-menu.ui
+++ b/src/ui/gears-menu.ui
@@ -50,6 +50,10 @@
       </item>
     </section>
     <section>
+      <item>
+        <attribute name="action">win.show-help-overlay</attribute>
+        <attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
+      </item>
       <item>
         <attribute name="action">app.help</attribute>
         <attribute name="label" translatable="yes">_Help</attribute>
diff --git a/src/ui/help-overlay.ui b/src/ui/help-overlay.ui
new file mode 100644
index 00000000..26ccd99b
--- /dev/null
+++ b/src/ui/help-overlay.ui
@@ -0,0 +1,163 @@
+<?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">12</property>
+        <child>
+          <object class="GtkShortcutsGroup">
+            <property name="visible">true</property>
+            <property name="title" translatable="yes" context="shortcut window">General</property>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">true</property>
+                <property name="accelerator">F1</property>
+                <property name="title" translatable="yes" context="shortcut window">Show help</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">&lt;Primary&gt;question</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">true</property>
+                <property name="title" translatable="yes" context="shortcut window">Close window</property>
+                <property name="accelerator">&lt;Primary&gt;W</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">&lt;Primary&gt;Q</property>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="GtkShortcutsGroup">
+            <property name="visible">true</property>
+            <property name="title" translatable="yes" context="shortcut window">Archive</property>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">true</property>
+                <property name="accelerator">&lt;Primary&gt;N</property>
+                <property name="title" translatable="yes" context="shortcut window">Create new 
archive</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">true</property>
+                <property name="accelerator">&lt;Primary&gt;O</property>
+                <property name="title" translatable="yes" context="shortcut window">Open an 
archive</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">true</property>
+                <property name="accelerator">&lt;Primary&gt;E</property>
+                <property name="title" translatable="yes" context="shortcut window">Extract an 
archive</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">true</property>
+                <property name="accelerator">&lt;Alt&gt;Return</property>
+                <property name="title" translatable="yes" context="shortcut window">View archive 
properties</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">true</property>
+                <property name="accelerator">F2</property>
+                <property name="title" translatable="yes" context="shortcut window">Rename file or folder in 
an archive</property>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="GtkShortcutsGroup">
+            <property name="visible">true</property>
+            <property name="title" translatable="yes" context="shortcut window">View</property>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">true</property>
+                <property name="accelerator">F9</property>
+                <property name="title" translatable="yes" context="shortcut window">Display the tree view of 
the folders in the side pane</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">true</property>
+                <property name="accelerator">&lt;Primary&gt;1</property>
+                <property name="title" translatable="yes" context="shortcut window">View the content of an 
archive as a list of files</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">true</property>
+                <property name="accelerator">&lt;Primary&gt;2</property>
+                <property name="title" translatable="yes" context="shortcut window">View the content of an 
archive as a folder structure</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">true</property>
+                <property name="accelerator">&lt;Primary&gt;R</property>
+                <property name="title" translatable="yes" context="shortcut window">Refresh</property>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="GtkShortcutsGroup">
+            <property name="visible">true</property>
+            <property name="title" translatable="yes" context="shortcut window">Common</property>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">true</property>
+                <property name="accelerator">&lt;Primary&gt;F</property>
+                <property name="title" translatable="yes" context="shortcut window">Find</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">true</property>
+                <property name="accelerator">&lt;Primary&gt;A</property>
+                <property name="title" translatable="yes" context="shortcut window">Select all</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">true</property>
+                <property name="accelerator">&lt;Primary&gt;&lt;Shift&gt;A</property>
+                <property name="title" translatable="yes" context="shortcut window">Deselect all</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">true</property>
+                <property name="accelerator">Delete</property>
+                <property name="title" translatable="yes" context="shortcut window">Delete files or folders 
from an archive</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">true</property>
+                <property name="accelerator">Escape</property>
+                <property name="title" translatable="yes" context="shortcut window">Stop the 
operation</property>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]