[geary/mjog/folder-actions: 5/7] Plugin: Add new Button class to allow plugins to create buttons



commit 0c5c204d31733706785ae8204fa5c016f2e6c7bf
Author: Michael Gratton <mike vee net>
Date:   Fri Mar 20 15:17:23 2020 +1100

    Plugin: Add new Button class to allow plugins to create buttons

 po/POTFILES.in                       |  1 +
 src/client/meson.build               |  1 +
 src/client/plugin/plugin-button.vala | 36 ++++++++++++++++++++++++++++++++++++
 3 files changed, 38 insertions(+)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 066079ae..a1f9c866 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -89,6 +89,7 @@ src/client/folder-list/folder-list-special-grouping.vala
 src/client/folder-list/folder-list-tree.vala
 src/client/plugin/plugin-account.vala
 src/client/plugin/plugin-application.vala
+src/client/plugin/plugin-button.vala
 src/client/plugin/plugin-contact-store.vala
 src/client/plugin/plugin-email-store.vala
 src/client/plugin/plugin-email.vala
diff --git a/src/client/meson.build b/src/client/meson.build
index c1140f18..36962f3e 100644
--- a/src/client/meson.build
+++ b/src/client/meson.build
@@ -98,6 +98,7 @@ geary_client_vala_sources = files(
 
   'plugin/plugin-account.vala',
   'plugin/plugin-application.vala',
+  'plugin/plugin-button.vala',
   'plugin/plugin-contact-store.vala',
   'plugin/plugin-email-store.vala',
   'plugin/plugin-email.vala',
diff --git a/src/client/plugin/plugin-button.vala b/src/client/plugin/plugin-button.vala
new file mode 100644
index 00000000..498c63d0
--- /dev/null
+++ b/src/client/plugin/plugin-button.vala
@@ -0,0 +1,36 @@
+/*
+ * Copyright © 2020 Michael Gratton <mike vee net>
+ *
+ * This software is licensed under the GNU Lesser General Public License
+ * (version 2.1 or later). See the COPYING file in this distribution.
+ */
+
+/**
+ * Enables plugins to add buttons to the user interface.
+ */
+public class Plugin.Button : Geary.BaseObject {
+
+
+    /**
+     * A short human-readable button label.
+     *
+     * This should ideally be less than 10 characters long.
+     */
+    public string label { get; private set; }
+
+    /** The action to be invoked when the button is clicked. */
+    public GLib.Action action { get; private set; }
+
+    /** The parameter value for the action, if any. */
+    public GLib.Variant? action_target { get; private set; }
+
+    /** Constructs a new button with a text label. */
+    public Button(string label,
+                  GLib.Action action,
+                  GLib.Variant? action_target = null) {
+        this.label = label;
+        this.action = action;
+        this.action_target = action_target;
+    }
+
+}


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