[geary] Update Close and Save button state as draft status changes. Bug 747627.
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary] Update Close and Save button state as draft status changes. Bug 747627.
- Date: Fri, 23 Sep 2016 00:55:47 +0000 (UTC)
commit c9acc6faab8d328834e77764eaa2876a01778f52
Author: Michael James Gratton <mike vee net>
Date: Tue Sep 20 11:25:51 2016 +1000
Update Close and Save button state as draft status changes. Bug 747627.
* src/client/composer/composer-widget.vala (ComposerWidget): Disable
the Close and Save button when closing the draft manager, enable it and
managed its visibility when opening the manager.
* src/client/composer/composer-headerbar.vala (ComposerHeaderbar): Allow
composer access to the Save and Exit button so it can manage its
visibility.
src/client/composer/composer-headerbar.vala | 3 +++
src/client/composer/composer-widget.vala | 16 ++++++++++++----
2 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/src/client/composer/composer-headerbar.vala b/src/client/composer/composer-headerbar.vala
index e909728..d8d4d41 100644
--- a/src/client/composer/composer-headerbar.vala
+++ b/src/client/composer/composer-headerbar.vala
@@ -12,6 +12,9 @@ public class ComposerHeaderbar : Gtk.HeaderBar {
public bool show_pending_attachments { get; set; default = false; }
[GtkChild]
+ internal Gtk.Button save_and_close_button; // { get; private set; }
+
+ [GtkChild]
private Gtk.Box detach_start;
[GtkChild]
private Gtk.Box detach_end;
diff --git a/src/client/composer/composer-widget.vala b/src/client/composer/composer-widget.vala
index 5388dcc..6bd5449 100644
--- a/src/client/composer/composer-widget.vala
+++ b/src/client/composer/composer-widget.vala
@@ -462,7 +462,6 @@ public class ComposerWidget : Gtk.EventBox {
editing_draft_id = fill_in_from_referred(referred, quote, is_referred_draft);
update_from_field();
- open_draft_manager_async.begin(editing_draft_id);
// only add signature if the option is actually set and if this is not a draft
if (this.account.information.use_email_signature && !is_referred_draft)
@@ -501,6 +500,8 @@ public class ComposerWidget : Gtk.EventBox {
this.editor.navigation_policy_decision_requested.connect(on_navigation_policy_decision_requested);
this.editor.new_window_policy_decision_requested.connect(on_navigation_policy_decision_requested);
+ open_draft_manager_async.begin(editing_draft_id);
+
GearyApplication.instance.config.settings.changed[Configuration.SPELL_CHECK_KEY].connect(
on_spell_check_changed);
@@ -530,8 +531,8 @@ public class ComposerWidget : Gtk.EventBox {
ConversationViewer conversation_viewer =
GearyApplication.instance.controller.main_window.conversation_viewer;
conversation_viewer.cleared.connect(() => {
- if (this.draft_manager != null)
- conversation_viewer.blacklist_by_id(this.draft_manager.current_draft_id);
+ if (this.draft_manager != null)
+ conversation_viewer.blacklist_by_id(this.draft_manager.current_draft_id);
});
destroy.connect(() => { close_draft_manager_async.begin(null); });
@@ -1334,8 +1335,11 @@ public class ComposerWidget : Gtk.EventBox {
this.draft_save_text = "";
yield close_draft_manager_async(cancellable);
- if (!this.account.information.save_drafts)
+ SimpleAction close_and_save = get_action(ACTION_CLOSE_AND_SAVE);
+ if (!this.account.information.save_drafts) {
+ this.header.save_and_close_button.hide();
return;
+ }
this.draft_manager = new Geary.App.DraftManager(account);
try {
@@ -1349,6 +1353,9 @@ public class ComposerWidget : Gtk.EventBox {
throw err;
}
+ close_and_save.set_enabled(true);
+ this.header.save_and_close_button.show();
+
this.draft_manager.notify[Geary.App.DraftManager.PROP_DRAFT_STATE]
.connect(on_draft_state_changed);
this.draft_manager.notify[Geary.App.DraftManager.PROP_CURRENT_DRAFT_ID]
@@ -1357,6 +1364,7 @@ public class ComposerWidget : Gtk.EventBox {
}
private async void close_draft_manager_async(Cancellable? cancellable) throws Error {
+ get_action(ACTION_CLOSE_AND_SAVE).set_enabled(false);
if (this.draft_manager == null)
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]