[geary/wip/775956-dbus-activation: 10/16] Fully implement --quit
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/775956-dbus-activation: 10/16] Fully implement --quit
- Date: Fri, 12 Apr 2019 12:05:59 +0000 (UTC)
commit 6f2187f5e221b0a9d2e665840aa6674124c5b906
Author: Michael Gratton <mike vee net>
Date: Wed Apr 10 18:26:22 2019 +1000
Fully implement --quit
Ensure that -q also shuts down non-local instances.
src/client/application/geary-application.vala | 7 +++++--
src/client/application/geary-controller.vala | 17 ++++++++++++-----
2 files changed, 17 insertions(+), 7 deletions(-)
---
diff --git a/src/client/application/geary-application.vala b/src/client/application/geary-application.vala
index 9c57313e..a443be3b 100644
--- a/src/client/application/geary-application.vala
+++ b/src/client/application/geary-application.vala
@@ -426,8 +426,9 @@ public class GearyApplication : Gtk.Application {
// see create_async() for reasoning hold/release is used
hold();
- if (this.controller != null) // If we didn't get activated, controller might be null
+ if (this.controller != null && this.controller.is_open) {
yield this.controller.close_async();
+ }
release();
this.is_destroyed = true;
@@ -598,8 +599,10 @@ public class GearyApplication : Gtk.Application {
public int handle_general_options(Configuration config,
GLib.VariantDict options) {
- if (options.contains(OPTION_QUIT))
+ if (options.contains(OPTION_QUIT)) {
+ exit();
return 0;
+ }
bool enable_debug = options.contains(OPTION_LOG_DEBUG);
// Will be logging to stderr until this point
diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala
index 2c338da2..f3e524f8 100644
--- a/src/client/application/geary-controller.vala
+++ b/src/client/application/geary-controller.vala
@@ -109,6 +109,13 @@ public class GearyController : Geary.BaseObject {
}
+ /** Determines if the controller is opening or is open. */
+ public bool is_open {
+ get {
+ return (this.open_cancellable != null);
+ }
+ }
+
public weak GearyApplication application { get; private set; } // circular ref
public Accounts.Manager? account_manager { get; private set; default = null; }
@@ -413,13 +420,13 @@ public class GearyController : Geary.BaseObject {
this.open_cancellable.cancel();
this.open_cancellable = null;
- Geary.Engine.instance.account_available.disconnect(on_account_available);
-
- // Release folder and conversations in the main window
- on_conversations_selected(new Gee.HashSet<Geary.App.Conversation>());
- on_folder_selected(null);
+ this.application.engine.account_available.disconnect(on_account_available);
if (this.main_window != null) {
+ // Release folder and conversations in the main window
+ on_conversations_selected(new Gee.HashSet<Geary.App.Conversation>());
+ on_folder_selected(null);
+
// Disconnect from various UI signals.
this.main_window.conversation_list_view.conversations_selected.disconnect(on_conversations_selected);
this.main_window.conversation_list_view.conversation_activated.disconnect(on_conversation_activated);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]