[dconf-editor] Fix hiding row popover.



commit c31e3b299a0391bb867c571f9f847eeee88c78b0
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Fri Jan 26 17:28:50 2018 +0100

    Fix hiding row popover.

 editor/key-list-box-row.vala |   12 +-----------
 editor/registry-search.vala  |   10 ++++++++--
 editor/registry-view.vala    |   10 ++++++++--
 3 files changed, 17 insertions(+), 15 deletions(-)
---
diff --git a/editor/key-list-box-row.vala b/editor/key-list-box-row.vala
index d021398..f7cbfb3 100644
--- a/editor/key-list-box-row.vala
+++ b/editor/key-list-box-row.vala
@@ -116,7 +116,7 @@ private abstract class ClickableListBoxRow : EventBox
             ((!) nullable_popover).destroy ();
     }
 
-    protected void hide_right_click_popover ()
+    public void hide_right_click_popover ()
     {
         if (nullable_popover != null)
             ((!) nullable_popover).popdown ();
@@ -586,16 +586,6 @@ private class ContextPopover : Popover
         new_section_real ();
 
         bind_model (menu, null);
-
-        key_press_event.connect (on_key_press_event);   // TODO should be only for RegistryView popovers, 
not for RegistryInfo ones (nullable booleans & enums)
-    }
-
-    private bool on_key_press_event (Widget widget, Gdk.EventKey event)
-    {
-        if (Gdk.keyval_name (event.keyval) != "Menu")
-            return false;
-        popdown ();
-        return true;
     }
 
     /*\
diff --git a/editor/registry-search.vala b/editor/registry-search.vala
index d1cdd23..999deb2 100644
--- a/editor/registry-search.vala
+++ b/editor/registry-search.vala
@@ -295,8 +295,14 @@ class RegistrySearch : Grid, BrowsableView
             return false;
 
         ClickableListBoxRow row = (ClickableListBoxRow) ((!) selected_row).get_child ();
-        row.show_right_click_popover ();
-        rows_possibly_with_popover.append (row);
+
+        if (row.right_click_popover_visible ())
+            row.hide_right_click_popover ();
+        else
+        {
+            row.show_right_click_popover ();
+            rows_possibly_with_popover.append (row);
+        }
         return true;
     }
 
diff --git a/editor/registry-view.vala b/editor/registry-view.vala
index 36a2ad0..52f7035 100644
--- a/editor/registry-view.vala
+++ b/editor/registry-view.vala
@@ -322,8 +322,14 @@ class RegistryView : Grid, BrowsableView
             return false;
 
         ClickableListBoxRow row = (ClickableListBoxRow) ((!) selected_row).get_child ();
-        row.show_right_click_popover ();
-        rows_possibly_with_popover.append (row);
+
+        if (row.right_click_popover_visible ())
+            row.hide_right_click_popover ();
+        else
+        {
+            row.show_right_click_popover ();
+            rows_possibly_with_popover.append (row);
+        }
         return true;
     }
 


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