geary/src/client/composer/composer-box.vala
Michael Gratton 44fd56588b Clean up the Composer API
Make ComposerWidget::close method handle a lot more common code,
allowing many handlers to be simplified. Make access for some properties
more private and add accessors as appropriate, replace some "notify is
too hard" singnals with actual notify calls. Rename a few other
properties to better indicate what they do. Reintroduce `is-draft`
argument to ::load so we can accurately determine if we are loading a
draft, and so the `draft_id` param can be removed from the ctor.
Introduce a ::set_enabled method that can be used to disable and hide
the composer before closing it. Rename ::change_compose_type to
::append_to_email and reduce its scope drastically.

Drastically simplify ComposerContainer's API and its implementing
classes, reducing the API surface down to a single method call. Ensure
its properties that could be null are nullable, update call sites.

Remove dead code in all of the above classes, add more API docs.
2019-11-17 20:00:02 +11:00

54 lines
1.4 KiB
Vala

/*
* Copyright 2016 Software Freedom Conservancy Inc.
* Copyright 2019 Michael Gratton <mike@vee.net>
*
* This software is licensed under the GNU Lesser General Public License
* (version 2.1 or later). See the COPYING file in this distribution.
*/
/**
* A container for full-height paned composers in the main window.
*/
public class Composer.Box : Gtk.Frame, Container {
/** {@inheritDoc} */
public Gtk.ApplicationWindow? top_window {
get { return get_toplevel() as Gtk.ApplicationWindow; }
}
/** {@inheritDoc} */
internal Widget composer { get; set; }
private MainToolbar main_toolbar { get; private set; }
/** Emitted when the container is closed. */
public signal void vanished();
public Box(Widget composer) {
this.composer = composer;
this.composer.free_header();
this.main_toolbar = GearyApplication.instance.controller.main_window.main_toolbar;
get_style_context().add_class("geary-composer-box");
this.halign = Gtk.Align.FILL;
this.vexpand = true;
this.vexpand_set = true;
add(this.composer);
this.main_toolbar.set_conversation_header(composer.header);
show();
}
/** {@inheritDoc} */
public void close() {
this.main_toolbar.remove_conversation_header(composer.header);
vanished();
remove(this.composer);
destroy();
}
}