[geary/gnumdk/mail-merge-action-enabled] plugin: Only enable mail merge action for templates




commit 665b8877a272de2ee57d78ceafeb0901b517600f
Author: Cédric Bellegarde <cedric bellegarde adishatz org>
Date:   Sat Aug 27 14:53:09 2022 +0200

    plugin: Only enable mail merge action for templates
    
    Fix #1410

 src/client/application/application-plugin-manager.vala | 11 +++++++++--
 src/client/plugin/mail-merge/mail-merge.vala           |  6 ++++++
 2 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/src/client/application/application-plugin-manager.vala 
b/src/client/application/application-plugin-manager.vala
index 1d736222e..e712267fd 100644
--- a/src/client/application/application-plugin-manager.vala
+++ b/src/client/application/application-plugin-manager.vala
@@ -350,9 +350,10 @@ public class Application.PluginManager : GLib.Object {
 
 
         public bool can_send {
-            get { return this.backing.can_send; }
-            set { this.backing.can_send = value; }
+            get { return this._can_send; }
+            set { this._can_send = value; }
         }
+        private bool _can_send;
 
         public Plugin.Account? sender_context {
             get {
@@ -397,6 +398,12 @@ public class Application.PluginManager : GLib.Object {
             this.backing = backing;
             this.application = application;
             this._action_group_name = application.plugin.action_group_name + "-cmp";
+            backing.bind_property(
+                "can-send",
+                this,
+                "can-send",
+                BindingFlags.SYNC_CREATE |
+                BindingFlags.BIDIRECTIONAL);
         }
 
         public void save_to_folder(Plugin.Folder? location) {
diff --git a/src/client/plugin/mail-merge/mail-merge.vala b/src/client/plugin/mail-merge/mail-merge.vala
index 1fa7c7c1d..91d4b8800 100644
--- a/src/client/plugin/mail-merge/mail-merge.vala
+++ b/src/client/plugin/mail-merge/mail-merge.vala
@@ -287,6 +287,12 @@ public class Plugin.MailMerge :
                 /// merge in composer
                 new Actionable(_("Mail Merge"), load_action)
             );
+            composer.bind_property(
+                "can-send",
+                load_action,
+                "enabled",
+                BindingFlags.SYNC_CREATE |
+                BindingFlags.INVERT_BOOLEAN);
         }
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]