[geary/wip/768975-service-info: 1/4] Miscellaneous whitespace changes.
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/768975-service-info: 1/4] Miscellaneous whitespace changes.
- Date: Thu, 12 Oct 2017 02:54:55 +0000 (UTC)
commit 1370ffba18a017ba0f8091d7ab29bc75ec64d3b3
Author: Oskar Viljasaar <oskar viljasaar gmail com>
Date: Fri Jul 14 16:00:45 2017 +0200
Miscellaneous whitespace changes.
src/client/application/geary-controller.vala | 14 ++--
src/engine/api/geary-account-information.vala | 142 ++++++++++++------------
src/engine/api/geary-engine.vala | 12 +-
3 files changed, 84 insertions(+), 84 deletions(-)
---
diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala
index b263530..72ce93d 100644
--- a/src/client/application/geary-controller.vala
+++ b/src/client/application/geary-controller.vala
@@ -126,7 +126,7 @@ public class GearyController : Geary.BaseObject {
private Geary.Nonblocking.Mutex untrusted_host_prompt_mutex = new Geary.Nonblocking.Mutex();
private Gee.HashSet<Geary.Endpoint> validating_endpoints = new Gee.HashSet<Geary.Endpoint>();
private Geary.Revokable? revokable = null;
-
+
// List of windows we're waiting to close before Geary closes.
private Gee.List<ComposerWidget> waiting_to_close = new Gee.ArrayList<ComposerWidget>();
@@ -464,7 +464,7 @@ public class GearyController : Geary.BaseObject {
mark_unread.label = _("Mark as _Unread");
entries += mark_unread;
add_accelerator("<Shift>U", ACTION_MARK_AS_UNREAD);
-
+
Gtk.ActionEntry mark_starred = { ACTION_MARK_AS_STARRED, "star-symbolic", TRANSLATABLE, "S", null,
on_mark_as_starred };
mark_starred.label = _("_Star");
@@ -474,13 +474,13 @@ public class GearyController : Geary.BaseObject {
null, on_mark_as_unstarred };
mark_unstarred.label = _("U_nstar");
entries += mark_unstarred;
-
+
Gtk.ActionEntry mark_spam = { ACTION_MARK_AS_SPAM, null, TRANSLATABLE, "<Ctrl>J", null,
on_mark_as_spam };
mark_spam.label = MARK_AS_SPAM_LABEL;
entries += mark_spam;
add_accelerator("exclam", ACTION_MARK_AS_SPAM); // Exclamation mark (!)
-
+
Gtk.ActionEntry copy_menu = { ACTION_COPY_MENU, null, TRANSLATABLE, "L",
_("Add label"), null };
copy_menu.label = _("_Label");
@@ -543,7 +543,7 @@ public class GearyController : Geary.BaseObject {
Gtk.ActionEntry empty_trash = { ACTION_EMPTY_TRASH, null, null, null, null, on_empty_trash };
empty_trash.label = _("Empty _Trash…");
entries += empty_trash;
-
+
Gtk.ActionEntry undo = { ACTION_UNDO, "edit-undo-symbolic", null, "<Ctrl>Z", null, on_revoke };
entries += undo;
@@ -622,7 +622,7 @@ public class GearyController : Geary.BaseObject {
account.email_removed.connect(on_account_email_removed);
connect_account_async.begin(account, cancellable_open_account);
}
-
+
private void close_account(Geary.Account account) {
account.report_problem.disconnect(on_report_problem);
account.email_removed.disconnect(on_account_email_removed);
@@ -935,7 +935,7 @@ public class GearyController : Geary.BaseObject {
real_account_information = get_real_account_information(account_information);
real_account_information.copy_from(account_information);
}
-
+
real_account_information.store_async.begin(cancellable);
do_update_stored_passwords_async.begin(Geary.ServiceFlag.IMAP | Geary.ServiceFlag.SMTP,
real_account_information);
diff --git a/src/engine/api/geary-account-information.vala b/src/engine/api/geary-account-information.vala
index c2a34b3..2766013 100644
--- a/src/engine/api/geary-account-information.vala
+++ b/src/engine/api/geary-account-information.vala
@@ -6,7 +6,7 @@
public class Geary.AccountInformation : BaseObject {
public const string PROP_NICKNAME = "nickname"; // Name of nickname property.
-
+
private const string GROUP = "AccountInformation";
private const string REAL_NAME_KEY = "real_name";
private const string NICKNAME_KEY = "nickname";
@@ -38,23 +38,23 @@ public class Geary.AccountInformation : BaseObject {
private const string SAVE_DRAFTS_KEY = "save_drafts";
private const string USE_EMAIL_SIGNATURE_KEY = "use_email_signature";
private const string EMAIL_SIGNATURE_KEY = "email_signature";
-
+
//
// "Retired" keys
//
-
+
/*
* key: "imap_pipeline"
* value: bool
*/
-
+
public const string SETTINGS_FILENAME = "geary.ini";
public const int DEFAULT_PREFETCH_PERIOD_DAYS = 14;
-
+
public static int default_ordinal = 0;
-
+
private static Gee.HashMap<string, Geary.Endpoint>? known_endpoints = null;
-
+
/**
* Location account information is stored (as well as other data, including database and
* attachment files.
@@ -184,11 +184,11 @@ public class Geary.AccountInformation : BaseObject {
public bool smtp_remember_password { get; set; default = true; }
public bool save_drafts { get; set; default = true; }
-
+
private bool _save_sent_mail = true;
private Endpoint? imap_endpoint = null;
private Endpoint? smtp_endpoint = null;
-
+
/**
* Indicates the supplied {@link Endpoint} has reported TLS certificate warnings during
* connection.
@@ -321,29 +321,29 @@ public class Geary.AccountInformation : BaseObject {
~AccountInformation() {
if (imap_endpoint != null)
imap_endpoint.untrusted_host.disconnect(on_imap_untrusted_host);
-
+
if (smtp_endpoint != null)
smtp_endpoint.untrusted_host.disconnect(on_smtp_untrusted_host);
}
-
+
internal static void init() {
known_endpoints = new Gee.HashMap<string, Geary.Endpoint>();
}
-
+
private static Geary.Endpoint get_shared_endpoint(Service service, Endpoint endpoint) {
string key = "%s/%s:%u".printf(service.user_label(), endpoint.remote_address.hostname,
endpoint.remote_address.port);
-
+
// if already known, prefer it over this one
if (known_endpoints.has_key(key))
return known_endpoints.get(key);
-
+
// save for future use and return this one
known_endpoints.set(key, endpoint);
-
+
return endpoint;
}
-
+
// Copies all data from the "from" object into this one.
public void copy_from(AccountInformation from) {
this.id = from.id;
@@ -391,10 +391,10 @@ public class Geary.AccountInformation : BaseObject {
if (alternate_mailboxes != null)
all.add_all(alternate_mailboxes);
-
+
return all;
}
-
+
/**
* Add an alternate email address to the account.
*
@@ -403,11 +403,11 @@ public class Geary.AccountInformation : BaseObject {
public void add_alternate_mailbox(Geary.RFC822.MailboxAddress mailbox) {
if (alternate_mailboxes == null)
alternate_mailboxes = new Gee.ArrayList<RFC822.MailboxAddress>();
-
+
if (!alternate_mailboxes.contains(mailbox))
alternate_mailboxes.add(mailbox);
}
-
+
/**
* Replaces the list of alternate email addresses with the supplied collection.
*
@@ -415,14 +415,14 @@ public class Geary.AccountInformation : BaseObject {
*/
public void replace_alternate_mailboxes(Gee.Collection<Geary.RFC822.MailboxAddress>? mailboxes) {
alternate_mailboxes = null;
-
+
if (mailboxes == null || mailboxes.size == 0)
return;
-
+
foreach (RFC822.MailboxAddress mailbox in mailboxes)
add_alternate_mailbox(mailbox);
}
-
+
/**
* Return whether this account allows setting the save_sent_mail option.
* If not, save_sent_mail will always be true and setting it will be
@@ -445,7 +445,7 @@ public class Geary.AccountInformation : BaseObject {
switch (special) {
case Geary.SpecialFolderType.DRAFTS:
return drafts_folder_path;
-
+
case Geary.SpecialFolderType.SENT:
return sent_mail_folder_path;
@@ -513,13 +513,13 @@ public class Geary.AccountInformation : BaseObject {
if (services.has_imap()) {
yield Geary.Engine.instance.authentication_mediator.clear_password_async(
Service.IMAP, this);
-
+
if (imap_credentials != null)
imap_credentials.pass = null;
} else if (services.has_smtp()) {
yield Geary.Engine.instance.authentication_mediator.clear_password_async(
Service.SMTP, this);
-
+
if (smtp_credentials != null)
smtp_credentials.pass = null;
}
@@ -533,19 +533,19 @@ public class Geary.AccountInformation : BaseObject {
if (services.has_smtp() && smtp_credentials != null && !smtp_credentials.is_complete())
get_services |= ServiceFlag.SMTP;
-
+
ServiceFlag unset_services = services;
if (get_services != 0)
unset_services = yield get_passwords_async(get_services);
else
return true;
-
+
if (unset_services == 0)
return true;
-
+
return yield prompt_passwords_async(unset_services);
}
-
+
private void check_mediator_instance() throws EngineError {
if (Geary.Engine.instance.authentication_mediator == null)
throw new EngineError.OPEN_REQUIRED(
@@ -562,7 +562,7 @@ public class Geary.AccountInformation : BaseObject {
// See above. Same argument.
smtp_credentials = new Credentials(smtp_credentials.user, smtp_password);
}
-
+
/**
* Use Engine's authentication mediator to retrieve the passwords for the
* given services. The passwords will be stored in the appropriate
@@ -573,13 +573,13 @@ public class Geary.AccountInformation : BaseObject {
*/
public async ServiceFlag get_passwords_async(ServiceFlag services) throws Error {
check_mediator_instance();
-
+
CredentialsMediator mediator = Geary.Engine.instance.authentication_mediator;
ServiceFlag failed_services = 0;
-
+
if (services.has_imap()) {
string? imap_password = yield mediator.get_password_async(Service.IMAP, this);
-
+
if (imap_password != null)
set_imap_password(imap_password);
else
@@ -588,16 +588,16 @@ public class Geary.AccountInformation : BaseObject {
if (services.has_smtp() && smtp_credentials != null) {
string? smtp_password = yield mediator.get_password_async(Service.SMTP, this);
-
+
if (smtp_password != null)
set_smtp_password(smtp_password);
else
failed_services |= ServiceFlag.SMTP;
}
-
+
return failed_services;
}
-
+
/**
* Use the Engine's authentication mediator to prompt for the passwords for
* the given services. The passwords will be stored in the appropriate
@@ -608,49 +608,49 @@ public class Geary.AccountInformation : BaseObject {
*/
public async bool prompt_passwords_async(ServiceFlag services) throws Error {
check_mediator_instance();
-
+
string? imap_password, smtp_password;
bool imap_remember_password, smtp_remember_password;
-
+
if (smtp_credentials == null)
services &= ~ServiceFlag.SMTP;
-
+
if (!yield Geary.Engine.instance.authentication_mediator.prompt_passwords_async(
services, this, out imap_password, out smtp_password,
out imap_remember_password, out smtp_remember_password))
return false;
-
+
if (services.has_imap()) {
set_imap_password(imap_password);
this.imap_remember_password = imap_remember_password;
}
-
+
if (services.has_smtp()) {
set_smtp_password(smtp_password);
this.smtp_remember_password = smtp_remember_password;
}
yield update_stored_passwords_async(services);
-
+
return true;
}
-
+
/**
* Use the Engine's authentication mediator to set or clear the passwords
* for the given services in the key store.
*/
public async void update_stored_passwords_async(ServiceFlag services) throws Error {
check_mediator_instance();
-
+
CredentialsMediator mediator = Geary.Engine.instance.authentication_mediator;
-
+
if (services.has_imap()) {
if (imap_remember_password)
yield mediator.set_password_async(Service.IMAP, this);
else
yield mediator.clear_password_async(Service.IMAP, this);
}
-
+
if (services.has_smtp() && smtp_credentials != null) {
if (smtp_remember_password)
yield mediator.set_password_async(Service.SMTP, this);
@@ -658,7 +658,7 @@ public class Geary.AccountInformation : BaseObject {
yield mediator.clear_password_async(Service.SMTP, this);
}
}
-
+
/**
* Returns the {@link Endpoint} for the account's IMAP service.
*
@@ -669,27 +669,27 @@ public class Geary.AccountInformation : BaseObject {
public Endpoint get_imap_endpoint() {
if (imap_endpoint != null)
return imap_endpoint;
-
+
switch (service_provider) {
case ServiceProvider.GMAIL:
imap_endpoint = ImapEngine.GmailAccount.generate_imap_endpoint();
break;
-
+
case ServiceProvider.YAHOO:
imap_endpoint = ImapEngine.YahooAccount.generate_imap_endpoint();
break;
-
+
case ServiceProvider.OUTLOOK:
imap_endpoint = ImapEngine.OutlookAccount.generate_imap_endpoint();
break;
-
+
case ServiceProvider.OTHER:
Endpoint.Flags imap_flags = Endpoint.Flags.NONE;
if (default_imap_server_ssl)
imap_flags |= Endpoint.Flags.SSL;
if (default_imap_server_starttls)
imap_flags |= Endpoint.Flags.STARTTLS;
-
+
imap_endpoint = new Endpoint(default_imap_server_host, default_imap_server_port,
imap_flags, Imap.ClientConnection.RECOMMENDED_TIMEOUT_SEC);
break;
@@ -697,22 +697,22 @@ public class Geary.AccountInformation : BaseObject {
default:
assert_not_reached();
}
-
+
// look for existing one in the global pool; want to use that because Endpoint is mutable
// and signalled in such a way that it's better to share them
imap_endpoint = get_shared_endpoint(Service.IMAP, imap_endpoint);
-
+
// bind shared Endpoint signal to this AccountInformation's signal
imap_endpoint.untrusted_host.connect(on_imap_untrusted_host);
-
+
return imap_endpoint;
}
-
+
private void on_imap_untrusted_host(Endpoint endpoint, Endpoint.SecurityType security,
TlsConnection cx) {
untrusted_host(endpoint, security, cx, Service.IMAP);
}
-
+
/**
* Returns the {@link Endpoint} for the account's SMTP service.
*
@@ -736,22 +736,22 @@ public class Geary.AccountInformation : BaseObject {
case ServiceProvider.OUTLOOK:
smtp_endpoint = ImapEngine.OutlookAccount.generate_smtp_endpoint();
break;
-
+
case ServiceProvider.OTHER:
Endpoint.Flags smtp_flags = Endpoint.Flags.NONE;
if (default_smtp_server_ssl)
smtp_flags |= Endpoint.Flags.SSL;
if (default_smtp_server_starttls)
smtp_flags |= Endpoint.Flags.STARTTLS;
-
+
smtp_endpoint = new Endpoint(default_smtp_server_host, default_smtp_server_port,
smtp_flags, Smtp.ClientConnection.DEFAULT_TIMEOUT_SEC);
break;
-
+
default:
assert_not_reached();
}
-
+
// look for existing one in the global pool; want to use that because Endpoint is mutable
// and signalled in such a way that it's better to share them
smtp_endpoint = get_shared_endpoint(Service.SMTP, smtp_endpoint);
@@ -766,7 +766,7 @@ public class Geary.AccountInformation : BaseObject {
TlsConnection cx) {
untrusted_host(endpoint, security, cx, Service.SMTP);
}
-
+
public Geary.Endpoint get_endpoint_for_service(Geary.Service service) {
switch (service) {
case Service.IMAP:
@@ -774,7 +774,7 @@ public class Geary.AccountInformation : BaseObject {
case Service.SMTP:
return get_smtp_endpoint();
-
+
default:
assert_not_reached();
}
@@ -789,7 +789,7 @@ public class Geary.AccountInformation : BaseObject {
path = path.get_child(parts.get(i));
return path;
}
-
+
private string get_string_value(KeyFile key_file, string group, string key, string def = "") {
try {
return key_file.get_value(group, key);
@@ -941,30 +941,30 @@ public class Geary.AccountInformation : BaseObject {
debug("Error writing to account info file: %s", err.message);
}
}
-
+
public async void clear_stored_passwords_async(ServiceFlag services) throws Error {
Error? return_error = null;
check_mediator_instance();
CredentialsMediator mediator = Geary.Engine.instance.authentication_mediator;
-
+
try {
if (services.has_imap())
yield mediator.clear_password_async(Service.IMAP, this);
} catch (Error e) {
return_error = e;
}
-
+
try {
if (services.has_smtp() && smtp_credentials != null)
yield mediator.clear_password_async(Service.SMTP, this);
} catch (Error e) {
return_error = e;
}
-
+
if (return_error != null)
throw return_error;
}
-
+
/**
* Deletes an account from disk. This is used by Geary.Engine and should not
* normally be invoked directly.
@@ -981,7 +981,7 @@ public class Geary.AccountInformation : BaseObject {
} else {
yield Files.recursive_delete_async(config_dir, cancellable);
}
-
+
try {
yield clear_stored_passwords_async(ServiceFlag.IMAP | ServiceFlag.SMTP);
} catch (Error e) {
diff --git a/src/engine/api/geary-engine.vala b/src/engine/api/geary-engine.vala
index 54031d6..d25feff 100644
--- a/src/engine/api/geary-engine.vala
+++ b/src/engine/api/geary-engine.vala
@@ -145,10 +145,10 @@ public class Geary.Engine : BaseObject {
// initialize *before* opening the Engine ... all initialize code should assume the Engine
// is closed
initialize_library();
-
+
if (is_open)
throw new EngineError.ALREADY_OPEN("Geary.Engine instance already open");
-
+
this.user_config_dir = user_config_dir;
this.user_data_dir = user_data_dir;
this.resource_dir = resource_dir;
@@ -221,16 +221,16 @@ public class Geary.Engine : BaseObject {
Gee.Collection<AccountInformation> unavailable_accounts = accounts.values;
accounts.clear();
-
+
foreach(AccountInformation account in unavailable_accounts)
account_unavailable(account);
-
+
user_data_dir = null;
resource_dir = null;
authentication_mediator = null;
accounts = null;
account_instances = null;
-
+
is_open = false;
closed();
}
@@ -361,7 +361,7 @@ public class Geary.Engine : BaseObject {
} finally {
imap_session = null;
}
-
+
// SMTP is simpler, merely see if login works and done (throws an SmtpError if not)
Geary.Smtp.ClientSession? smtp_session = new Geary.Smtp.ClientSession(account.get_smtp_endpoint());
try {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]