Merge branch 'mjog/931-cannot-remove-accounts' into 'mainline'
Cannot remove accounts Closes #931 See merge request GNOME/geary!550
This commit is contained in:
commit
fe269267a3
4 changed files with 37 additions and 52 deletions
|
|
@ -50,7 +50,7 @@ valac = meson.get_compiler('vala')
|
||||||
# Required libraries and other dependencies
|
# Required libraries and other dependencies
|
||||||
#
|
#
|
||||||
|
|
||||||
target_vala = '0.46.2'
|
target_vala = '0.48.6'
|
||||||
target_glib = '2.60.4'
|
target_glib = '2.60.4'
|
||||||
target_gtk = '3.24.7'
|
target_gtk = '3.24.7'
|
||||||
target_webkit = '2.26'
|
target_webkit = '2.26'
|
||||||
|
|
|
||||||
|
|
@ -306,7 +306,7 @@ public class Accounts.Manager : GLib.Object {
|
||||||
* restore_account}.
|
* restore_account}.
|
||||||
*/
|
*/
|
||||||
public async void remove_account(Geary.AccountInformation account,
|
public async void remove_account(Geary.AccountInformation account,
|
||||||
GLib.Cancellable cancellable)
|
GLib.Cancellable? cancellable)
|
||||||
throws GLib.Error {
|
throws GLib.Error {
|
||||||
this.accounts.unset(account.id);
|
this.accounts.unset(account.id);
|
||||||
this.removed.add(account);
|
this.removed.add(account);
|
||||||
|
|
@ -324,7 +324,7 @@ public class Accounts.Manager : GLib.Object {
|
||||||
* he account was removed.
|
* he account was removed.
|
||||||
*/
|
*/
|
||||||
public async void restore_account(Geary.AccountInformation account,
|
public async void restore_account(Geary.AccountInformation account,
|
||||||
GLib.Cancellable cancellable)
|
GLib.Cancellable? cancellable)
|
||||||
throws GLib.Error {
|
throws GLib.Error {
|
||||||
if (this.removed.remove(account)) {
|
if (this.removed.remove(account)) {
|
||||||
yield save_account(account, cancellable);
|
yield save_account(account, cancellable);
|
||||||
|
|
|
||||||
|
|
@ -1184,11 +1184,14 @@ public class Application.Client : Gtk.Application {
|
||||||
private void on_activate_new_window() {
|
private void on_activate_new_window() {
|
||||||
// If there was an existing active main, select the same
|
// If there was an existing active main, select the same
|
||||||
// account/folder/conversation.
|
// account/folder/conversation.
|
||||||
|
Geary.Folder? folder = null;
|
||||||
|
Gee.Collection<Geary.App.Conversation>? conversations = null;
|
||||||
MainWindow? current = this.last_active_main_window;
|
MainWindow? current = this.last_active_main_window;
|
||||||
this.new_window.begin(
|
if (current != null) {
|
||||||
current.selected_folder,
|
folder = current.selected_folder;
|
||||||
current.conversation_list_view.copy_selected()
|
conversations = current.conversation_list_view.copy_selected();
|
||||||
);
|
}
|
||||||
|
this.new_window.begin(folder, conversations);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void on_activate_preferences() {
|
private void on_activate_preferences() {
|
||||||
|
|
|
||||||
|
|
@ -947,6 +947,16 @@ internal class Application.Controller :
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void add_account(Geary.AccountInformation added) {
|
||||||
|
try {
|
||||||
|
this.application.engine.add_account(added);
|
||||||
|
} catch (Geary.EngineError.ALREADY_EXISTS err) {
|
||||||
|
// all good
|
||||||
|
} catch (GLib.Error err) {
|
||||||
|
report_problem(new Geary.AccountProblemReport(added, err));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async void open_account(Geary.Account account) {
|
private async void open_account(Geary.Account account) {
|
||||||
AccountContext context = new AccountContext(
|
AccountContext context = new AccountContext(
|
||||||
account,
|
account,
|
||||||
|
|
@ -1012,6 +1022,19 @@ internal class Application.Controller :
|
||||||
update_account_status();
|
update_account_status();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async void remove_account(Geary.AccountInformation removed) {
|
||||||
|
yield close_account(removed, false);
|
||||||
|
try {
|
||||||
|
this.application.engine.remove_account(removed);
|
||||||
|
} catch (Geary.EngineError.NOT_FOUND err) {
|
||||||
|
// all good
|
||||||
|
} catch (GLib.Error err) {
|
||||||
|
report_problem(
|
||||||
|
new Geary.AccountProblemReport(removed, err)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async void close_account(Geary.AccountInformation config,
|
private async void close_account(Geary.AccountInformation config,
|
||||||
bool is_shutdown) {
|
bool is_shutdown) {
|
||||||
AccountContext? context = this.accounts.get(config);
|
AccountContext? context = this.accounts.get(config);
|
||||||
|
|
@ -1540,11 +1563,7 @@ internal class Application.Controller :
|
||||||
private void on_account_added(Geary.AccountInformation added,
|
private void on_account_added(Geary.AccountInformation added,
|
||||||
Accounts.Manager.Status status) {
|
Accounts.Manager.Status status) {
|
||||||
if (status == Accounts.Manager.Status.ENABLED) {
|
if (status == Accounts.Manager.Status.ENABLED) {
|
||||||
try {
|
this.add_account(added);
|
||||||
this.application.engine.add_account(added);
|
|
||||||
} catch (GLib.Error err) {
|
|
||||||
report_problem(new Geary.AccountProblemReport(added, err));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1552,33 +1571,12 @@ internal class Application.Controller :
|
||||||
Accounts.Manager.Status status) {
|
Accounts.Manager.Status status) {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case Accounts.Manager.Status.ENABLED:
|
case Accounts.Manager.Status.ENABLED:
|
||||||
if (!this.application.engine.has_account(changed)) {
|
this.add_account(changed);
|
||||||
try {
|
|
||||||
this.application.engine.add_account(changed);
|
|
||||||
} catch (GLib.Error err) {
|
|
||||||
report_problem(new Geary.AccountProblemReport(changed, err));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Accounts.Manager.Status.UNAVAILABLE:
|
case Accounts.Manager.Status.UNAVAILABLE:
|
||||||
case Accounts.Manager.Status.DISABLED:
|
case Accounts.Manager.Status.DISABLED:
|
||||||
if (this.application.engine.has_account(changed)) {
|
this.remove_account.begin(changed);
|
||||||
this.close_account.begin(
|
|
||||||
changed,
|
|
||||||
false,
|
|
||||||
(obj, res) => {
|
|
||||||
this.close_account.end(res);
|
|
||||||
try {
|
|
||||||
this.application.engine.remove_account(changed);
|
|
||||||
} catch (GLib.Error err) {
|
|
||||||
report_problem(
|
|
||||||
new Geary.AccountProblemReport(changed, err)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Accounts.Manager.Status.REMOVED:
|
case Accounts.Manager.Status.REMOVED:
|
||||||
|
|
@ -1588,23 +1586,7 @@ internal class Application.Controller :
|
||||||
}
|
}
|
||||||
|
|
||||||
private void on_account_removed(Geary.AccountInformation removed) {
|
private void on_account_removed(Geary.AccountInformation removed) {
|
||||||
debug("%s: Closing account for removal", removed.id);
|
this.remove_account.begin(removed);
|
||||||
this.close_account.begin(
|
|
||||||
removed,
|
|
||||||
false,
|
|
||||||
(obj, res) => {
|
|
||||||
this.close_account.end(res);
|
|
||||||
debug("%s: Account closed", removed.id);
|
|
||||||
try {
|
|
||||||
this.application.engine.remove_account(removed);
|
|
||||||
debug("%s: Account removed from engine", removed.id);
|
|
||||||
} catch (GLib.Error err) {
|
|
||||||
report_problem(
|
|
||||||
new Geary.AccountProblemReport(removed, err)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void on_report_problem(Geary.ProblemReport problem) {
|
private void on_report_problem(Geary.ProblemReport problem) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue