diff --git a/src/client/application/application-controller.vala b/src/client/application/application-controller.vala index 1339a034..7f0593d5 100644 --- a/src/client/application/application-controller.vala +++ b/src/client/application/application-controller.vala @@ -992,7 +992,6 @@ internal class Application.Controller : account.notify["current-status"].connect( on_account_status_notify ); - account.email_removed.connect(on_account_email_removed); account.folders_available_unavailable.connect(on_folders_available_unavailable); account.report_problem.connect(on_report_problem); @@ -1001,8 +1000,6 @@ internal class Application.Controller : ); if (smtp != null) { smtp.email_sent.connect(on_sent); - smtp.sending_monitor.start.connect(on_sending_started); - smtp.sending_monitor.finish.connect(on_sending_finished); } // Notify before opening so that listeners have a chance to @@ -1077,7 +1074,6 @@ internal class Application.Controller : on_account_status_notify ); - account.email_removed.disconnect(on_account_email_removed); account.folders_available_unavailable.disconnect(on_folders_available_unavailable); Geary.Smtp.ClientService? smtp = ( @@ -1085,8 +1081,6 @@ internal class Application.Controller : ); if (smtp != null) { smtp.email_sent.disconnect(on_sent); - smtp.sending_monitor.start.disconnect(on_sending_started); - smtp.sending_monitor.finish.disconnect(on_sending_finished); } // Now the account is not in the accounts map, reset any @@ -1303,28 +1297,6 @@ internal class Application.Controller : update_account_status(); } - private void on_account_email_removed(Geary.Folder folder, - Gee.Collection ids) { - if (folder.used_as == OUTBOX) { - foreach (MainWindow window in this.application.get_main_windows()) { - window.status_bar.deactivate_message(StatusBar.Message.OUTBOX_SEND_FAILURE); - window.status_bar.deactivate_message(StatusBar.Message.OUTBOX_SAVE_SENT_MAIL_FAILED); - } - } - } - - private void on_sending_started() { - foreach (MainWindow window in this.application.get_main_windows()) { - window.status_bar.activate_message(StatusBar.Message.OUTBOX_SENDING); - } - } - - private void on_sending_finished() { - foreach (MainWindow window in this.application.get_main_windows()) { - window.status_bar.deactivate_message(StatusBar.Message.OUTBOX_SENDING); - } - } - // Returns true if the caller should try opening the account again private async bool account_database_error_async(Geary.Account account) { bool retry = true; diff --git a/src/client/application/application-main-window.vala b/src/client/application/application-main-window.vala index 67da6b71..92ed7f1c 100644 --- a/src/client/application/application-main-window.vala +++ b/src/client/application/application-main-window.vala @@ -73,8 +73,6 @@ public class Application.MainWindow : private const string CONVERSATION_LIST = "conversation_list"; private const string CONVERSATION_VIEWER = "conversation_viewer"; - private const int STATUS_BAR_HEIGHT = 18; - private const int UPDATE_UI_INTERVAL = 60; private const int MIN_CONVERSATION_COUNT = 50; @@ -370,12 +368,8 @@ public class Application.MainWindow : get; private set; default = new Components.InfoBarStack(PRIORITY_QUEUE); } - public StatusBar status_bar { get; private set; default = new StatusBar(); } - private Controller controller; - private MonitoredSpinner spinner = new MonitoredSpinner(); - private Gee.Set accounts = new Gee.HashSet(); private GLib.SimpleActionGroup edit_actions = new GLib.SimpleActionGroup(); @@ -406,7 +400,6 @@ public class Application.MainWindow : // Folds the folder list and the conversation list [GtkChild] private unowned Hdy.Leaflet inner_leaflet; - [GtkChild] private unowned Gtk.Box folder_box; [GtkChild] private unowned Gtk.ScrolledWindow folder_list_scrolled; [GtkChild] private unowned Gtk.Box conversation_list_box; @@ -607,7 +600,6 @@ public class Application.MainWindow : }); setup_layout(application.config); - this.folder_box.pack_start(status_bar, false, false); update_command_actions(); update_conversation_actions(NONE); @@ -1387,13 +1379,7 @@ public class Application.MainWindow : } ); - // Status bar - this.status_bar.set_size_request(-1, STATUS_BAR_HEIGHT); - this.status_bar.set_border_width(2); - this.spinner.set_size_request(STATUS_BAR_HEIGHT - 2, -1); - this.spinner.set_progress_monitor(progress_monitor); - this.status_bar.add(this.spinner); - this.status_bar.show_all(); + this.application_headerbar.spinner.set_progress_monitor(progress_monitor); this.conversation_list_actions.set_mark_inverted(); diff --git a/src/client/components/components-headerbar-application.vala b/src/client/components/components-headerbar-application.vala index 39ca1312..66bc9c29 100644 --- a/src/client/components/components-headerbar-application.vala +++ b/src/client/components/components-headerbar-application.vala @@ -17,6 +17,7 @@ public class Components.ApplicationHeaderBar : Hdy.HeaderBar { [GtkChild] private unowned Gtk.MenuButton app_menu_button; + [GtkChild] public unowned MonitoredSpinner spinner; construct { diff --git a/src/client/components/status-bar.vala b/src/client/components/status-bar.vala deleted file mode 100644 index 6b71a911..00000000 --- a/src/client/components/status-bar.vala +++ /dev/null @@ -1,107 +0,0 @@ -/* Copyright 2016 Software Freedom Conservancy Inc. - * - * This software is licensed under the GNU Lesser General Public License - * (version 2.1 or later). See the COPYING file in this distribution. - */ - -/** - * A wrapper around Gtk.Statusbar that predefines messages and context areas so - * you don't have to keep track of them elsewhere. You can activate and - * deactivate messages, instead of worrying about context areas and stacks. - * Internally, activations are reference counted, and every new activation - * pushes the message to the top of its context area's stack. Only when - * the number of deactivations equals the number of activations is the message - * removed from the stack entirely. - */ -public class StatusBar : Gtk.Statusbar { - public enum Message { - OUTBOX_SENDING, - OUTBOX_SEND_FAILURE, - OUTBOX_SAVE_SENT_MAIL_FAILED; - - internal string get_text() { - switch (this) { - case Message.OUTBOX_SENDING: - /// Displayed in the space-limited status bar while a message is in the process of being sent. - return _("Sending…"); - case Message.OUTBOX_SEND_FAILURE: - /// Displayed in the space-limited status bar when a message fails to be sent due to error. - return _("Error sending email"); - case Message.OUTBOX_SAVE_SENT_MAIL_FAILED: - // Displayed in the space-limited status bar when a message fails to be uploaded - // to Sent Mail after being sent. - return _("Error saving sent mail"); - default: - assert_not_reached(); - } - } - - internal Context get_context() { - switch (this) { - case Message.OUTBOX_SENDING: - return Context.OUTBOX; - case Message.OUTBOX_SEND_FAILURE: - return Context.OUTBOX; - case Message.OUTBOX_SAVE_SENT_MAIL_FAILED: - return Context.OUTBOX; - default: - assert_not_reached(); - } - } - } - - internal enum Context { - OUTBOX, - } - - private Gee.HashMap context_ids = new Gee.HashMap(); - private Gee.HashMap message_ids = new Gee.HashMap(); - private Gee.HashMap message_counts = new Gee.HashMap(); - - public StatusBar() { - set_context_id(Context.OUTBOX); - } - - private void set_context_id(Context context) { - context_ids.set(context, get_context_id(context.to_string())); - } - - private int get_count(Message message) { - return (message_counts.has_key(message) ? message_counts.get(message) : 0); - } - - private void push_message(Message message) { - message_ids.set(message, push(context_ids.get(message.get_context()), message.get_text())); - } - - private void remove_message(Message message) { - remove(context_ids.get(message.get_context()), message_ids.get(message)); - message_ids.unset(message); - } - - /** - * Return whether the message has been activated more times than it has - * been deactivated. - */ - public bool is_message_active(Message message) { - return message_ids.has_key(message); - } - - public void activate_message(Message message) { - if (is_message_active(message)) - remove_message(message); - - push_message(message); - message_counts.set(message, get_count(message) + 1); - } - - public void deactivate_message(Message message) { - if (!is_message_active(message)) - return; - - int count = get_count(message); - if (count == 1) - remove_message(message); - message_counts.set(message, count - 1); - } -} diff --git a/src/client/meson.build b/src/client/meson.build index 89008d0f..e12d2e29 100644 --- a/src/client/meson.build +++ b/src/client/meson.build @@ -72,7 +72,6 @@ client_vala_sources = files( 'components/icon-factory.vala', 'components/monitored-progress-bar.vala', 'components/monitored-spinner.vala', - 'components/status-bar.vala', 'components/stock.vala', 'composer/composer-application-interface.vala', diff --git a/ui/components-headerbar-application.ui b/ui/components-headerbar-application.ui index c68db056..05fef7ef 100644 --- a/ui/components-headerbar-application.ui +++ b/ui/components-headerbar-application.ui @@ -5,6 +5,15 @@