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.
This commit is contained in:
parent
896aa710ac
commit
038cf7c997
4 changed files with 23 additions and 8 deletions
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue