composer: close the composer when navigating back

This commit is contained in:
Julian Sparber 2020-10-06 17:31:49 +02:00
parent 0b743ab0d3
commit d6c546e2d5
3 changed files with 18 additions and 0 deletions

View file

@ -1955,6 +1955,17 @@ public class Application.MainWindow :
return Gdk.EVENT_STOP;
}
[GtkCallback]
private void on_main_leaflet_visible_child_changed() {
if (main_leaflet.child_transition_running)
return;
if (main_leaflet.visible_child_name == "conversations" && main_leaflet.folded)
if (this.conversation_viewer.current_composer != null) {
this.conversation_viewer.current_composer.activate_close_action();
}
}
private void on_offline_infobar_response() {
this.info_bars.remove(this.offline_infobar);
}

View file

@ -1361,6 +1361,11 @@ public class Composer.Widget : Gtk.EventBox, Geary.BaseInterface {
}
}
/* Activate the close action */
public void activate_close_action() {
this.actions.activate_action(ACTION_CLOSE, null);
}
internal void set_mode(PresentationMode new_mode) {
this.current_mode = new_mode;
this.header.set_mode(new_mode);

View file

@ -29,6 +29,8 @@
<property name="can_focus">True</property>
<property name="can_swipe_back">True</property>
<property name="transition_type">over</property>
<signal name="notify::visible-child" handler="on_main_leaflet_visible_child_changed" swapped="no"/>
<signal name="notify::child-transition-running" handler="on_main_leaflet_visible_child_changed" swapped="no"/>
<child>
<object class="HdyLeaflet" id="conversations_leaflet">
<property name="visible">True</property>