client: Simplify main window outer leaflet state change handling
This commit is contained in:
parent
5aea0ad10f
commit
dbb9cc35e8
2 changed files with 20 additions and 11 deletions
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue