[geary/mjog/1193-conversation-buttons-resize-race: 1/9] client: Simplify main window outer leaflet state change handling
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/mjog/1193-conversation-buttons-resize-race: 1/9] client: Simplify main window outer leaflet state change handling
- Date: Tue, 13 Apr 2021 14:49:58 +0000 (UTC)
commit dbb9cc35e8ba1d6f0ba7702b898794146b5e46b3
Author: Michael Gratton <mike vee net>
Date: Sun Apr 11 11:58:55 2021 +1000
client: Simplify main window outer leaflet state change handling
.../application/application-main-window.vala | 27 ++++++++++++++--------
ui/application-main-window.ui | 4 ++--
2 files changed, 20 insertions(+), 11 deletions(-)
---
diff --git a/src/client/application/application-main-window.vala
b/src/client/application/application-main-window.vala
index 41f022358..14c0ab98c 100644
--- a/src/client/application/application-main-window.vala
+++ b/src/client/application/application-main-window.vala
@@ -282,6 +282,18 @@ public class Application.MainWindow :
get; private set; default = null;
}
+ /** Specifies if the conversation list is currently displayed. */
+ public bool is_folder_list_shown {
+ get {
+ return (
+ (!this.outer_leaflet.folded ||
+ this.outer_leaflet.visible_child_name == INNER_LEAFLET) &&
+ (!this.inner_leaflet.folded ||
+ this.inner_leaflet.visible_child_name == FOLDER_LIST)
+ );
+ }
+ }
+
/** Specifies if the conversation list is currently displayed. */
public bool is_conversation_list_shown {
get {
@@ -2047,15 +2059,12 @@ public class Application.MainWindow :
}
[GtkCallback]
- private void on_outer_leaflet_visible_child_changed() {
- if (this.outer_leaflet.child_transition_running)
- return;
-
- if (this.outer_leaflet.visible_child_name == INNER_LEAFLET &&
- this.outer_leaflet.folded)
- if (this.conversation_viewer.current_composer != null) {
- this.conversation_viewer.current_composer.activate_close_action();
- }
+ private void on_outer_leaflet_changed() {
+ if (this.has_composer &&
+ this.outer_leaflet.folded &&
+ (this.is_folder_list_shown || this.is_conversation_list_shown)) {
+ close_composer(false, false);
+ }
}
private void on_offline_infobar_response() {
diff --git a/ui/application-main-window.ui b/ui/application-main-window.ui
index 5b96e9613..4c3c71ec9 100644
--- a/ui/application-main-window.ui
+++ b/ui/application-main-window.ui
@@ -22,8 +22,8 @@
<property name="visible">True</property>
<property name="can_swipe_back">True</property>
<property name="transition_type">over</property>
- <signal name="notify::visible-child" handler="on_outer_leaflet_visible_child_changed"
swapped="no"/>
- <signal name="notify::child-transition-running"
handler="on_outer_leaflet_visible_child_changed" swapped="no"/>
+ <signal name="notify::folded" handler="on_outer_leaflet_changed" swapped="no"/>
+ <signal name="notify::visible-child" handler="on_outer_leaflet_changed" swapped="no"/>
<child>
<object class="HdyLeaflet" id="inner_leaflet">
<property name="visible">True</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]