[dconf-editor] Better interaction between searchbar and bookmarks.



commit b39d7cbf819af71f216328615ac4421542395344
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Fri Oct 16 05:58:39 2015 +0200

    Better interaction between searchbar and bookmarks.

 editor/bookmarks.vala    |    1 +
 editor/dconf-editor.ui   |    1 +
 editor/dconf-window.vala |   14 +++++++++++---
 3 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/editor/bookmarks.vala b/editor/bookmarks.vala
index 227d73a..b59abd5 100644
--- a/editor/bookmarks.vala
+++ b/editor/bookmarks.vala
@@ -41,6 +41,7 @@ public class Bookmarks : MenuButton
         notify ["current-path"].connect (update_icon_and_switch);
         bookmarked_switch.notify ["active"].connect (switch_changed_cb);    // TODO activated when 
current_path changes...
         update_bookmarks ();
+        bookmarked_switch.grab_focus ();
     }
 
     private void update_icon_and_switch ()
diff --git a/editor/dconf-editor.ui b/editor/dconf-editor.ui
index 1f18e89..cb17340 100644
--- a/editor/dconf-editor.ui
+++ b/editor/dconf-editor.ui
@@ -47,6 +47,7 @@
           <object class="Bookmarks" id="bookmarks_button">
             <property name="visible">True</property>
             <property name="schema">ca.desrt.dconf-editor.Settings</property>
+            <signal name="clicked" handler="on_bookmarks_button_clicked"/>
             <signal name="bookmark_activated" handler="scroll_to_path"/>
           </object>
           <packing>
diff --git a/editor/dconf-window.vala b/editor/dconf-window.vala
index 68eb666..afb90c2 100644
--- a/editor/dconf-window.vala
+++ b/editor/dconf-window.vala
@@ -197,19 +197,27 @@ class DConfWindow : ApplicationWindow
     [GtkCallback]
     private bool on_key_press_event (Widget widget, Gdk.EventKey event)     // TODO better?
     {
-        if (bookmarks_button.active)        // TODO open bug
-            return false;
-
         if (Gdk.keyval_name (event.keyval) == "f" && (event.state & Gdk.ModifierType.CONTROL_MASK) != 0)    
// TODO better?
         {
+            if (bookmarks_button.active)
+                bookmarks_button.active = false;
             search_bar.set_search_mode (!search_bar.get_search_mode ());
             return true;
         }
 
+        if (bookmarks_button.active)        // TODO open bug
+            return false;
+
         return search_bar.handle_event (event);
     }
 
     [GtkCallback]
+    private void on_bookmarks_button_clicked ()
+    {
+        search_bar.set_search_mode (false);
+    }
+
+    [GtkCallback]
     private void find_next_cb ()
     {
         if (!search_bar.get_search_mode ())     // TODO better; switches to next list_box_row when 
keyboard-activating an entry of the popover


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