[dconf-editor] Some shorcuts love.



commit ad1e4332da959641dcf29c341f22f52ea5b6e9c9
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Sun Feb 14 12:17:31 2016 +0100

    Some shorcuts love.

 editor/bookmarks.vala    |    5 ++-
 editor/dconf-editor.ui   |    1 +
 editor/dconf-window.vala |   23 +++++++++++++---
 editor/help-overlay.ui   |   64 +++++++++++++++++++++++++++++++++-------------
 4 files changed, 69 insertions(+), 24 deletions(-)
---
diff --git a/editor/bookmarks.vala b/editor/bookmarks.vala
index cb7ce2e..b366bed 100644
--- a/editor/bookmarks.vala
+++ b/editor/bookmarks.vala
@@ -78,9 +78,10 @@ public class Bookmarks : MenuButton
         }
     }
 
-    public void toggle_bookmark ()
+    public void set_bookmarked (bool new_state)
     {
-        bookmarked_switch.set_active (!bookmarked_switch.get_active ());
+        if (bookmarked_switch.get_active () != new_state)
+            bookmarked_switch.set_active (new_state);
     }
 
     private Widget new_bookmark_row (Object item)
diff --git a/editor/dconf-editor.ui b/editor/dconf-editor.ui
index 5c6bbb7..e3eed95 100644
--- a/editor/dconf-editor.ui
+++ b/editor/dconf-editor.ui
@@ -22,6 +22,7 @@
             <property name="visible">True</property>
             <property name="valign">center</property>
             <property name="focus-on-click">False</property>
+            <accelerator key="F10" signal="clicked"/>
             <signal name="clicked" handler="on_menu_button_clicked"/>
             <style>
               <class name="image-button"/>
diff --git a/editor/dconf-window.vala b/editor/dconf-window.vala
index b74ce3f..d934276 100644
--- a/editor/dconf-window.vala
+++ b/editor/dconf-window.vala
@@ -272,19 +272,26 @@ class DConfWindow : ApplicationWindow
     [GtkCallback]
     private bool on_key_press_event (Widget widget, Gdk.EventKey event)     // TODO better?
     {
+        string name = Gdk.keyval_name (event.keyval);
+
         if ((event.state & Gdk.ModifierType.CONTROL_MASK) != 0)
         {
-            switch (Gdk.keyval_name (event.keyval))
+            switch (name)
             {
                 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 ();
+                    if (info_button.active)
+                        info_button.active = false;
+                    bookmarks_button.set_bookmarked (true);
+                    return true;
+                case "D":
+                    if (info_button.active)
+                        info_button.active = false;
+                    bookmarks_button.set_bookmarked (false);
                     return true;
                 case "f":
                     if (bookmarks_button.active)
@@ -302,6 +309,14 @@ class DConfWindow : ApplicationWindow
                     break;  // TODO report bug for making <ctrl>v work?
             }
         }
+        else if (name == "F10")
+        {
+            bookmarks_button.active = false;
+            return false;
+        }
+        else if (name == "plus"   || name == "minus" ||
+                 name == "KP_Add" || name == "KP_Subtract")     // TODO open bug for search_bar blocking 
standard treeview shortcuts
+            return false;                                       // TODO GtkTreeView has a weird behaviour if 
expanding without children
 
         if (bookmarks_button.active || info_button.active)      // TODO open bug about modal popovers and 
search_bar
             return false;
diff --git a/editor/help-overlay.ui b/editor/help-overlay.ui
index 36bea69..b67bb08 100644
--- a/editor/help-overlay.ui
+++ b/editor/help-overlay.ui
@@ -4,30 +4,44 @@
     <child>
       <object class="GtkShortcutsSection">
         <property name="visible">True</property>
-        <!--property name="section-name"></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>
+            <property name="title" translatable="yes" context="shortcut window">Actions</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>
+                <property name="title" translatable="yes" context="shortcut window">Bookmarks menu</property>
+                <property name="accelerator">&lt;Primary&gt;b</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <property name="title" translatable="yes" context="shortcut window">Bookmark 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">Unbookmark this 
path</property>
+                <property name="accelerator">&lt;Primary&gt;&lt;Shift&gt;d</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="title" translatable="yes" context="shortcut window">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>
+                <property name="title" translatable="yes" context="shortcut window">Actions menu</property>
+                <property name="accelerator">F10</property>
               </object>
             </child>
           </object>
@@ -48,19 +62,33 @@
         <child>
           <object class="GtkShortcutsGroup">
             <property name="visible">True</property>
-            <property name="title" translatable="yes" context="shortcut window">Bookmarks</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">Bookmark or unbookmark 
this path</property>
-                <property name="accelerator">&lt;Primary&gt;d</property>
+                <property name="title" translatable="yes" context="shortcut window">Expand</property>
+                <property name="accelerator">plus</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>
+                <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</property>
+                <property name="accelerator">minus</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>
@@ -68,19 +96,19 @@
         <child>
           <object class="GtkShortcutsGroup">
             <property name="visible">True</property>
-            <property name="title" translatable="yes" context="shortcut window">Tree navigation</property>
+            <property name="title" translatable="yes" context="shortcut window">Generic</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>
+                <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">
+              <object class="GtkShortcutsShortcut"> <!-- TODO doesn't quit if a KeyEditor dialog is opened 
-->
                 <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>
+                <property name="title" translatable="yes" context="shortcut window">Quit</property>
+                <property name="accelerator">&lt;Primary&gt;q</property>
               </object>
             </child>
           </object>


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