[dconf-editor] Add help overlay & two bookmarks-related shortcuts.



commit e251d793eb53d3258d78986a6dd800c47ff0275d
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Wed Feb 10 18:49:29 2016 +0100

    Add help overlay & two bookmarks-related shortcuts.

 editor/Makefile.am                |    3 +-
 editor/bookmarks.vala             |    5 ++
 editor/dconf-editor-menu.ui       |    4 ++
 editor/dconf-editor.gresource.xml |    1 +
 editor/dconf-editor.ui            |    1 +
 editor/dconf-window.vala          |   10 ++++
 editor/help-overlay.ui            |   91 +++++++++++++++++++++++++++++++++++++
 po/POTFILES.in                    |    1 +
 8 files changed, 115 insertions(+), 1 deletions(-)
---
diff --git a/editor/Makefile.am b/editor/Makefile.am
index 344cdc3..b1762fa 100644
--- a/editor/Makefile.am
+++ b/editor/Makefile.am
@@ -27,7 +27,8 @@ resource_data = \
        key-editor.ui \
        key-editor-no-schema.ui \
        bookmarks.ui \
-       bookmark.ui
+       bookmark.ui \
+       help-overlay.ui
 
 resources.c: $(resource_data)
        $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --target=$@ --generate-source $<
diff --git a/editor/bookmarks.vala b/editor/bookmarks.vala
index bad8a09..cb7ce2e 100644
--- a/editor/bookmarks.vala
+++ b/editor/bookmarks.vala
@@ -78,6 +78,11 @@ public class Bookmarks : MenuButton
         }
     }
 
+    public void toggle_bookmark ()
+    {
+        bookmarked_switch.set_active (!bookmarked_switch.get_active ());
+    }
+
     private Widget new_bookmark_row (Object item)
     {
         return (Bookmark) item;
diff --git a/editor/dconf-editor-menu.ui b/editor/dconf-editor-menu.ui
index 1cf0428..2f20497 100644
--- a/editor/dconf-editor-menu.ui
+++ b/editor/dconf-editor-menu.ui
@@ -3,6 +3,10 @@
   <menu id="app-menu">
     <section>
       <item>
+        <attribute name="label" translatable="yes">Keyboard Shortcuts</attribute>
+        <attribute name="action">win.show-help-overlay</attribute>
+      </item>
+      <item>
         <attribute name="label" translatable="yes">_About</attribute>
         <attribute name="action">app.about</attribute>
       </item>
diff --git a/editor/dconf-editor.gresource.xml b/editor/dconf-editor.gresource.xml
index e87969f..d2bc774 100644
--- a/editor/dconf-editor.gresource.xml
+++ b/editor/dconf-editor.gresource.xml
@@ -10,5 +10,6 @@
   </gresource>
   <gresource prefix="/ca/desrt/dconf-editor/gtk">
     <file preprocess="xml-stripblanks" alias="menus.ui">dconf-editor-menu.ui</file>
+    <file preprocess="xml-stripblanks">help-overlay.ui</file>
   </gresource>
 </gresources>
diff --git a/editor/dconf-editor.ui b/editor/dconf-editor.ui
index 082d453..5c6bbb7 100644
--- a/editor/dconf-editor.ui
+++ b/editor/dconf-editor.ui
@@ -80,6 +80,7 @@
             <property name="schema-id">ca.desrt.dconf-editor.Settings</property>
             <signal name="clicked" handler="on_menu_button_clicked"/>
             <signal name="bookmark_activated" handler="scroll_to_path"/>
+            <!-- <accelerator key="B" signal="activate" modifiers="GDK_CONTROL_MASK"/> TODO -->
             <style>
               <class name="image-button"/> <!-- TODO https://bugzilla.gnome.org/show_bug.cgi?id=756731 -->
             </style>
diff --git a/editor/dconf-window.vala b/editor/dconf-window.vala
index bb89a13..b74ce3f 100644
--- a/editor/dconf-window.vala
+++ b/editor/dconf-window.vala
@@ -276,6 +276,16 @@ class DConfWindow : ApplicationWindow
         {
             switch (Gdk.keyval_name (event.keyval))
             {
+                case "b":
+                    if (search_bar.get_search_mode ())
+                        search_bar.set_search_mode (false);
+                    if (info_button.active)
+                        info_button.active = false;
+                    bookmarks_button.clicked ();
+                    return true;
+                case "d":
+                    bookmarks_button.toggle_bookmark ();
+                    return true;
                 case "f":
                     if (bookmarks_button.active)
                         bookmarks_button.active = false;
diff --git a/editor/help-overlay.ui b/editor/help-overlay.ui
new file mode 100644
index 0000000..36bea69
--- /dev/null
+++ b/editor/help-overlay.ui
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <object class="GtkShortcutsWindow" id="help_overlay">
+    <child>
+      <object class="GtkShortcutsSection">
+        <property name="visible">True</property>
+        <!--property name="section-name"></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="title" translatable="yes" context="shortcut window">Show this help</property>
+                <property name="accelerator">&lt;Primary&gt;question &lt;Primary&gt;F1</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <property name="title" translatable="yes" context="shortcut window">Toggle search 
bar</property>
+                <property name="accelerator">&lt;Primary&gt;f</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">Clipboard</property>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <property name="title" translatable="yes" context="shortcut window">Copy path or 
descriptor</property>
+                <property name="accelerator">&lt;Primary&gt;c</property>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="GtkShortcutsGroup">
+            <property name="visible">True</property>
+            <property name="title" translatable="yes" context="shortcut window">Bookmarks</property>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <property name="title" translatable="yes" context="shortcut window">Bookmark or unbookmark 
this path</property>
+                <property name="accelerator">&lt;Primary&gt;d</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <property name="title" translatable="yes" context="shortcut window">Toggle bookmarks 
popover</property>
+                <property name="accelerator">&lt;Primary&gt;b</property>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="GtkShortcutsGroup">
+            <property name="visible">True</property>
+            <property name="title" translatable="yes" context="shortcut window">Tree navigation</property>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <property name="title" translatable="yes" context="shortcut window">Expand all 
subtrees</property>
+                <property name="accelerator">&lt;Shift&gt;Right</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <property name="title" translatable="yes" context="shortcut window">Collapse all 
subtrees</property>
+                <property name="accelerator">&lt;Shift&gt;Left</property>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index f70970a..97417dd 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -9,6 +9,7 @@ editor/dconf-editor.vala
 editor/dconf-model.vala
 editor/dconf-view.vala
 editor/dconf-window.vala
+[type: gettext/glade]editor/help-overlay.ui
 [type: gettext/glade]editor/key-editor-no-schema.ui
 [type: gettext/glade]editor/key-editor.ui
 editor/key-list-box-row.vala


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