[geary/mjog/493-undo-send: 7/20] Move composer classes into their own namespace



commit fbfab0c308ebe4c66375697636ee3058de9fc71c
Author: Michael Gratton <mike vee net>
Date:   Sun Nov 10 09:35:58 2019 +1100

    Move composer classes into their own namespace
    
    Rename all composer classes prefixed with "Composer" so that the prefix
    is a namespace instead. This increases the compartmentalisation of the
    classes, making `internal` a useful member modifier and makes them
    consistent with the code style guide.

 src/client/application/application-controller.vala | 69 ++++++++++++----------
 src/client/application/geary-application.vala      |  2 +-
 src/client/components/main-window.vala             | 16 ++---
 src/client/composer/composer-box.vala              |  8 +--
 src/client/composer/composer-container.vala        |  4 +-
 src/client/composer/composer-embed.vala            | 12 ++--
 src/client/composer/composer-headerbar.vala        |  6 +-
 src/client/composer/composer-link-popover.vala     |  4 +-
 src/client/composer/composer-web-view.vala         | 12 ++--
 src/client/composer/composer-widget.vala           | 57 +++++++++---------
 src/client/composer/composer-window.vala           |  8 +--
 src/client/composer/email-entry.vala               |  4 +-
 .../conversation-viewer/conversation-list-box.vala |  6 +-
 .../conversation-viewer/conversation-viewer.vala   | 10 ++--
 test/client/composer/composer-web-view-test.vala   | 30 +++++-----
 test/js/composer-page-state-test.vala              | 12 ++--
 test/test-client.vala                              |  4 +-
 17 files changed, 137 insertions(+), 127 deletions(-)
