[dconf-editor] Close row popover on window vertical resize.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Close row popover on window vertical resize.
- Date: Wed, 28 Nov 2018 20:26:19 +0000 (UTC)
commit 9ad4529b28ec2e8e06546cdca140c111a6b31352
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Mon Nov 26 07:04:03 2018 +0100
Close row popover on window vertical resize.
editor/key-list-box-row.vala | 19 -------------------
editor/registry-list.vala | 42 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 42 insertions(+), 19 deletions(-)
---
diff --git a/editor/key-list-box-row.vala b/editor/key-list-box-row.vala
index 90fb310..d40f762 100644
--- a/editor/key-list-box-row.vala
+++ b/editor/key-list-box-row.vala
@@ -80,25 +80,6 @@ private abstract class ClickableListBoxRow : EventBox
public string full_name { internal get; protected construct; }
public uint16 context_id { internal get; protected construct; }
- /*\
- * * Dismiss popover on window resize
- \*/
-
- private int width;
-
- construct
- {
- size_allocate.connect (on_size_allocate);
- }
-
- private void on_size_allocate (Allocation allocation)
- {
- if (allocation.width == width)
- return;
- hide_right_click_popover ();
- width = allocation.width;
- }
-
/*\
* * right click popover stuff
\*/
diff --git a/editor/registry-list.vala b/editor/registry-list.vala
index f8dcb74..f0d1e3e 100644
--- a/editor/registry-list.vala
+++ b/editor/registry-list.vala
@@ -37,6 +37,8 @@ private abstract class RegistryList : Grid, BrowsableView, AdaptativeWidget
construct
{
+ register_size_allocate ();
+
adjustment = key_list_box.get_adjustment ();
}
@@ -223,6 +225,46 @@ private abstract class RegistryList : Grid, BrowsableView, AdaptativeWidget
}
}
+ /*\
+ * * close row popover on resize
+ \*/
+
+ private int width = -1;
+ private int height = -1;
+
+ private inline void register_size_allocate ()
+ {
+ size_allocate.connect (on_size_allocate);
+ }
+
+ private void on_size_allocate (Allocation allocation)
+ {
+ if (width != allocation.width)
+ {
+ width = allocation.width;
+ if (height != allocation.height)
+ height = allocation.height;
+ hide_right_click_popover ();
+ }
+ else if (height != allocation.height)
+ {
+ height = allocation.height;
+ hide_right_click_popover ();
+ }
+ }
+
+ private void hide_right_click_popover ()
+ {
+ ListBoxRow? selected_row = (ListBoxRow?) key_list_box.get_selected_row ();
+ if (selected_row == null)
+ return;
+
+ ClickableListBoxRow row = (ClickableListBoxRow) ((!) selected_row).get_child ();
+
+ if (row.right_click_popover_visible ())
+ row.hide_right_click_popover ();
+ }
+
/*\
* * Keyboard calls
\*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]