[geary/wip/714104-refine-account-dialog: 66/69] Update to Account.set_endpoints set only one specific endpoint
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/714104-refine-account-dialog: 66/69] Update to Account.set_endpoints set only one specific endpoint
- Date: Fri, 30 Nov 2018 12:53:53 +0000 (UTC)
commit 038cf7c997fc2092bda7cb392e6341261cc1cc0d
Author: Michael Gratton <mike vee net>
Date: Fri Nov 30 23:37:32 2018 +1100
Update to Account.set_endpoints set only one specific endpoint
This will allow updating the endpoint for only a single service instead
of both if only one has changed.
src/engine/api/geary-account.vala | 8 ++++++--
src/engine/api/geary-engine.vala | 4 +++-
src/engine/imap-engine/imap-engine-generic-account.vala | 14 +++++++++++---
test/engine/api/geary-account-mock.vala | 5 +++--
4 files changed, 23 insertions(+), 8 deletions(-)
---
diff --git a/src/engine/api/geary-account.vala b/src/engine/api/geary-account.vala
index 9f237ecb..fe53657f 100644
--- a/src/engine/api/geary-account.vala
+++ b/src/engine/api/geary-account.vala
@@ -390,14 +390,18 @@ public abstract class Geary.Account : BaseObject {
}
/**
- * Sets network endpoints for incoming and outgoing client services.
+ * Sets network endpoints for the incoming or outgoing service.
*
* This is called by {@link Engine} after creating the account and
* if the network configuration changes. Implementations should
* pass these to their incoming and outgoing client services and
* restart them as required.
+ *
+ * The service parameter is one of {@link incoming} or {@link
+ * outgoing}.
*/
- internal abstract void set_endpoints(Endpoint incoming, Endpoint outgoing);
+ internal abstract void set_endpoint(ClientService service,
+ Endpoint endpoint);
/** Fires a {@link opened} signal. */
protected virtual void notify_opened() {
diff --git a/src/engine/api/geary-engine.vala b/src/engine/api/geary-engine.vala
index 9164ce35..751cd641 100644
--- a/src/engine/api/geary-engine.vala
+++ b/src/engine/api/geary-engine.vala
@@ -368,10 +368,12 @@ public class Geary.Engine : BaseObject {
Endpoint imap = get_shared_endpoint(
config.service_provider, config.imap
);
+ account.set_endpoint(account.incoming, imap);
+
Endpoint smtp = get_shared_endpoint(
config.service_provider, config.smtp
);
- account.set_endpoints(imap, smtp);
+ account.set_endpoint(account.outgoing, smtp);
account_instances.set(config.id, account);
return account;
diff --git a/src/engine/imap-engine/imap-engine-generic-account.vala
b/src/engine/imap-engine/imap-engine-generic-account.vala
index b23f6a33..538f0e8f 100644
--- a/src/engine/imap-engine/imap-engine-generic-account.vala
+++ b/src/engine/imap-engine/imap-engine-generic-account.vala
@@ -558,9 +558,17 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.Account {
return (map.size == 0) ? null : map;
}
- internal override void set_endpoints(Endpoint incoming, Endpoint outgoing) {
- this.imap.set_endpoint_restart.begin(incoming, this.open_cancellable);
- this.smtp.set_endpoint_restart.begin(outgoing, this.open_cancellable);
+ internal override void set_endpoint(ClientService service,
+ Endpoint endpoint) {
+ if (service == this.incoming) {
+ this.imap.set_endpoint_restart.begin(
+ endpoint, this.open_cancellable
+ );
+ } else if (service == this.outgoing) {
+ this.smtp.set_endpoint_restart.begin(
+ endpoint, this.open_cancellable
+ );
+ }
}
/**
diff --git a/test/engine/api/geary-account-mock.vala b/test/engine/api/geary-account-mock.vala
index e185c5d3..319c1067 100644
--- a/test/engine/api/geary-account-mock.vala
+++ b/test/engine/api/geary-account-mock.vala
@@ -230,9 +230,10 @@ public class Geary.MockAccount : Account, MockObject {
);
}
- internal override void set_endpoints(Endpoint incoming, Endpoint outgoing) {
+ internal override void set_endpoint(ClientService service,
+ Endpoint endpoint) {
try {
- void_call("set_endpoints", {incoming, outgoing});
+ void_call("set_endpoint", {service, endpoint});
} catch (GLib.Error err) {
// oh well
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]