1/* 2 * Copyright © 2020 Michael Gratton <mike@vee.net> 3 * 4 * This software is licensed under the GNU Lesser General Public License 5 * (version 2.1 or later). See the COPYING file in this distribution. 6 */ 7 8 9/** 10 * Application interface for objects that manage accounts. 11 * 12 * This interface allows non-core application components to access the 13 * application's account context objects. Typically this is 14 * implemented by {@link Controller}. 15 * 16 * It also supports unit testing these components without having to 17 * load the complete application by providing mock instances of this 18 * interface instead of a fully initialised controller. 19 */ 20internal interface Application.AccountInterface : GLib.Object { 21 22 /** 23 * Emitted when an account is added or is enabled. 24 * 25 * This will be emitted after an account is opened and added to 26 * the controller. 27 * 28 * The `is_startup` argument will be true if the application is in 29 * the middle of starting up, otherwise if the account was newly 30 * added when the application was already running then it will be 31 * false. 32 */ 33 public signal void account_available( 34 AccountContext context, 35 bool is_startup 36 ); 37 38 /** 39 * Emitted when an account is removed or is disabled. 40 * 41 * This will be emitted after the account is removed from the 42 * controller's collection of accounts, but before the {@link 43 * AccountContext.cancellable} is cancelled and before the account 44 * itself is closed. 45 * 46 * The `is_shutdown` argument will be true if the application is 47 * in the middle of quitting, otherwise if the account was simply 48 * removed but the application will keep running, then it will be 49 * false. 50 */ 51 public signal void account_unavailable( 52 AccountContext context, 53 bool is_shutdown 54 ); 55 56 /** Returns a context for an account, if any. */ 57 internal abstract AccountContext? get_context_for_account(Geary.AccountInformation account); 58 59 /** Returns a read-only collection of contexts each active account. */ 60 internal abstract Gee.Collection<AccountContext> get_account_contexts(); 61 62 63} 64