---
diff --git a/src/client/application/application-controller.vala 
b/src/client/application/application-controller.vala
index 6c2ff04d..baeba205 100644
--- a/src/client/application/application-controller.vala
+++ b/src/client/application/application-controller.vala
@@ -163,11 +163,17 @@ public class Application.Controller : Geary.BaseObject {
     private PluginManager plugin_manager;
 
     private Cancellable cancellable_open_account = new Cancellable();
-    private Gee.LinkedList<ComposerWidget> composer_widgets = new Gee.LinkedList<ComposerWidget>();
-    private Gee.List<string?> pending_mailtos = new Gee.ArrayList<string>();
 
-    // List of windows we're waiting to close before Geary closes.
-    private Gee.List<ComposerWidget> waiting_to_close = new Gee.ArrayList<ComposerWidget>();
+    // Currently open composers
+    private Gee.Collection<Composer.Widget> composer_widgets =
+        new Gee.LinkedList<Composer.Widget>();
+
+    // Composers that are in the process of closing
+    private Gee.Collection<Composer.Widget> waiting_to_close =
+        new Gee.LinkedList<Composer.Widget>();
+
+    // Requested mailto composers not yet fullfulled
+    private Gee.List<string?> pending_mailtos = new Gee.ArrayList<string>();
 
 
     /**
@@ -204,7 +210,7 @@ public class Application.Controller : Geary.BaseObject {
             ClientWebView.load_resources(
                 this.application.get_user_config_directory()
             );
-            ComposerWebView.load_resources();
+            Composer.WebView.load_resources();
             ConversationWebView.load_resources();
             Accounts.SignatureWebView.load_resources();
         } catch (Error err) {
@@ -409,21 +415,21 @@ public class Application.Controller : Geary.BaseObject {
      * Opens new composer with an existing message as context.
      */
     public void compose_with_context_email(Geary.Account account,
-                                           ComposerWidget.ComposeType type,
+                                           Composer.Widget.ComposeType type,
                                            Geary.Email context,
                                            string? quote) {
         create_compose_widget(account, type, context, quote);
     }
 
     /** Adds a new composer to be kept track of. */
-    public void add_composer(ComposerWidget widget) {
+    public void add_composer(Composer.Widget widget) {
         debug(@"Added composer of type $(widget.compose_type); $(this.composer_widgets.size) composers 
total");
         widget.destroy.connect(this.on_composer_widget_destroy);
         this.composer_widgets.add(widget);
     }
 
     /** Returns a read-only collection of currently open composers .*/
-    public Gee.Collection<ComposerWidget> get_composers() {
+    public Gee.Collection<Composer.Widget> get_composers() {
         return this.composer_widgets.read_only_view;
     }
 
@@ -1463,38 +1469,39 @@ public class Application.Controller : Geary.BaseObject {
     }
 
     internal bool close_composition_windows(bool main_window_only = false) {
-        Gee.List<ComposerWidget> composers_to_destroy = new Gee.ArrayList<ComposerWidget>();
+        Gee.List<Composer.Widget> composers_to_destroy = new Gee.ArrayList<Composer.Widget>();
         bool quit_cancelled = false;
 
         // If there's composer windows open, give the user a chance to
         // save or cancel.
-        foreach(ComposerWidget cw in composer_widgets) {
+        foreach(Composer.Widget cw in composer_widgets) {
             if (!main_window_only ||
-                cw.state != ComposerWidget.ComposerState.DETACHED) {
+                cw.state != Composer.Widget.ComposerState.DETACHED) {
                 // Check if we should close the window immediately, or
                 // if we need to wait.
-                ComposerWidget.CloseStatus status = cw.should_close();
-                if (status == ComposerWidget.CloseStatus.PENDING_CLOSE) {
+                Composer.Widget.CloseStatus status = cw.should_close();
+                if (status == Composer.Widget.CloseStatus.PENDING_CLOSE) {
                     // Window is currently busy saving.
                     waiting_to_close.add(cw);
-                } else if (status == ComposerWidget.CloseStatus.CANCEL_CLOSE) {
+                } else if (status == Composer.Widget.CloseStatus.CANCEL_CLOSE) {
                     // User cancelled operation.
                     quit_cancelled = true;
                     break;
-                } else if (status == ComposerWidget.CloseStatus.DO_CLOSE) {
+                } else if (status == Composer.Widget.CloseStatus.DO_CLOSE) {
                     // Hide any existing composer windows for the
                     // moment; actually deleting the windows will
                     // result in their removal from composer_windows,
                     // which could crash this loop.
                     composers_to_destroy.add(cw);
-                    ((ComposerContainer) cw.parent).vanish();
+                    ((Composer.Container) cw.parent).vanish();
                 }
             }
         }
 
         // Safely destroy windows.
-        foreach(ComposerWidget cw in composers_to_destroy)
-            ((ComposerContainer) cw.parent).close_container();
+        foreach(Composer.Widget cw in composers_to_destroy) {
+            ((Composer.Container) cw.parent).close_container();
+        }
 
         // If we cancelled the quit we can bail here.
         if (quit_cancelled) {
@@ -1530,7 +1537,7 @@ public class Application.Controller : Geary.BaseObject {
      * a new mail (false)
      */
     private void create_compose_widget(Geary.Account account,
-                                       ComposerWidget.ComposeType compose_type,
+                                       Composer.Widget.ComposeType compose_type,
                                        Geary.Email? referred = null,
                                        string? quote = null,
                                        string? mailto = null,
@@ -1541,7 +1548,7 @@ public class Application.Controller : Geary.BaseObject {
         if (compose_type == NEW_MESSAGE && !is_draft) {
             // We're creating a new message that isn't a draft, if
             // there's already a composer open, just use that
-            ComposerWidget? existing =
+            Composer.Widget? existing =
                 this.main_window.conversation_viewer.current_composer;
             if (existing != null &&
                 existing.state == PANED &&
@@ -1553,7 +1560,7 @@ public class Application.Controller : Geary.BaseObject {
         } else if (compose_type != NEW_MESSAGE) {
             // We're replying, see whether we already have a reply for
             // that message and if so, insert a quote into that.
-            foreach (ComposerWidget existing in this.composer_widgets) {
+            foreach (Composer.Widget existing in this.composer_widgets) {
                 if (existing.state != DETACHED &&
                     ((referred != null && existing.referred_ids.contains(referred.id)) ||
                      quote != null)) {
@@ -1571,13 +1578,13 @@ public class Application.Controller : Geary.BaseObject {
             }
         }
 
-        ComposerWidget widget;
+        Composer.Widget widget;
         if (mailto != null) {
-            widget = new ComposerWidget.from_mailto(
+            widget = new Composer.Widget.from_mailto(
                 this.application, account, mailto
             );
         } else {
-            widget = new ComposerWidget(
+            widget = new Composer.Widget(
                 this.application,
                 account,
                 is_draft ? referred.id : null,
@@ -1605,7 +1612,7 @@ public class Application.Controller : Geary.BaseObject {
     }
 
     private async void load_composer(Geary.Account account,
-                                     ComposerWidget widget,
+                                     Composer.Widget widget,
                                      Geary.Email? referred = null,
                                      string? quote = null) {
         Geary.Email? full = null;
@@ -1618,7 +1625,7 @@ public class Application.Controller : Geary.BaseObject {
                     full = yield context.emails.fetch_email_async(
                         referred.id,
                         Geary.ComposedEmail.REQUIRED_REPLY_FIELDS |
-                        ComposerWidget.REQUIRED_FIELDS,
+                        Composer.Widget.REQUIRED_FIELDS,
                         NONE,
                         cancellable
                     );
@@ -1636,11 +1643,11 @@ public class Application.Controller : Geary.BaseObject {
     }
 
     private void on_composer_widget_destroy(Gtk.Widget sender) {
-        composer_widgets.remove((ComposerWidget) sender);
-        debug(@"Destroying composer of type $(((ComposerWidget) sender).compose_type); "
+        composer_widgets.remove((Composer.Widget) sender);
+        debug(@"Destroying composer of type $(((Composer.Widget) sender).compose_type); "
             + @"$(composer_widgets.size) composers remaining");
 
-        if (waiting_to_close.remove((ComposerWidget) sender)) {
+        if (waiting_to_close.remove((Composer.Widget) sender)) {
             // If we just removed the last window in the waiting to close list, it's time to exit!
             if (waiting_to_close.size == 0)
                 this.application.exit();
@@ -1665,8 +1672,8 @@ public class Application.Controller : Geary.BaseObject {
     }
 
     // Returns a list of composer windows for an account, or null if none.
-    public Gee.List<ComposerWidget>? get_composer_widgets_for_account(Geary.AccountInformation account) {
-        Gee.LinkedList<ComposerWidget> ret = Geary.traverse<ComposerWidget>(composer_widgets)
+    public Gee.List<Composer.Widget>? get_composer_widgets_for_account(Geary.AccountInformation account) {
+        Gee.LinkedList<Composer.Widget> ret = Geary.traverse<Composer.Widget>(composer_widgets)
             .filter(w => w.account.information == account)
             .to_linked_list();
 
diff --git a/src/client/application/geary-application.vala b/src/client/application/geary-application.vala
index 4cf4bc72..0baae273 100644
--- a/src/client/application/geary-application.vala
+++ b/src/client/application/geary-application.vala
@@ -434,7 +434,7 @@ public class GearyApplication : Gtk.Application {
         add_edit_accelerators(Action.Edit.UNDO, { "<Ctrl>Z" });
 
         MainWindow.add_accelerators(this);
-        ComposerWidget.add_accelerators(this);
+        Composer.Widget.add_accelerators(this);
         Components.Inspector.add_accelerators(this);
         Dialogs.ProblemDetailsDialog.add_accelerators(this);
 
diff --git a/src/client/components/main-window.vala b/src/client/components/main-window.vala
index 876df1a7..b37de490 100644
--- a/src/client/components/main-window.vala
+++ b/src/client/components/main-window.vala
@@ -567,7 +567,7 @@ public class MainWindow : Gtk.ApplicationWindow, Geary.BaseInterface {
     /** Displays a composer addressed to a specific email address. */
     public void open_composer_for_mailbox(Geary.RFC822.MailboxAddress to) {
         Application.Controller controller = this.application.controller;
-        ComposerWidget composer = new ComposerWidget(
+        Composer.Widget composer = new Composer.Widget(
             this.application, this.selected_folder.account, null, NEW_MESSAGE
         );
         composer.to = to.to_full_display();
@@ -577,10 +577,10 @@ public class MainWindow : Gtk.ApplicationWindow, Geary.BaseInterface {
     }
 
     /** Displays a composer in the window if possible, else in a new window. */
-    public void show_composer(ComposerWidget composer) {
+    public void show_composer(Composer.Widget composer) {
         if (this.has_composer) {
-            composer.state = ComposerWidget.ComposerState.DETACHED;
-            new ComposerWindow(composer, this.application);
+            composer.state = Composer.Widget.ComposerState.DETACHED;
+            new Composer.Window(composer, this.application);
         } else {
             this.conversation_viewer.do_compose(composer);
             get_window_action(ACTION_FIND_IN_CONVERSATION).set_enabled(false);
@@ -595,7 +595,7 @@ public class MainWindow : Gtk.ApplicationWindow, Geary.BaseInterface {
      */
     public bool close_composer() {
         bool closed = true;
-        ComposerWidget? composer = this.conversation_viewer.current_composer;
+        Composer.Widget? composer = this.conversation_viewer.current_composer;
         if (composer != null) {
             switch (composer.should_close()) {
             case DO_CLOSE:
@@ -1242,7 +1242,7 @@ public class MainWindow : Gtk.ApplicationWindow, Geary.BaseInterface {
         this.conversations = null;
     }
 
-    private void create_composer_from_viewer(ComposerWidget.ComposeType compose_type) {
+    private void create_composer_from_viewer(Composer.Widget.ComposeType compose_type) {
         Geary.Account? account = this.selected_account;
         ConversationEmail? email_view = null;
         ConversationListBox? list_view = this.conversation_viewer.current_list;
@@ -1514,7 +1514,7 @@ public class MainWindow : Gtk.ApplicationWindow, Geary.BaseInterface {
         if (event.keyval == Gdk.Key.Shift_L || event.keyval == Gdk.Key.Shift_R) {
             Gtk.Widget? focus = get_focus();
             if (focus == null ||
-                (!(focus is Gtk.Entry) && !(focus is ComposerWebView))) {
+                (!(focus is Gtk.Entry) && !(focus is Composer.WebView))) {
                 set_shift_key_down(event.type == Gdk.EventType.KEY_PRESS);
             }
         }
@@ -1715,7 +1715,7 @@ public class MainWindow : Gtk.ApplicationWindow, Geary.BaseInterface {
             // Check all known composers since the draft may be open
             // in a detached composer
             bool already_open = false;
-            foreach (ComposerWidget composer
+            foreach (Composer.Widget composer
                      in this.application.controller.get_composers()) {
                 if (composer.draft_id != null &&
                     composer.draft_id.equal_to(draft.id)) {
diff --git a/src/client/composer/composer-box.vala b/src/client/composer/composer-box.vala
index 9bf9f3e9..6f02dc16 100644
--- a/src/client/composer/composer-box.vala
+++ b/src/client/composer/composer-box.vala
@@ -8,13 +8,13 @@
  * A ComposerBox is a ComposerContainer that is used to compose mails in the main-window
  * (i.e. not-detached), yet separate from a conversation.
  */
-public class ComposerBox : Gtk.Frame, ComposerContainer {
+public class Composer.Box : Gtk.Frame, Container {
 
     public Gtk.ApplicationWindow top_window {
         get { return (Gtk.ApplicationWindow) get_toplevel(); }
     }
 
-    internal ComposerWidget composer { get; set; }
+    internal Widget composer { get; set; }
 
     protected Gee.MultiMap<string, string>? old_accelerators { get; set; }
 
@@ -24,7 +24,7 @@ public class ComposerBox : Gtk.Frame, ComposerContainer {
     public signal void vanished();
 
 
-    public ComposerBox(ComposerWidget composer) {
+    public Box(Widget composer) {
         this.composer = composer;
         this.composer.free_header();
 
@@ -48,7 +48,7 @@ public class ComposerBox : Gtk.Frame, ComposerContainer {
     public void vanish() {
         hide();
         this.main_toolbar.remove_conversation_header(composer.header);
-        this.composer.state = ComposerWidget.ComposerState.DETACHED;
+        this.composer.state = Widget.ComposerState.DETACHED;
         vanished();
     }
 
diff --git a/src/client/composer/composer-container.vala b/src/client/composer/composer-container.vala
index fe79d653..88e12366 100644
--- a/src/client/composer/composer-container.vala
+++ b/src/client/composer/composer-container.vala
@@ -7,10 +7,10 @@
 /**
  * A generic interface for widgets that have a single ComposerWidget-child.
  */
-public interface ComposerContainer {
+public interface Composer.Container {
 
     // The ComposerWidget-child.
-    internal abstract ComposerWidget composer { get; set; }
+    internal abstract Widget composer { get; set; }
 
     // We use old_accelerators to keep track of the accelerators we temporarily disabled.
     protected abstract Gee.MultiMap<string, string>? old_accelerators { get; set; }
diff --git a/src/client/composer/composer-embed.vala b/src/client/composer/composer-embed.vala
index ce2390e4..19ba05cc 100644
--- a/src/client/composer/composer-embed.vala
+++ b/src/client/composer/composer-embed.vala
@@ -8,7 +8,7 @@
  * A ComposerEmbed is a widget that is used to compose emails that are inlined into a
  * conversation view, e.g. for reply or forward mails.
  */
-public class ComposerEmbed : Gtk.EventBox, ComposerContainer {
+public class Composer.Embed : Gtk.EventBox, Container {
 
     private const int MIN_EDITOR_HEIGHT = 200;
 
@@ -18,7 +18,7 @@ public class ComposerEmbed : Gtk.EventBox, ComposerContainer {
         get { return (Gtk.ApplicationWindow) get_toplevel(); }
     }
 
-    internal ComposerWidget composer { get; set; }
+    internal Widget composer { get; set; }
 
     protected Gee.MultiMap<string, string>? old_accelerators { get; set; }
 
@@ -28,9 +28,9 @@ public class ComposerEmbed : Gtk.EventBox, ComposerContainer {
     public signal void vanished();
 
 
-    public ComposerEmbed(Geary.Email referred,
-                         ComposerWidget composer,
-                         Gtk.ScrolledWindow outer_scroller) {
+    public Embed(Geary.Email referred,
+                 Widget composer,
+                 Gtk.ScrolledWindow outer_scroller) {
         this.referred = referred;
         this.composer = composer;
         this.outer_scroller = outer_scroller;
@@ -179,7 +179,7 @@ public class ComposerEmbed : Gtk.EventBox, ComposerContainer {
 
     public void vanish() {
         hide();
-        this.composer.state = ComposerWidget.ComposerState.DETACHED;
+        this.composer.state = Widget.ComposerState.DETACHED;
         vanished();
     }
 
diff --git a/src/client/composer/composer-headerbar.vala b/src/client/composer/composer-headerbar.vala
index 337d6890..16c41ce7 100644
--- a/src/client/composer/composer-headerbar.vala
+++ b/src/client/composer/composer-headerbar.vala
@@ -5,11 +5,11 @@
  */
 
 [GtkTemplate (ui = "/org/gnome/Geary/composer-headerbar.ui")]
-public class ComposerHeaderbar : Gtk.HeaderBar {
+public class Composer.Headerbar : Gtk.HeaderBar {
 
     public Application.Configuration config { get; set; }
 
-    public ComposerWidget.ComposerState state { get; set; }
+    public Widget.ComposerState state { get; set; }
 
     public bool show_pending_attachments { get; set; default = false; }
 
@@ -32,7 +32,7 @@ public class ComposerHeaderbar : Gtk.HeaderBar {
     /** Fired when the user wants to expand a compact composer. */
     public signal void expand_composer();
 
-    public ComposerHeaderbar(Application.Configuration config, bool is_compact) {
+    public Headerbar(Application.Configuration config, bool is_compact) {
         this.config = config;
 
         this.recipients_button.set_visible(is_compact);
diff --git a/src/client/composer/composer-link-popover.vala b/src/client/composer/composer-link-popover.vala
index b1692b56..048c50f9 100644
--- a/src/client/composer/composer-link-popover.vala
+++ b/src/client/composer/composer-link-popover.vala
@@ -18,7 +18,7 @@
  *   an update, delete and open buttons.
  */
 [GtkTemplate (ui = "/org/gnome/Geary/composer-link-popover.ui")]
-public class ComposerLinkPopover : Gtk.Popover {
+public class Composer.LinkPopover : Gtk.Popover {
 
     private const string[] HTTP_SCHEMES = { "http", "https" };
     private const string[] OTHER_SCHEMES = {
@@ -71,7 +71,7 @@ public class ComposerLinkPopover : Gtk.Popover {
     public signal void link_delete();
 
 
-    public ComposerLinkPopover(Type type) {
+    public LinkPopover(Type type) {
         set_default_widget(this.url);
         set_focus_child(this.url);
         switch (type) {
diff --git a/src/client/composer/composer-web-view.vala b/src/client/composer/composer-web-view.vala
index 98770197..a7e467a0 100644
--- a/src/client/composer/composer-web-view.vala
+++ b/src/client/composer/composer-web-view.vala
@@ -9,7 +9,7 @@
 /**
  * A WebView for editing messages in the composer.
  */
-public class ComposerWebView : ClientWebView {
+public class Composer.WebView : ClientWebView {
 
 
     // WebKit message handler names
@@ -83,10 +83,10 @@ public class ComposerWebView : ClientWebView {
 
     public static new void load_resources()
         throws Error {
-        ComposerWebView.app_style = ClientWebView.load_app_stylesheet(
+        WebView.app_style = ClientWebView.load_app_stylesheet(
             "composer-web-view.css"
         );
-        ComposerWebView.app_script = ClientWebView.load_app_script(
+        WebView.app_script = ClientWebView.load_app_script(
             "composer-web-view.js"
         );
     }
@@ -112,13 +112,13 @@ public class ComposerWebView : ClientWebView {
     internal signal bool button_release_event_done(Gdk.Event event);
 
 
-    public ComposerWebView(Application.Configuration config) {
+    public WebView(Application.Configuration config) {
         base(config);
 
         add_events(Gdk.EventMask.KEY_PRESS_MASK | Gdk.EventMask.KEY_RELEASE_MASK);
 
-        this.user_content_manager.add_style_sheet(ComposerWebView.app_style);
-        this.user_content_manager.add_script(ComposerWebView.app_script);
+        this.user_content_manager.add_style_sheet(WebView.app_style);
+        this.user_content_manager.add_script(WebView.app_script);
 
         register_message_handler(CURSOR_CONTEXT_CHANGED, on_cursor_context_changed);
 
diff --git a/src/client/composer/composer-widget.vala b/src/client/composer/composer-widget.vala
index ea39c3a8..3dba017b 100644
--- a/src/client/composer/composer-widget.vala
+++ b/src/client/composer/composer-widget.vala
@@ -11,9 +11,13 @@ private errordomain AttachmentError {
     DUPLICATE
 }
 
-// The actual widget for sending messages. Should be put in a ComposerContainer
+/**
+ * A widget for editing an email message.
+ *
+ * Composers must always be placed in an instance of {@link Container}.
+ */
 [GtkTemplate (ui = "/org/gnome/Geary/composer-widget.ui")]
-public class ComposerWidget : Gtk.EventBox, Geary.BaseInterface {
+public class Composer.Widget : Gtk.EventBox, Geary.BaseInterface {
 
 
     /** The email fields the composer requires for referred email. */
@@ -248,9 +252,9 @@ public class ComposerWidget : Gtk.EventBox, Geary.BaseInterface {
         }
     }
 
-    public ComposerHeaderbar header { get; private set; }
+    public Headerbar header { get; private set; }
 
-    public ComposerWebView editor { get; private set; }
+    public WebView editor { get; private set; }
 
     public string window_title { get; set; }
 
@@ -396,8 +400,8 @@ public class ComposerWidget : Gtk.EventBox, Geary.BaseInterface {
     // Is the composer closing (e.g. saving a draft or sending)?
     private bool is_closing = false;
 
-    private ComposerContainer container {
-        get { return (ComposerContainer) parent; }
+    private Container container {
+        get { return (Container) parent; }
     }
 
     private GearyApplication application;
@@ -413,7 +417,7 @@ public class ComposerWidget : Gtk.EventBox, Geary.BaseInterface {
     public signal void subject_changed(string new_subject);
 
 
-    public ComposerWidget(GearyApplication application,
+    public Widget(GearyApplication application,
                           Geary.Account initial_account,
                           Geary.EmailIdentifier? draft_id,
                           ComposeType compose_type) {
@@ -440,7 +444,7 @@ public class ComposerWidget : Gtk.EventBox, Geary.BaseInterface {
             this.state = ComposerState.INLINE_COMPACT;
         }
 
-        this.header = new ComposerHeaderbar(
+        this.header = new Headerbar(
             application.config,
             this.state == ComposerState.INLINE_COMPACT
         );
@@ -494,7 +498,7 @@ public class ComposerWidget : Gtk.EventBox, Geary.BaseInterface {
         );
         update_subject_spell_checker();
 
-        this.editor = new ComposerWebView(application.config);
+        this.editor = new WebView(application.config);
         this.editor.set_hexpand(true);
         this.editor.set_vexpand(true);
         this.editor.content_loaded.connect(on_editor_content_loaded);
@@ -557,7 +561,7 @@ public class ComposerWidget : Gtk.EventBox, Geary.BaseInterface {
         load_entry_completions();
     }
 
-    ~ComposerWidget() {
+    ~Widget() {
         base_unref();
     }
 
@@ -580,9 +584,9 @@ public class ComposerWidget : Gtk.EventBox, Geary.BaseInterface {
         base.destroy();
     }
 
-    public ComposerWidget.from_mailto(GearyApplication application,
-                                      Geary.Account initial_account,
-                                      string mailto) {
+    public Widget.from_mailto(GearyApplication application,
+                              Geary.Account initial_account,
+                              string mailto) {
         this(application, initial_account, null, ComposeType.NEW_MESSAGE);
 
         Gee.HashMultiMap<string, string> headers = new Gee.HashMultiMap<string, string>();
@@ -1092,7 +1096,7 @@ public class ComposerWidget : Gtk.EventBox, Geary.BaseInterface {
 
                 if (this.state != ComposerState.PANED &&
                     this.state != ComposerState.DETACHED) {
-                    this.state = ComposerWidget.ComposerState.PANED;
+                    this.state = Widget.ComposerState.PANED;
                     // XXX move the two lines below to the controller
                     this.container.remove_composer();
                     GearyApplication.instance.controller.main_window.conversation_viewer.do_compose(this);
@@ -1272,7 +1276,7 @@ public class ComposerWidget : Gtk.EventBox, Geary.BaseInterface {
 
         Gtk.Widget? focused_widget = this.container.top_window.get_focus();
         this.container.remove_composer();
-        ComposerWindow new_window = new ComposerWindow(this, this.application);
+        Window new_window = new Window(this, this.application);
 
         // Workaround a GTK+ crasher, Bug 771812. When the composer is
         // re-parented, its menu_button's popover keeps a reference to
@@ -1287,15 +1291,14 @@ public class ComposerWidget : Gtk.EventBox, Geary.BaseInterface {
             this.application.config.compose_as_html
         );
 
-        this.state = ComposerWidget.ComposerState.DETACHED;
+        this.state = DETACHED;
         update_composer_view();
 
         // If the previously focused widget is in the new composer
         // window then focus that, else focus something useful.
         bool refocus = true;
         if (focused_widget != null) {
-            ComposerWindow? focused_window =
-                focused_widget.get_toplevel() as ComposerWindow;
+            Window? focused_window = focused_widget.get_toplevel() as Window;
             if (new_window == focused_window) {
                 focused_widget.grab_focus();
                 refocus = false;
@@ -2343,15 +2346,15 @@ public class ComposerWidget : Gtk.EventBox, Geary.BaseInterface {
         buffer.spell_checker = checker;
     }
 
-    private async ComposerLinkPopover new_link_popover(ComposerLinkPopover.Type type,
-                                                       string url) {
+    private async LinkPopover new_link_popover(LinkPopover.Type type,
+                                               string url) {
         var selection_id = "";
         try {
             selection_id = yield this.editor.save_selection();
         } catch (Error err) {
             debug("Error saving selection: %s", err.message);
         }
-        ComposerLinkPopover popover = new ComposerLinkPopover(type);
+        LinkPopover popover = new LinkPopover(type);
         popover.set_link_url(url);
         popover.closed.connect(() => {
                 this.editor.free_selection(selection_id);
@@ -2422,9 +2425,9 @@ public class ComposerWidget : Gtk.EventBox, Geary.BaseInterface {
             location.y = (int) button.y;
 
             this.new_link_popover.begin(
-                ComposerLinkPopover.Type.EXISTING_LINK, this.pointer_url,
+                LinkPopover.Type.EXISTING_LINK, this.pointer_url,
                 (obj, res) => {
-                    ComposerLinkPopover popover = this.new_link_popover.end(res);
+                    LinkPopover popover = this.new_link_popover.end(res);
                     popover.set_relative_to(this.editor);
                     popover.set_pointing_to(location);
                     popover.show();
@@ -2433,7 +2436,7 @@ public class ComposerWidget : Gtk.EventBox, Geary.BaseInterface {
         return Gdk.EVENT_PROPAGATE;
     }
 
-    private void on_cursor_context_changed(ComposerWebView.EditContext context) {
+    private void on_cursor_context_changed(WebView.EditContext context) {
         this.cursor_url = context.is_link ? context.link_url : null;
         update_cursor_actions();
 
@@ -2524,15 +2527,15 @@ public class ComposerWidget : Gtk.EventBox, Geary.BaseInterface {
     }
 
     private void on_insert_link(SimpleAction action, Variant? param) {
-        ComposerLinkPopover.Type type = ComposerLinkPopover.Type.NEW_LINK;
+        LinkPopover.Type type = LinkPopover.Type.NEW_LINK;
         string url = "https://";;
         if (this.cursor_url != null) {
-            type = ComposerLinkPopover.Type.EXISTING_LINK;
+            type = LinkPopover.Type.EXISTING_LINK;
             url = this.cursor_url;
         }
 
         this.new_link_popover.begin(type, url, (obj, res) => {
-                ComposerLinkPopover popover = this.new_link_popover.end(res);
+                LinkPopover popover = this.new_link_popover.end(res);
 
                 // We have to disconnect then reconnect the selection
                 // changed signal for the duration of the popover
diff --git a/src/client/composer/composer-window.vala b/src/client/composer/composer-window.vala
index 8a134ca4..f5a7ed83 100644
--- a/src/client/composer/composer-window.vala
+++ b/src/client/composer/composer-window.vala
@@ -8,7 +8,7 @@
  * A ComposerWindow is a ComposerContainer that is used to compose mails in a separate window
  * (i.e. detached) of its own.
  */
-public class ComposerWindow : Gtk.ApplicationWindow, ComposerContainer {
+public class Composer.Window : Gtk.ApplicationWindow, Container {
 
 
     private const string DEFAULT_TITLE = _("New Message");
@@ -23,13 +23,13 @@ public class ComposerWindow : Gtk.ApplicationWindow, ComposerContainer {
         get { return this; }
     }
 
-    internal ComposerWidget composer { get; set; }
+    internal Widget composer { get; set; }
 
     protected Gee.MultiMap<string, string>? old_accelerators { get; set; }
 
     private bool closing = false;
 
-    public ComposerWindow(ComposerWidget composer, GearyApplication application) {
+    public Window(Widget composer, GearyApplication application) {
         Object(application: application, type: Gtk.WindowType.TOPLEVEL);
         this.composer = composer;
         this.composer.header.detached();
@@ -111,7 +111,7 @@ public class ComposerWindow : Gtk.ApplicationWindow, ComposerContainer {
 
     public override bool delete_event(Gdk.EventAny event) {
         return !(this.closing ||
-            ((ComposerWidget) get_child()).should_close() == ComposerWidget.CloseStatus.DO_CLOSE);
+            ((Widget) get_child()).should_close() == Widget.CloseStatus.DO_CLOSE);
     }
 
     public void vanish() {
diff --git a/src/client/composer/email-entry.vala b/src/client/composer/email-entry.vala
index 0cc35a4a..2af610f7 100644
--- a/src/client/composer/email-entry.vala
+++ b/src/client/composer/email-entry.vala
@@ -16,11 +16,11 @@ public class EmailEntry : Gtk.Entry {
     // null or valid addresses
     public Geary.RFC822.MailboxAddresses? addresses { get; set; default = null; }
 
-    private weak ComposerWidget composer;
+    private weak Composer.Widget composer;
 
     private bool updating = false;
 
-    public EmailEntry(ComposerWidget composer) {
+    public EmailEntry(Composer.Widget composer) {
         changed.connect(on_changed);
         key_press_event.connect(on_key_press);
         this.composer = composer;
diff --git a/src/client/conversation-viewer/conversation-list-box.vala 
b/src/client/conversation-viewer/conversation-list-box.vala
index 04bd989d..1e636244 100644
--- a/src/client/conversation-viewer/conversation-list-box.vala
+++ b/src/client/conversation-viewer/conversation-list-box.vala
@@ -427,10 +427,10 @@ public class ConversationListBox : Gtk.ListBox, Geary.BaseInterface {
     internal class ComposerRow : ConversationRow {
 
         // The embedded composer for this row
-        public ComposerEmbed view { get; private set; }
+        public Composer.Embed view { get; private set; }
 
 
-        public ComposerRow(ComposerEmbed view) {
+        public ComposerRow(Composer.Embed view) {
             base(view.referred);
             this.view = view;
             this.is_expanded = true;
@@ -834,7 +834,7 @@ public class ConversationListBox : Gtk.ListBox, Geary.BaseInterface {
     /**
      * Adds an an embedded composer to the view.
      */
-    public void add_embedded_composer(ComposerEmbed embed, bool is_draft) {
+    public void add_embedded_composer(Composer.Embed embed, bool is_draft) {
         if (is_draft) {
             this.draft_id = embed.referred.id;
             EmailRow? draft = this.email_rows.get(embed.referred.id);
diff --git a/src/client/conversation-viewer/conversation-viewer.vala 
b/src/client/conversation-viewer/conversation-viewer.vala
index 661429b4..6ea1fe8d 100644
--- a/src/client/conversation-viewer/conversation-viewer.vala
+++ b/src/client/conversation-viewer/conversation-viewer.vala
@@ -20,7 +20,7 @@ public class ConversationViewer : Gtk.Stack, Geary.BaseInterface {
     }
 
     /** Returns the currently displayed composer if any. */
-    public ComposerWidget? current_composer {
+    public Composer.Widget? current_composer {
         get; private set; default = null;
     }
 
@@ -145,8 +145,8 @@ public class ConversationViewer : Gtk.Stack, Geary.BaseInterface {
     /**
      * Puts the view into composer mode, showing a full-height composer.
      */
-    public void do_compose(ComposerWidget composer) {
-        ComposerBox box = new ComposerBox(composer);
+    public void do_compose(Composer.Widget composer) {
+        Composer.Box box = new Composer.Box(composer);
         this.current_composer = composer;
 
         // XXX move the ConversationListView management code into
@@ -166,10 +166,10 @@ public class ConversationViewer : Gtk.Stack, Geary.BaseInterface {
     /**
      * Puts the view into composer mode, showing an embedded composer.
      */
-    public void do_compose_embedded(ComposerWidget composer,
+    public void do_compose_embedded(Composer.Widget composer,
                                     Geary.Email? referred) {
         this.current_composer = composer;
-        ComposerEmbed embed = new ComposerEmbed(
+        Composer.Embed embed = new Composer.Embed(
             referred,
             composer,
             this.conversation_scroller
diff --git a/test/client/composer/composer-web-view-test.vala 
b/test/client/composer/composer-web-view-test.vala
index 49b222ae..0b72d9d5 100644
--- a/test/client/composer/composer-web-view-test.vala
+++ b/test/client/composer/composer-web-view-test.vala
@@ -5,11 +5,11 @@
  * (version 2.1 or later). See the COPYING file in this distribution.
  */
 
-public class ComposerWebViewTest : ClientWebViewTestCase<ComposerWebView> {
+public class Composer.WebViewTest : ClientWebViewTestCase<Composer.WebView> {
 
 
-    public ComposerWebViewTest() {
-        base("ComposerWebViewTest");
+    public WebViewTest() {
+        base("Composer.WebViewTest");
         add_test("load_resources", load_resources);
         add_test("edit_context", edit_context);
         add_test("get_html", get_html);
@@ -28,22 +28,22 @@ public class ComposerWebViewTest : ClientWebViewTestCase<ComposerWebView> {
 
     public void load_resources() throws Error {
         try {
-            ComposerWebView.load_resources();
+            WebView.load_resources();
         } catch (Error err) {
             assert_not_reached();
         }
     }
 
     public void edit_context() throws Error {
-        assert(!(new ComposerWebView.EditContext("0,,,").is_link));
-        assert(new ComposerWebView.EditContext("1,,,").is_link);
-        assert(new ComposerWebView.EditContext("1,url,,").link_url == "url");
+        assert(!(new WebView.EditContext("0,,,").is_link));
+        assert(new WebView.EditContext("1,,,").is_link);
+        assert(new WebView.EditContext("1,url,,").link_url == "url");
 
-        assert(new ComposerWebView.EditContext("0,,Helvetica,").font_family == "sans");
-        assert(new ComposerWebView.EditContext("0,,Times New Roman,").font_family == "serif");
-        assert(new ComposerWebView.EditContext("0,,Courier,").font_family == "monospace");
+        assert(new WebView.EditContext("0,,Helvetica,").font_family == "sans");
+        assert(new WebView.EditContext("0,,Times New Roman,").font_family == "serif");
+        assert(new WebView.EditContext("0,,Courier,").font_family == "monospace");
 
-        assert(new ComposerWebView.EditContext("0,,,12").font_size == 12);
+        assert(new WebView.EditContext("0,,,12").font_size == 12);
     }
 
     public void get_html() throws GLib.Error {
@@ -51,7 +51,7 @@ public class ComposerWebViewTest : ClientWebViewTestCase<ComposerWebView> {
         load_body_fixture(BODY);
         this.test_view.get_html.begin((obj, ret) => { async_complete(ret); });
         string html = this.test_view.get_html.end(async_result());
-        assert_string(ComposerPageStateTest.CLEAN_BODY_TEMPLATE.printf(BODY), html);
+        assert_string(PageStateTest.CLEAN_BODY_TEMPLATE.printf(BODY), html);
     }
 
     public void get_html_for_draft() throws GLib.Error {
@@ -59,7 +59,7 @@ public class ComposerWebViewTest : ClientWebViewTestCase<ComposerWebView> {
         load_body_fixture(BODY);
         this.test_view.get_html_for_draft.begin((obj, ret) => { async_complete(ret); });
         string html = this.test_view.get_html.end(async_result());
-        assert_string(ComposerPageStateTest.COMPLETE_BODY_TEMPLATE.printf(BODY), html);
+        assert_string(PageStateTest.COMPLETE_BODY_TEMPLATE.printf(BODY), html);
     }
 
     public void get_text() throws Error {
@@ -242,8 +242,8 @@ long, long, long, long, long, long, long, long, long, long,
         assert_false(SIG2 in html, "Signature 2 still present");
     }
 
-    protected override ComposerWebView set_up_test_view() {
-        return new ComposerWebView(this.config);
+    protected override Composer.WebView set_up_test_view() {
+        return new Composer.WebView(this.config);
     }
 
     protected override void load_body_fixture(string html = "") {
diff --git a/test/js/composer-page-state-test.vala b/test/js/composer-page-state-test.vala
index 197efeff..a9af1a78 100644
--- a/test/js/composer-page-state-test.vala
+++ b/test/js/composer-page-state-test.vala
@@ -5,7 +5,7 @@
  * (version 2.1 or later). See the COPYING file in this distribution.
  */
 
-class ComposerPageStateTest : ClientWebViewTestCase<ComposerWebView> {
+class Composer.PageStateTest : ClientWebViewTestCase<Composer.WebView> {
 
     public const string COMPLETE_BODY_TEMPLATE =
         """<div id="geary-body" dir="auto">%s<div><br></div><div><br></div></div><div id="geary-signature" 
dir="auto"></div>""";
@@ -16,8 +16,8 @@ class ComposerPageStateTest : ClientWebViewTestCase<ComposerWebView> {
 """;
     public const string CLEAN_BODY_TEMPLATE = """<div id="geary-body" 
dir="auto">%s<div><br></div><div><br></div></div>""";
 
-    public ComposerPageStateTest() {
-        base("ComposerPageStateTest");
+    public PageStateTest() {
+        base("Composer.PageStateTest");
         add_test("html_to_text", html_to_text);
         add_test("html_to_text_with_quote", html_to_text_with_quote);
         add_test("html_to_text_with_nested_quote", html_to_text_with_nested_quote);
@@ -34,7 +34,7 @@ class ComposerPageStateTest : ClientWebViewTestCase<ComposerWebView> {
         add_test("replace_non_breaking_space", replace_non_breaking_space);
 
         try {
-            ComposerWebView.load_resources();
+            WebView.load_resources();
         } catch (Error err) {
             assert_not_reached();
         }
@@ -418,8 +418,8 @@ I can send email through smtp.gmail.com:587 or through <a href="https://www.gmai
         }
     }
 
-    protected override ComposerWebView set_up_test_view() {
-        return new ComposerWebView(this.config);
+    protected override Composer.WebView set_up_test_view() {
+        return new Composer.WebView(this.config);
     }
 
     protected override void load_body_fixture(string body = "") {
diff --git a/test/test-client.vala b/test/test-client.vala
index 72486677..2b9be70b 100644
--- a/test/test-client.vala
+++ b/test/test-client.vala
@@ -51,7 +51,7 @@ int main(string[] args) {
     client.add_suite(new Accounts.ManagerTest().get_suite());
     client.add_suite(new Application.ConfigurationTest().get_suite());
     client.add_suite(new ClientWebViewTest().get_suite());
-    client.add_suite(new ComposerWebViewTest().get_suite());
+    client.add_suite(new Composer.WebViewTest().get_suite());
     client.add_suite(new GearyApplicationTest().get_suite());
     client.add_suite(new Util.Avatar.Test().get_suite());
     client.add_suite(new Util.Cache.Test().get_suite());
@@ -61,7 +61,7 @@ int main(string[] args) {
     TestSuite js = new TestSuite("js");
 
     js.add_suite(new ClientPageStateTest().get_suite());
-    js.add_suite(new ComposerPageStateTest().get_suite());
+    js.add_suite(new Composer.PageStateTest().get_suite());
     js.add_suite(new ConversationPageStateTest().get_suite());
 
     /*



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]