Commit dbb9cc35 authored by Michael Gratton's avatar Michael Gratton 🍸 Committed by Michael Gratton
Browse files

client: Simplify main window outer leaflet state change handling

parent 5aea0ad1
......@@ -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() {
......
......@@ -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>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment